All of lore.kernel.org
 help / color / mirror / Atom feed
From: Scott Wood <scottwood@freescale.com>
To: Alexander Graf <agraf@suse.de>
Cc: <kvm-ppc@vger.kernel.org>, <kvm@vger.kernel.org>
Subject: Re: [PATCH 00/33] KVM: PPC: Fix IRQ race in magic page code
Date: Tue, 24 Jun 2014 19:21:29 -0500	[thread overview]
Message-ID: <1403655689.2435.55.camel@snotra.buserror.net> (raw)
In-Reply-To: <53AA0C78.60703@suse.de>

On Wed, 2014-06-25 at 01:40 +0200, Alexander Graf wrote:
> On 25.06.14 01:15, Scott Wood wrote:
> > On Wed, 2014-06-25 at 00:41 +0200, Alexander Graf wrote:
> >> On 24.06.14 20:53, Scott Wood wrote:
> >>> The timer interrupt works, but I'm not fully convinced that it's a good
> >> idea for things like MC events which we also block during critical
> >> sections on e500v2.
> > Are you concerned about the guest seeing machine checks that are (more)
> > asynchronous with the error condition?  e500v2 machine checks are always
> > asynchronous.  From the core manual:
> >
> >          Machine check interrupts are typically caused by a hardware or
> >          memory subsystem failure or by an attempt to access an invalid
> >          address. They may be caused indirectly by execution of an
> >          instruction, but may not be recognized or reported until long
> >          after the processor has executed past the instruction that
> >          caused the machine check. As such, machine check interrupts are
> >          not thought of as synchronous or asynchronous nor as precise or
> >          imprecise.
> >
> > I don't think the lag would be a problem, and certainly it's better than
> > the current situation.
> 
> So what value would you set the timer to? If the value is too small, we 
> never finish the critical section. If it's too big, we add lots of jitter.

Maybe something like 100us?

Single stepping would be better, though.

> >> Single stepping is hard enough to get right on interaction between QEMU,
> >> KVM and the guest. I didn't really want to make that stuff any more
> >> complicated.
> > I'm not sure that it would add much complexity.  We'd just need to check
> > whether any source other than the magic page turned wants DCBR0_IC on,
> > to determine whether to exit to userspace or not.
> 
> What if the guest is single stepping itself? How do we determine when to 
> unset the bit again? When we get out of the critical section? How do we 
> know what the value was before we set it?

Keep track of each requester of single stepping separately, and only
ever set the real bit by ORing them.

-Scott

WARNING: multiple messages have this Message-ID (diff)
From: Scott Wood <scottwood@freescale.com>
To: Alexander Graf <agraf@suse.de>
Cc: kvm-ppc@vger.kernel.org, kvm@vger.kernel.org
Subject: Re: [PATCH 00/33] KVM: PPC: Fix IRQ race in magic page code
Date: Wed, 25 Jun 2014 00:21:29 +0000	[thread overview]
Message-ID: <1403655689.2435.55.camel@snotra.buserror.net> (raw)
In-Reply-To: <53AA0C78.60703@suse.de>

On Wed, 2014-06-25 at 01:40 +0200, Alexander Graf wrote:
> On 25.06.14 01:15, Scott Wood wrote:
> > On Wed, 2014-06-25 at 00:41 +0200, Alexander Graf wrote:
> >> On 24.06.14 20:53, Scott Wood wrote:
> >>> The timer interrupt works, but I'm not fully convinced that it's a good
> >> idea for things like MC events which we also block during critical
> >> sections on e500v2.
> > Are you concerned about the guest seeing machine checks that are (more)
> > asynchronous with the error condition?  e500v2 machine checks are always
> > asynchronous.  From the core manual:
> >
> >          Machine check interrupts are typically caused by a hardware or
> >          memory subsystem failure or by an attempt to access an invalid
> >          address. They may be caused indirectly by execution of an
> >          instruction, but may not be recognized or reported until long
> >          after the processor has executed past the instruction that
> >          caused the machine check. As such, machine check interrupts are
> >          not thought of as synchronous or asynchronous nor as precise or
> >          imprecise.
> >
> > I don't think the lag would be a problem, and certainly it's better than
> > the current situation.
> 
> So what value would you set the timer to? If the value is too small, we 
> never finish the critical section. If it's too big, we add lots of jitter.

Maybe something like 100us?

Single stepping would be better, though.

> >> Single stepping is hard enough to get right on interaction between QEMU,
> >> KVM and the guest. I didn't really want to make that stuff any more
> >> complicated.
> > I'm not sure that it would add much complexity.  We'd just need to check
> > whether any source other than the magic page turned wants DCBR0_IC on,
> > to determine whether to exit to userspace or not.
> 
> What if the guest is single stepping itself? How do we determine when to 
> unset the bit again? When we get out of the critical section? How do we 
> know what the value was before we set it?

Keep track of each requester of single stepping separately, and only
ever set the real bit by ORing them.

-Scott



  reply	other threads:[~2014-06-25  0:21 UTC|newest]

Thread overview: 80+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-22 21:23 [PATCH 00/33] KVM: PPC: Fix IRQ race in magic page code Alexander Graf
2014-06-22 21:23 ` Alexander Graf
2014-06-22 21:23 ` [PATCH 01/33] KVM: PPC: Implement kvmppc_xlate for all targets Alexander Graf
2014-06-22 21:23   ` Alexander Graf
2014-06-22 21:23 ` [PATCH 02/33] KVM: PPC: Move kvmppc_ld/st to common code Alexander Graf
2014-06-22 21:23   ` Alexander Graf
2014-06-22 21:23 ` [PATCH 03/33] KVM: PPC: Remove kvmppc_bad_hva() Alexander Graf
2014-06-22 21:23   ` Alexander Graf
2014-06-22 21:23 ` [PATCH 04/33] KVM: PPC: Propagate kvmppc_xlate errors properly Alexander Graf
2014-06-22 21:23   ` Alexander Graf
2014-06-22 21:23 ` [PATCH 05/33] KVM: PPC: Use kvm_read_guest in kvmppc_ld Alexander Graf
2014-06-22 21:23   ` Alexander Graf
2014-06-22 21:23 ` [PATCH 06/33] KVM: PPC: Handle magic page in kvmppc_ld/st Alexander Graf
2014-06-22 21:23   ` Alexander Graf
2014-06-22 21:23 ` [PATCH 07/33] KVM: PPC: Separate loadstore emulation from priv emulation Alexander Graf
2014-06-22 21:23   ` Alexander Graf
2014-06-22 21:23 ` [PATCH 08/33] KVM: PPC: Introduce emulation for unprivileged instructions Alexander Graf
2014-06-22 21:23   ` Alexander Graf
2014-06-22 21:23 ` [PATCH 09/33] KVM: PPC: Move critical section detection to common code Alexander Graf
2014-06-22 21:23   ` Alexander Graf
2014-06-22 21:23 ` [PATCH 10/33] KVM: PPC: Make critical section detection conditional Alexander Graf
2014-06-22 21:23   ` Alexander Graf
2014-06-22 21:23 ` [PATCH 11/33] KVM: PPC: BookE: Use common critical section helper Alexander Graf
2014-06-22 21:23   ` Alexander Graf
2014-06-22 21:23 ` [PATCH 12/33] KVM: PPC: Emulate critical sections when we hit them Alexander Graf
2014-06-22 21:23   ` Alexander Graf
2014-06-22 21:23 ` [PATCH 13/33] KVM: PPC: Expose helper functions for data/inst faults Alexander Graf
2014-06-22 21:23   ` Alexander Graf
2014-06-22 21:23 ` [PATCH 14/33] KVM: PPC: Add std instruction emulation Alexander Graf
2014-06-22 21:23   ` Alexander Graf
2014-06-22 21:23 ` [PATCH 15/33] KVM: PPC: Add stw " Alexander Graf
2014-06-22 21:23   ` Alexander Graf
2014-06-22 21:23 ` [PATCH 16/33] KVM: PPC: Add ld " Alexander Graf
2014-06-22 21:23   ` Alexander Graf
2014-06-22 21:23 ` [PATCH 17/33] KVM: PPC: Add lwz " Alexander Graf
2014-06-22 21:23   ` Alexander Graf
2014-06-22 21:23 ` [PATCH 18/33] KVM: PPC: Add mfcr " Alexander Graf
2014-06-22 21:23   ` Alexander Graf
2014-06-22 21:23 ` [PATCH 19/33] KVM: PPC: Add addis " Alexander Graf
2014-06-22 21:23   ` Alexander Graf
2014-06-22 21:23 ` [PATCH 20/33] KVM: PPC: Add ori " Alexander Graf
2014-06-22 21:23   ` Alexander Graf
2014-06-22 21:23 ` [PATCH 21/33] KVM: PPC: Add and " Alexander Graf
2014-06-22 21:23   ` Alexander Graf
2014-06-22 21:23 ` [PATCH 22/33] KVM: PPC: Add andi. " Alexander Graf
2014-06-22 21:23   ` Alexander Graf
2014-06-22 21:23 ` [PATCH 23/33] KVM: PPC: Add or " Alexander Graf
2014-06-22 21:23   ` Alexander Graf
2014-06-22 21:23 ` [PATCH 24/33] KVM: PPC: Add cmpwi/cmpdi " Alexander Graf
2014-06-22 21:23   ` Alexander Graf
2014-06-22 21:23 ` [PATCH 25/33] KVM: PPC: Add bc " Alexander Graf
2014-06-22 21:23   ` Alexander Graf
2014-06-22 21:23 ` [PATCH 26/33] KVM: PPC: Add mtcrf " Alexander Graf
2014-06-22 21:23   ` Alexander Graf
2014-06-22 21:23 ` [PATCH 27/33] KVM: PPC: Add xor " Alexander Graf
2014-06-22 21:23   ` Alexander Graf
2014-06-22 21:23 ` [PATCH 28/33] KVM: PPC: Add oris " Alexander Graf
2014-06-22 21:23   ` Alexander Graf
2014-06-22 21:23 ` [PATCH 29/33] KVM: PPC: Add rldicr/rldicl/rldic " Alexander Graf
2014-06-22 21:23   ` Alexander Graf
2014-06-22 21:23 ` [PATCH 30/33] KVM: PPC: Add rlwimi " Alexander Graf
2014-06-22 21:23   ` Alexander Graf
2014-06-22 21:23 ` [PATCH 31/33] KVM: PPC: Add rlwinm " Alexander Graf
2014-06-22 21:23   ` Alexander Graf
2014-06-22 21:23 ` [PATCH 32/33] KVM: PPC: Handle NV registers in emulated critical sections Alexander Graf
2014-06-22 21:23   ` Alexander Graf
2014-06-22 21:23 ` [PATCH 33/33] KVM: PPC: Enable critical section emulation Alexander Graf
2014-06-22 21:23   ` Alexander Graf
2014-06-24 18:53 ` [PATCH 00/33] KVM: PPC: Fix IRQ race in magic page code Scott Wood
2014-06-24 18:53   ` Scott Wood
2014-06-24 22:41   ` Alexander Graf
2014-06-24 22:41     ` Alexander Graf
2014-06-24 23:15     ` Scott Wood
2014-06-24 23:15       ` Scott Wood
2014-06-24 23:40       ` Alexander Graf
2014-06-24 23:40         ` Alexander Graf
2014-06-25  0:21         ` Scott Wood [this message]
2014-06-25  0:21           ` Scott Wood
2014-07-28 14:10           ` Alexander Graf
2014-07-28 14:10             ` Alexander Graf

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=1403655689.2435.55.camel@snotra.buserror.net \
    --to=scottwood@freescale.com \
    --cc=agraf@suse.de \
    --cc=kvm-ppc@vger.kernel.org \
    --cc=kvm@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.