From: Rik van Riel <riel@redhat.com>
To: Keir Fraser <keir@xensource.com>
Cc: "Tian, Kevin" <kevin.tian@intel.com>,
xen-devel@lists.xensource.com, "Langsdorf,
Mark" <mark.langsdorf@amd.com>
Subject: Re: [PATCH] 1/2: cpufreq/PowerNow! in Xen: Time and platform changes
Date: Thu, 30 Aug 2007 14:23:28 -0400 [thread overview]
Message-ID: <46D70B20.2010108@redhat.com> (raw)
In-Reply-To: <C2FC9B0B.150B9%keir@xensource.com>
[-- Attachment #1: Type: text/plain, Size: 871 bytes --]
Keir Fraser wrote:
> It's a misleading simplification. For example, the ondemand governor will
> build and run in a dom0 kernel but it's not actually going to do the right
> thing, as it doesn't observe whole-machine load.
Here is the missing piece of the puzzle. A platform
hypercall operation to get system wide idle time.
I believe Mark's changes, together with this little
patch, are the way we can get cpufreq working on
Xen with the minimal amount of code duplication.
Duplicating code anywhere, whether it be inside the
hypervisor or in some Xen-only userland package, will
only lead to bit rot and make Xen maintenance more
painful.
Signed-off-by: Rik van Riel <riel@redhat.com>
--
Politics is the struggle between those who want to make their country
the best in the world, and those who believe it already is. Each group
calls the other unpatriotic.
[-- Attachment #2: xen-idletime-platform.patch --]
[-- Type: text/x-patch, Size: 2159 bytes --]
diff -r 81c9213b3d39 xen/include/public/platform.h
--- a/xen/include/public/platform.h Tue Nov 28 18:41:42 2006 +0000
+++ b/xen/include/public/platform.h Thu Aug 30 14:18:04 2007 -0400
@@ -114,6 +114,19 @@ typedef struct xenpf_platform_quirk xenp
typedef struct xenpf_platform_quirk xenpf_platform_quirk_t;
DEFINE_XEN_GUEST_HANDLE(xenpf_platform_quirk_t);
+typedef uint64_t cputime_t;
+DEFINE_XEN_GUEST_HANDLE(cputime_t);
+#define XENPF_getidletime 40
+struct xenpf_getidletime {
+ /* IN variables. */
+ uint32_t max_cpus;
+ XEN_GUEST_HANDLE(uint64_t) buffer;
+ /* OUT variables. */
+ uint32_t num_cpus;
+};
+typedef struct xenpf_getidletime xenpf_getidletime_t;
+DEFINE_XEN_GUEST_HANDLE(xenpf_getidletime_t);
+
struct xen_platform_op {
uint32_t cmd;
uint32_t interface_version; /* XENPF_INTERFACE_VERSION */
@@ -124,6 +137,7 @@ struct xen_platform_op {
struct xenpf_read_memtype read_memtype;
struct xenpf_microcode_update microcode;
struct xenpf_platform_quirk platform_quirk;
+ struct xenpf_getidletime getidletime;
uint8_t pad[128];
} u;
};
diff -r 81c9213b3d39 xen/arch/x86/platform_hypercall.c
--- a/xen/arch/x86/platform_hypercall.c Tue Nov 28 18:41:42 2006 +0000
+++ b/xen/arch/x86/platform_hypercall.c Thu Aug 30 14:18:12 2007 -0400
@@ -138,6 +138,31 @@ long do_platform_op(XEN_GUEST_HANDLE(xen
}
break;
+ case XENPF_getidletime:
+ {
+ uint32_t cpu;
+ uint32_t max_cpus = op->u.getidletime.max_cpus;
+ uint64_t idletime;
+
+ for_each_online_cpu (cpu) {
+ if ( cpu >= max_cpus )
+ break;
+
+ idletime = idle_vcpu[cpu]->runstate.time[RUNSTATE_running];
+
+ if ( copy_to_guest_offset(op->u.getidletime.buffer, cpu, &idletime, 1) ) {
+ ret = -EFAULT;
+ break;
+ }
+ }
+
+ op->u.getidletime.num_cpus = cpu;
+
+ if ( copy_to_guest(u_xenpf_op, op, 1) )
+ ret = -EFAULT;
+ }
+ break;
+
default:
ret = -ENOSYS;
break;
[-- Attachment #3: Type: text/plain, Size: 138 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
next prev parent reply other threads:[~2007-08-30 18:23 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-08-29 22:02 [PATCH] 1/2: cpufreq/PowerNow! in Xen: Time and platform changes Mark Langsdorf
2007-08-30 6:41 ` Tian, Kevin
2007-08-30 9:30 ` Keir Fraser
2007-08-30 9:45 ` Tian, Kevin
2007-08-30 10:12 ` Keir Fraser
2007-08-31 1:20 ` Tian, Kevin
2007-08-31 10:04 ` Keir Fraser
2007-08-31 15:09 ` Tian, Kevin
2007-08-31 15:25 ` Keir Fraser
2007-09-01 0:23 ` Tian, Kevin
2007-09-01 11:07 ` Keir Fraser
2007-09-01 13:31 ` Tian, Kevin
2007-09-01 13:57 ` Keir Fraser
2007-09-01 14:14 ` Tian, Kevin
2007-09-01 14:22 ` Tian, Kevin
2007-09-01 14:12 ` Keir Fraser
2007-09-01 14:18 ` Tian, Kevin
2007-09-01 15:26 ` Keir Fraser
2007-09-01 15:45 ` Tian, Kevin
2007-09-01 16:41 ` Keir Fraser
2007-09-03 4:25 ` Tian, Kevin
2007-09-04 17:23 ` Rik van Riel
2007-08-30 14:45 ` Langsdorf, Mark
2007-08-30 15:04 ` Keir Fraser
2007-08-30 18:23 ` Rik van Riel [this message]
[not found] ` <1449F58C868D8D4E9C72945771150BDF0207700B@SAUSEXMB1.amd.com>
2007-08-30 20:56 ` Rik van Riel
2007-08-31 2:43 ` Tian, Kevin
2007-08-31 8:41 ` Jan Beulich
2007-08-30 14:59 ` Rik van Riel
2007-08-31 2:42 ` Tian, Kevin
2007-08-31 9:23 ` Keir Fraser
2007-08-31 13:50 ` Rik van Riel
2007-08-30 14:57 ` Langsdorf, Mark
2007-08-30 15:08 ` Keir Fraser
2007-10-01 8:30 ` xeb
2007-10-01 8:33 ` Keir Fraser
2007-10-02 12:56 ` xeb
2007-10-02 12:57 ` xeb
2007-10-02 13:00 ` xeb
2007-10-02 13:02 ` xeb
-- strict thread matches above, loose matches on Subject: below --
2007-10-02 13:05 xeb
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=46D70B20.2010108@redhat.com \
--to=riel@redhat.com \
--cc=keir@xensource.com \
--cc=kevin.tian@intel.com \
--cc=mark.langsdorf@amd.com \
--cc=xen-devel@lists.xensource.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.