linux-acpi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ACPI: Fix the incorrect calculation about C-state idle time
@ 2010-06-02  3:04 yakui.zhao
  2010-06-02 15:06 ` Matthew Garrett
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: yakui.zhao @ 2010-06-02  3:04 UTC (permalink / raw)
  To: lenb; +Cc: linux-acpi, Zhao Yakui, Venkatesh Pallipadi

From: Zhao Yakui <yakui.zhao@intel.com>

The C-state idle time is not calculated correctly, which will return the wrong
residency time in C-state. It will have the following effects:
   1.  The system can't choose the deeper C-state when it is idle next time.
Of course the system power is increased. E.g. On one server machine about 40W
idle power is increased.
   2.  The powertop shows that it will stay in C0 running state about 95% time
although the system is idle at most time.

Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
Reported-by: Yu Zhidong <zhidong.yu@intel.com>
Tested-by: Yu Zhidong <zhidong.yu@intel.com>
CC: Venkatesh Pallipadi <venki@google.com>
---
 drivers/acpi/processor_idle.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c
index 2e8c27d..6b38a6b 100644
--- a/drivers/acpi/processor_idle.c
+++ b/drivers/acpi/processor_idle.c
@@ -1022,7 +1022,7 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev,
 		spin_unlock(&c3_lock);
 	}
 	kt2 = ktime_get_real();
-	idle_time_ns = ktime_to_us(ktime_sub(kt2, kt1));
+	idle_time_ns = ktime_to_ns(ktime_sub(kt2, kt1));
 	idle_time = idle_time_ns;
 	do_div(idle_time, NSEC_PER_USEC);
 
-- 
1.5.4.5


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

* Re: [PATCH] ACPI: Fix the incorrect calculation about C-state idle time
  2010-06-02  3:04 [PATCH] ACPI: Fix the incorrect calculation about C-state idle time yakui.zhao
@ 2010-06-02 15:06 ` Matthew Garrett
  2010-06-03  1:06   ` ykzhao
  2010-06-02 16:28 ` Venkatesh Pallipadi
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 8+ messages in thread
From: Matthew Garrett @ 2010-06-02 15:06 UTC (permalink / raw)
  To: yakui.zhao; +Cc: lenb, linux-acpi, Venkatesh Pallipadi

On Wed, Jun 02, 2010 at 11:04:09AM +0800, yakui.zhao@intel.com wrote:
> From: Zhao Yakui <yakui.zhao@intel.com>
> 
> The C-state idle time is not calculated correctly, which will return the wrong
> residency time in C-state. It will have the following effects:
>    1.  The system can't choose the deeper C-state when it is idle next time.
> Of course the system power is increased. E.g. On one server machine about 40W
> idle power is increased.
>    2.  The powertop shows that it will stay in C0 running state about 95% time
> although the system is idle at most time.

What kind of system was this seen on?

-- 
Matthew Garrett | mjg59@srcf.ucam.org

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

