* [PATCH][OPROFILE] disable preempt when calling smp_processor_id()
@ 2004-11-06 0:32 Chris Wright
2004-11-07 16:56 ` John Levon
0 siblings, 1 reply; 3+ messages in thread
From: Chris Wright @ 2004-11-06 0:32 UTC (permalink / raw)
To: levon; +Cc: akpm, linux-kernel, cliffw
Oprofile is hitting many of the below BUG messages.
BUG: using smp_processor_id() in preemptible [00000001] code: sleep/4892
caller is task_exit_notify+0x9/0x17
Call Trace: <ffffffff802ac70f>{smp_processor_id+191}
<ffffffff803ff219>{task_exit_notify+9}
<ffffffff8014a930>{notifier_call_chain+32}
<ffffffff8013d181>{profile_task_exit+49}
<ffffffff8013eb22>{do_exit+34}
<ffffffff80146490>{process_timeout+0}
<ffffffff8013f8c8>{do_group_exit+264}
<ffffffff801106b6>{system_call+126}
smp_processor_id() is called w/out preempt disabled. Use
get_cpu()/put_cpu() instead. Should this be put_cpu_no_resched()?
Signed-off-by: Chris Wright <chrisw@osdl.org>
--- linux-2.6.10-rc1-mm3-smp_processor_id/drivers/oprofile/buffer_sync.c~orig 2004-11-05 15:21:21.551984200 -0800
+++ linux-2.6.10-rc1-mm3-smp_processor_id/drivers/oprofile/buffer_sync.c 2004-11-05 15:23:29.000000000 -0800
@@ -62,7 +62,8 @@
/* To avoid latency problems, we only process the current CPU,
* hoping that most samples for the task are on this CPU
*/
- sync_buffer(smp_processor_id());
+ sync_buffer(get_cpu());
+ put_cpu();
return 0;
}
@@ -86,7 +87,8 @@
/* To avoid latency problems, we only process the current CPU,
* hoping that most samples for the task are on this CPU
*/
- sync_buffer(smp_processor_id());
+ sync_buffer(get_cpu());
+ put_cpu();
return 0;
}
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH][OPROFILE] disable preempt when calling smp_processor_id()
2004-11-06 0:32 [PATCH][OPROFILE] disable preempt when calling smp_processor_id() Chris Wright
@ 2004-11-07 16:56 ` John Levon
2004-11-08 17:11 ` Chris Wright
0 siblings, 1 reply; 3+ messages in thread
From: John Levon @ 2004-11-07 16:56 UTC (permalink / raw)
To: Chris Wright; +Cc: akpm, linux-kernel, cliffw
On Fri, Nov 05, 2004 at 04:32:21PM -0800, Chris Wright wrote:
> smp_processor_id() is called w/out preempt disabled. Use
> get_cpu()/put_cpu() instead. Should this be put_cpu_no_resched()?
No, the patch below looks fine
regards
john
> Signed-off-by: Chris Wright <chrisw@osdl.org>
>
> --- linux-2.6.10-rc1-mm3-smp_processor_id/drivers/oprofile/buffer_sync.c~orig 2004-11-05 15:21:21.551984200 -0800
> +++ linux-2.6.10-rc1-mm3-smp_processor_id/drivers/oprofile/buffer_sync.c 2004-11-05 15:23:29.000000000 -0800
> @@ -62,7 +62,8 @@
> /* To avoid latency problems, we only process the current CPU,
> * hoping that most samples for the task are on this CPU
> */
> - sync_buffer(smp_processor_id());
> + sync_buffer(get_cpu());
> + put_cpu();
> return 0;
> }
>
> @@ -86,7 +87,8 @@
> /* To avoid latency problems, we only process the current CPU,
> * hoping that most samples for the task are on this CPU
> */
> - sync_buffer(smp_processor_id());
> + sync_buffer(get_cpu());
> + put_cpu();
> return 0;
> }
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH][OPROFILE] disable preempt when calling smp_processor_id()
2004-11-07 16:56 ` John Levon
@ 2004-11-08 17:11 ` Chris Wright
0 siblings, 0 replies; 3+ messages in thread
From: Chris Wright @ 2004-11-08 17:11 UTC (permalink / raw)
To: John Levon; +Cc: Chris Wright, akpm, linux-kernel, cliffw
* John Levon (levon@movementarian.org) wrote:
> On Fri, Nov 05, 2004 at 04:32:21PM -0800, Chris Wright wrote:
> > smp_processor_id() is called w/out preempt disabled. Use
> > get_cpu()/put_cpu() instead. Should this be put_cpu_no_resched()?
>
> No, the patch below looks fine
I realized over the weekend that it's still broken. And Cliff hit it
in some tests he ran here. The sync_buffer() function can sleep, and
while the unprotected call to smp_processor_id() is no longer a problem,
scheduling with preempt disabled is.
thanks,
-chris
--
Linux Security Modules http://lsm.immunix.org http://lsm.bkbits.net
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2004-11-08 17:17 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-11-06 0:32 [PATCH][OPROFILE] disable preempt when calling smp_processor_id() Chris Wright
2004-11-07 16:56 ` John Levon
2004-11-08 17:11 ` Chris Wright
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®