public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Sean Christopherson <sean.j.christopherson@intel.com>
To: Vitaly Kuznetsov <vkuznets@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
	Wanpeng Li <wanpengli@tencent.com>,
	Jim Mattson <jmattson@google.com>, Joerg Roedel <joro@8bytes.org>,
	kvm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 06/13] KVM: x86: Refactor emulate tracepoint to explicitly take context
Date: Tue, 3 Mar 2020 08:48:13 -0800	[thread overview]
Message-ID: <20200303164813.GL1439@linux.intel.com> (raw)
In-Reply-To: <8736axjmte.fsf@vitty.brq.redhat.com>

On Wed, Feb 26, 2020 at 06:11:25PM +0100, Vitaly Kuznetsov wrote:
> Sean Christopherson <sean.j.christopherson@intel.com> writes:
> 
> > Explicitly pass the emulation context to the emulate tracepoint in
> > preparation of dynamically allocation the emulation context.
> >
> > Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
> > ---
> >  arch/x86/kvm/trace.h | 22 +++++++++++-----------
> >  arch/x86/kvm/x86.c   | 13 ++++++++-----
> >  2 files changed, 19 insertions(+), 16 deletions(-)
> >
> > diff --git a/arch/x86/kvm/trace.h b/arch/x86/kvm/trace.h
> > index f194dd058470..5605000ca5f6 100644
> > --- a/arch/x86/kvm/trace.h
> > +++ b/arch/x86/kvm/trace.h
> > @@ -731,8 +731,9 @@ TRACE_EVENT(kvm_skinit,
> >  	})
> >  
> >  TRACE_EVENT(kvm_emulate_insn,
> > -	TP_PROTO(struct kvm_vcpu *vcpu, __u8 failed),
> > -	TP_ARGS(vcpu, failed),
> > +	TP_PROTO(struct kvm_vcpu *vcpu, struct x86_emulate_ctxt *ctxt,
> > +		 __u8 failed),
> > +	TP_ARGS(vcpu, ctxt, failed),
> >  
> >  	TP_STRUCT__entry(
> >  		__field(    __u64, rip                       )
> > @@ -745,13 +746,10 @@ TRACE_EVENT(kvm_emulate_insn,
> >  
> >  	TP_fast_assign(
> >  		__entry->csbase = kvm_x86_ops->get_segment_base(vcpu, VCPU_SREG_CS);
> 
> This seems the only usage of 'vcpu' parameter now; I checked and even
> after switching to dynamic emulation context allocation we still set
> ctxt->vcpu in alloc_emulate_ctxt(), can we get rid of 'vcpu' parameter
> here then (and use ctxt->vcpu instead)?

Hmm, ya, not sure what I was thinking here.

> > -		__entry->len = vcpu->arch.emulate_ctxt.fetch.ptr
> > -			       - vcpu->arch.emulate_ctxt.fetch.data;
> > -		__entry->rip = vcpu->arch.emulate_ctxt._eip - __entry->len;
> > -		memcpy(__entry->insn,
> > -		       vcpu->arch.emulate_ctxt.fetch.data,
> > -		       15);
> > -		__entry->flags = kei_decode_mode(vcpu->arch.emulate_ctxt.mode);
> > +		__entry->len = ctxt->fetch.ptr - ctxt->fetch.data;
> > +		__entry->rip = ctxt->_eip - __entry->len;
> > +		memcpy(__entry->insn, ctxt->fetch.data, 15);
> > +		__entry->flags = kei_decode_mode(ctxt->mode);
> >  		__entry->failed = failed;
> >  		),
> >  
> > @@ -764,8 +762,10 @@ TRACE_EVENT(kvm_emulate_insn,
> >  		)
> >  	);
> >  
> > -#define trace_kvm_emulate_insn_start(vcpu) trace_kvm_emulate_insn(vcpu, 0)
> > -#define trace_kvm_emulate_insn_failed(vcpu) trace_kvm_emulate_insn(vcpu, 1)
> > +#define trace_kvm_emulate_insn_start(vcpu, ctxt)	\
> > +	trace_kvm_emulate_insn(vcpu, ctxt, 0)
> > +#define trace_kvm_emulate_insn_failed(vcpu, ctxt)	\
> > +	trace_kvm_emulate_insn(vcpu, ctxt, 1)
> >  
> >  TRACE_EVENT(
> >  	vcpu_match_mmio,

  reply	other threads:[~2020-03-03 16:48 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-18 23:29 [PATCH v2 00/13] KVM: x86: Allow userspace to disable the emulator Sean Christopherson
2020-02-18 23:29 ` [PATCH v2 01/13] KVM: x86: Refactor I/O emulation helpers to provide vcpu-only variant Sean Christopherson
2020-02-26 15:16   ` Vitaly Kuznetsov
2020-02-18 23:29 ` [PATCH v2 02/13] KVM: x86: Explicitly pass an exception struct to check_intercept Sean Christopherson
2020-02-18 23:29 ` [PATCH v2 03/13] KVM: x86: Move emulation-only helpers to emulate.c Sean Christopherson
2020-02-26 15:23   ` Vitaly Kuznetsov
2020-02-18 23:29 ` [PATCH v2 04/13] KVM: x86: Refactor R/W page helper to take the emulation context Sean Christopherson
2020-02-26 15:24   ` Vitaly Kuznetsov
2020-02-18 23:29 ` [PATCH v2 05/13] KVM: x86: Refactor emulated exception injection to take the emul context Sean Christopherson
2020-02-26 15:25   ` Vitaly Kuznetsov
2020-02-18 23:29 ` [PATCH v2 06/13] KVM: x86: Refactor emulate tracepoint to explicitly take context Sean Christopherson
2020-02-26 17:11   ` Vitaly Kuznetsov
2020-03-03 16:48     ` Sean Christopherson [this message]
2020-03-03 17:29       ` Paolo Bonzini
2020-03-03 17:42         ` Sean Christopherson
2020-03-03 17:44           ` Paolo Bonzini
2020-02-18 23:29 ` [PATCH v2 07/13] KVM: x86: Refactor init_emulate_ctxt() " Sean Christopherson
2020-02-26 17:13   ` Vitaly Kuznetsov
2020-02-18 23:29 ` [PATCH v2 08/13] KVM: x86: Dynamically allocate per-vCPU emulation context Sean Christopherson
2020-02-26 17:29   ` Vitaly Kuznetsov
2020-03-03 10:26     ` Paolo Bonzini
2020-03-03 14:57       ` Sean Christopherson
2020-03-03 16:18         ` Vitaly Kuznetsov
2020-03-03 16:52     ` Sean Christopherson
2020-02-18 23:29 ` [PATCH v2 09/13] KVM: x86: Move kvm_emulate.h into KVM's private directory Sean Christopherson
2020-02-26 17:38   ` Vitaly Kuznetsov
2020-03-03 10:27     ` Paolo Bonzini
2020-02-18 23:29 ` [PATCH v2 10/13] KVM: x86: Shrink the usercopy region of the emulation context Sean Christopherson
2020-02-26 17:51   ` Vitaly Kuznetsov
2020-03-02 18:40     ` Paolo Bonzini
2020-03-02 19:19       ` Sean Christopherson
2020-03-02 19:13     ` Sean Christopherson
2020-02-18 23:29 ` [PATCH v2 11/13] KVM: x86: Add helper to "handle" internal emulation error Sean Christopherson
2020-02-26 17:52   ` Vitaly Kuznetsov
2020-02-18 23:29 ` [PATCH v2 12/13] KVM: x86: Add variable to control existence of emulator Sean Christopherson
2020-02-26 18:01   ` Vitaly Kuznetsov
2020-02-18 23:29 ` [PATCH v2 13/13] KVM: x86: Allow userspace to disable the kernel's emulator Sean Christopherson
2020-03-02 18:42 ` [PATCH v2 00/13] KVM: x86: Allow userspace to disable the emulator Paolo Bonzini
2020-03-02 20:02   ` Sean Christopherson

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=20200303164813.GL1439@linux.intel.com \
    --to=sean.j.christopherson@intel.com \
    --cc=jmattson@google.com \
    --cc=joro@8bytes.org \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=vkuznets@redhat.com \
    --cc=wanpengli@tencent.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox