LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: "Luis R. Rodriguez" <mcgrof@suse.com>
To: David Vrabel <david.vrabel@citrix.com>
Cc: "Luis R. Rodriguez" <mcgrof@do-not-panic.com>,
	konrad.wilk@oracle.com, boris.ostrovsky@oracle.com,
	xen-devel@lists.xenproject.org, Borislav Petkov <bp@suse.de>,
	kvm@vger.kernel.org, x86@kernel.org,
	linux-kernel@vger.kernel.org, rostedt@goodmis.org,
	Andy Lutomirski <luto@amacapital.net>,
	Ingo Molnar <mingo@redhat.com>, Jan Beulich <JBeulich@suse.com>,
	"H. Peter Anvin" <hpa@zytor.com>,
	Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	paulmck@linux.vnet.ibm.com
Subject: Re: [Xen-devel] [RFC v4 1/2] x86/xen: add xen_is_preemptible_hypercall()
Date: Fri, 23 Jan 2015 19:57:11 +0100	[thread overview]
Message-ID: <20150123185711.GW17887@wotan.suse.de> (raw)
In-Reply-To: <54C230C8.4000207@citrix.com>

On Fri, Jan 23, 2015 at 11:30:16AM +0000, David Vrabel wrote:
> On 23/01/15 00:29, Luis R. Rodriguez 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.
> [...]
> > --- 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[];
> > +
> > +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;
> 
> I think you can optimize this to:
> 
>     return (regs->ip >> PAGE_SHIFT) == preemptible_hypercall_pfn

I take it you meant preemptible_hypercall_page ?

> 	&& !user_mode_vm(regs);

If so I don't see how this can work as an identical replacement.
Consider a PAGE_SIZE is 16, so PAGE_SHIFT would be 4, and lets
say we are checking for byte 2 which should be in the page:

; 0b0010 >>4
	0

Can you elaborate more on this, or can we perhaps leave such
optimization as an evolution to avoid regressions if you are
not 100% certain?

  Luis

  reply	other threads:[~2015-01-23 18:57 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-23  0:29 [RFC v4 0/2] x86/xen: add xen hypercall preemption Luis R. Rodriguez
2015-01-23  0:29 ` [RFC v4 1/2] x86/xen: add xen_is_preemptible_hypercall() Luis R. Rodriguez
2015-01-23  1:40   ` Andy Lutomirski
2015-01-27  1:45     ` Luis R. Rodriguez
2015-01-23 11:30   ` [Xen-devel] " David Vrabel
2015-01-23 18:57     ` Luis R. Rodriguez [this message]
2015-01-23  0:29 ` [RFC v4 2/2] x86/xen: allow privcmd hypercalls to be preempted Luis R. Rodriguez
2015-01-23  1:40   ` Andy Lutomirski
2015-01-23  1:57     ` Steven Rostedt
2015-01-23 11:45   ` [Xen-devel] " David Vrabel
2015-01-23 18:58     ` Luis R. Rodriguez
2015-01-26 10:46       ` Jan Beulich
2015-01-26 10:47       ` David Vrabel
2015-01-23 19:16     ` Luis R. Rodriguez
2015-01-23 11:51 ` [Xen-devel] [RFC v4 0/2] x86/xen: add xen hypercall preemption David Vrabel
2015-01-23 18:58   ` Luis R. Rodriguez

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=20150123185711.GW17887@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=paulmck@linux.vnet.ibm.com \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    --cc=xen-devel@lists.xenproject.org \
    --subject='Re: [Xen-devel] [RFC v4 1/2] x86/xen: add xen_is_preemptible_hypercall()' \
    /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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).