public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Paul Mackerras <paulus@samba.org>
To: Alexander Graf <agraf@suse.de>
Cc: kvm-ppc@vger.kernel.org, kvm@vger.kernel.org
Subject: Re: [PATCH v2] KVM: PPC: Book3S HV: Handle guest-caused machine checks on POWER7 without panicking
Date: Tue, 27 Nov 2012 10:18:13 +1100	[thread overview]
Message-ID: <20121126231813.GE3370@bloggs.ozlabs.ibm.com> (raw)
In-Reply-To: <2951D66E-5A98-455A-92FD-808C2083987E@suse.de>

On Tue, Nov 27, 2012 at 12:16:28AM +0100, Alexander Graf wrote:
> 
> On 24.11.2012, at 09:37, Paul Mackerras wrote:
> 
> > Currently, if a machine check interrupt happens while we are in the
> > guest, we exit the guest and call the host's machine check handler,
> > which tends to cause the host to panic.  Some machine checks can be
> > triggered by the guest; for example, if the guest creates two entries
> > in the SLB that map the same effective address, and then accesses that
> > effective address, the CPU will take a machine check interrupt.
> > 
> > To handle this better, when a machine check happens inside the guest,
> > we call a new function, kvmppc_realmode_machine_check(), while still in
> > real mode before exiting the guest.  On POWER7, it handles the cases
> > that the guest can trigger, either by flushing and reloading the SLB,
> > or by flushing the TLB, and then it delivers the machine check interrupt
> > directly to the guest without going back to the host.  On POWER7, the
> > OPAL firmware patches the machine check interrupt vector so that it
> > gets control first, and it leaves behind its analysis of the situation
> > in a structure pointed to by the opal_mc_evt field of the paca.  The
> > kvmppc_realmode_machine_check() function looks at this, and if OPAL
> > reports that there was no error, or that it has handled the error, we
> > also go straight back to the guest with a machine check.  We have to
> > deliver a machine check to the guest since the machine check interrupt
> > might have trashed valid values in SRR0/1.
> > 
> > If the machine check is one we can't handle in real mode, and one that
> > OPAL hasn't already handled, or on PPC970, we exit the guest and call
> > the host's machine check handler.  We do this by jumping to the
> > machine_check_fwnmi label, rather than absolute address 0x200, because
> > we don't want to re-execute OPAL's handler on POWER7.  On PPC970, the
> > two are equivalent because address 0x200 just contains a branch.
> > 
> > Then, if the host machine check handler decides that the system can
> > continue executing, kvmppc_handle_exit() delivers a machine check
> > interrupt to the guest -- once again to let the guest know that SRR0/1
> > have been modified.
> > 
> > Signed-off-by: Paul Mackerras <paulus@samba.org>
> 
> Thanks for the semantic explanations :). From that POV things are clear and good with me now. That leaves only checkpatch ;)
> 
> 
> WARNING: please, no space before tabs
> #142: FILE: arch/powerpc/kvm/book3s_hv_ras.c:21:
> +#define SRR1_MC_IFETCH_SLBMULTI ^I3^I/* SLB multi-hit */$
> 
> WARNING: please, no space before tabs
> #143: FILE: arch/powerpc/kvm/book3s_hv_ras.c:22:
> +#define SRR1_MC_IFETCH_SLBPARMULTI ^I4^I/* SLB parity + multi-hit */$
> 
> WARNING: min() should probably be min_t(u32, slb->persistent, SLB_MIN_SIZE)
> #168: FILE: arch/powerpc/kvm/book3s_hv_ras.c:47:
> +	n = min(slb->persistent, (u32) SLB_MIN_SIZE);
> 
> total: 0 errors, 3 warnings, 357 lines checked

Phooey.  Do you want me to resubmit the patch, or will you fix it up?

Paul.

  reply	other threads:[~2012-11-26 23:18 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-22  9:24 [PATCH 0/5] KVM: PPC: Fix various bugs and vulnerabilities in HV KVM Paul Mackerras
2012-11-22  9:25 ` [PATCH 1/5] KVM: PPC: Book3S HV: Handle guest-caused machine checks on POWER7 without panicking Paul Mackerras
2012-11-23 14:13   ` Alexander Graf
2012-11-23 21:42     ` Paul Mackerras
2012-11-26 13:15       ` Alexander Graf
2012-11-26 21:33         ` Paul Mackerras
2012-11-26 21:55           ` Alexander Graf
2012-11-26 22:03             ` Alexander Graf
2012-11-26 23:11               ` Paul Mackerras
2012-11-24  8:37     ` [PATCH v2] " Paul Mackerras
2012-11-26 23:16       ` Alexander Graf
2012-11-26 23:18         ` Paul Mackerras [this message]
2012-11-26 23:20           ` Alexander Graf
2012-11-27  0:20             ` Paul Mackerras
2012-12-22 14:09       ` [PATCH] KVM: PPC: Book3S HV: Fix compilation without CONFIG_PPC_POWERNV Andreas Schwab
2013-01-06 13:05         ` Alexander Graf
2012-11-22  9:27 ` [PATCH 2/5] KVM: PPC: Book3S HV: Reset reverse-map chains when resetting the HPT Paul Mackerras
2012-11-22  9:28 ` [PATCH 3/5] KVM: PPC: Book3S HV: Improve handling of local vs. global TLB invalidations Paul Mackerras
2012-11-23 15:43   ` Alexander Graf
2012-11-23 22:07     ` Paul Mackerras
2012-11-26 13:10       ` Alexander Graf
2012-11-26 21:48         ` Paul Mackerras
2012-11-26 22:03           ` Alexander Graf
2012-11-26 23:16             ` Paul Mackerras
2012-11-26 23:18               ` Alexander Graf
2012-11-22  9:28 ` [PATCH 4/5] KVM: PPC: Book3S HV: Don't give the guest RW access to RO pages Paul Mackerras
2012-11-23 15:47   ` Alexander Graf
2012-11-23 22:13     ` Paul Mackerras
2012-11-24  9:05       ` Alexander Graf
2012-11-24  9:32         ` Paul Mackerras
2012-11-26 13:09           ` Alexander Graf
2012-11-22  9:29 ` [PATCH 5/5] KVM: PPC: Book3S HV: Report correct HPT entry index when reading HPT Paul Mackerras
2012-11-23 15:48 ` [PATCH 0/5] KVM: PPC: Fix various bugs and vulnerabilities in HV KVM 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=20121126231813.GE3370@bloggs.ozlabs.ibm.com \
    --to=paulus@samba.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox