linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* RE: [ACPI] ACPI using smp_processor_id in preemptible code
@ 2005-01-10  1:24 Li, Shaohua
  2005-01-10  9:55 ` Pavel Machek
  0 siblings, 1 reply; 5+ messages in thread
From: Li, Shaohua @ 2005-01-10  1:24 UTC (permalink / raw)
  To: Pavel Machek, ACPI mailing list, kernel list

>I enabled CPU hotplug and preemptible debugging... now I get...
>
>BUG: using smp_processor_id() in preemptible [00000001] code:
>swapper/0
>caller is acpi_processor_idle+0xb/0x235
> [<c020ba28>] smp_processor_id+0xa8/0xc0
> [<c02338ce>] acpi_processor_idle+0xb/0x235
> [<c02338c3>] acpi_processor_idle+0x0/0x235
> [<c02338ce>] acpi_processor_idle+0xb/0x235
> [<c02338c3>] acpi_processor_idle+0x0/0x235
> [<c02338c3>] acpi_processor_idle+0x0/0x235
> [<c02338c3>] acpi_processor_idle+0x0/0x235
> [<c0101115>] cpu_idle+0x75/0x110
> [<c04f5988>] start_kernel+0x158/0x180
> [<c04f5390>] unknown_bootoption+0x0/0x1e0
It doesn't trouble to me. It's in idle thread.

Thanks,
Shaohua

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [ACPI] ACPI using smp_processor_id in preemptible code
  2005-01-10  1:24 [ACPI] ACPI using smp_processor_id in preemptible code Li, Shaohua
@ 2005-01-10  9:55 ` Pavel Machek
  2005-01-11  1:04   ` Li Shaohua
  0 siblings, 1 reply; 5+ messages in thread
From: Pavel Machek @ 2005-01-10  9:55 UTC (permalink / raw)
  To: Li, Shaohua; +Cc: ACPI mailing list, kernel list

Hi!

> >I enabled CPU hotplug and preemptible debugging... now I get...
> >
> >BUG: using smp_processor_id() in preemptible [00000001] code:
> >swapper/0
> >caller is acpi_processor_idle+0xb/0x235
> > [<c020ba28>] smp_processor_id+0xa8/0xc0
> > [<c02338ce>] acpi_processor_idle+0xb/0x235
> > [<c02338c3>] acpi_processor_idle+0x0/0x235
> > [<c02338ce>] acpi_processor_idle+0xb/0x235
> > [<c02338c3>] acpi_processor_idle+0x0/0x235
> > [<c02338c3>] acpi_processor_idle+0x0/0x235
> > [<c02338c3>] acpi_processor_idle+0x0/0x235
> > [<c0101115>] cpu_idle+0x75/0x110
> > [<c04f5988>] start_kernel+0x158/0x180
> > [<c04f5390>] unknown_bootoption+0x0/0x1e0
> It doesn't trouble to me. It's in idle thread.

You mean it does not happen to you? On my machine it fills logs very
quickly...
								Pavel
-- 
People were complaining that M$ turns users into beta-testers...
...jr ghea gurz vagb qrirybcref, naq gurl frrz gb yvxr vg gung jnl!

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [ACPI] ACPI using smp_processor_id in preemptible code
  2005-01-10  9:55 ` Pavel Machek
