From: Len Brown <lenb@kernel.org>
To: venkatesh.pallipadi@intel.com
Cc: linux-acpi@vger.kernel.org
Subject: Re: [patch 1/4] ACPI: Fix acpi_safe_halt usages and interrupt enabling/disabling
Date: Thu, 7 Feb 2008 02:21:06 -0500 [thread overview]
Message-ID: <200802070221.07000.lenb@kernel.org> (raw)
In-Reply-To: <20080201013629.115986000@intel.com>
applied.
thanks,
-len
On Thursday 31 January 2008 20:35, venkatesh.pallipadi@intel.com wrote:
> acpi_safe_halt() needs interrupts to be disabled for atomic
> need_resched check and safe halt. Otherwise we may miss an
> interrupt and go into halt.
>
> acpi_safe_halt() also does not enable interrupts on all return paths.
>
> So the callers should handle enable and disable interrupts around it.
>
> There were multiple places where this was not happening. Below is the fix.
>
> Signed-off-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
>
> Index: linux-2.6.25-rc/drivers/acpi/processor_idle.c
> ===================================================================
> --- linux-2.6.25-rc.orig/drivers/acpi/processor_idle.c
> +++ linux-2.6.25-rc/drivers/acpi/processor_idle.c
> @@ -201,6 +201,10 @@ static inline u32 ticks_elapsed_in_us(u3
> return PM_TIMER_TICKS_TO_US((0xFFFFFFFF - t1) + t2);
> }
>
> +/*
> + * Callers should disable interrupts before the call and enable
> + * interrupts after return.
> + */
> static void acpi_safe_halt(void)
> {
> current_thread_info()->status &= ~TS_POLLING;
> @@ -393,6 +397,8 @@ static void acpi_processor_idle(void)
> pm_idle_save();
> else
> acpi_safe_halt();
> +
> + local_irq_enable();
> return;
> }
>
> @@ -501,6 +507,7 @@ static void acpi_processor_idle(void)
> * skew otherwise.
> */
> sleep_ticks = 0xFFFFFFFF;
> + local_irq_enable();
> break;
>
> case ACPI_STATE_C2:
> @@ -1378,11 +1385,13 @@ static int acpi_idle_enter_c1(struct cpu
> if (unlikely(!pr))
> return 0;
>
> + local_irq_disable();
> if (pr->flags.bm_check)
> acpi_idle_update_bm_rld(pr, cx);
>
> acpi_safe_halt();
>
> + local_irq_enable();
> cx->usage++;
>
> return 0;
> @@ -1490,7 +1499,9 @@ static int acpi_idle_enter_bm(struct cpu
> if (dev->safe_state) {
> return dev->safe_state->enter(dev, dev->safe_state);
> } else {
> + local_irq_disable();
> acpi_safe_halt();
> + local_irq_enable();
> return 0;
> }
> }
>
next prev parent reply other threads:[~2008-02-07 7:21 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-02-01 1:35 [patch 0/4] ACPI, CPU_IDLE: ACPI processor_idle changes, C1 residency time, etc venkatesh.pallipadi
2008-02-01 1:35 ` [patch 1/4] ACPI: Fix acpi_safe_halt usages and interrupt enabling/disabling venkatesh.pallipadi
2008-02-07 7:21 ` Len Brown [this message]
2008-02-01 1:35 ` [patch 2/4] ACPI: Use mwait for C1 idle venkatesh.pallipadi
2008-02-07 7:38 ` Len Brown
2008-02-01 1:35 ` [patch 3/4] ACPI, CPU_IDLE: Support C1 idle time accounting venkatesh.pallipadi
2008-02-07 7:38 ` Len Brown
2008-02-01 1:35 ` [patch 4/4] CPUIDLE: Add a poll_idle method into CPU_IDLE venkatesh.pallipadi
2008-02-07 7:38 ` Len Brown
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=200802070221.07000.lenb@kernel.org \
--to=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=venkatesh.pallipadi@intel.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox