From: Alexander Graf <agraf@suse.de>
To: Madhavan Srinivasan <maddy@linux.vnet.ibm.com>,
benh@kernel.crashing.org, paulus@samba.org, mpe@ellerman.id.au
Cc: linuxppc-dev@lists.ozlabs.org, kvm-ppc@vger.kernel.org,
kvm@vger.kernel.org
Subject: Re: [PATCH 2/2 v5] powerpc/kvm: common sw breakpoint instr across ppc
Date: Mon, 08 Sep 2014 15:09:50 +0200 [thread overview]
Message-ID: <540DAA9E.1070102@suse.de> (raw)
In-Reply-To: <1410107494-25556-3-git-send-email-maddy@linux.vnet.ibm.com>
On 07.09.14 18:31, Madhavan Srinivasan wrote:
> This patch extends the use of illegal instruction as software
> breakpoint instruction across the ppc platform. Patch extends
> booke program interrupt code to support software breakpoint.
>
> Signed-off-by: Madhavan Srinivasan <maddy@linux.vnet.ibm.com>
> ---
>
> Patch is only compile tested. Will really help if
> someone can try it out and let me know comments.
>
> arch/powerpc/kvm/booke.c | 18 ++++++++++++++++--
> 1 file changed, 16 insertions(+), 2 deletions(-)
>
> diff --git a/arch/powerpc/kvm/booke.c b/arch/powerpc/kvm/booke.c
> index b4c89fa..1b84853 100644
> --- a/arch/powerpc/kvm/booke.c
> +++ b/arch/powerpc/kvm/booke.c
> @@ -870,6 +870,10 @@ int kvmppc_handle_exit(struct kvm_run *run, struct kvm_vcpu *vcpu,
> case BOOKE_INTERRUPT_HV_PRIV:
> emulated = kvmppc_get_last_inst(vcpu, false, &last_inst);
> break;
> + case BOOKE_INTERRUPT_PROGRAM:
> + /*SW breakpoints arrive as illegal instructions on HV */
Is it my email client or is there a space missing again? ;)
Also, please only fetch the last instruction if debugging is active.
> + emulated = kvmppc_get_last_inst(vcpu, false, &last_inst);
> + break;
> default:
> break;
> }
> @@ -947,7 +951,17 @@ int kvmppc_handle_exit(struct kvm_run *run, struct kvm_vcpu *vcpu,
> break;
>
> case BOOKE_INTERRUPT_PROGRAM:
> - if (vcpu->arch.shared->msr & (MSR_PR | MSR_GS)) {
> + if ((vcpu->arch.shared->msr & (MSR_PR | MSR_GS)) &&
> + (last_inst == KVMPPC_INST_SW_BREAKPOINT)) {
I think this is changing the logic from "if the guest is in user mode or
we're in HV, deflect" to "if the guest is in user mode or an HV guest
and the instruction is a breakpoint, treat it as debug. Otherwise
deflect". So you're essentially breaking PR KVM here from what I can tell.
Why don't you just split the whole thing out to the beginning of
BOOKE_INTERRUPT_PROGRAM and check for
a) debug is enabled
b) instruction is sw breakpoint
instead?
> + /*
> + * We are here because of an SW breakpoint instr,
> + * so lets return to host to handle.
> + */
> + r = kvmppc_handle_debug(run, vcpu);
> + run->exit_reason = KVM_EXIT_DEBUG;
> + kvmppc_account_exit(vcpu, DEBUG_EXITS);
> + break;
> + } else {
> /*
> * Program traps generated by user-level software must
> * be handled by the guest kernel.
> @@ -1505,7 +1519,7 @@ int kvm_vcpu_ioctl_get_one_reg(struct kvm_vcpu *vcpu, struct kvm_one_reg *reg)
> val = get_reg_val(reg->id, vcpu->arch.tsr);
> break;
> case KVM_REG_PPC_DEBUG_INST:
> - val = get_reg_val(reg->id, KVMPPC_INST_EHPRIV_DEBUG);
Please also remove the definition of EHPRIV_DEBUG.
Alex
> + val = get_reg_val(reg->id, KVMPPC_INST_SW_BREAKPOINT);
> break;
> case KVM_REG_PPC_VRSAVE:
> val = get_reg_val(reg->id, vcpu->arch.vrsave);
>
next prev parent reply other threads:[~2014-09-08 13:09 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-07 16:31 [PATCH 0/2 v5] powerpc/kvm: support to handle sw breakpoint Madhavan Srinivasan
2014-09-07 16:31 ` [PATCH 1/2 " Madhavan Srinivasan
2014-09-08 13:05 ` Alexander Graf
2014-09-09 7:31 ` Madhavan Srinivasan
2014-09-07 16:31 ` [PATCH 2/2 v5] powerpc/kvm: common sw breakpoint instr across ppc Madhavan Srinivasan
2014-09-08 13:09 ` Alexander Graf [this message]
2014-09-09 7:41 ` Madhavan Srinivasan
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=540DAA9E.1070102@suse.de \
--to=agraf@suse.de \
--cc=benh@kernel.crashing.org \
--cc=kvm-ppc@vger.kernel.org \
--cc=kvm@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=maddy@linux.vnet.ibm.com \
--cc=mpe@ellerman.id.au \
--cc=paulus@samba.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;
as well as URLs for NNTP newsgroup(s).