From: "Luis R. Rodriguez" <mcgrof@suse.com>
To: Juergen Gross <jgross@suse.com>
Cc: David Vrabel <david.vrabel@citrix.com>,
Joerg Roedel <jroedel@suse.de>,
kvm@vger.kernel.org, Davidlohr Bueso <dbueso@suse.de>,
Peter Zijlstra <peterz@infradead.org>,
x86@kernel.org, Oleg Nesterov <oleg@redhat.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Jan Beulich <JBeulich@suse.com>,
xen-devel@lists.xenproject.org, boris.ostrovsky@oracle.com,
Borislav Petkov <bp@suse.de>, Olaf Hering <ohering@suse.de>,
Ingo Molnar <mingo@kernel.org>
Subject: Re: [Xen-devel] [PATCH] xen: privcmd: schedule() after private hypercall when non CONFIG_PREEMPT
Date: Fri, 5 Dec 2014 17:20:51 +0100 [thread overview]
Message-ID: <20141205162051.GK25677@wotan.suse.de> (raw)
In-Reply-To: <20141203193947.GD25677@wotan.suse.de>
On Wed, Dec 03, 2014 at 08:39:47PM +0100, Luis R. Rodriguez wrote:
> On Wed, Dec 03, 2014 at 05:37:51AM +0100, Juergen Gross wrote:
> > On 12/03/2014 03:28 AM, Luis R. Rodriguez wrote:
> >> On Tue, Dec 02, 2014 at 11:11:18AM +0000, David Vrabel wrote:
> >>> On 01/12/14 22:36, Luis R. Rodriguez wrote:
> >>>>
> >>>> Then I do agree its a fair analogy (and find this obviously odd that how
> >>>> widespread cond_resched() is), we just don't have an equivalent for IRQ
> >>>> context, why not avoid the special check then and use this all the time in the
> >>>> middle of a hypercall on the return from an interrupt (e.g., the timer
> >>>> interrupt)?
> >>>
> >>> http://lists.xen.org/archives/html/xen-devel/2014-02/msg01101.html
> >>
> >> OK thanks! That explains why we need some asm code but in that submission you
> >> still also had used is_preemptible_hypercall(regs) and in the new
> >> implementation you use a CPU variable xen_in_preemptible_hcall prior to calling
> >> preempt_schedule_irq(). I believe you added the CPU variable because
> >> preempt_schedule_irq() will preempt first without any checks if it should, I'm
> >> asking why not do something like cond_resched_irq() where we check with
> >> should_resched() prior to preempting and that way we can avoid having to use
> >> the CPU variable?
> >
> > Because that could preempt at any asynchronous interrupt making the
> > no-preempt kernel fully preemptive.
>
> OK yeah I see. That still doesn't negate the value of using something
> like cond_resched_irq() with a should_resched() on only critical hypercalls.
> The current implementation (patch by David) forces preemption without
> checking for should_resched() so it would preempt unnecessarily at least
> once.
>
> > How would you know you are just
> > doing a critical hypercall which should be preempted?
>
> You would not, you're right. I was just trying to see if we could generalize
> an API for this to avoid having users having to create their own CPU variables
> but this all seems very specialized as we want to use this on the timer
> so if we do generalize a cond_resched_irq() perhaps the documentation can
> warn about this type of case or abuse.
David's patch had the check only it was x86 based, if we use cond_resched_irq()
we can leave that aspect out to be done through asm inlines or it'll use the
generic shoudl_resched(), that should save some code on the asm implementations.
I have some patches now which generalizees this, I also have more information
about this can happen exactly, and a way to triggger it on small systems with
some hacks to emulate possibly backend behaviour on larger systems. In the worst
case this can be a dangerious situation to be in. I'll send some new RFTs.
Luis
prev parent reply other threads:[~2014-12-05 16:20 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-26 22:26 Luis R. Rodriguez
2014-11-27 6:36 ` Juergen Gross
2014-11-27 18:36 ` Luis R. Rodriguez
2014-11-27 18:46 ` Luis R. Rodriguez
2014-11-27 18:50 ` [Xen-devel] " Andrew Cooper
2014-11-28 4:49 ` Juergen Gross
2014-12-01 11:01 ` David Vrabel
2014-12-01 13:32 ` Luis R. Rodriguez
2014-12-01 14:42 ` Juergen Gross
2014-12-01 15:50 ` Luis R. Rodriguez
2014-11-28 21:51 ` Luis R. Rodriguez
2014-12-01 11:11 ` David Vrabel
2014-12-01 15:05 ` Luis R. Rodriguez
2014-12-01 15:18 ` David Vrabel
2014-12-01 15:44 ` Luis R. Rodriguez
2014-12-01 15:54 ` David Vrabel
2014-12-01 16:19 ` Luis R. Rodriguez
2014-12-01 17:07 ` Juergen Gross
2014-12-01 17:52 ` Luis R. Rodriguez
2014-12-01 18:16 ` [Xen-devel] " David Vrabel
2014-12-01 22:36 ` Luis R. Rodriguez
2014-12-02 11:11 ` David Vrabel
2014-12-03 2:28 ` Luis R. Rodriguez
2014-12-03 4:37 ` Juergen Gross
2014-12-03 19:39 ` Luis R. Rodriguez
2014-12-05 16:20 ` Luis R. Rodriguez [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=20141205162051.GK25677@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=dbueso@suse.de \
--cc=jgross@suse.com \
--cc=jroedel@suse.de \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=ohering@suse.de \
--cc=oleg@redhat.com \
--cc=peterz@infradead.org \
--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
all inboxes | Powered by JetHome®