[LITMUS^RT] using smp_processor_id()

Glenn Elliott gelliott at cs.unc.edu
Tue Jan 27 13:13:36 CET 2015


> On Jan 27, 2015, at 6:54 AM, Namhoon Kim <namhoonk at cs.unc.edu> wrote:
> 
> Hi,
> 
> I am trying to implement mixed-criticality scheduling plugin. My implementation is based on P-RES plugin from wip-reservations branch. 
> 
> The kernel output a warning message "BUG: using smp_processor_id() in preemptible [00000000] code: mc2spin/945" when a user program calls sys_complete_job system call. Does anyone know about this message?
> 
> Here's the kernel log.
> 
> 6246 P3: polling_replenish(945): next_replenishment=51360000000
> 6247 P3: GMP reservation R945 state 3->1 at 51200049993
> 6248 P3: NEXT_EVENT ADDED at 51220000000
> 6249 P3: EVENT FOUND at 51220000000, NEW EVENT 51220000000
> 6250 P3: (mc2spin/945:6) UPDATE_TIMER LV = 2
> 6255 P3: (mc2spin/945:6) scheduled.
> 6256 P3: (mc2spin/945:6) migrate from 0
> 6257 P3: (mc2spin/945:6) stack_in_use=-1
> 6258 P3: (mc2spin/945:6) mc2_complete_job returns at 51200117663
> 6348 P3: ^A3BUG: using smp_processor_id() in preemptible [00000000] code: mc2spin/945
> 6358 P3: caller is mc2_complete_job+0x1c/0x3b8
> 6359 P3: ^AdCPU: 3 PID: 945 Comm: mc2spin Not tainted 3.10.31-litmus #418
> 6360 P3: [<800155d8>] (unwind_backtrace+0x0/0x104) from [<800128ac>] (show_stack+0x20/0x24)
> 6361 P3: [<800128ac>] (show_stack+0x20/0x24) from [<8070c37c>] (dump_stack+0x20/0x28)
> 6362 P3: [<8070c37c>] (dump_stack+0x20/0x28) from [<80314e70>] (debug_smp_processor_id+0xcc/0xf0)
> 6363 P3: [<80314e70>] (debug_smp_processor_id+0xcc/0xf0) from [<802feff0>] (mc2_complete_job+0x1c/0x3b8)
> 6364 P3: [<802feff0>] (mc2_complete_job+0x1c/0x3b8) from [<802ebc8c>] (sys_complete_job+0x54/0x64)
> 6365 P3: [<802ebc8c>] (sys_complete_job+0x54/0x64) from [<8000e8c0>] (ret_fast_syscall+0x0/0x30)
> 6366 P3: (mc2spin/945:6) mc2_complete_job at 51221827554 (deadline: 51245000000) (cur->budget: 0)
> 6367 P3: (mc2spin/945:7) next_release=51245000000
> 6368 P3: EVENT FOUND at 51360000000, NEW EVENT 51360000000
> 6369 P3: (mc2spin/945:7) CLIENT DEPART with budget 0
> 6370 P3: (mc2spin/945:7) descheduled.
> 6371 P3: EVENT FOUND at 51360000000, NEW EVENT 51360000000
> 6399 P3: (mc2spin/945:7) try_to_wake_up() state:1
> 6401 P3: (mc2spin/945:7) thread wakes up at 51245016173
> 6403 P3: EVENT FOUND at 51360000000, NEW EVENT 51360000000
> 6405 P3: (mc2spin/945:7) mc2_resume()
> 6408 P3: (mc2spin/945:7) try_to_wake_up() done state:0
> 
> Thanks,
> 
> Namhoon

I believe smp_processor_id() may only be called safely while interrupts are disabled, e.g., a critical section protected by a spinlock or after irq_disable(). The CPU # is somewhat useless with preemption enabled, since the scheduler may migrate the calling thread immediately after.

-Glenn



More information about the litmus-dev mailing list