mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Zachary Amsden <zach@vmware.com>
To: Rusty Russell <rusty@rustcorp.com.au>
Cc: Jeremy Fitzhardinge <jeremy@goop.org>,
	Linus Torvalds <torvalds@osdl.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Andrew Morton <akpm@osdl.org>, Chris Wright <chrisw@sous-sol.org>,
	stable@kernel.org,
	Virtualization Mailing List <virtualization@lists.osdl.org>,
	Andi Kleen <ak@suse.de>, Anthony Liguori <anthony@codemonkey.ws>
Subject: Re: [PATCH] Fix preemptible lazy mode bug
Date: Wed, 05 Sep 2007 10:05:09 -0700	[thread overview]
Message-ID: <1189011909.21516.1.camel@bodhitayantram.eng.vmware.com> (raw)
In-Reply-To: <1189010022.10802.161.camel@localhost.localdomain>

On Thu, 2007-09-06 at 02:33 +1000, Rusty Russell wrote:
> On Tue, 2007-09-04 at 14:42 +0100, Jeremy Fitzhardinge wrote:
> > Rusty Russell wrote:
> > >  static inline void arch_flush_lazy_mmu_mode(void)
> > >  {
> > > -	PVOP_VCALL1(set_lazy_mode, PARAVIRT_LAZY_FLUSH);
> > > +	if (unlikely(__get_cpu_var(paravirt_lazy_mode) == PARAVIRT_LAZY_MMU))
> > > +		arch_leave_lazy_mmu_mode();
> > >  }
> > >   
> > 
> > This changes the semantics a bit; previously "flush" would flush
> > anything pending but leave us in lazy mode.  This just drops lazymode
> > altogether?
> > 
> > I guess if we assume that flushing is a rare event then its OK, but I
> > think the name's a bit misleading.  How does it differ from plain
> > arch_leave_lazy_mmu_mode()?
> 
> Whether it's likely or unlikely to be in lazy mode, basically.  But
> you're right, this should be folded, since we don't want to "leave" lazy
> mode twice.
> 
> ===
> Hoist per-cpu lazy_mode variable up into common code.
> 
> VMI, Xen and lguest all track paravirt_lazy_mode individually, meaning
> we hand a "magic" value for set_lazy_mode() to say "flush if currently
> active".
> 
> We can simplify the logic by hoisting this variable into common code.
> 
> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
> 
> ---
>  arch/i386/kernel/vmi.c      |   16 ++++------------
>  arch/i386/xen/enlighten.c   |   15 +++------------
>  arch/i386/xen/multicalls.h  |    2 +-
>  arch/i386/xen/xen-ops.h     |    7 -------
>  drivers/lguest/lguest.c     |   25 ++++++-------------------
>  include/asm-i386/paravirt.h |   29 ++++++++++++++++-------------
>  6 files changed, 30 insertions(+), 64 deletions(-)
> 
> diff -r 072a0b3924fb arch/i386/kernel/vmi.c
> --- a/arch/i386/kernel/vmi.c	Thu Aug 30 04:47:43 2007 +1000
> +++ b/arch/i386/kernel/vmi.c	Wed Sep 05 04:06:20 2007 +1000
> @@ -554,22 +554,14 @@ vmi_startup_ipi_hook(int phys_apicid, un
>  
>  static void vmi_set_lazy_mode(enum paravirt_lazy_mode mode)
>  {
> -	static DEFINE_PER_CPU(enum paravirt_lazy_mode, lazy_mode);
> -
>  	if (!vmi_ops.set_lazy_mode)
>  		return;
>  
>  	/* Modes should never nest or overlap */
> -	BUG_ON(__get_cpu_var(lazy_mode) && !(mode == PARAVIRT_LAZY_NONE ||
> -					     mode == PARAVIRT_LAZY_FLUSH));
> -
> -	if (mode == PARAVIRT_LAZY_FLUSH) {
> -		vmi_ops.set_lazy_mode(0);
> -		vmi_ops.set_lazy_mode(__get_cpu_var(lazy_mode));
> -	} else {
> -		vmi_ops.set_lazy_mode(mode);
> -		__get_cpu_var(lazy_mode) = mode;
> -	}
> +	BUG_ON(get_lazy_mode() && !(mode == PARAVIRT_LAZY_NONE |
> +				    | mode == PARAVIRT_LAZY_FLUSH));

That's a pretty strange line break.




  reply	other threads:[~2007-09-05 17:05 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-24  5:46 Zachary Amsden
2007-08-24  6:53 ` Jeremy Fitzhardinge
2007-08-24  6:59   ` Zachary Amsden
2007-08-25 11:57     ` Rusty Russell
2007-09-01 21:09     ` Jeremy Fitzhardinge
2007-09-03 20:14       ` Rusty Russell
2007-09-04 13:42         ` Jeremy Fitzhardinge
2007-09-05 16:33           ` Rusty Russell
2007-09-05 17:05             ` Zachary Amsden [this message]
2007-09-05 17:48               ` Rusty Russell
2007-09-05 20:10             ` Jeremy Fitzhardinge
2007-09-05 20:37 ` Rusty Russell
2007-09-05 23:49   ` Zachary Amsden
2007-09-06  5:41     ` Andi Kleen
2007-09-06  9:56       ` Jeremy Fitzhardinge
2007-09-06  9:57       ` Jeremy Fitzhardinge

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=1189011909.21516.1.camel@bodhitayantram.eng.vmware.com \
    --to=zach@vmware.com \
    --cc=ak@suse.de \
    --cc=akpm@osdl.org \
    --cc=anthony@codemonkey.ws \
    --cc=chrisw@sous-sol.org \
    --cc=jeremy@goop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rusty@rustcorp.com.au \
    --cc=stable@kernel.org \
    --cc=torvalds@osdl.org \
    --cc=virtualization@lists.osdl.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

all inboxes | Powered by JetHome®