@ 2005-01-11  1:04   ` Li Shaohua
  2005-01-11  1:24     ` Con Kolivas
  2005-01-11  2:09     ` Dmitry Torokhov
  0 siblings, 2 replies; 5+ messages in thread
From: Li Shaohua @ 2005-01-11  1:04 UTC (permalink / raw)
  To: Pavel Machek; +Cc: ACPI mailing list, kernel list

On Mon, 2005-01-10 at 17:55, Pavel Machek wrote:
> > >I enabled CPU hotplug and preemptible debugging... now I get...
> > >
> > >BUG: using smp_processor_id() in preemptible [00000001] code:
> > >swapper/0
> > >caller is acpi_processor_idle+0xb/0x235
> > > [<c020ba28>] smp_processor_id+0xa8/0xc0
> > > [<c02338ce>] acpi_processor_idle+0xb/0x235
> > > [<c02338c3>] acpi_processor_idle+0x0/0x235
> > > [<c02338ce>] acpi_processor_idle+0xb/0x235
> > > [<c02338c3>] acpi_processor_idle+0x0/0x235
> > > [<c02338c3>] acpi_processor_idle+0x0/0x235
> > > [<c02338c3>] acpi_processor_idle+0x0/0x235
> > > [<c0101115>] cpu_idle+0x75/0x110
> > > [<c04f5988>] start_kernel+0x158/0x180
> > > [<c04f5390>] unknown_bootoption+0x0/0x1e0
> > It doesn't trouble to me. It's in idle thread.
> 
> You mean it does not happen to you? On my machine it fills logs very
> quickly...
What I mean is idle thread can't be migrated so this doesn't impact the
correctness. I guess the preemptible debugging can't recognise such
situation.

Thanks,
Shaohua


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [ACPI] ACPI using smp_processor_id in preemptible code
  2005-01-11  1:04   ` Li Shaohua
@ 2005-01-11  1:24     ` Con Kolivas
  2005-01-11  2:09     ` Dmitry Torokhov
  1 sibling, 0 replies; 5+ messages in thread
From: Con Kolivas @ 2005-01-11  1:24 UTC (permalink / raw)
  To: Li Shaohua; +Cc: Pavel Machek, ACPI mailing list, kernel list

[-- Attachment #1: Type: text/plain, Size: 1184 bytes --]

Li Shaohua wrote:
> On Mon, 2005-01-10 at 17:55, Pavel Machek wrote:
> 
>>>>I enabled CPU hotplug and preemptible debugging... now I get...
>>>>
>>>>BUG: using smp_processor_id() in preemptible [00000001] code:
>>>>swapper/0
>>>>caller is acpi_processor_idle+0xb/0x235
>>>>[<c020ba28>] smp_processor_id+0xa8/0xc0
>>>>[<c02338ce>] acpi_processor_idle+0xb/0x235
>>>>[<c02338c3>] acpi_processor_idle+0x0/0x235
>>>>[<c02338ce>] acpi_processor_idle+0xb/0x235
>>>>[<c02338c3>] acpi_processor_idle+0x0/0x235
>>>>[<c02338c3>] acpi_processor_idle+0x0/0x235
>>>>[<c02338c3>] acpi_processor_idle+0x0/0x235
>>>>[<c0101115>] cpu_idle+0x75/0x110
>>>>[<c04f5988>] start_kernel+0x158/0x180
>>>>[<c04f5390>] unknown_bootoption+0x0/0x1e0
>>>
>>>It doesn't trouble to me. It's in idle thread.
>>
>>You mean it does not happen to you? On my machine it fills logs very
>>quickly...
> 
> What I mean is idle thread can't be migrated so this doesn't impact the
> correctness. I guess the preemptible debugging can't recognise such
> situation.

This patch should help. If it's safe to use smp_processor_id() in 
acpi_processor_idle use the alternative call.

Signed-off-by: Con Kolivas <kernel@kolivas.org>

[-- Attachment #2: fix_acpi_smp_processor_id.diff --]
[-- Type: text/x-patch, Size: 471 bytes --]

Index: linux-2.6.10-mm2/drivers/acpi/processor_idle.c
===================================================================
--- linux-2.6.10-mm2.orig/drivers/acpi/processor_idle.c	2005-01-11 12:20:31.399070008 +1100
+++ linux-2.6.10-mm2/drivers/acpi/processor_idle.c	2005-01-11 12:22:19.931570560 +1100
@@ -162,7 +162,7 @@
 	int			sleep_ticks = 0;
 	u32			t1, t2 = 0;
 
-	pr = processors[smp_processor_id()];
+	pr = processors[_smp_processor_id()];
 	if (!pr)
 		return;
 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [ACPI] ACPI using smp_processor_id in preemptible code
  2005-01-11  1:04   ` Li Shaohua
  2005-01-11  1:24     ` Con Kolivas
@ 2005-01-11  2:09     ` Dmitry Torokhov
  1 sibling, 0 replies; 5+ messages in thread
From: Dmitry Torokhov @ 2005-01-11  2:09 UTC (permalink / raw)
  To: acpi-devel; +Cc: Li Shaohua, Pavel Machek, kernel list

On Monday 10 January 2005 08:04 pm, Li Shaohua wrote:
> On Mon, 2005-01-10 at 17:55, Pavel Machek wrote:
> > > >I enabled CPU hotplug and preemptible debugging... now I get...
> > > >
> > > >BUG: using smp_processor_id() in preemptible [00000001] code:
> > > >swapper/0
> > > >caller is acpi_processor_idle+0xb/0x235
> > > > [<c020ba28>] smp_processor_id+0xa8/0xc0
> > > > [<c02338ce>] acpi_processor_idle+0xb/0x235
> > > > [<c02338c3>] acpi_processor_idle+0x0/0x235
> > > > [<c02338ce>] acpi_processor_idle+0xb/0x235
> > > > [<c02338c3>] acpi_processor_idle+0x0/0x235
> > > > [<c02338c3>] acpi_processor_idle+0x0/0x235
> > > > [<c02338c3>] acpi_processor_idle+0x0/0x235
> > > > [<c0101115>] cpu_idle+0x75/0x110
> > > > [<c04f5988>] start_kernel+0x158/0x180
> > > > [<c04f5390>] unknown_bootoption+0x0/0x1e0
> > > It doesn't trouble to me. It's in idle thread.
> > 
> > You mean it does not happen to you? On my machine it fills logs very
> > quickly...
> What I mean is idle thread can't be migrated so this doesn't impact the
> correctness. I guess the preemptible debugging can't recognise such
> situation.
>

Why don't you just move that statement down, like in the patch below.
Also, if processor is not registered but idle thread managed to call
acpi_processor_idle I think it's BUG()...

I also cut out unnecessary local variable initializations.

Signed-off-by: Dmitry Torokhov <dtor@mail.ru>

-- 
Dmitry

===== drivers/acpi/processor.c 1.72 vs edited =====
--- 1.72/drivers/acpi/processor.c	2004-12-03 02:25:47 -05:00
+++ edited/drivers/acpi/processor.c	2005-01-10 20:58:38 -05:00
@@ -337,15 +337,11 @@
 static void
 acpi_processor_idle (void)
 {
-	struct acpi_processor	*pr = NULL;
-	struct acpi_processor_cx *cx = NULL;
-	unsigned int			next_state = 0;
-	unsigned int		sleep_ticks = 0;
-	u32			t1, t2 = 0;
-
-	pr = processors[smp_processor_id()];
-	if (!pr)
-		return;
+	struct acpi_processor	*pr;
+	struct acpi_processor_cx *cx;
+	unsigned int		next_state;
+	unsigned int		sleep_ticks;
+	u32			t1, t2;
 
 	/*
 	 * Interrupts must be disabled during bus mastering calculations and
@@ -361,6 +357,10 @@
 		local_irq_enable();
 		return;
 	}
+
+	pr = processors[smp_processor_id()];
+	if (!pr)
+		BUG();
 
 	cx = &(pr->power.states[pr->power.state]);
 

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2005-01-11  2:14 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-01-10  1:24 [ACPI] ACPI using smp_processor_id in preemptible code Li, Shaohua
2005-01-10  9:55 ` Pavel Machek
2005-01-11  1:04   ` Li Shaohua
2005-01-11  1:24     ` Con Kolivas
2005-01-11  2:09     ` Dmitry Torokhov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).