public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
From: venkatesh.pallipadi@intel.com
To: lenb@kernel.org, len.brown@intel.com
Cc: linux-acpi@vger.kernel.org,
	Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Subject: [patch 3/4] ACPI, CPU_IDLE: Support C1 idle time accounting
Date: Thu, 31 Jan 2008 17:35:05 -0800	[thread overview]
Message-ID: <20080201013629.535233000@intel.com> (raw)
In-Reply-To: 20080201013502.750627000@intel.com

[-- Attachment #1: acpi_cpuidle_c1_resident_time.patch --]
[-- Type: text/plain, Size: 1506 bytes --]

Show C1 idle time in /sysfs cpuidle interface. C1 idle time may not
be entirely accurate in all cases. It includes the time spent
in the interrupt handler after wakeup with "hlt" based C1. But, it will
be accurate with "mwait" based C1.

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
@@ -1382,8 +1382,10 @@ static inline void acpi_idle_do_entry(st
 static int acpi_idle_enter_c1(struct cpuidle_device *dev,
 			      struct cpuidle_state *state)
 {
+	u32 t1, t2;
 	struct acpi_processor *pr;
 	struct acpi_processor_cx *cx = cpuidle_get_statedata(state);
+
 	pr = processors[smp_processor_id()];
 
 	if (unlikely(!pr))
@@ -1393,12 +1395,14 @@ static int acpi_idle_enter_c1(struct cpu
 	if (pr->flags.bm_check)
 		acpi_idle_update_bm_rld(pr, cx);
 
+	t1 = inl(acpi_gbl_FADT.xpm_timer_block.address);
 	acpi_idle_do_entry(cx);
+	t2 = inl(acpi_gbl_FADT.xpm_timer_block.address);
 
 	local_irq_enable();
 	cx->usage++;
 
-	return 0;
+	return ticks_elapsed_in_us(t1, t2);
 }
 
 /**
@@ -1632,6 +1636,7 @@ static int acpi_processor_setup_cpuidle(
 		switch (cx->type) {
 			case ACPI_STATE_C1:
 			state->flags |= CPUIDLE_FLAG_SHALLOW;
+			state->flags |= CPUIDLE_FLAG_TIME_VALID;
 			state->enter = acpi_idle_enter_c1;
 			dev->safe_state = state;
 			break;

-- 

  parent reply	other threads:[~2008-02-01  1:37 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
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 ` venkatesh.pallipadi [this message]
2008-02-07  7:38   ` [patch 3/4] ACPI, CPU_IDLE: Support C1 idle time accounting 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=20080201013629.535233000@intel.com \
    --to=venkatesh.pallipadi@intel.com \
    --cc=len.brown@intel.com \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox