From: Jerone Young <jyoung5@us.ibm.com>
To: Hollis Blanchard <hollisb@us.ibm.com>
Cc: kvm-ppc-devel@lists.sourceforge.net, linuxppc-dev@ozlabs.org,
Stuart Yoder <stuart.yoder@freescale.com>
Subject: Re: [kvm-ppc-devel] [PATCH] Add idle wait support for 44x platforms
Date: Fri, 04 Apr 2008 06:15:13 +0000 [thread overview]
Message-ID: <1207289713.6971.20.camel@thinkpadL> (raw)
In-Reply-To: <200804031813.59297.hollisb@us.ibm.com>
On Thu, 2008-04-03 at 18:13 -0500, Hollis Blanchard wrote:
> On Thursday 03 April 2008 17:43:02 Jerone Young wrote:
> > # HG changeset patch
> > # User Jerone Young <jyoung5@us.ibm.com>
> > # Date 1207262487 18000
> > # Node ID 7226bef216680748a50327900572c2fbc3e762b0
> > # Parent a5b2aebbc6ebd2439c655f1c047ed7e3c1991ec1
> > Add idle wait support for 44x platforms
> >
> > This patch adds the ability for the CPU to go into wait state while in
> > cpu_idle loop. This helps virtulization solutions know when the guest Linux
> > kernel is in an idle state. There are two ways to do it.
> >
> > 1) Command line
> > idle=spin <-- CPU will spin (this is the default)
> > idle=wait <-- set CPU into wait state when idle
> >
> > 2) The device tree will be checked for the "/hypervisor" node
> > If this node is seen it will use "wait" for idle, so that
> > the hypervisor can know when guest Linux kernel it is in
> > an idle state.
> >
> > This patch, unlike the last, isolates the code to 44x platforms.
> >
> > Signed-off-by: Jerone Young <jyoung5@us.ibm.com>
>
> Very nice.
>
> > +static void ppc44x_idle(void)
> > +{
> > + unsigned long msr_save;
> > +
> > + msr_save = mfmsr();
> > + /* set wait state MSR */
> > + mtmsr(msr_save|MSR_WE|MSR_EE|MSR_CE);
> > + /* return to initial state */
> > + mtmsr(msr_save);
> > +}
> > +
> > +int __init ppc44x_idle_init(void)
> > +{
> > + if(of_find_node_by_path("/hypervisor") != NULL) {
> > + /* if we find /hypervisor node is in device tree,
> > + set idle mode to wait */
> > + current_mode = 1; /* wait mode */
> > + }
> > +
> > + ppc_md.power_save = modes[current_mode].entry;
> > + return 0;
> > +}
>
> By the way, watch that space in "if(". Also, you need to call of_node_put()
Got it.
>
> The one thing I don't like is the hardcoded assumption that 1 means "wait".
> Instead, you could do something like this (not even compile-tested):
>
> int __init ppc44x_idle_init(void)
> {
> void *func = modes[current_mode].entry;
> struct device_node *node;
>
> node = of_find_node_by_path("/hypervisor")
> if (node) {
> /* if we find /hypervisor node is in device tree,
> * set idle mode to wait */
> func = &ppc44x_idle;
> of_node_put(node);
> }
>
> ppc_md.power_save = func;
> return 0;
> }
>
Will change.
> Stuart, we're getting into ePAPR territory. Do you think we need to worry
> about a hypervisor not handling mtmsr(MSR_WE)? In that case, we'd need to be
> more specific than just testing for "/hypervisor". IMHO every hypervisor
> should implement it... but maybe /hypervisor/idle = "wait" would be more
> explicit and therefore better?
This is the problem with just looking for the /hypervisor node. I'll
submit another with all the comments from everyone. But I have a feeling
this is going to lead to a longer discussion.
>
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
kvm-ppc-devel mailing list
kvm-ppc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-ppc-devel
WARNING: multiple messages have this Message-ID (diff)
From: Jerone Young <jyoung5@us.ibm.com>
To: Hollis Blanchard <hollisb@us.ibm.com>
Cc: kvm-ppc-devel@lists.sourceforge.net, linuxppc-dev@ozlabs.org,
Stuart Yoder <stuart.yoder@freescale.com>
Subject: Re: [kvm-ppc-devel] [PATCH] Add idle wait support for 44x platforms
Date: Fri, 04 Apr 2008 01:15:13 -0500 [thread overview]
Message-ID: <1207289713.6971.20.camel@thinkpadL> (raw)
In-Reply-To: <200804031813.59297.hollisb@us.ibm.com>
On Thu, 2008-04-03 at 18:13 -0500, Hollis Blanchard wrote:
> On Thursday 03 April 2008 17:43:02 Jerone Young wrote:
> > # HG changeset patch
> > # User Jerone Young <jyoung5@us.ibm.com>
> > # Date 1207262487 18000
> > # Node ID 7226bef216680748a50327900572c2fbc3e762b0
> > # Parent a5b2aebbc6ebd2439c655f1c047ed7e3c1991ec1
> > Add idle wait support for 44x platforms
> >
> > This patch adds the ability for the CPU to go into wait state while in
> > cpu_idle loop. This helps virtulization solutions know when the guest Linux
> > kernel is in an idle state. There are two ways to do it.
> >
> > 1) Command line
> > idle=spin <-- CPU will spin (this is the default)
> > idle=wait <-- set CPU into wait state when idle
> >
> > 2) The device tree will be checked for the "/hypervisor" node
> > If this node is seen it will use "wait" for idle, so that
> > the hypervisor can know when guest Linux kernel it is in
> > an idle state.
> >
> > This patch, unlike the last, isolates the code to 44x platforms.
> >
> > Signed-off-by: Jerone Young <jyoung5@us.ibm.com>
>
> Very nice.
>
> > +static void ppc44x_idle(void)
> > +{
> > + unsigned long msr_save;
> > +
> > + msr_save = mfmsr();
> > + /* set wait state MSR */
> > + mtmsr(msr_save|MSR_WE|MSR_EE|MSR_CE);
> > + /* return to initial state */
> > + mtmsr(msr_save);
> > +}
> > +
> > +int __init ppc44x_idle_init(void)
> > +{
> > + if(of_find_node_by_path("/hypervisor") != NULL) {
> > + /* if we find /hypervisor node is in device tree,
> > + set idle mode to wait */
> > + current_mode = 1; /* wait mode */
> > + }
> > +
> > + ppc_md.power_save = modes[current_mode].entry;
> > + return 0;
> > +}
>
> By the way, watch that space in "if(". Also, you need to call of_node_put()
Got it.
>
> The one thing I don't like is the hardcoded assumption that 1 means "wait".
> Instead, you could do something like this (not even compile-tested):
>
> int __init ppc44x_idle_init(void)
> {
> void *func = modes[current_mode].entry;
> struct device_node *node;
>
> node = of_find_node_by_path("/hypervisor")
> if (node) {
> /* if we find /hypervisor node is in device tree,
> * set idle mode to wait */
> func = &ppc44x_idle;
> of_node_put(node);
> }
>
> ppc_md.power_save = func;
> return 0;
> }
>
Will change.
> Stuart, we're getting into ePAPR territory. Do you think we need to worry
> about a hypervisor not handling mtmsr(MSR_WE)? In that case, we'd need to be
> more specific than just testing for "/hypervisor". IMHO every hypervisor
> should implement it... but maybe /hypervisor/idle = "wait" would be more
> explicit and therefore better?
This is the problem with just looking for the /hypervisor node. I'll
submit another with all the comments from everyone. But I have a feeling
this is going to lead to a longer discussion.
>
next prev parent reply other threads:[~2008-04-04 6:15 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-04-03 22:43 [kvm-ppc-devel] [PATCH] Add idle wait support for 44x platforms Jerone Young
2008-04-03 22:43 ` Jerone Young
2008-04-03 23:03 ` [kvm-ppc-devel] " Tony Breeds
2008-04-03 23:03 ` Tony Breeds
2008-04-04 1:59 ` [kvm-ppc-devel] " Josh Boyer
2008-04-04 1:59 ` Josh Boyer
2008-04-04 6:12 ` [kvm-ppc-devel] " Jerone Young
2008-04-04 6:12 ` Jerone Young
2008-04-04 11:47 ` [kvm-ppc-devel] " Josh Boyer
2008-04-04 11:47 ` Josh Boyer
2008-04-08 2:17 ` [kvm-ppc-devel] " Arnd Bergmann
2008-04-08 2:17 ` Arnd Bergmann
2008-04-08 2:31 ` [kvm-ppc-devel] " Josh Boyer
2008-04-08 2:31 ` Josh Boyer
2008-04-08 2:41 ` [kvm-ppc-devel] " Arnd Bergmann
2008-04-08 2:41 ` Arnd Bergmann
2008-04-08 2:44 ` [kvm-ppc-devel] " Josh Boyer
2008-04-08 2:44 ` Josh Boyer
2008-04-03 23:13 ` [kvm-ppc-devel] " Hollis Blanchard
2008-04-03 23:13 ` Hollis Blanchard
2008-04-04 0:17 ` Scott Wood
2008-04-04 0:17 ` Scott Wood
2008-04-04 6:15 ` Jerone Young [this message]
2008-04-04 6:15 ` Jerone Young
2008-04-04 2:00 ` Josh Boyer
2008-04-04 2:00 ` Josh Boyer
2008-04-04 5:59 ` [kvm-ppc-devel] " Jerone Young
2008-04-04 5:59 ` Jerone Young
2008-04-04 14:33 ` [kvm-ppc-devel] " Hollis Blanchard
2008-04-04 14:33 ` Hollis Blanchard
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=1207289713.6971.20.camel@thinkpadL \
--to=jyoung5@us.ibm.com \
--cc=hollisb@us.ibm.com \
--cc=kvm-ppc-devel@lists.sourceforge.net \
--cc=linuxppc-dev@ozlabs.org \
--cc=stuart.yoder@freescale.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.