Linux kernel 在2.6.34中使用RT修补程序完成ISR后,高优先级任务无法抢占当前任务 拱门是powerpc 我将ISR从线程更改为无线程 ISR唤醒另一个优先级=19的FIFO任务 有时,在“ret_from_except”结束时,当执行“resume_kernel”时,抢占调度条件未满足:“可抢占”为是,未设置“需要重新调度”标志,但是 在C代码中,“try_to_wake_up”将“need_resched”标志设置为yes 我尝试了缓存同步,效果更好,但没有消除问题 与代码段相关:
“5555555”和“eeeeeeee”已打印,但“ffffffff”未打印 kernel/sched.c:Linux kernel 在2.6.34中使用RT修补程序完成ISR后,高优先级任务无法抢占当前任务 拱门是powerpc 我将ISR从线程更改为无线程 ISR唤醒另一个优先级=19的FIFO任务 有时,在“ret_from_except”结束时,当执行“resume_kernel”时,抢占调度条件未满足:“可抢占”为是,未设置“需要重新调度”标志,但是 在C代码中,“try_to_wake_up”将“need_resched”标志设置为yes 我尝试了缓存同步,效果更好,但没有消除问题 与代码段相关:,linux-kernel,real-time,schedule,irq,Linux Kernel,Real Time,Schedule,Irq,“5555555”和“eeeeeeee”已打印,但“ffffffff”未打印 kernel/sched.c: 184 +static void my_resched_task( struct task_struct *new, struct task_struct *cur ) { 185 + int cpu; 186 + 187 + assert_raw_spin_locked(&task_rq(cur)->lock); 188 + 189 + cpu = ta
184 +static void my_resched_task( struct task_struct *new, struct task_struct *cur ) {
185 + int cpu;
186 +
187 + assert_raw_spin_locked(&task_rq(cur)->lock);
188 +
189 + cpu = task_cpu(cur);
190 +
191 + if (test_tsk_need_resched(cur)) {
192 + if( new->prio <= 20 && in_irq() ) {
193 + set_tsk_need_resched(cur);
194 + __asm__ volatile("sync;isync": : : "memory");
195 + PRMPT_SCHD_IRQ_TS_PRINT(0x55555555);
196 + dcbf(&(task_thread_info(cur)->flags));
197 + in_be32(&(task_thread_info(cur)->flags));
198 + __asm__ volatile ("msync");
199 + }
200 + return;
201 + }
202 +
203 + set_tsk_need_resched(cur);
204 + if( new->prio <= 20 && in_irq() ) {
205 + __asm__ volatile("sync;isync": : : "memory");
206 + PRMPT_SCHD_IRQ_TS_PRINT(0x66666666);
207 + dcbf(&(task_thread_info(cur)->flags));
208 + in_be32(&(task_thread_info(cur)->flags));
209 + __asm__ volatile ("msync");
210 + }
184+静态void my_resched_任务(struct task_struct*new,struct task_struct*cur){
185+int处理器;
186 +
187+断言\u原始\u旋转\u锁定(&task\u rq(cur)->锁定);
188 +
189+cpu=任务_cpu(cur);
190 +
191+如果(测试tsk需要重新测试(cur)){
192+如果(新->优先级标志));
197+in_be32(&(任务线程信息(cur)->标志));
198+自动同步(msync);
199 + }
200+返回;
201 + }
202 +
203+设置需要重新设置(cur);
204+if(新->优先级标志);
208+in_be32(&(任务线程信息(cur)->标志));
209+uuuu asm_uuuuuuu易变(“msync”);
210 + }
arch/powerpc/kernel/entry_32.S
66 + /*wqc add >>*/
67 + WQC_PRMT_TAG_IMT(0xeeeeeeee)
68 + /*would r0 has been changed in the above flow ? reload it*/
69 + rlwinm r9,r1,0,0,(31-THREAD_SHIFT)
70 + lwz r0,TI_FLAGS(r9)
71 + /*wqc add <<*/
72 +
73 andi. r0,r0,_TIF_NEED_RESCHED
74 beq+ restore
75 + WQC_PRMT_TAG_IMT(0xffffffff)
76 lwz r3,_MSR(r1)
77 andi. r0,r3,MSR_EE /* interrupts off? */
78 beq restore /* don't schedule if so */
79 @@ -938,6 +970,7 @@ resume_kernel:
80 //wqc */
81 //wqc bl trace_hardirqs_off
82 #endif
83 + WQC_PRMT_TAG_IMT(0xa0a0a0a0)
84 1: bl preempt_schedule_irq
66+/*wqc添加>>*/
67+WQC\U PRMT\U TAG\U IMT(0xEEEE)
68+/*在上述流程中r0会发生变化吗?重新加载*/
69+rlwinm r9,r1,0,0,(31-螺纹移位)
70+lwz r0,TI_标志(r9)
71+/*wqc add我们解决了问题。
这是因为在中断返回前检查抢占时访问了受污染的寄存器。
张贴在这里供他人参考
diff --git a/arch/powerpc/kernel/entry_32.S b/arch/powerpc/kernel/entry_32.S
index 88b2e4a..bd0a283 100644
--- a/arch/powerpc/kernel/entry_32.S
+++ b/arch/powerpc/kernel/entry_32.S
@@ -891,8 +891,8 @@ restore_user:
resume_kernel:
/* check current_thread_info, _TIF_EMULATE_STACK_STORE */
rlwinm r9,r1,0,0,(31-THREAD_SHIFT)
- lwz r0,TI_FLAGS(r9)
- andis. r0,r0,_TIF_EMULATE_STACK_STORE@h
+ lwz r8,TI_FLAGS(r9)
+ andis. r0,r8,_TIF_EMULATE_STACK_STORE@h
beq+ 1f
addi r8,r1,INT_FRAME_SIZE /* Get the kprobed function entry */
@@ -900,16 +900,22 @@ resume_kernel:
lwz r3,GPR1(r1)
subi r3,r3,INT_FRAME_SIZE /* dst: Allocate a trampoline exception frame */
mr r4,r1 /* src: current exception frame */
- li r5,INT_FRAME_SIZE /* size: INT_FRAME_SIZE */
mr r1,r3 /* Reroute the trampoline frame to r1 */
- bl memcpy /* Copy from the original to the trampoline */
+
+ /* Copy from the original to the trampoline. */
+ li r5,INT_FRAME_SIZE/4 /* size: INT_FRAME_SIZE */
+ li r6,0 /* start offset: 0 */
+ mtctr r5
+2: lwzx r0,r6,r4
+ stwx r0,r6,r3
+ addi r6,r6,4
+ bdnz 2b
/* Do real store operation to complete stwu */
lwz r5,GPR1(r1)
stw r8,0(r5)
/* Clear _TIF_EMULATE_STACK_STORE flag */
- rlwinm r9,r1,0,0,(31-THREAD_SHIFT)
lis r11,_TIF_EMULATE_STACK_STORE@h
addi r5,r9,TI_FLAGS
0: lwarx r8,0,r5
@@ -923,10 +929,10 @@ resume_kernel:
#ifdef CONFIG_PREEMPT
/* check current_thread_info->preempt_count */
- lwz r8,TI_PREEMPT(r9)
- cmpwi 0,r8,0 /* if non-zero, just restore regs and return */
+ lwz r0,TI_PREEMPT(r9)
+ cmpwi 0,r0,0 /* if non-zero, just restore regs and return */
bne restore
- andi. r0,r0,_TIF_NEED_RESCHED
+ andi. r8,r8,_TIF_NEED_RESCHED
beq+ restore
lwz r3,_MSR(r1)
andi. r0,r3,MSR_EE /* interrupts off? */
欢迎来到堆栈溢出!在这里,我们希望与问题相关的代码和日志位于问题帖子本身(作为文本),而不是链接。请回答您的问题并解决此问题。您可以使用{}
工具格式化代码和日志。有关提问的更多信息,请参阅。