public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
* Warnings: pm branch
@ 2009-08-11 14:55 Pandita, Vikram
  2009-08-11 15:27 ` Kevin Hilman
  0 siblings, 1 reply; 10+ messages in thread
From: Pandita, Vikram @ 2009-08-11 14:55 UTC (permalink / raw)
  To: linux-omap@vger.kernel.org, Kevin Hilman


Has anyone send these warning logs on the pm branch on kevin's tree [1] 
This seems to be some issue in CpuIdle path with interrupts? 


<4>WARNING: at arch/arm/kernel/process.c:171 cpu_idle+0x60/0x88()
WARNING: at arch/arm/kernel/process.c:171 cpu_idle+0x60/0x88()
<d>Modules linked in:Modules linked in:
[<c0031344>] [<c0031344>] (unwind_backtrace+0x0/0xdc) (unwind_backtrace+0x0/0xdc
) from [<c0057a08>] from [<c0057a08>] (warn_slowpath_common+0x48/0x60)
(warn_slowpath_common+0x48/0x60)
[<c0057a08>] [<c0057a08>] (warn_slowpath_common+0x48/0x60) (warn_slowpath_common
+0x48/0x60) from [<c002d204>] from [<c002d204>] (cpu_idle+0x60/0x88)
(cpu_idle+0x60/0x88)
[<c002d204>] [<c002d204>] (cpu_idle+0x60/0x88) (cpu_idle+0x60/0x88) from [<c0008
a70>] from [<c0008a70>] (start_kernel+0x234/0x28c)
(start_kernel+0x234/0x28c)
[<c0008a70>] [<c0008a70>] (start_kernel+0x234/0x28c) (start_kernel+0x234/0x28c)
from [<80008034>] from [<80008034>] (0x80008034)
(0x80008034)

Regards,
Vikram 

[1] http://git.kernel.org/?p=linux/kernel/git/khilman/linux-omap-pm.git;a=summary


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

* Re: Warnings: pm branch
  2009-08-11 14:55 Warnings: pm branch Pandita, Vikram
@ 2009-08-11 15:27 ` Kevin Hilman
  2009-08-12  9:48   ` Hemanth V
  0 siblings, 1 reply; 10+ messages in thread
From: Kevin Hilman @ 2009-08-11 15:27 UTC (permalink / raw)
  To: Pandita, Vikram; +Cc: linux-omap@vger.kernel.org

"Pandita, Vikram" <vikram.pandita@ti.com> writes:

> Has anyone send these warning logs on the pm branch on kevin's tree [1] 
> This seems to be some issue in CpuIdle path with interrupts? 
>
> <4>WARNING: at arch/arm/kernel/process.c:171 cpu_idle+0x60/0x88()
> WARNING: at arch/arm/kernel/process.c:171 cpu_idle+0x60/0x88()
> <d>Modules linked in:Modules linked in:
> [<c0031344>] [<c0031344>] (unwind_backtrace+0x0/0xdc) (unwind_backtrace+0x0/0xdc
> ) from [<c0057a08>] from [<c0057a08>] (warn_slowpath_common+0x48/0x60)
> (warn_slowpath_common+0x48/0x60)
> [<c0057a08>] [<c0057a08>] (warn_slowpath_common+0x48/0x60) (warn_slowpath_common
> +0x48/0x60) from [<c002d204>] from [<c002d204>] (cpu_idle+0x60/0x88)
> (cpu_idle+0x60/0x88)
> [<c002d204>] [<c002d204>] (cpu_idle+0x60/0x88) (cpu_idle+0x60/0x88) from [<c0008
> a70>] from [<c0008a70>] (start_kernel+0x234/0x28c)
> (start_kernel+0x234/0x28c)
> [<c0008a70>] [<c0008a70>] (start_kernel+0x234/0x28c) (start_kernel+0x234/0x28c)
> from [<80008034>] from [<80008034>] (0x80008034)
> (0x80008034)
>

Yes, I've seen it, but have yet to debug it.

This warning is from the generic ARM idle loop reporting that the OMAP
idle path is returning with IRQs disabled.

Kevin

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

* Re: Warnings: pm branch
  2009-08-11 15:27 ` Kevin Hilman