* Re: [PATCH] ACPI: Fix the incorrect calculation about C-state idle time
  2010-06-02  3:04 [PATCH] ACPI: Fix the incorrect calculation about C-state idle time yakui.zhao
  2010-06-02 15:06 ` Matthew Garrett
@ 2010-06-02 16:28 ` Venkatesh Pallipadi
  2010-06-03  5:42   ` Len Brown
  2010-06-02 16:29 ` Venkatesh Pallipadi
  2010-06-04  7:35 ` Len Brown
  3 siblings, 1 reply; 8+ messages in thread
From: Venkatesh Pallipadi @ 2010-06-02 16:28 UTC (permalink / raw)
  To: yakui.zhao; +Cc: lenb, linux-acpi

On Tue, Jun 1, 2010 at 8:04 PM,  <yakui.zhao@intel.com> wrote:
> From: Zhao Yakui <yakui.zhao@intel.com>
>
> The C-state idle time is not calculated correctly, which will return the wrong
> residency time in C-state. It will have the following effects:
>   1.  The system can't choose the deeper C-state when it is idle next time.
> Of course the system power is increased. E.g. On one server machine about 40W
> idle power is increased.
>   2.  The powertop shows that it will stay in C0 running state about 95% time
> although the system is idle at most time.

This was a bug from my recent patch here :-(
http://marc.info/?l=linux-acpi&m=127198016715509&w=2

Thanks for catching this..

Acked-by: Venkatesh Pallipadi <venki@google.com>

>
> Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
> Reported-by: Yu Zhidong <zhidong.yu@intel.com>
> Tested-by: Yu Zhidong <zhidong.yu@intel.com>
> CC: Venkatesh Pallipadi <venki@google.com>
> ---
>  drivers/acpi/processor_idle.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c
> index 2e8c27d..6b38a6b 100644
> --- a/drivers/acpi/processor_idle.c
> +++ b/drivers/acpi/processor_idle.c
> @@ -1022,7 +1022,7 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev,
>                spin_unlock(&c3_lock);
>        }
>        kt2 = ktime_get_real();
> -       idle_time_ns = ktime_to_us(ktime_sub(kt2, kt1));
> +       idle_time_ns = ktime_to_ns(ktime_sub(kt2, kt1));
>        idle_time = idle_time_ns;
>        do_div(idle_time, NSEC_PER_USEC);
>
> --
> 1.5.4.5
>
>
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" 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] 8+ messages in thread

* Re: [PATCH] ACPI: Fix the incorrect calculation about C-state idle time
  2010-06-02  3:04 [PATCH] ACPI: Fix the incorrect calculation about C-state idle time yakui.zhao
  2010-06-02 15:06 ` Matthew Garrett
  2010-06-02 16:28 ` Venkatesh Pallipadi
@ 2010-06-02 16:29 ` Venkatesh Pallipadi
  2010-06-04  7:35 ` Len Brown
  3 siblings, 0 replies; 8+ messages in thread
From: Venkatesh Pallipadi @ 2010-06-02 16:29 UTC (permalink / raw)
  To: yakui.zhao; +Cc: lenb, linux-acpi

On Tue, Jun 1, 2010 at 8:04 PM,  <yakui.zhao@intel.com> wrote:
> From: Zhao Yakui <yakui.zhao@intel.com>
>
> The C-state idle time is not calculated correctly, which will return the wrong
> residency time in C-state. It will have the following effects:
>   1.  The system can't choose the deeper C-state when it is idle next time.
> Of course the system power is increased. E.g. On one server machine about 40W
> idle power is increased.
>   2.  The powertop shows that it will stay in C0 running state about 95% time
> although the system is idle at most time.

This was a bug from my recent patch here :-(
http://marc.info/?l=linux-acpi&m=127198016715509&w=2

Thanks for catching this..

Acked-by: Venkatesh Pallipadi <venki@google.com>

>
> Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
> Reported-by: Yu Zhidong <zhidong.yu@intel.com>
> Tested-by: Yu Zhidong <zhidong.yu@intel.com>
> CC: Venkatesh Pallipadi <venki@google.com>
> ---
>  drivers/acpi/processor_idle.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c
> index 2e8c27d..6b38a6b 100644
> --- a/drivers/acpi/processor_idle.c
> +++ b/drivers/acpi/processor_idle.c
> @@ -1022,7 +1022,7 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev,
>                spin_unlock(&c3_lock);
>        }
>        kt2 = ktime_get_real();
> -       idle_time_ns = ktime_to_us(ktime_sub(kt2, kt1));
> +       idle_time_ns = ktime_to_ns(ktime_sub(kt2, kt1));
>        idle_time = idle_time_ns;
>        do_div(idle_time, NSEC_PER_USEC);
>
> --
> 1.5.4.5
>
>
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" 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] 8+ messages in thread

* Re: [PATCH] ACPI: Fix the incorrect calculation about C-state idle time
  2010-06-02 15:06 ` Matthew Garrett
@ 2010-06-03  1:06   ` ykzhao
  2010-06-03  1:39     ` Matthew Garrett
  0 siblings, 1 reply; 8+ messages in thread
From: ykzhao @ 2010-06-03  1:06 UTC (permalink / raw)
  To: Matthew Garrett
  Cc: lenb@kernel.org, linux-acpi@vger.kernel.org, Venkatesh Pallipadi

On Wed, 2010-06-02 at 23:06 +0800, Matthew Garrett wrote:
> On Wed, Jun 02, 2010 at 11:04:09AM +0800, yakui.zhao@intel.com wrote:
> > From: Zhao Yakui <yakui.zhao@intel.com>
> > 
> > The C-state idle time is not calculated correctly, which will return the wrong
> > residency time in C-state. It will have the following effects:
> >    1.  The system can't choose the deeper C-state when it is idle next time.
> > Of course the system power is increased. E.g. On one server machine about 40W
> > idle power is increased.
> >    2.  The powertop shows that it will stay in C0 running state about 95% time
> > although the system is idle at most time.
> 
> What kind of system was this seen on?

