mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Luis R. Rodriguez" <mcgrof@suse.com>
To: Andy Lutomirski <luto@amacapital.net>
Cc: "Luis R. Rodriguez" <mcgrof@do-not-panic.com>,
	David Vrabel <david.vrabel@citrix.com>,
	Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>,
	Boris Ostrovsky <boris.ostrovsky@oracle.com>,
	"xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	X86 ML <x86@kernel.org>, kvm list <kvm@vger.kernel.org>,
	Borislav Petkov <bp@suse.de>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>,
	Jan Beulich <JBeulich@suse.com>
Subject: Re: [RFC v3 1/2] x86/xen: add xen_is_preemptible_hypercall()
Date: Thu, 22 Jan 2015 20:30:03 +0100	[thread overview]
Message-ID: <20150122193003.GR17887@wotan.suse.de> (raw)
In-Reply-To: <CALCETrXp7qWLQYEAq7zKTMeMg7mfXo+mL-qPfPN6hfJGQGSoPw@mail.gmail.com>

On Wed, Jan 21, 2015 at 07:07:36PM -0800, Andy Lutomirski wrote:
> On Wed, Jan 21, 2015 at 6:17 PM, Luis R. Rodriguez
> <mcgrof@do-not-panic.com> wrote:
> > From: "Luis R. Rodriguez" <mcgrof@suse.com>
> >
> > On kernels with voluntary or no preemption we can run
> > into situations where a hypercall issued through userspace
> > will linger around as it addresses sub-operatiosn in kernel
> > context (multicalls). Such operations can trigger soft lockup
> > detection.
> >
> > We want to address a way to let the kernel voluntarily preempt
> > such calls even on non preempt kernels, to address this we first
> > need to distinguish which hypercalls fall under this category.
> > This implements xen_is_preemptible_hypercall() which lets us do
> > just that by adding a secondary hypercall page, calls made via
> > the new page may be preempted.
> >
> > Andrew had originally submitted a version of this work [0].
> >
> > [0] http://lists.xen.org/archives/html/xen-devel/2014-02/msg01056.html
> >
> > Based on original work by: Andrew Cooper <andrew.cooper3@citrix.com>
> >
> > Cc: Andy Lutomirski <luto@amacapital.net>
> > Cc: Borislav Petkov <bp@suse.de>
> > Cc: David Vrabel <david.vrabel@citrix.com>
> > Cc: Thomas Gleixner <tglx@linutronix.de>
> > Cc: Ingo Molnar <mingo@redhat.com>
> > Cc: "H. Peter Anvin" <hpa@zytor.com>
> > Cc: x86@kernel.org
> > Cc: Steven Rostedt <rostedt@goodmis.org>
> > Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
> > Cc: Jan Beulich <JBeulich@suse.com>
> > Cc: linux-kernel@vger.kernel.org
> > Signed-off-by: Luis R. Rodriguez <mcgrof@suse.com>
> > ---
> >  arch/x86/include/asm/xen/hypercall.h | 20 ++++++++++++++++++++
> >  arch/x86/xen/enlighten.c             |  7 +++++++
> >  arch/x86/xen/xen-head.S              | 18 +++++++++++++++++-
> >  3 files changed, 44 insertions(+), 1 deletion(-)
> >
> > diff --git a/arch/x86/include/asm/xen/hypercall.h b/arch/x86/include/asm/xen/hypercall.h
> > index ca08a27..221008e 100644
> > --- a/arch/x86/include/asm/xen/hypercall.h
> > +++ b/arch/x86/include/asm/xen/hypercall.h
> > @@ -84,6 +84,22 @@
> >
> >  extern struct { char _entry[32]; } hypercall_page[];
> >
> > +#ifndef CONFIG_PREEMPT
> > +extern struct { char _entry[32]; } preemptible_hypercall_page[];
> 
> A comment somewhere explaining why only non-preemptible kernels have
> preemptible hypercalls might be friendly to some future reader. :)

Good idea, since this section is arch specific, I'll instead add a blurb
explaining this on the upcall.

> > +
> > +static inline bool xen_is_preemptible_hypercall(struct pt_regs *regs)
> > +{
> > +       return !user_mode_vm(regs) &&
> > +               regs->ip >= (unsigned long)preemptible_hypercall_page &&
> > +               regs->ip < (unsigned long)preemptible_hypercall_page + PAGE_SIZE;
> > +}
> 
> This makes it seem like the page is indeed one page long, but I don't
> see what actually allocates a whole page for it.  What am I missing?

arch/x86/xen/xen-head.S

.pushsection .text                                                              
        .balign PAGE_SIZE                                                       
ENTRY(hypercall_page) 

#ifndef CONFIG_PREEMPT                                                          
ENTRY(preemptible_hypercall_page)                                               
        .skip PAGE_SIZE                                                         
#endif /* CONFIG_PREEMPT */  

Does that suffice to be sure?

 Luis

  reply	other threads:[~2015-01-22 19:30 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-22  2:17 [RFC v3 0/2] x86/xen: add xen hypercall preemption Luis R. Rodriguez
2015-01-22  2:17 ` [RFC v3 1/2] x86/xen: add xen_is_preemptible_hypercall() Luis R. Rodriguez
2015-01-22  3:07   ` Andy Lutomirski
2015-01-22 19:30     ` Luis R. Rodriguez [this message]
2015-01-22 20:01       ` Andy Lutomirski
2015-01-22 21:09         ` Luis R. Rodriguez
2015-01-22 21:44           ` Andrew Cooper
2015-01-22 22:44             ` Luis R. Rodriguez
2015-01-22  2:17 ` [RFC v3 2/2] x86/xen: allow privcmd hypercalls to be preempted Luis R. Rodriguez
2015-01-22  3:18   ` Andy Lutomirski
2015-01-22 12:55     ` [Xen-devel] " David Vrabel
2015-01-22 17:56       ` Luis R. Rodriguez
2015-01-22 19:30     ` Luis R. Rodriguez
2015-01-22 11:50   ` [Xen-devel] " Andrew Cooper
2015-01-22 13:56     ` Steven Rostedt
2015-01-22 18:39       ` Luis R. Rodriguez
2015-01-22 20:16         ` Steven Rostedt
2015-01-22 20:24           ` Andy Lutomirski
2015-01-22 20:37             ` Steven Rostedt
2015-01-22 20:58               ` Andy Lutomirski
2015-01-22 21:16                 ` Steven Rostedt
2015-01-22 21:21                   ` Andy Lutomirski
2015-01-22 22:29                 ` Andrew Cooper
2015-01-22 21:07           ` Paul E. McKenney
2015-01-22 18:41     ` Luis R. Rodriguez
2015-01-22 13:10   ` Julien Grall
2015-01-22 18:56     ` Luis R. Rodriguez
2015-01-22 20:31       ` Julien Grall

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=20150122193003.GR17887@wotan.suse.de \
    --to=mcgrof@suse.com \
    --cc=JBeulich@suse.com \
    --cc=boris.ostrovsky@oracle.com \
    --cc=bp@suse.de \
    --cc=david.vrabel@citrix.com \
    --cc=hpa@zytor.com \
    --cc=konrad.wilk@oracle.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@amacapital.net \
    --cc=masami.hiramatsu.pt@hitachi.com \
    --cc=mcgrof@do-not-panic.com \
    --cc=mingo@redhat.com \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    --cc=xen-devel@lists.xenproject.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

Powered by JetHome