lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CY5PR11MB6365E7E07AB03F3675543717DC799@CY5PR11MB6365.namprd11.prod.outlook.com>
Date:   Tue, 30 Aug 2022 06:02:31 +0000
From:   "Wang, Wei W" <wei.w.wang@...el.com>
To:     "Christopherson,, Sean" <seanjc@...gle.com>
CC:     "Li, Xiaoyao" <xiaoyao.li@...el.com>,
        Peter Zijlstra <peterz@...radead.org>,
        Arnaldo Carvalho de Melo <acme@...nel.org>,
        "Mark Rutland" <mark.rutland@....com>,
        Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
        Jiri Olsa <jolsa@...nel.org>,
        "Namhyung Kim" <namhyung@...nel.org>,
        Paolo Bonzini <pbonzini@...hat.com>,
        "linux-perf-users@...r.kernel.org" <linux-perf-users@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "kvm@...r.kernel.org" <kvm@...r.kernel.org>
Subject: RE: [RFC PATCH 0/2] KVM: VMX: Fix VM entry failure on
 PT_MODE_HOST_GUEST while host is using PT

On Tuesday, August 30, 2022 1:34 AM, Sean Christopherson wrote:
> On Mon, Aug 29, 2022, Wang, Wei W wrote:
> > On Thursday, August 25, 2022 4:56 PM, Xiaoyao Li wrote:
> >  #if defined(CONFIG_PERF_EVENTS) && defined(CONFIG_CPU_SUP_AMD)
> diff
> > --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c index
> > d7f8331d6f7e..195debc1bff1 100644
> > --- a/arch/x86/kvm/vmx/vmx.c
> > +++ b/arch/x86/kvm/vmx/vmx.c
> > @@ -1125,37 +1125,29 @@ static inline void pt_save_msr(struct pt_ctx
> > *ctx, u32 addr_range)
> >
> >  static void pt_guest_enter(struct vcpu_vmx *vmx)  {
> > -       if (vmx_pt_mode_is_system())
> > +       struct perf_event *event;
> > +
> > +       if (vmx_pt_mode_is_system() ||
> > +           !(vmx->pt_desc.guest.ctl & RTIT_CTL_TRACEEN))
> 
> I don't think the host should trace the guest in the host/guest mode just
> because the guest isn't tracing itself.  I.e. the host still needs to turn off it's
> own tracing.

Right, need to fix this one.

> This is effectively what I suggested[*], the main difference being that my
> version adds dedicated enter/exit helpers so that perf can skip save/restore of
> the other MSRs.  

What "other MSRs" were you referring to?
(I suppose you meant perf_event_disable needs to save more MSRs)

> It's easy to extend if perf needs to hand back an event to
> complete the "exit.
> 
> 	bool guest_trace_enabled = vmx->pt_desc.guest.ctl &
> RTIT_CTL_TRACEEN;
> 
> 	vmx->pt_desc.host_event = intel_pt_guest_enter(guest_trace_enabled);
> 
> 
> and then on exit
> 
> 	bool guest_trace_enabled = vmx->pt_desc.guest.ctl &
> RTIT_CTL_TRACEEN;
> 
> 	intel_pt_guest_exit(vmx->pt_desc.host_event, guest_trace_enabled);
> 
> [*] https://lore.kernel.org/all/YwecducnM%2FU6tqJT@google.com

Yes, this can function. But I feel it a bit violates the general rule
that I got from previous experiences:
KVM should be a user of the perf subsystem, instead of implementing a secondary
driver beyond perf's management.
Being a user of perf means everything possible should go through "perf event",
which is the interface that perf exposes to users.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