This can be seen on laptops. But maybe the idle power effect is not
significant on laptops like that on server machine. 
     I also test the power on one T400 laptop and test shows that about
0.3W idle power is increased. 

thanks.
    Yakui 
> 


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

* Re: [PATCH] ACPI: Fix the incorrect calculation about C-state idle time
  2010-06-03  1:06   ` ykzhao
@ 2010-06-03  1:39     ` Matthew Garrett
  0 siblings, 0 replies; 8+ messages in thread
From: Matthew Garrett @ 2010-06-03  1:39 UTC (permalink / raw)
  To: ykzhao; +Cc: lenb@kernel.org, linux-acpi@vger.kernel.org, Venkatesh Pallipadi

On Thu, Jun 03, 2010 at 09:06:54AM +0800, ykzhao wrote:
> On Wed, 2010-06-02 at 23:06 +0800, Matthew Garrett wrote:
> > What kind of system was this seen on?
> 
> This can be seen on laptops. But maybe the idle power effect is not
> significant on laptops like that on server machine. 
>      I also test the power on one T400 laptop and test shows that about
> 0.3W idle power is increased. 

Thanks, I was able to reproduce this behaviour. Your patch appears to 
fix it.

-- 
Matthew Garrett | mjg59@srcf.ucam.org

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

* Re: [PATCH] ACPI: Fix the incorrect calculation about C-state idle time
  2010-06-02 16:28 ` Venkatesh Pallipadi
@ 2010-06-03  5:42   ` Len Brown
  0 siblings, 0 replies; 8+ messages in thread
From: Len Brown @ 2010-06-03  5:42 UTC (permalink / raw)
  To: Venkatesh Pallipadi; +Cc: yakui.zhao, linux-acpi

[-- Attachment #1: Type: TEXT/PLAIN, Size: 1182 bytes --]



thanks,
Len Brown, Intel Open Source Technology Center

On Wed, 2 Jun 2010, Venkatesh Pallipadi wrote:

> On Tue, Jun 1, 2010 at 8:04 PM,  <yakui.zhao@intel.com> wrote:
> > From: Zhao Yakui <yakui.zhao@intel.com>
> >
> > The C-state idle time is not calculated correctly, which will return the wrong
> > residency time in C-state. It will have the following effects:
> >   1.  The system can't choose the deeper C-state when it is idle next time.
> > Of course the system power is increased. E.g. On one server machine about 40W
> > idle power is increased.
> >   2.  The powertop shows that it will stay in C0 running state about 95% time
> > although the system is idle at most time.
> 
> This was a bug from my recent patch here :-(
> http://marc.info/?l=linux-acpi&m=127198016715509&w=2
> 
> Thanks for catching this..
> 
> Acked-by: Venkatesh Pallipadi <venki@google.com>

Another question about that patch...
regarding sched_clock_idle_wakeup_event().
Why do we call it for _simple and _bm, but not for _c1?
Why do we bother calculating its sleep_ticks*PM_TIMER_TICK_NS
argument, when that argument is never accessed?

thanks,
Len Brown, Intel Open Source Technology Center

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

* Re: [PATCH] ACPI: Fix the incorrect calculation about C-state idle time
  2010-06-02  3:04 [PATCH] ACPI: Fix the incorrect calculation about C-state idle time yakui.zhao
                   ` (2 preceding siblings ...)
  2010-06-02 16:29 ` Venkatesh Pallipadi
@ 2010-06-04  7:35 ` Len Brown
  3 siblings, 0 replies; 8+ messages in thread
From: Len Brown @ 2010-06-04  7:35 UTC (permalink / raw)
  To: Zhao Yakui; +Cc: linux-acpi, Venkatesh Pallipadi

applied

thanks,
Len Brown, Intel Open Source Technology Center


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

end of thread, other threads:[~2010-06-04  7:35 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-02  3:04 [PATCH] ACPI: Fix the incorrect calculation about C-state idle time yakui.zhao
2010-06-02 15:06 ` Matthew Garrett
2010-06-03  1:06   ` ykzhao
2010-06-03  1:39     ` Matthew Garrett
2010-06-02 16:28 ` Venkatesh Pallipadi
2010-06-03  5:42   ` Len Brown
2010-06-02 16:29 ` Venkatesh Pallipadi
2010-06-04  7:35 ` Len Brown

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).