@ 2009-08-12  9:48   ` Hemanth V
  2009-08-12 12:54     ` Hemanth V
  0 siblings, 1 reply; 10+ messages in thread
From: Hemanth V @ 2009-08-12  9:48 UTC (permalink / raw)
  To: Pandita, Vikram, Kevin Hilman; +Cc: linux-omap

----- Original Message ----- 
From: "Kevin Hilman" <khilman@deeprootsystems.com>
To: "Pandita, Vikram" <vikram.pandita@ti.com>
Cc: <linux-omap@vger.kernel.org>
Sent: Tuesday, August 11, 2009 8:57 PM
Subject: Re: Warnings: pm branch


> "Pandita, Vikram" <vikram.pandita@ti.com> writes:
>
>> Has anyone send these warning logs on the pm branch on kevin's tree [1]
>> This seems to be some issue in CpuIdle path with interrupts?
>>
>> <4>WARNING: at arch/arm/kernel/process.c:171 cpu_idle+0x60/0x88()
>> WARNING: at arch/arm/kernel/process.c:171 cpu_idle+0x60/0x88()
>> <d>Modules linked in:Modules linked in:
>> [<c0031344>] [<c0031344>] (unwind_backtrace+0x0/0xdc) 
>> (unwind_backtrace+0x0/0xdc
>> ) from [<c0057a08>] from [<c0057a08>] (warn_slowpath_common+0x48/0x60)
>> (warn_slowpath_common+0x48/0x60)
>> [<c0057a08>] [<c0057a08>] (warn_slowpath_common+0x48/0x60) 
>> (warn_slowpath_common
>> +0x48/0x60) from [<c002d204>] from [<c002d204>] (cpu_idle+0x60/0x88)
>> (cpu_idle+0x60/0x88)
>> [<c002d204>] [<c002d204>] (cpu_idle+0x60/0x88) (cpu_idle+0x60/0x88) from 
>> [<c0008
>> a70>] from [<c0008a70>] (start_kernel+0x234/0x28c)
>> (start_kernel+0x234/0x28c)
>> [<c0008a70>] [<c0008a70>] (start_kernel+0x234/0x28c) 
>> (start_kernel+0x234/0x28c)
>> from [<80008034>] from [<80008034>] (0x80008034)
>> (0x80008034)
>>
>
> Yes, I've seen it, but have yet to debug it.
>
> This warning is from the generic ARM idle loop reporting that the OMAP
> idle path is returning with IRQs disabled.
>
> Kevin

I did some more debugging on this. I added the below instrumentation to 
local_irq_disable to capture
the PC of the last call to local_irq_disable.

extern unsigned long hem_pc;
register unsigned long current_pc asm ("pc");

#define local_irq_disable() \
        do { hem_pc = current_pc;raw_local_irq_disable(); 
trace_hardirqs_off(); } while (0)


When I set a breakpoint  at the instruction pointing to 
WARN_ON(irqs_disabled()) using
lauterbach and dump hem_pc, I see that the last call to irq_disable is 
actuall from cpu_idle itself.
Looks like some recursion is happening. Does anyone have any inputs on this.

