All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dtor_core-yWtbtysYrB+LZ21kGMrzwg@public.gmane.org>
To: acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
Cc: Li Shaohua <shaohua.li-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
	Pavel Machek <pavel-+ZI9xUNit7I@public.gmane.org>,
	kernel list
	<linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: Re: ACPI using smp_processor_id in preemptible code
Date: Mon, 10 Jan 2005 21:09:48 -0500	[thread overview]
Message-ID: <200501102109.51513.dtor_core@ameritech.net> (raw)
In-Reply-To: <1105405464.18834.4.camel-U5EdaLXB8smDugQYiPIPGdh3ngVCH38I@public.gmane.org>

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-JGs/UdohzUI@public.gmane.org>

-- 
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]);
 


-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues
Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt

WARNING: multiple messages have this Message-ID (diff)
From: Dmitry Torokhov <dtor_core@ameritech.net>
To: acpi-devel@lists.sourceforge.net
Cc: Li Shaohua <shaohua.li@intel.com>, Pavel Machek <pavel@ucw.cz>,
	kernel list <linux-kernel@vger.kernel.org>
Subject: Re: [ACPI] ACPI using smp_processor_id in preemptible code
Date: Mon, 10 Jan 2005 21:09:48 -0500	[thread overview]
Message-ID: <200501102109.51513.dtor_core@ameritech.net> (raw)
In-Reply-To: <1105405464.18834.4.camel@sli10-desk.sh.intel.com>

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]);
 

  parent reply	other threads:[~2005-01-11  2:09 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-01-10  1:24 [ACPI] ACPI using smp_processor_id in preemptible code Li, Shaohua
2005-01-10  9:55 ` Pavel Machek
     [not found]   ` <20050110095508.GJ1353-I/5MKhXcvmPrBKCeMvbIDA@public.gmane.org>
2005-01-11  1:04     ` Li Shaohua
2005-01-11  1:04       ` [ACPI] " Li Shaohua
2005-01-11  1:24       ` Con Kolivas
     [not found]       ` <1105405464.18834.4.camel-U5EdaLXB8smDugQYiPIPGdh3ngVCH38I@public.gmane.org>
2005-01-11  2:09         ` Dmitry Torokhov [this message]
2005-01-11  2:09           ` Dmitry Torokhov
  -- strict thread matches above, loose matches on Subject: below --
2005-01-09 21:10 Pavel Machek
2005-01-09 21:10 ` Pavel Machek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200501102109.51513.dtor_core@ameritech.net \
    --to=dtor_core-ywtbtysyrb+lz21kgmrzwg@public.gmane.org \
    --cc=acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=pavel-+ZI9xUNit7I@public.gmane.org \
    --cc=shaohua.li-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.