From: "Glauber de Oliveira Costa" <glommer@gmail.com>
To: "Jeremy Fitzhardinge" <jeremy@goop.org>
Cc: "Linux Kernel Mailing List" <linux-kernel@vger.kernel.org>,
"Andi Kleen" <ak@suse.de>, "Zachary Amsden" <zach@vmware.com>,
"Rusty Russell" <rusty@rustcorp.com.au>,
"Avi Kivity" <avi@qumranet.com>,
"Anthony Liguori" <anthony@codemonkey.ws>,
"Nakajima, Jun" <jun.nakajima@intel.com>
Subject: Re: [PATCH RFC 2/2] paravirt: clean up lazy mode handling
Date: Mon, 15 Oct 2007 22:54:32 -0300 [thread overview]
Message-ID: <5d6222a80710151854j1159296ese2b6c471c9deb4ad@mail.gmail.com> (raw)
In-Reply-To: <470FDBC4.4050306@goop.org>
On 10/12/07, Jeremy Fitzhardinge <jeremy@goop.org> wrote:
> [ Changes since last post: fixed up lguest ]
>
> Currently, the set_lazy_mode pv_op is overloaded with 5 functions:
> 1. enter lazy cpu mode
> 2. leave lazy cpu mode
> 3. enter lazy mmu mode
> 4. leave lazy mmu mode
> 5. flush pending batched operations
>
> This complicates each paravirt backend, since it needs to deal with
> all the possible state transitions, handling flushing, etc. In
> particular, flushing is quite distinct from the other 4 functions, and
> seems to just cause complication.
>
> This patch removes the set_lazy_mode operation, and adds "enter" and
> "leave" lazy mode operations on mmu_ops and cpu_ops. All the logic
> associated with enter and leaving lazy states is now in common code
> (basically BUG_ONs to make sure that no mode is current when entering
> a lazy mode, and make sure that the mode is current when leaving).
> Also, flush is handled in a common way, by simply leaving and
> re-entering the lazy mode.
>
> The result is that the Xen, lguest and VMI lazy mode implementations
> are much simpler.
>
> Signed-off-by: Jeremy Fitzhardinge <jeremy@xensource.com>
> Cc: Andi Kleen <ak@suse.de>
> Cc: Zach Amsden <zach@vmware.com>
> Cc: Rusty Russell <rusty@rustcorp.com.au>
> Cc: Avi Kivity <avi@qumranet.com>
> Cc: Anthony Liguory <aliguori@us.ibm.com>
> Cc: "Glauber de Oliveira Costa" <glommer@gmail.com>
> Cc: "Nakajima, Jun" <jun.nakajima@intel.com>
>
> ---
> arch/i386/kernel/paravirt.c | 58 +++++++++++++++++++++++++++++++++++++++----
> arch/i386/kernel/vmi.c | 45 +++++++++++++++++++--------------
> arch/i386/xen/enlighten.c | 44 ++++++++++----------------------
> arch/i386/xen/mmu.c | 2 -
> arch/i386/xen/multicalls.h | 2 -
> arch/i386/xen/xen-ops.h | 7 -----
> drivers/lguest/lguest.c | 34 ++++++++-----------------
> include/asm-i386/paravirt.h | 52 ++++++++++++++++++++++++--------------
> 8 files changed, 140 insertions(+), 104 deletions(-)
>
> ===================================================================
> --- a/arch/i386/kernel/paravirt.c
> +++ b/arch/i386/kernel/paravirt.c
> @@ -266,6 +266,49 @@ int paravirt_disable_iospace(void)
> }
>
> return ret;
> +}
> +
> +static DEFINE_PER_CPU(enum paravirt_lazy_mode, paravirt_lazy_mode) = PARAVIRT_LAZY_NONE;
> +
> +static inline void enter_lazy(enum paravirt_lazy_mode mode)
> +{
> + BUG_ON(x86_read_percpu(paravirt_lazy_mode) != PARAVIRT_LAZY_NONE);
> + BUG_ON(preemptible());
Wouldn't it be better to WARN_ON, and simply not entering lazy mode?
It does not sound like a fatal condition.
> +void paravirt_leave_lazy(enum paravirt_lazy_mode mode)
> +{
> + BUG_ON(x86_read_percpu(paravirt_lazy_mode) != mode);
> + BUG_ON(preemptible());
Although this one seems like a fatal condition ;-)
> +void paravirt_enter_lazy_mmu(void)
> +{
> + enter_lazy(PARAVIRT_LAZY_MMU);
> +}
> +
> +void paravirt_leave_lazy_mmu(void)
> +{
> + paravirt_leave_lazy(PARAVIRT_LAZY_MMU);
> +}
> +
> +void paravirt_enter_lazy_cpu(void)
> +{
> + enter_lazy(PARAVIRT_LAZY_CPU);
> +}
> +
> +void paravirt_leave_lazy_cpu(void)
> +{
> + paravirt_leave_lazy(PARAVIRT_LAZY_CPU);
> +}
> +
> +enum paravirt_lazy_mode paravirt_get_lazy_mode(void)
> +{
> + return x86_read_percpu(paravirt_lazy_mode);
> }
I am concerned that this is 32-bit specific.
But hey: We could wrap it here, but the best solution may be just to
define this macro for 64-bit, and make it everyone benefits. So yeah,
this is a concern here, but I don't think anything should be changed
in this patch to address it so... so... ok ;-)
--
Glauber de Oliveira Costa.
"Free as in Freedom"
http://glommer.net
"The less confident you are, the more serious you have to act."
prev parent reply other threads:[~2007-10-16 1:54 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-10-12 20:40 Jeremy Fitzhardinge
2007-10-16 0:04 ` Rusty Russell
2007-10-16 1:54 ` Glauber de Oliveira Costa [this message]
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=5d6222a80710151854j1159296ese2b6c471c9deb4ad@mail.gmail.com \
--to=glommer@gmail.com \
--cc=ak@suse.de \
--cc=anthony@codemonkey.ws \
--cc=avi@qumranet.com \
--cc=jeremy@goop.org \
--cc=jun.nakajima@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=rusty@rustcorp.com.au \
--cc=zach@vmware.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®