void cpu_idle(void)
{

        local_fiq_enable();

        /* endless idle loop with no priority at all */
        while (1) {
                tick_nohz_stop_sched_tick(1);
                leds_event(led_idle_start);
                while (!need_resched()) {
#ifdef CONFIG_HOTPLUG_CPU
                        if (cpu_is_offline(smp_processor_id()))
                                cpu_die();
#endif

>>                        local_irq_disable();


Thanks
Hemanth 


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

* Re: Warnings: pm branch
  2009-08-12  9:48   ` Hemanth V
@ 2009-08-12 12:54     ` Hemanth V
  2009-08-12 13:28       ` Kevin Hilman
  2009-08-12 14:15       ` Kevin Hilman
  0 siblings, 2 replies; 10+ messages in thread
From: Hemanth V @ 2009-08-12 12:54 UTC (permalink / raw)
  To: Hemanth V; +Cc: Pandita, Vikram, Kevin Hilman, linux-omap

> ----- Original Message -----
> From: "Kevin Hilman" <khilman@deeprootsystems.com>
> To: "Pandita, Vikram" <vikram.pandita@ti.com>
> Cc: <linux-omap@vger.kernel.org>
> Sent: Tuesday, August 11, 2009 8:57 PM
> Subject: Re: Warnings: pm branch
>
>
>> "Pandita, Vikram" <vikram.pandita@ti.com> writes:
>>
>>> Has anyone send these warning logs on the pm branch on kevin's tree [1]
>>> This seems to be some issue in CpuIdle path with interrupts?
>>>
>>> <4>WARNING: at arch/arm/kernel/process.c:171 cpu_idle+0x60/0x88()
>>> WARNING: at arch/arm/kernel/process.c:171 cpu_idle+0x60/0x88()
>>> <d>Modules linked in:Modules linked in:
>>> [<c0031344>] [<c0031344>] (unwind_backtrace+0x0/0xdc)
>>> (unwind_backtrace+0x0/0xdc
>>> ) from [<c0057a08>] from [<c0057a08>] (warn_slowpath_common+0x48/0x60)
>>> (warn_slowpath_common+0x48/0x60)
>>> [<c0057a08>] [<c0057a08>] (warn_slowpath_common+0x48/0x60)
>>> (warn_slowpath_common
>>> +0x48/0x60) from [<c002d204>] from [<c002d204>] (cpu_idle+0x60/0x88)
>>> (cpu_idle+0x60/0x88)
>>> [<c002d204>] [<c002d204>] (cpu_idle+0x60/0x88) (cpu_idle+0x60/0x88) from
>>> [<c0008
>>> a70>] from [<c0008a70>] (start_kernel+0x234/0x28c)
>>> (start_kernel+0x234/0x28c)
>>> [<c0008a70>] [<c0008a70>] (start_kernel+0x234/0x28c)
>>> (start_kernel+0x234/0x28c)
>>> from [<80008034>] from [<80008034>] (0x80008034)
>>> (0x80008034)
>>>
>>
>> Yes, I've seen it, but have yet to debug it.
>>
>> This warning is from the generic ARM idle loop reporting that the OMAP
>> idle path is returning with IRQs disabled.
>>
>> Kevin
>
> I did some more debugging on this. I added the below instrumentation to
> local_irq_disable to capture
> the PC of the last call to local_irq_disable.
>
> extern unsigned long hem_pc;
> register unsigned long current_pc asm ("pc");
>
> #define local_irq_disable() \
>         do { hem_pc = current_pc;raw_local_irq_disable();
> trace_hardirqs_off(); } while (0)
>
>
> When I set a breakpoint  at the instruction pointing to
> WARN_ON(irqs_disabled()) using
> lauterbach and dump hem_pc, I see that the last call to irq_disable is
> actuall from cpu_idle itself.
> Looks like some recursion is happening. Does anyone have any inputs on this.
>
> void cpu_idle(void)
> {
>
>         local_fiq_enable();
>
>         /* endless idle loop with no priority at all */
>         while (1) {
>                 tick_nohz_stop_sched_tick(1);
>                 leds_event(led_idle_start);
>                 while (!need_resched()) {
> #ifdef CONFIG_HOTPLUG_CPU
>                         if (cpu_is_offline(smp_processor_id()))
>                                 cpu_die();
> #endif
>
>>>                        local_irq_disable();
>
>
> Thanks
> Hemanth
>

Below patch seems to fix the issue.

diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c
index 8504a21..3014104 100644
--- a/drivers/cpuidle/cpuidle.c
+++ b/drivers/cpuidle/cpuidle.c
@@ -75,8 +75,10 @@ static void cpuidle_idle_call(void)
 #endif
 	/* ask the governor for the next state */
 	next_state = cpuidle_curr_governor->select(dev);
+
 	if (need_resched())
-		return;
+		goto out;
+
 	target_state = &dev->states[next_state];

 	/* enter the state and update stats */
@@ -91,6 +93,12 @@ static void cpuidle_idle_call(void)
 	/* give the governor an opportunity to reflect on the outcome */
 	if (cpuidle_curr_governor->reflect)
 		cpuidle_curr_governor->reflect(dev);
+
+	return;
+
+out:
+	local_irq_enable();
+	return;
 }

 /**



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

* Re: Warnings: pm branch
  2009-08-12 12:54     ` Hemanth V
@ 2009-08-12 13:28       ` Kevin Hilman
  2009-08-12 13:38         ` Sripathy, Vishwanath
  2009-08-12 14:15       ` Kevin Hilman
  1 sibling, 1 reply; 10+ messages in thread
From: Kevin Hilman @ 2009-08-12 13:28 UTC (permalink / raw)
  To: Hemanth V; +Cc: Pandita, Vikram, linux-omap

"Hemanth V" <hemanthv@ti.com> writes:

>> ----- Original Message -----
>> From: "Kevin Hilman" <khilman@deeprootsystems.com>
>> To: "Pandita, Vikram" <vikram.pandita@ti.com>
>> Cc: <linux-omap@vger.kernel.org>
>> Sent: Tuesday, August 11, 2009 8:57 PM
>> Subject: Re: Warnings: pm branch
>>
>>
>>> "Pandita, Vikram" <vikram.pandita@ti.com> writes:
>>>
>>>> Has anyone send these warning logs on the pm branch on kevin's tree [1]
>>>> This seems to be some issue in CpuIdle path with interrupts?
>>>>
>>>> <4>WARNING: at arch/arm/kernel/process.c:171 cpu_idle+0x60/0x88()
>>>> WARNING: at arch/arm/kernel/process.c:171 cpu_idle+0x60/0x88()
>>>> <d>Modules linked in:Modules linked in:
>>>> [<c0031344>] [<c0031344>] (unwind_backtrace+0x0/0xdc)
>>>> (unwind_backtrace+0x0/0xdc
>>>> ) from [<c0057a08>] from [<c0057a08>] (warn_slowpath_common+0x48/0x60)
>>>> (warn_slowpath_common+0x48/0x60)
>>>> [<c0057a08>] [<c0057a08>] (warn_slowpath_common+0x48/0x60)
>>>> (warn_slowpath_common
>>>> +0x48/0x60) from [<c002d204>] from [<c002d204>] (cpu_idle+0x60/0x88)
>>>> (cpu_idle+0x60/0x88)
>>>> [<c002d204>] [<c002d204>] (cpu_idle+0x60/0x88) (cpu_idle+0x60/0x88) from
>>>> [<c0008
>>>> a70>] from [<c0008a70>] (start_kernel+0x234/0x28c)
>>>> (start_kernel+0x234/0x28c)
>>>> [<c0008a70>] [<c0008a70>] (start_kernel+0x234/0x28c)
>>>> (start_kernel+0x234/0x28c)
>>>> from [<80008034>] from [<80008034>] (0x80008034)
>>>> (0x80008034)
>>>>
>>>
>>> Yes, I've seen it, but have yet to debug it.
>>>
>>> This warning is from the generic ARM idle loop reporting that the OMAP
>>> idle path is returning with IRQs disabled.
>>>
>>> Kevin
>>
>> I did some more debugging on this. I added the below instrumentation to
>> local_irq_disable to capture
>> the PC of the last call to local_irq_disable.
>>
>> extern unsigned long hem_pc;
>> register unsigned long current_pc asm ("pc");
>>
>> #define local_irq_disable() \
>>         do { hem_pc = current_pc;raw_local_irq_disable();
>> trace_hardirqs_off(); } while (0)
>>
>>
>> When I set a breakpoint  at the instruction pointing to
>> WARN_ON(irqs_disabled()) using
>> lauterbach and dump hem_pc, I see that the last call to irq_disable is
>> actuall from cpu_idle itself.
>> Looks like some recursion is happening. Does anyone have any inputs on this.
>>
>> void cpu_idle(void)
>> {
>>
>>         local_fiq_enable();
>>
>>         /* endless idle loop with no priority at all */
>>         while (1) {
>>                 tick_nohz_stop_sched_tick(1);
>>                 leds_event(led_idle_start);
>>                 while (!need_resched()) {
>> #ifdef CONFIG_HOTPLUG_CPU
>>                         if (cpu_is_offline(smp_processor_id()))
>>                                 cpu_die();
>> #endif
>>
>>>>                        local_irq_disable();
>>
>>
>> Thanks
>> Hemanth
>>
>
> Below patch seems to fix the issue.

The question remains, who is disabling interrupts?

If this patch works, someone is disabling interrupts between the
enable in this routine and the return of this function.

Kevin

> diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c
> index 8504a21..3014104 100644
> --- a/drivers/cpuidle/cpuidle.c
> +++ b/drivers/cpuidle/cpuidle.c
> @@ -75,8 +75,10 @@ static void cpuidle_idle_call(void)
>  #endif
>  	/* ask the governor for the next state */
>  	next_state = cpuidle_curr_governor->select(dev);
> +
>  	if (need_resched())
> -		return;
> +		goto out;
> +
>  	target_state = &dev->states[next_state];
>
>  	/* enter the state and update stats */
> @@ -91,6 +93,12 @@ static void cpuidle_idle_call(void)
>  	/* give the governor an opportunity to reflect on the outcome */
>  	if (cpuidle_curr_governor->reflect)
>  		cpuidle_curr_governor->reflect(dev);
> +
> +	return;
> +
> +out:
> +	local_irq_enable();
> +	return;
>  }
>
>  /**

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

* RE: Warnings: pm branch
  2009-08-12 13:28       ` Kevin Hilman
@ 2009-08-12 13:38         ` Sripathy, Vishwanath
  0 siblings, 0 replies; 10+ messages in thread
From: Sripathy, Vishwanath @ 2009-08-12 13:38 UTC (permalink / raw)
  To: Kevin Hilman, V, Hemanth; +Cc: Pandita, Vikram, linux-omap@vger.kernel.org



-----Original Message-----
From: linux-omap-owner@vger.kernel.org [mailto:linux-omap-owner@vger.kernel.org] On Behalf Of Kevin Hilman
Sent: Wednesday, August 12, 2009 6:59 PM
To: V, Hemanth
Cc: Pandita, Vikram; linux-omap@vger.kernel.org
Subject: Re: Warnings: pm branch

"Hemanth V" <hemanthv@ti.com> writes:

>> ----- Original Message -----
>> From: "Kevin Hilman" <khilman@deeprootsystems.com>
>> To: "Pandita, Vikram" <vikram.pandita@ti.com>
>> Cc: <linux-omap@vger.kernel.org>
>> Sent: Tuesday, August 11, 2009 8:57 PM
>> Subject: Re: Warnings: pm branch
>>
>>
>>> "Pandita, Vikram" <vikram.pandita@ti.com> writes:
>>>
>>>> Has anyone send these warning logs on the pm branch on kevin's tree [1]
>>>> This seems to be some issue in CpuIdle path with interrupts?
>>>>
>>>> <4>WARNING: at arch/arm/kernel/process.c:171 cpu_idle+0x60/0x88()
>>>> WARNING: at arch/arm/kernel/process.c:171 cpu_idle+0x60/0x88()
>>>> <d>Modules linked in:Modules linked in:
>>>> [<c0031344>] [<c0031344>] (unwind_backtrace+0x0/0xdc)
>>>> (unwind_backtrace+0x0/0xdc
>>>> ) from [<c0057a08>] from [<c0057a08>] (warn_slowpath_common+0x48/0x60)
>>>> (warn_slowpath_common+0x48/0x60)
>>>> [<c0057a08>] [<c0057a08>] (warn_slowpath_common+0x48/0x60)
>>>> (warn_slowpath_common
>>>> +0x48/0x60) from [<c002d204>] from [<c002d204>] (cpu_idle+0x60/0x88)
>>>> (cpu_idle+0x60/0x88)
>>>> [<c002d204>] [<c002d204>] (cpu_idle+0x60/0x88) (cpu_idle+0x60/0x88) from
>>>> [<c0008
>>>> a70>] from [<c0008a70>] (start_kernel+0x234/0x28c)
>>>> (start_kernel+0x234/0x28c)
>>>> [<c0008a70>] [<c0008a70>] (start_kernel+0x234/0x28c)
>>>> (start_kernel+0x234/0x28c)
>>>> from [<80008034>] from [<80008034>] (0x80008034)
>>>> (0x80008034)
>>>>
>>>
>>> Yes, I've seen it, but have yet to debug it.
>>>
>>> This warning is from the generic ARM idle loop reporting that the OMAP
>>> idle path is returning with IRQs disabled.
>>>
>>> Kevin
>>
>> I did some more debugging on this. I added the below instrumentation to
>> local_irq_disable to capture
>> the PC of the last call to local_irq_disable.
>>
>> extern unsigned long hem_pc;
>> register unsigned long current_pc asm ("pc");
>>
>> #define local_irq_disable() \
>>         do { hem_pc = current_pc;raw_local_irq_disable();
>> trace_hardirqs_off(); } while (0)
>>
>>
>> When I set a breakpoint  at the instruction pointing to
>> WARN_ON(irqs_disabled()) using
>> lauterbach and dump hem_pc, I see that the last call to irq_disable is
>> actuall from cpu_idle itself.
>> Looks like some recursion is happening. Does anyone have any inputs on this.
>>
>> void cpu_idle(void)
>> {
>>
>>         local_fiq_enable();
>>
>>         /* endless idle loop with no priority at all */
>>         while (1) {
>>                 tick_nohz_stop_sched_tick(1);
>>                 leds_event(led_idle_start);
>>                 while (!need_resched()) {
>> #ifdef CONFIG_HOTPLUG_CPU
>>                         if (cpu_is_offline(smp_processor_id()))
>>                                 cpu_die();
>> #endif
>>
>>>>                        local_irq_disable();
>>
>>
>> Thanks
>> Hemanth
>>
>
> Below patch seems to fix the issue.

> The question remains, who is disabling interrupts?
>
> If this patch works, someone is disabling interrupts between the
> enable in this routine and the return of this function.

> Kevin
It's disabled in cpu_idle function itself before calling pm_idle
Here is the snap of cpu_idle

void cpu_idle(void)
{
	local_fiq_enable();

	/* endless idle loop with no priority at all */
	while (1) {
		tick_nohz_stop_sched_tick(1);
		leds_event(led_idle_start);
		while (!need_resched()) {
#ifdef CONFIG_HOTPLUG_CPU
			if (cpu_is_offline(smp_processor_id()))
				cpu_die();
#endif

			local_irq_disable();  //it's disabled here
			if (hlt_counter) {
				local_irq_enable();
				cpu_relax();
			} else {
				stop_critical_timings();
				pm_idle();
				start_critical_timings();
				/*
				 * This will eventually be removed - pm_idle
				 * functions should always return with IRQs
				 * enabled.
				 */
				WARN_ON(irqs_disabled());
				local_irq_enable();
			}
		}


> diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c
> index 8504a21..3014104 100644
> --- a/drivers/cpuidle/cpuidle.c
> +++ b/drivers/cpuidle/cpuidle.c
> @@ -75,8 +75,10 @@ static void cpuidle_idle_call(void)
>  #endif
>  	/* ask the governor for the next state */
>  	next_state = cpuidle_curr_governor->select(dev);
> +
>  	if (need_resched())
> -		return;
> +		goto out;
> +
>  	target_state = &dev->states[next_state];
>
>  	/* enter the state and update stats */
> @@ -91,6 +93,12 @@ static void cpuidle_idle_call(void)
>  	/* give the governor an opportunity to reflect on the outcome */
>  	if (cpuidle_curr_governor->reflect)
>  		cpuidle_curr_governor->reflect(dev);
> +
> +	return;
> +
> +out:
> +	local_irq_enable();
> +	return;
>  }
>
>  /**
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


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

* Re: Warnings: pm branch
  2009-08-12 12:54     ` Hemanth V
  2009-08-12 13:28       ` Kevin Hilman
@ 2009-08-12 14:15       ` Kevin Hilman
  2009-08-12 14:22         ` Hemanth V
  1 sibling, 1 reply; 10+ messages in thread
From: Kevin Hilman @ 2009-08-12 14:15 UTC (permalink / raw)
  To: Hemanth V; +Cc: Pandita, Vikram, linux-omap

"Hemanth V" <hemanthv@ti.com> writes:

[...]

> Below patch seems to fix the issue.

After looking closer, I think this is the right fix as the
cpuidle_idle_call() can return with interrupts disabled, but...

[...]

> diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c
> index 8504a21..3014104 100644
> --- a/drivers/cpuidle/cpuidle.c
> +++ b/drivers/cpuidle/cpuidle.c
> @@ -75,8 +75,10 @@ static void cpuidle_idle_call(void)
>  #endif
>  	/* ask the governor for the next state */
>  	next_state = cpuidle_curr_governor->select(dev);
> +
>  	if (need_resched())
> -		return;
> +		goto out;
> +
>  	target_state = &dev->states[next_state];
>
>  	/* enter the state and update stats */
> @@ -91,6 +93,12 @@ static void cpuidle_idle_call(void)
>  	/* give the governor an opportunity to reflect on the outcome */
>  	if (cpuidle_curr_governor->reflect)
>  		cpuidle_curr_governor->reflect(dev);
> +
> +	return;
> +

... I think you want to drop this return.  If it returns here, it
will still not enable IRQs.  I think it should just fall through
to the enable and return.

> +out:
> +	local_irq_enable();
> +	return;
>  }
>
>  /**


Kevin

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

* Re: Warnings: pm branch
  2009-08-12 14:15       ` Kevin Hilman
@ 2009-08-12 14:22         ` Hemanth V
  2009-08-12 14:38           ` Kevin Hilman
  0 siblings, 1 reply; 10+ messages in thread
From: Hemanth V @ 2009-08-12 14:22 UTC (permalink / raw)
  To: Kevin Hilman; +Cc: Pandita, Vikram, linux-omap

----- Original Message ----- 
From: "Kevin Hilman" <khilman@deeprootsystems.com>
>>  /* enter the state and update stats */
>> @@ -91,6 +93,12 @@ static void cpuidle_idle_call(void)
>>  /* give the governor an opportunity to reflect on the outcome */
>>  if (cpuidle_curr_governor->reflect)
>>  cpuidle_curr_governor->reflect(dev);
>> +
>> + return;
>> +
> 
> ... I think you want to drop this return.  If it returns here, it
> will still not enable IRQs.  I think it should just fall through
> to the enable and return.

Since omap3_enter_idle returns with interrupts enabled, I had
added this return. We could remove it also for safety purposes.

Thanks
Hemanth

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

* Re: Warnings: pm branch
  2009-08-12 14:22         ` Hemanth V
@ 2009-08-12 14:38           ` Kevin Hilman
  2009-09-30 17:32             ` Kevin Hilman
  0 siblings, 1 reply; 10+ messages in thread
From: Kevin Hilman @ 2009-08-12 14:38 UTC (permalink / raw)
  To: Hemanth V; +Cc: Pandita, Vikram, linux-omap

"Hemanth V" <hemanthv@ti.com> writes:

> ----- Original Message ----- 
> From: "Kevin Hilman" <khilman@deeprootsystems.com>
>>>  /* enter the state and update stats */
>>> @@ -91,6 +93,12 @@ static void cpuidle_idle_call(void)
>>>  /* give the governor an opportunity to reflect on the outcome */
>>>  if (cpuidle_curr_governor->reflect)
>>>  cpuidle_curr_governor->reflect(dev);
>>> +
>>> + return;
>>> +
>>
>> ... I think you want to drop this return.  If it returns here, it
>> will still not enable IRQs.  I think it should just fall through
>> to the enable and return.
>
> Since omap3_enter_idle returns with interrupts enabled, I had
> added this return. We could remove it also for safety purposes.
 
OK.  I think you should post to linux-pm for comment, and possibly
raise this as a question.

You can add:

Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>


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

* Re: Warnings: pm branch
  2009-08-12 14:38           ` Kevin Hilman
@ 2009-09-30 17:32             ` Kevin Hilman
  0 siblings, 0 replies; 10+ messages in thread
From: Kevin Hilman @ 2009-09-30 17:32 UTC (permalink / raw)
  To: Hemanth V; +Cc: Pandita, Vikram, linux-omap

On Wed, Aug 12, 2009 at 7:38 AM, Kevin Hilman
<khilman@deeprootsystems.com> wrote:
> "Hemanth V" <hemanthv@ti.com> writes:
>
>> ----- Original Message -----
>> From: "Kevin Hilman" <khilman@deeprootsystems.com>
>>>>  /* enter the state and update stats */
>>>> @@ -91,6 +93,12 @@ static void cpuidle_idle_call(void)
>>>>  /* give the governor an opportunity to reflect on the outcome */
>>>>  if (cpuidle_curr_governor->reflect)
>>>>  cpuidle_curr_governor->reflect(dev);
>>>> +
>>>> + return;
>>>> +
>>>
>>> ... I think you want to drop this return.  If it returns here, it
>>> will still not enable IRQs.  I think it should just fall through
>>> to the enable and return.
>>
>> Since omap3_enter_idle returns with interrupts enabled, I had
>> added this return. We could remove it also for safety purposes.
>
> OK.  I think you should post to linux-pm for comment, and possibly
> raise this as a question.
>
> You can add:
>
> Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>

Hemanth,

I've reworked/simplified this patch slightly (see below) and will send
to linux-pm shortly.

Kevin


This one is against PM branch:

commit 808854375b94017ba996a467a082a38730fff434
Author: Kevin Hilman <khilman@deeprootsystems.com>
Date:   Wed Sep 30 09:57:40 2009 -0700

    CPUidle: always return with interrupts enabled

    In the case where cpuidle_idle_call() returns before changing state
    due to a need_resched(), it was returning with IRQs disabled.

    This patche ensures IRQs are (re)enabled before returning.

    Reported-by: Hemanth V <hemanthv@ti.com>
    Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>

diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c
index 8504a21..910c49d 100644
--- a/drivers/cpuidle/cpuidle.c
+++ b/drivers/cpuidle/cpuidle.c
@@ -75,8 +75,11 @@ static void cpuidle_idle_call(void)
 #endif
 	/* ask the governor for the next state */
 	next_state = cpuidle_curr_governor->select(dev);
-	if (need_resched())
+	if (need_resched()) {
+		local_irq_enable();
 		return;
+	}
+
 	target_state = &dev->states[next_state];

 	/* enter the state and update stats */
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

end of thread, other threads:[~2009-09-30 17:32 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-11 14:55 Warnings: pm branch Pandita, Vikram
2009-08-11 15:27 ` Kevin Hilman
2009-08-12  9:48   ` Hemanth V
2009-08-12 12:54     ` Hemanth V
2009-08-12 13:28       ` Kevin Hilman
2009-08-12 13:38         ` Sripathy, Vishwanath
2009-08-12 14:15       ` Kevin Hilman
2009-08-12 14:22         ` Hemanth V
2009-08-12 14:38           ` Kevin Hilman
2009-09-30 17:32             ` Kevin Hilman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox