From: Scott Wood <scottwood@freescale.com>
To: Alexander Graf <agraf@suse.de>
Cc: kvm-ppc@vger.kernel.org, KVM list <kvm@vger.kernel.org>,
Marcelo Tosatti <mtosatti@redhat.com>,
Gleb Natapov <gleb@redhat.com>
Subject: Re: [PATCH 2/4] KVM: PPC: Only WARN on invalid emulation
Date: Tue, 18 Dec 2012 23:05:58 +0000 [thread overview]
Message-ID: <1355871958.5138.4@snotra> (raw)
In-Reply-To: <CF58F22E-41B1-402E-85CF-FC844BB594E4@suse.de> (from agraf@suse.de on Tue Dec 18 17:01:19 2012)
On 12/18/2012 05:01:19 PM, Alexander Graf wrote:
>
> On 18.12.2012, at 23:54, Scott Wood wrote:
>
> > On 12/18/2012 06:38:41 AM, Alexander Graf wrote:
> >> When we hit an emulation result that we didn't expect, that is an
> error,
> >> but it's nothing that warrants a BUG(), because it can be guest
> triggered.
> >> So instead, let's only WARN() the user that this happened.
> >> Signed-off-by: Alexander Graf <agraf@suse.de>
> >> ---
> >> arch/powerpc/kvm/powerpc.c | 3 ++-
> >> 1 files changed, 2 insertions(+), 1 deletions(-)
> >> diff --git a/arch/powerpc/kvm/powerpc.c
> b/arch/powerpc/kvm/powerpc.c
> >> index be83fca..e2225e5 100644
> >> --- a/arch/powerpc/kvm/powerpc.c
> >> +++ b/arch/powerpc/kvm/powerpc.c
> >> @@ -237,7 +237,8 @@ int kvmppc_emulate_mmio(struct kvm_run *run,
> struct kvm_vcpu *vcpu)
> >> r = RESUME_HOST;
> >> break;
> >> default:
> >> - BUG();
> >> + WARN_ON(1);
> >> + r = RESUME_GUEST;
> >
> > Do you have a specific way of a guest triggering this in mind, or
> is it just being cautious? The guest probably shouldn't be allowed
> to spam the kernel log with WARNs either. Is a traceback even useful
> here?
>
> For debugging, yes.
I figured the interesting bits would be in the stack frames you've just
returned from.
> But maybe we would be better off with a trace point.
Or a ratelimited error message, and maybe we should return to host
instead of guest?
> Anyway, a WARN is better than a BUG either way for now.
Yes...
> I was able to provoke this by live patching an instruction without
> flushing the icache, so that the last_inst instruction fetch gets a
> different instruction from the instruction that resulted in the trap
> we're currently in.
Which EMULATE code did you get in that case?
-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 list <kvm@vger.kernel.org>,
Marcelo Tosatti <mtosatti@redhat.com>,
Gleb Natapov <gleb@redhat.com>
Subject: Re: [PATCH 2/4] KVM: PPC: Only WARN on invalid emulation
Date: Tue, 18 Dec 2012 17:05:58 -0600 [thread overview]
Message-ID: <1355871958.5138.4@snotra> (raw)
In-Reply-To: <CF58F22E-41B1-402E-85CF-FC844BB594E4@suse.de> (from agraf@suse.de on Tue Dec 18 17:01:19 2012)
On 12/18/2012 05:01:19 PM, Alexander Graf wrote:
>
> On 18.12.2012, at 23:54, Scott Wood wrote:
>
> > On 12/18/2012 06:38:41 AM, Alexander Graf wrote:
> >> When we hit an emulation result that we didn't expect, that is an
> error,
> >> but it's nothing that warrants a BUG(), because it can be guest
> triggered.
> >> So instead, let's only WARN() the user that this happened.
> >> Signed-off-by: Alexander Graf <agraf@suse.de>
> >> ---
> >> arch/powerpc/kvm/powerpc.c | 3 ++-
> >> 1 files changed, 2 insertions(+), 1 deletions(-)
> >> diff --git a/arch/powerpc/kvm/powerpc.c
> b/arch/powerpc/kvm/powerpc.c
> >> index be83fca..e2225e5 100644
> >> --- a/arch/powerpc/kvm/powerpc.c
> >> +++ b/arch/powerpc/kvm/powerpc.c
> >> @@ -237,7 +237,8 @@ int kvmppc_emulate_mmio(struct kvm_run *run,
> struct kvm_vcpu *vcpu)
> >> r = RESUME_HOST;
> >> break;
> >> default:
> >> - BUG();
> >> + WARN_ON(1);
> >> + r = RESUME_GUEST;
> >
> > Do you have a specific way of a guest triggering this in mind, or
> is it just being cautious? The guest probably shouldn't be allowed
> to spam the kernel log with WARNs either. Is a traceback even useful
> here?
>
> For debugging, yes.
I figured the interesting bits would be in the stack frames you've just
returned from.
> But maybe we would be better off with a trace point.
Or a ratelimited error message, and maybe we should return to host
instead of guest?
> Anyway, a WARN is better than a BUG either way for now.
Yes...
> I was able to provoke this by live patching an instruction without
> flushing the icache, so that the last_inst instruction fetch gets a
> different instruction from the instruction that resulted in the trap
> we're currently in.
Which EMULATE code did you get in that case?
-Scott
next prev parent reply other threads:[~2012-12-18 23:05 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-18 12:38 [PULL 0/4] ppc patch queue 2012-12-18 Alexander Graf
2012-12-18 12:38 ` Alexander Graf
2012-12-18 12:38 ` [PATCH 1/4] KVM: PPC: Fix SREGS documentation reference Alexander Graf
2012-12-18 12:38 ` Alexander Graf
2012-12-18 12:38 ` [PATCH 2/4] KVM: PPC: Only WARN on invalid emulation Alexander Graf
2012-12-18 12:38 ` Alexander Graf
2012-12-18 22:54 ` Scott Wood
2012-12-18 22:54 ` Scott Wood
2012-12-18 23:01 ` Alexander Graf
2012-12-18 23:01 ` Alexander Graf
2012-12-18 23:05 ` Scott Wood [this message]
2012-12-18 23:05 ` Scott Wood
2012-12-18 23:09 ` Alexander Graf
2012-12-18 23:09 ` Alexander Graf
2012-12-19 9:37 ` Gleb Natapov
2012-12-19 9:37 ` Gleb Natapov
2012-12-19 9:59 ` Alexander Graf
2012-12-19 9:59 ` Alexander Graf
2012-12-19 10:00 ` Gleb Natapov
2012-12-19 10:00 ` Gleb Natapov
2012-12-18 12:38 ` [PATCH 3/4] KVM: PPC: Book3S: PR: Enable alternative instruction for SC 1 Alexander Graf
2012-12-18 12:38 ` Alexander Graf
2012-12-18 12:38 ` [PATCH 4/4] powerpc: Corrected include header path in kvm_para.h Alexander Graf
2012-12-18 12:38 ` Alexander Graf
2012-12-18 15:20 ` [PULL 0/4] ppc patch queue 2012-12-18 Gleb Natapov
2012-12-18 15:20 ` Gleb Natapov
2012-12-18 16:35 ` Alexander Graf
2012-12-18 16:35 ` Alexander Graf
2012-12-19 9:40 ` Gleb Natapov
2012-12-19 9:40 ` Gleb Natapov
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=1355871958.5138.4@snotra \
--to=scottwood@freescale.com \
--cc=agraf@suse.de \
--cc=gleb@redhat.com \
--cc=kvm-ppc@vger.kernel.org \
--cc=kvm@vger.kernel.org \
--cc=mtosatti@redhat.com \
/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.