All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: alex.shi@intel.com
Cc: Len Brown <lenb@kernel.org>,
	linux-kernel@vger.kernel.org,
	Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>,
	linux-acpi@vger.kernel.org
Subject: Re: [patch]: fixing of pmtimer overflow that make Cx states time incorrect
Date: Mon, 2 Feb 2009 23:24:38 -0800	[thread overview]
Message-ID: <20090202232438.d91d19f7.akpm@linux-foundation.org> (raw)
In-Reply-To: <1233539217.4069.24.camel@alexs-hp>


(Cc: line rewritten.  What on earth is your email client doing??)

On Mon, 02 Feb 2009 09:46:57 +0800 "alex.shi" <alex.shi@intel.com> wrote:

> Yagui want to give a clear explanation to be used for commitment. So I resend
> this again. 
> 
>     On most boxes the ACPI PM timer is 24-bit counter that runs on 3.579545MHz
> clock. In such case the max C-state sleep time should be less than 4687ms when
> it is used to record C2/C3 duration time. 
>     But on some boxes the max C-state sleep time is more than 4687ms. In such
> case the overflow happens and the C-state duration time can't be counted
> accurately.
> 
>     Use clocksource to get the C-state time instead of ACPI PM timer. and use
> div64_u64 to convert US_TO_PM_TIME_TICKS in i386 mode.
> 

A minor thing..

> --- linux-2.6.29-rc3.orig/drivers/acpi/processor_idle.c
> +++ linux-2.6.29-rc3/drivers/acpi/processor_idle.c
> @@ -64,7 +64,8 @@
>  #define _COMPONENT              ACPI_PROCESSOR_COMPONENT
>  ACPI_MODULE_NAME("processor_idle");
>  #define ACPI_PROCESSOR_FILE_POWER	"power"
> -#define US_TO_PM_TIMER_TICKS(t)		((t * (PM_TIMER_FREQUENCY/1000)) / 1000)
> +#define US_TO_PM_TIMER_TICKS(t)		div64_u64(\
> +	(t * (PM_TIMER_FREQUENCY/1000)), 1000ULL)

I suppose it doesn't matter much, but we could make this function more
accurate via

	(t * PM_TIMER_FREQUENCY) / 1000

Also, it would be nicer to implement this is a regular C function. 
There's no need at all for it to be an ugly all-caps macro.



  parent reply	other threads:[~2009-02-03  7:24 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-19  5:13 [patch]: fixing of pmtimer overflow that make Cx states time incorrect alex.shi
2009-01-27  6:52 ` Andrew Morton
2009-02-01  2:04   ` yakui_zhao
2009-02-01 10:03     ` alex.shi
2009-02-02  1:46     ` alex.shi
2009-02-03  6:18       ` yakui_zhao
2009-02-03  7:24       ` Andrew Morton [this message]
2009-02-09 19:56       ` Andrew Morton
2009-02-10  3:37         ` alex.shi
2009-02-10  3:37           ` alex.shi

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=20090202232438.d91d19f7.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=alex.shi@intel.com \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@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 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.