Re: [Xen-devel] [PATCH v1 03/10] KVM: Prepare kvm_is_reserved_pfn() for PG_reserved changes

2019-11-05 Thread Sean Christopherson
On Tue, Nov 05, 2019 at 11:02:46AM +0100, David Hildenbrand wrote: > On 05.11.19 10:49, David Hildenbrand wrote: > >On 05.11.19 10:17, David Hildenbrand wrote: > >>On 05.11.19 05:38, Dan Williams wrote: > >>>On Thu, Oct 24, 2019 at 5:11 AM David Hildenbrand wrote: > > Right now, ZONE_DEVI

Re: [Xen-devel] [PATCH v1 03/10] KVM: Prepare kvm_is_reserved_pfn() for PG_reserved changes

2019-11-05 Thread Sean Christopherson
On Tue, Nov 05, 2019 at 09:30:53PM +0100, David Hildenbrand wrote: > >>>I think I know what's going wrong: > >>> > >>>Pages that are pinned via gfn_to_pfn() and friends take a references, > >>>however are often released via > >>>kvm_release_pfn_clean()/kvm_release_pfn_dirty()/kvm_release_page_clean

Re: [Xen-devel] [PATCH v1 03/10] KVM: Prepare kvm_is_reserved_pfn() for PG_reserved changes

2019-11-05 Thread Sean Christopherson
On Tue, Nov 05, 2019 at 03:02:40PM -0800, Dan Williams wrote: > On Tue, Nov 5, 2019 at 12:31 PM David Hildenbrand wrote: > > > The scarier code (for me) is transparent_hugepage_adjust() and > > > kvm_mmu_zap_collapsible_spte(), as I don't at all understand the > > > interaction between THP and _PA

Re: [Xen-devel] [PATCH v1 03/10] KVM: Prepare kvm_is_reserved_pfn() for PG_reserved changes

2019-11-05 Thread Sean Christopherson
On Tue, Nov 05, 2019 at 03:30:00PM -0800, Dan Williams wrote: > On Tue, Nov 5, 2019 at 3:13 PM Sean Christopherson > wrote: > > > > On Tue, Nov 05, 2019 at 03:02:40PM -0800, Dan Williams wrote: > > > On Tue, Nov 5, 2019 at 12:31 PM David Hildenbrand > > > wr

Re: [Xen-devel] [PATCH v1 03/10] KVM: Prepare kvm_is_reserved_pfn() for PG_reserved changes

2019-11-05 Thread Sean Christopherson
On Tue, Nov 05, 2019 at 03:43:29PM -0800, Dan Williams wrote: > On Tue, Nov 5, 2019 at 3:30 PM Dan Williams wrote: > > > > On Tue, Nov 5, 2019 at 3:13 PM Sean Christopherson > > wrote: > > > > > > On Tue, Nov 05, 2019 at 03:02:40PM -0800, Dan Williams wrot

Re: [Xen-devel] [PATCH v1 03/10] KVM: Prepare kvm_is_reserved_pfn() for PG_reserved changes

2019-11-06 Thread Sean Christopherson
On Wed, Nov 06, 2019 at 07:56:34AM +0100, David Hildenbrand wrote: > On 06.11.19 01:08, Dan Williams wrote: > >On Tue, Nov 5, 2019 at 4:03 PM Sean Christopherson > >>But David's proposed fix for the above refcount bug is to omit the patch > >>so that KVM no lo

Re: [PATCH v3 12/16] KVM: Move x86's perf guest info callbacks to generic KVM

2021-10-11 Thread Sean Christopherson
On Mon, Oct 11, 2021, Marc Zyngier wrote: > On Wed, 22 Sep 2021 01:05:29 +0100, Sean Christopherson > wrote: > > diff --git a/arch/arm64/include/asm/kvm_host.h > > b/arch/arm64/include/asm/kvm_host.h > > index ed940aec89e0..828b6eaa2c56 100644 > > --- a/arc

Re: [PATCH v3 01/16] perf: Ensure perf_guest_cbs aren't reloaded between !NULL check and deref

2021-11-04 Thread Sean Christopherson
On Thu, Nov 04, 2021, Like Xu wrote: > On 22/9/2021 8:05 am, Sean Christopherson wrote: > > diff --git a/kernel/events/core.c b/kernel/events/core.c > > index 464917096e73..80ff050a7b55 100644 > > --- a/kernel/events/core.c > > +++ b/kernel/events/core.c > &g

Re: [PATCH v3 15/16] KVM: arm64: Drop perf.c and fold its tiny bits of code into arm.c / pmu.c

2021-11-09 Thread Sean Christopherson
On Mon, Oct 11, 2021, Marc Zyngier wrote: > On Wed, 22 Sep 2021 01:05:32 +0100, > Sean Christopherson wrote: > > diff --git a/include/kvm/arm_pmu.h b/include/kvm/arm_pmu.h > > index 864b9997efb2..42270676498d 100644 > > --- a/include/kvm/arm_pmu.h > > +++ b/incl

Re: [PATCH v3 08/16] perf: Force architectures to opt-in to guest callbacks

2021-11-09 Thread Sean Christopherson
On Wed, Sep 22, 2021, Sean Christopherson wrote: > On Wed, Sep 22, 2021, Paolo Bonzini wrote: > > On 22/09/21 02:05, Sean Christopherson wrote: > > > @@ -1273,6 +1274,11 @@ static inline unsigned int > > > perf_guest_handle_intel_pt_intr(void) &g

Re: [PATCH v3 01/16] perf: Ensure perf_guest_cbs aren't reloaded between !NULL check and deref

2021-11-10 Thread Sean Christopherson
On Wed, Nov 10, 2021, Paolo Bonzini wrote: > On 11/4/21 15:18, Sean Christopherson wrote: > > If I'm interpeting Paolo's suggestion > > correctly, he's pointing out that oustanding stores to the function > > pointers in > > @cbs need to compl

[PATCH v4 00/17] perf: KVM: Fix, optimize, and clean up callbacks

2021-11-10 Thread Sean Christopherson
ze_rcu(). [Peter] - Avoid new exports like the plague. [Peter] v1: - https://lkml.kernel.org/r/20210827005718.585190-1-sea...@google.com v10 static_call: - https://lkml.kernel.org/r/20210806133802.3528-2-lingshan@intel.com Like Xu (1): perf/core: Rework guest callbacks to prepar

[PATCH v4 03/17] KVM: x86: Register Processor Trace interrupt hook iff PT enabled in guest

2021-11-10 Thread Sean Christopherson
t;KVM: x86: Inject PMI for KVM guest") Cc: sta...@vger.kernel.org Cc: Like Xu Reported-by: Alexander Shishkin Reported-by: Artem Kashkanov Acked-by: Paolo Bonzini Signed-off-by: Sean Christopherson --- arch/x86/include/asm/kvm_host.h | 1 + arch/x86/kvm/vmx/vmx.c | 1 + arch/x86

[PATCH v4 04/17] perf: Stop pretending that perf can handle multiple guest callbacks

2021-11-10 Thread Sean Christopherson
be co-tenant hypervisors, and if there are, that allowing multiple callbacks to be registered is desirable or even correct. Opportunistically rename callbacks=>cbs in the affected declarations to match their definitions. No functional change intended. Reviewed-by: Paolo Bonzini Signed

[PATCH v4 01/17] perf: Protect perf_guest_cbs with RCU

2021-11-10 Thread Sean Christopherson
nmi_handler+0x28/0x50 nmi_handle+0xc7/0x260 default_do_nmi+0x6b/0x170 exc_nmi+0x103/0x130 asm_exc_nmi+0x76/0xbf Fixes: 39447b386c84 ("perf: Enhance perf to allow for guest statistic collection from host") Cc: sta...@vger.kernel.org Signed-off-by: Sean Christopherson --- a

[PATCH v4 02/17] KVM: x86: Register perf callbacks after calling vendor's hardware_setup()

2021-11-10 Thread Sean Christopherson
Alexander Shishkin Cc: Artem Kashkanov Cc: sta...@vger.kernel.org Acked-by: Paolo Bonzini Signed-off-by: Sean Christopherson --- arch/x86/kvm/x86.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index c1c4e2b05a63..021b2c1ac9f0 10

[PATCH v4 05/17] perf: Drop dead and useless guest "support" from arm, csky, nds32 and riscv

2021-11-10 Thread Sean Christopherson
and at best wasting cycles. A future patch will also add a Kconfig to force architcture to opt into the callbacks to make it more difficult for uses "support" to sneak in in the future. No functional change intended. Reviewed-by: Paolo Bonzini Signed-off-by: Sean Christopherson --- ar

[PATCH v4 06/17] perf/core: Rework guest callbacks to prepare for static_call support

2021-11-10 Thread Sean Christopherson
stra (Intel) Signed-off-by: Like Xu Signed-off-by: Zhu Lingshan [sean: extracted from static_call patch, fixed get_ip() bug, wrote changelog] Signed-off-by: Sean Christopherson Reviewed-by: Boris Ostrovsky Reviewed-by: Paolo Bonzini --- arch/arm64/kernel/perf_callchain.c

[PATCH v4 07/17] perf: Add wrappers for invoking guest callbacks

2021-11-10 Thread Sean Christopherson
ething_ in this case. Reviewed-by: Paolo Bonzini Signed-off-by: Sean Christopherson --- arch/arm64/kernel/perf_callchain.c | 16 +--- arch/x86/events/core.c | 15 +-- arch/x86/events/intel/core.c | 5 + include/linux/perf_event

[PATCH v4 08/17] perf: Force architectures to opt-in to guest callbacks

2021-11-10 Thread Sean Christopherson
the happy bonus of avoiding a load of perf_guest_cbs when GUEST_PERF_EVENTS=n on arm64/x86. Reviewed-by: Paolo Bonzini Signed-off-by: Sean Christopherson --- arch/arm64/kvm/Kconfig | 1 + arch/x86/kvm/Kconfig | 1 + arch/x86/xen/Kconfig | 1 + include/linux/perf_event.h | 6 ++

[PATCH v4 11/17] KVM: x86: More precisely identify NMI from guest when handling PMI

2021-11-10 Thread Sean Christopherson
ets its flag. Fixes: dd60d217062f ("KVM: x86: Fix perf timer mode IP reporting") Reviewed-by: Paolo Bonzini Signed-off-by: Sean Christopherson --- arch/x86/kvm/svm/svm.c | 2 +- arch/x86/kvm/vmx/vmx.c | 4 +++- arch/x86/kvm/x86.c | 2 +- arch/x86/kvm/x86.h | 13 ++---

[PATCH v4 12/17] KVM: Move x86's perf guest info callbacks to generic KVM

2021-11-10 Thread Sean Christopherson
temporary #define (from x86) to avoid arm64 compilation errors when CONFIG_GUEST_PERF_EVENTS=y. Acked-by: Marc Zyngier Reviewed-by: Paolo Bonzini Signed-off-by: Sean Christopherson --- arch/arm64/include/asm/kvm_host.h | 10 ++ arch/arm64/kvm/arm.c | 5 +++ arch/x86/i

[PATCH v4 10/17] KVM: x86: Drop current_vcpu for kvm_running_vcpu + kvm_arch_vcpu variable

2021-11-10 Thread Sean Christopherson
e non-NULL when handling_intr_from_guest is non-zero. Switching to kvm_get_running_vcpu() will allows moving KVM's perf callbacks to generic code, and the new flag will be used in a future patch to more precisely identify the "NMI from guest" case. Reviewed-by: Paolo Bon

[PATCH v4 09/17] perf/core: Use static_call to optimize perf_guest_info_callbacks

2021-11-10 Thread Sean Christopherson
Cc: Like Xu Reviewed-by: Paolo Bonzini Signed-off-by: Sean Christopherson --- include/linux/perf_event.h | 34 -- kernel/events/core.c | 15 +++ 2 files changed, 23 insertions(+), 26 deletions(-) diff --git a/include/linux/perf_event.h b/include

[PATCH v4 14/17] KVM: arm64: Convert to the generic perf callbacks

2021-11-10 Thread Sean Christopherson
Drop arm64's version of the callbacks in favor of the callbacks provided by generic KVM, which are semantically identical. Reviewed-by: Marc Zyngier Signed-off-by: Sean Christopherson --- arch/arm64/kvm/perf.c | 34 ++ 1 file changed, 2 insertions(+

[PATCH v4 17/17] perf: Drop guest callback (un)register stubs

2021-11-10 Thread Sean Christopherson
Drop perf's stubs for (un)registering guest callbacks now that KVM registration of callbacks is hidden behind GUEST_PERF_EVENTS=y. The only other user is x86 XEN_PV, and x86 unconditionally selects PERF_EVENTS. No functional change intended. Reviewed-by: Paolo Bonzini Signed-off-by:

[PATCH v4 15/17] KVM: arm64: Hide kvm_arm_pmu_available behind CONFIG_HW_PERF_EVENTS=y

2021-11-10 Thread Sean Christopherson
rely. Signed-off-by: Sean Christopherson --- arch/arm64/kernel/image-vars.h | 2 ++ arch/arm64/kvm/perf.c | 2 -- arch/arm64/kvm/pmu-emul.c | 2 ++ include/kvm/arm_pmu.h | 19 --- 4 files changed, 16 insertions(+), 9 deletions(-) diff --git a/arch/arm64

[PATCH v4 13/17] KVM: x86: Move Intel Processor Trace interrupt handler to vmx.c

2021-11-10 Thread Sean Christopherson
Now that all state needed for VMX's PT interrupt handler is exposed to vmx.c (specifically the currently running vCPU), move the handler into vmx.c where it belongs. Signed-off-by: Sean Christopherson --- arch/x86/include/asm/kvm_host.h | 2 +- arch/x86/kvm/vmx/vmx.c

[PATCH v4 16/17] KVM: arm64: Drop perf.c and fold its tiny bits of code into arm.c

2021-11-10 Thread Sean Christopherson
Call KVM's (un)register perf callbacks helpers directly from arm.c and delete perf.c No functional change intended. Signed-off-by: Sean Christopherson --- arch/arm64/include/asm/kvm_host.h | 3 --- arch/arm64/kvm/Makefile | 2 +- arch/arm64/kvm/arm.c | 5 +++--

Re: [PATCH v7 0/2] KVM: x86/xen: update Xen CPUID Leaf 4

2023-01-19 Thread Sean Christopherson
On Fri, 06 Jan 2023 10:35:58 +, Paul Durrant wrote: > Patch #2 was the original patch. It has been expended to a series in v6. > > Paul Durrant (2): > KVM: x86/cpuid: generalize kvm_update_kvm_cpuid_base() and also > capture limit > KVM: x86/xen: update Xen CPUID Leaf 4 (tsc info) sub-

Re: [PATCH v2] x86/hotplug: Do not put offline vCPUs in mwait idle state

2023-01-20 Thread Sean Christopherson
On Fri, Jan 20, 2023, Igor Mammedov wrote: > On Fri, 20 Jan 2023 05:55:11 -0800 > "Srivatsa S. Bhat" wrote: > > > Hi Igor and Thomas, > > > > Thank you for your review! > > > > On 1/19/23 1:12 PM, Thomas Gleixner wrote: > > > On Mon, Jan 16 2023 at 15:55, Igor Mammedov wrote: > > >> "Srivatsa

Re: [PATCH V10 01/18] perf/core: Use static_call to optimize perf_guest_info_callbacks

2021-08-26 Thread Sean Christopherson
TL;DR: Please don't merge this patch, it's broken and is also built on a shoddy foundation that I would like to fix. On Fri, Aug 06, 2021, Zhu Lingshan wrote: > diff --git a/kernel/events/core.c b/kernel/events/core.c > index 464917096e73..e466fc8176e1 100644 > --- a/kernel/events/core.c >

[PATCH 04/15] perf: Force architectures to opt-in to guest callbacks

2021-08-26 Thread Sean Christopherson
x27;s useless and at best wasting cycles. Wrap even the stubs with an #ifdef to avoid an arch sneaking in a bogus registration with CONFIG_PERF_EVENTS=n. Signed-off-by: Sean Christopherson --- arch/arm/kernel/perf_callchain.c | 28 arch/arm64/Kconfig

[PATCH 06/15] KVM: x86: Register perf callbacks only when actively handling interrupt

2021-08-26 Thread Sean Christopherson
t;in guest" check. Signed-off-by: Sean Christopherson --- arch/x86/kvm/x86.c | 27 +-- arch/x86/kvm/x86.h | 10 ++ include/linux/perf_event.h | 2 ++ kernel/events/core.c | 12 4 files changed, 41 insertions(+), 10 deletions

[PATCH 05/15] perf: Track guest callbacks on a per-CPU basis

2021-08-26 Thread Sean Christopherson
does often reload perf_guest_cbs) as KVM has to stop running all guests and do a heavy teardown before unloading. Cc: Zhu Lingshan Signed-off-by: Sean Christopherson --- arch/arm64/kernel/perf_callchain.c | 18 -- arch/x86/events/core.c | 17 +++-- arc

[PATCH 00/15] perf: KVM: Fix, optimize, and clean up callbacks

2021-08-26 Thread Sean Christopherson
ntel_pmu_handle_irq+0xcf/0x410 perf_event_nmi_handler+0x28/0x50 nmi_handle+0xc7/0x260 default_do_nmi+0x6b/0x170 exc_nmi+0x103/0x130 asm_exc_nmi+0x76/0xbf [1] https://lkml.kernel.org/r/20210823193709.55886-1-sea...@google.com [2] https://lkml.kernel.org/r/20210806133802.3528-2-lings

[PATCH 01/15] KVM: x86: Register perf callbacks after calling vendor's hardware_setup()

2021-08-26 Thread Sean Christopherson
Alexander Shishkin Cc: Artem Kashkanov Cc: sta...@vger.kernel.org Signed-off-by: Sean Christopherson --- arch/x86/kvm/x86.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 86539c1686fa..fb6015f97f9e 100644 --- a/arch/x86/kvm/x

[PATCH 08/15] KVM: x86: Drop current_vcpu in favor of kvm_running_vcpu

2021-08-26 Thread Sean Christopherson
Now that KVM registers perf callbacks only when the CPU is "in guest", use kvm_running_vcpu instead of current_vcpu to retrieve the associated vCPU and drop current_vcpu. Signed-off-by: Sean Christopherson --- arch/x86/kvm/x86.c | 12 +--- arch/x86/kvm/x86.h | 4 2 fil

[PATCH 09/15] KVM: arm64: Register/unregister perf callbacks at vcpu load/put

2021-08-26 Thread Sean Christopherson
backs into common KVM as they arm64 and x86 now have semantically identical callback implementations. Note, KVM could likely be more precise in its registration, but that's a cleanup for the future. Signed-off-by: Sean Christopherson --- arch/arm64/include/asm/kvm_host.h | 12 ++-

[PATCH 07/15] KVM: Use dedicated flag to track if KVM is handling an NMI from guest

2021-08-26 Thread Sean Christopherson
t;KVM: x86: Fix perf timer mode IP reporting") Signed-off-by: Sean Christopherson --- arch/x86/include/asm/kvm_host.h | 3 +-- arch/x86/kvm/pmu.c | 2 +- arch/x86/kvm/svm/svm.c | 2 +- arch/x86/kvm/vmx/vmx.c | 2 +- arch/x86/kvm/x86.c | 4

[PATCH 02/15] KVM: x86: Register Processor Trace interrupt hook iff PT enabled in guest

2021-08-26 Thread Sean Christopherson
t;KVM: x86: Inject PMI for KVM guest") Cc: sta...@vger.kernel.org Cc: Like Xu Reported-by: Alexander Shishkin Reported-by: Artem Kashkanov Signed-off-by: Sean Christopherson --- arch/x86/include/asm/kvm_host.h | 1 + arch/x86/kvm/pmu.h | 1 + arch/x86/kvm/vmx/vmx.c |

[PATCH 03/15] perf: Stop pretending that perf can handle multiple guest callbacks

2021-08-26 Thread Sean Christopherson
r be cotenant hypervisors, and if there are, that allowing multiple callbacks to be registered is desirable or even correct. No functional change intended. Signed-off-by: Sean Christopherson --- arch/arm64/include/asm/kvm_host.h | 4 ++-- arch/arm64/kvm/perf.c | 8 +++

[PATCH 11/15] KVM: x86: Move Intel Processor Trace interrupt handler to vmx.c

2021-08-26 Thread Sean Christopherson
Now that all state needed for VMX's PT interrupt handler is exposed to vmx.c (specifically the currently running vCPU), move the handler into vmx.c where it belongs. Signed-off-by: Sean Christopherson --- arch/x86/include/asm/kvm_host.h | 1 - arch/x86/kvm/vmx/vmx.c

[PATCH 15/15] perf: KVM: Indicate "in guest" via NULL ->is_in_guest callback

2021-08-26 Thread Sean Christopherson
and also provides a handy excuse for a wrapper around retrieval of perf_get_guest_cbs, e.g. to reduce the probability of an errant direct read of perf_guest_cbs. Signed-off-by: Sean Christopherson --- arch/x86/events/core.c | 16 arch/x86/events/intel/core.c | 5 ++--- include

[PATCH 10/15] KVM: Move x86's perf guest info callbacks to generic KVM

2021-08-26 Thread Sean Christopherson
Move x86's perf guest callbacks into common KVM, as they are semantically identical to arm64's callbacks (the only other such KVM callbacks). arm64 will convert to the common versions in a future patch. Signed-off-by: Sean Christopherson --- arch/x86/include/asm/kvm_host.h | 1 + ar

[PATCH 14/15] perf: Disallow bulk unregistering of guest callbacks and do cleanup

2021-08-26 Thread Sean Christopherson
pointer in a PMI handler. Opportunistically tweak names to better reflect reality. Signed-off-by: Sean Christopherson --- arch/x86/xen/pmu.c | 2 +- include/linux/kvm_host.h | 2 +- include/linux/perf_event.h | 9 +++-- kernel/events/core.c | 31

[PATCH 13/15] KVM: arm64: Drop perf.c and fold its tiny bit of code into pmu.c

2021-08-26 Thread Sean Christopherson
Fold that last few remnants of perf.c into pmu.c and rename the init helper as appropriate. Signed-off-by: Sean Christopherson --- arch/arm64/include/asm/kvm_host.h | 2 -- arch/arm64/kvm/Makefile | 2 +- arch/arm64/kvm/arm.c | 3 ++- arch/arm64/kvm/perf.c

[PATCH 12/15] KVM: arm64: Convert to the generic perf callbacks

2021-08-26 Thread Sean Christopherson
Drop arm64's version of the callbacks in favor of the callbacks provided by generic KVM, which are semantically identical. Implement the "get ip" hook as needed. Signed-off-by: Sean Christopherson --- arch/arm64/include/asm/kvm_host.h | 6 + arch/arm64/kvm/arm.c

Re: [RFC PATCH v3 0/5] Hypervisor-Enforced Kernel Integrity - CR pinning

2024-05-03 Thread Sean Christopherson
On Fri, May 03, 2024, Mickaël Salaün wrote: > Hi, > > This patch series implements control-register (CR) pinning for KVM and > provides an hypervisor-agnostic API to protect guests. It includes the > guest interface, the host interface, and the KVM implementation. > > It's not ready for mainline

Re: [RFC PATCH v3 3/5] KVM: x86: Add notifications for Heki policy configuration and violation

2024-05-03 Thread Sean Christopherson
a policy > violation. > > Cc: Borislav Petkov > Cc: Dave Hansen > Cc: H. Peter Anvin > Cc: Ingo Molnar > Cc: Kees Cook > Cc: Madhavan T. Venkataraman > Cc: Paolo Bonzini > Cc: Sean Christopherson > Cc: Thomas Gleixner > Cc: Vitaly Kuznet

Re: [RFC PATCH v3 3/5] KVM: x86: Add notifications for Heki policy configuration and violation

2024-05-06 Thread Sean Christopherson
On Mon, May 06, 2024, Mickaël Salaün wrote: > On Fri, May 03, 2024 at 07:03:21AM GMT, Sean Christopherson wrote: > > > --- > > > > > > Changes since v1: > > > * New patch. Making user space aware of Heki properties was requested by > > > Sean

Re: [RFC PATCH v3 3/5] KVM: x86: Add notifications for Heki policy configuration and violation

2024-05-07 Thread Sean Christopherson
On Tue, May 07, 2024, Mickaël Salaün wrote: > > Actually, potential bad/crazy idea. Why does the _host_ need to define > > policy? > > Linux already knows what assets it wants to (un)protect and when. What's > > missing > > is a way for the guest kernel to effectively deprivilege and re-authent

Re: [RFC PATCH v3 3/5] KVM: x86: Add notifications for Heki policy configuration and violation

2024-05-15 Thread Sean Christopherson
On Tue, May 14, 2024, Mickaël Salaün wrote: > On Fri, May 10, 2024 at 10:07:00AM +, Nicolas Saenz Julienne wrote: > > Development happens > > https://github.com/vianpl/{linux,qemu,kvm-unit-tests} and the vsm-next > > branch, but I'd advice against looking into it until we add some order > > to

Re: [RFC PATCH v3 3/5] KVM: x86: Add notifications for Heki policy configuration and violation

2024-06-03 Thread Sean Christopherson
On Tue, May 14, 2024, Mickaël Salaün wrote: > On Tue, May 07, 2024 at 09:16:06AM -0700, Sean Christopherson wrote: > > On Tue, May 07, 2024, Mickaël Salaün wrote: > > > If yes, that would indeed require a *lot* of work for something we're not > > > sure will be acc

Re: [RFC PATCH v3 3/5] KVM: x86: Add notifications for Heki policy configuration and violation

2024-06-03 Thread Sean Christopherson
On Mon, Jun 03, 2024, Mickaël Salaün wrote: > On Wed, May 15, 2024 at 01:32:24PM -0700, Sean Christopherson wrote: > > On Tue, May 14, 2024, Mickaël Salaün wrote: > > > On Fri, May 10, 2024 at 10:07:00AM +, Nicolas Saenz Julienne wrote: > > > > Development happ

Re: [PATCH v9 00/36] x86: enable FRED for x86-64

2023-07-31 Thread Sean Christopherson
On Sun, Jul 30, 2023, Xin Li wrote: > This patch set enables the Intel flexible return and event delivery > (FRED) architecture for x86-64. ... > -- > 2.34.1 What is this based on? FYI, you're using a version of git that will (mostly) automatically generate the based, e.g. I do git format-

Re: [PATCH v9 00/36] x86: enable FRED for x86-64

2023-07-31 Thread Sean Christopherson
On Mon, Jul 31, 2023, Xin3 Li wrote: > > > This patch set enables the Intel flexible return and event delivery > > > (FRED) architecture for x86-64. > > > > ... > > > > > -- > > > 2.34.1 > > > > What is this based on? > > The tip tree master branch. > > > FYI, you're using a version of git tha

Re: [PATCH RESEND v9 33/36] KVM: VMX: Add VMX_DO_FRED_EVENT_IRQOFF for IRQ/NMI handling

2023-08-01 Thread Sean Christopherson
On Tue, Aug 01, 2023, Xin Li wrote: > > diff --git a/arch/x86/kvm/vmx/vmenter.S b/arch/x86/kvm/vmx/vmenter.S > index 07e927d4d099..5ee6a57b59a5 100644 > --- a/arch/x86/kvm/vmx/vmenter.S > +++ b/arch/x86/kvm/vmx/vmenter.S > @@ -2,12 +2,14 @@ > #include > #include > #include > +#include > #i

Re: [PATCH RESEND v9 33/36] KVM: VMX: Add VMX_DO_FRED_EVENT_IRQOFF for IRQ/NMI handling

2023-08-01 Thread Sean Christopherson
On Tue, Aug 01, 2023, Peter Zijlstra wrote: > On Tue, Aug 01, 2023 at 07:01:15PM +0000, Sean Christopherson wrote: > > The spec I have from May 2022 says the NMI bit colocated with CS, not SS. > > And > > the cover letter's suggestion to use a search engine to find

Re: [RFC PATCH v1 0/9] Hypervisor-Enforced Kernel Integrity

2023-05-31 Thread Sean Christopherson
On Tue, May 30, 2023, Rick P Edgecombe wrote: > On Fri, 2023-05-26 at 17:22 +0200, Micka�l Sala�n wrote: > > > > Can the guest kernel ask the host VMM's emulated devices to DMA into > > > > the protected data? It should go through the host userspace mappings I > > > > think, which don't care ab

Re: [ANNOUNCE] KVM Microconference at LPC 2023

2023-06-01 Thread Sean Christopherson
On Thu, Jun 01, 2023, Micka�l Sala�n wrote: > Hi, > > What is the status of this microconference proposal? We'd be happy to talk > about Heki [1] and potentially other hypervisor supports. Proposal submitted (deadline is/was today), now we wait :-) IIUC, we should find out rather quickly wh

Re: [PATCH RFC 1/1] x86/paravirt: introduce param to disable pv sched_clock

2023-10-19 Thread Sean Christopherson
rg/all/zojf2dmbgw%2fzv...@google.com > > > 2. The sched_clock. > > > > The scheduling is impacted if there is big drift. > > ... > > > Unfortunately, the "no-kvmclock" kernel parameter disables all pv clock > > operations (not only sched_clock

Re: [PATCH RFC 1/1] x86/paravirt: introduce param to disable pv sched_clock

2023-10-19 Thread Sean Christopherson
On Thu, Oct 19, 2023, David Woodhouse wrote: > On Thu, 2023-10-19 at 08:40 -0700, Sean Christopherson wrote: > > > If for some 'historical reasons' we can't revoke features we can always > > > introduce a new PV feature bit saying that TSC is preferred. >

Re: [PATCH 01/30] x86/crash,reboot: Avoid re-disabling VMX in all CPUs on crash/restart

2022-05-09 Thread Sean Christopherson
ally in the emergency restart. > > Fixes: ed72736183c4 ("x86/reboot: Force all cpus to exit VMX root if VMX is > supported) > Fixes: 0ee59413c967 ("x86/panic: replace smp_send_stop() with kdump friendly > version in panic path") > Cc: David P. Reed > Cc: Hidehiro Ka

Re: [PATCH 05/15] perf: Track guest callbacks on a per-CPU basis

2021-08-27 Thread Sean Christopherson
On Fri, Aug 27, 2021, Peter Zijlstra wrote: > On Thu, Aug 26, 2021 at 05:57:08PM -0700, Sean Christopherson wrote: > > Use a per-CPU pointer to track perf's guest callbacks so that KVM can set > > the callbacks more precisely and avoid a lurking NULL pointer dereference.

Re: [PATCH 07/15] KVM: Use dedicated flag to track if KVM is handling an NMI from guest

2021-08-27 Thread Sean Christopherson
On Fri, Aug 27, 2021, Peter Zijlstra wrote: > On Thu, Aug 26, 2021 at 05:57:10PM -0700, Sean Christopherson wrote: > > diff --git a/arch/x86/kvm/x86.h b/arch/x86/kvm/x86.h > > index 5cedc0e8a5d5..4c5ba4128b38 100644 > > --- a/arch/x86/kvm/x86.h > > +++ b/arch/x86/kvm/

Re: [PATCH 05/15] perf: Track guest callbacks on a per-CPU basis

2021-08-27 Thread Sean Christopherson
On Fri, Aug 27, 2021, Peter Zijlstra wrote: > On Fri, Aug 27, 2021 at 02:49:50PM +0000, Sean Christopherson wrote: > > On Fri, Aug 27, 2021, Peter Zijlstra wrote: > > > On Thu, Aug 26, 2021 at 05:57:08PM -0700, Sean Christopherson wrote: > > > > Use a per-CPU

Re: [PATCH V10 01/18] perf/core: Use static_call to optimize perf_guest_info_callbacks

2021-08-27 Thread Sean Christopherson
On Fri, Aug 06, 2021, Zhu Lingshan wrote: > @@ -2944,18 +2966,21 @@ static unsigned long code_segment_base(struct pt_regs > *regs) > > unsigned long perf_instruction_pointer(struct pt_regs *regs) > { > - if (perf_guest_cbs && perf_guest_cbs->is_in_guest()) > - return perf_guest

[PATCH v2 00/13] perf: KVM: Fix, optimize, and clean up callbacks

2021-08-27 Thread Sean Christopherson
. [Peter] v1: - https://lkml.kernel.org/r/20210827005718.585190-1-sea...@google.com v10 static_call: - https://lkml.kernel.org/r/20210806133802.3528-2-lingshan@intel.com Like Xu (2): perf/core: Rework guest callbacks to prepare for static_call support perf/core: Use static_call to

[PATCH v2 01/13] perf: Ensure perf_guest_cbs aren't reloaded between !NULL check and deref

2021-08-27 Thread Sean Christopherson
t_do_nmi+0x6b/0x170 exc_nmi+0x103/0x130 asm_exc_nmi+0x76/0xbf Fixes: 39447b386c84 ("perf: Enhance perf to allow for guest statistic collection from host") Cc: sta...@vger.kernel.org Signed-off-by: Sean Christopherson --- arch/arm/kernel/perf_callchain.c | 17 ++

[PATCH v2 02/13] KVM: x86: Register perf callbacks after calling vendor's hardware_setup()

2021-08-27 Thread Sean Christopherson
Alexander Shishkin Cc: Artem Kashkanov Cc: sta...@vger.kernel.org Signed-off-by: Sean Christopherson --- arch/x86/kvm/x86.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 86539c1686fa..fb6015f97f9e 100644 --- a/arch/x86/kvm/x

[PATCH v2 03/13] KVM: x86: Register Processor Trace interrupt hook iff PT enabled in guest

2021-08-27 Thread Sean Christopherson
t;KVM: x86: Inject PMI for KVM guest") Cc: sta...@vger.kernel.org Cc: Like Xu Reported-by: Alexander Shishkin Reported-by: Artem Kashkanov Signed-off-by: Sean Christopherson --- arch/x86/include/asm/kvm_host.h | 1 + arch/x86/kvm/vmx/vmx.c | 1 + arch/x86/kvm/x86.c |

[PATCH v2 04/13] perf: Stop pretending that perf can handle multiple guest callbacks

2021-08-27 Thread Sean Christopherson
be co-tenant hypervisors, and if there are, that allowing multiple callbacks to be registered is desirable or even correct. No functional change intended. Signed-off-by: Sean Christopherson --- arch/arm64/include/asm/kvm_host.h | 4 ++-- arch/arm64/kvm/perf.c | 8 +++

[PATCH v2 05/13] perf: Force architectures to opt-in to guest callbacks

2021-08-27 Thread Sean Christopherson
eless and at best wasting cycles. Wrap even the stubs with an #ifdef to avoid an arch sneaking in a bogus registration with CONFIG_PERF_EVENTS=n. Signed-off-by: Sean Christopherson --- arch/arm/kernel/perf_callchain.c | 33 - arch/arm64/Kconfig | 1 +

[PATCH v2 06/13] perf/core: Rework guest callbacks to prepare for static_call support

2021-08-27 Thread Sean Christopherson
stra (Intel) Signed-off-by: Like Xu Signed-off-by: Zhu Lingshan [sean: extracted from static_call patch, fixed get_ip() bug, wrote changelog] Signed-off-by: Sean Christopherson --- arch/arm64/kernel/perf_callchain.c | 13 +- arch/arm64/kvm/perf.c | 35 +++---

[PATCH v2 07/13] perf/core: Use static_call to optimize perf_guest_info_callbacks

2021-08-27 Thread Sean Christopherson
lstra (Intel) Signed-off-by: Like Xu Signed-off-by: Zhu Lingshan [sean: split out patch, drop __weak, tweak updaters, rewrite changelog] Signed-off-by: Sean Christopherson --- arch/arm64/kernel/perf_callchain.c | 31 +++- arch/x86/events/core.c | 38 +++

[PATCH v2 08/13] KVM: x86: Drop current_vcpu for kvm_running_vcpu + kvm_arch_vcpu variable

2021-08-27 Thread Sean Christopherson
e non-NULL when handling_intr_from_guest is non-zero. Switching to kvm_get_running_vcpu() will allows moving KVM's perf callbacks to generic code, and the new flag will be used in a future patch to more precisely identify the "NMI from guest" case. Signed-off-by: Sean Christophers

[PATCH v2 09/13] KVM: x86: More precisely identify NMI from guest when handling PMI

2021-08-27 Thread Sean Christopherson
ets its flag. Fixes: dd60d217062f ("KVM: x86: Fix perf timer mode IP reporting") Signed-off-by: Sean Christopherson --- arch/x86/kvm/svm/svm.c | 2 +- arch/x86/kvm/vmx/vmx.c | 4 +++- arch/x86/kvm/x86.c | 2 +- arch/x86/kvm/x86.h | 13 ++--- 4 files changed, 15 insertions(+)

[PATCH v2 10/13] KVM: Move x86's perf guest info callbacks to generic KVM

2021-08-27 Thread Sean Christopherson
Move x86's perf guest callbacks into common KVM, as they are semantically identical to arm64's callbacks (the only other such KVM callbacks). arm64 will convert to the common versions in a future patch. Signed-off-by: Sean Christopherson --- arch/x86/include/asm/kvm_host.h | 4 +++

[PATCH v2 11/13] KVM: x86: Move Intel Processor Trace interrupt handler to vmx.c

2021-08-27 Thread Sean Christopherson
Now that all state needed for VMX's PT interrupt handler is exposed to vmx.c (specifically the currently running vCPU), move the handler into vmx.c where it belongs. Signed-off-by: Sean Christopherson --- arch/x86/include/asm/kvm_host.h | 2 +- arch/x86/kvm/vmx/vmx.c

[PATCH v2 12/13] KVM: arm64: Convert to the generic perf callbacks

2021-08-27 Thread Sean Christopherson
Drop arm64's version of the callbacks in favor of the callbacks provided by generic KVM, which are semantically identical. Implement the "get ip" hook as needed. Signed-off-by: Sean Christopherson --- arch/arm64/include/asm/kvm_host.h | 12 +++ arch/arm64/kvm/arm.c

[PATCH v2 13/13] KVM: arm64: Drop perf.c and fold its tiny bits of code into arm.c / pmu.c

2021-08-27 Thread Sean Christopherson
Call KVM's (un)register perf callbacks helpers directly from arm.c, and move the PMU bits into pmu.c and rename the related helper accordingly. Signed-off-by: Sean Christopherson --- arch/arm64/include/asm/kvm_host.h | 3 --- arch/arm64/kvm/Makefile | 2 +- arch/arm64/kvm/

Re: [PATCH v2 00/13] perf: KVM: Fix, optimize, and clean up callbacks

2021-09-16 Thread Sean Christopherson
On Sat, Aug 28, 2021, Peter Zijlstra wrote: > On Fri, Aug 27, 2021 at 05:35:45PM -0700, Sean Christopherson wrote: > > Like Xu (2): > > perf/core: Rework guest callbacks to prepare for static_call support > > perf/core: Use static_call to optimize perf_guest_info_ca

Re: [PATCH v2 01/13] perf: Ensure perf_guest_cbs aren't reloaded between !NULL check and deref

2021-09-16 Thread Sean Christopherson
On Sat, Aug 28, 2021, Peter Zijlstra wrote: > On Fri, Aug 27, 2021 at 05:35:46PM -0700, Sean Christopherson wrote: > > diff --git a/kernel/events/core.c b/kernel/events/core.c > > index 464917096e73..2126f6327321 100644 > > --- a/kernel/events/core.c > > +++ b/kernel/ev

Re: [PATCH v2 05/13] perf: Force architectures to opt-in to guest callbacks

2021-09-16 Thread Sean Christopherson
On Sat, Aug 28, 2021, Peter Zijlstra wrote: > On Fri, Aug 27, 2021 at 05:35:50PM -0700, Sean Christopherson wrote: > > diff --git a/init/Kconfig b/init/Kconfig > > index 55f9f7738ebb..9ef51ae53977 100644 > > --- a/init/Kconfig > > +++ b/init/Kconfig >

Re: [PATCH v2 00/13] perf: KVM: Fix, optimize, and clean up callbacks

2021-09-17 Thread Sean Christopherson
On Fri, Sep 17, 2021, Peter Zijlstra wrote: > On Thu, Sep 16, 2021 at 09:37:43PM +0000, Sean Christopherson wrote: > So I don't mind exporting __static_call_return0, but exporting a raw > static_call is much like exporting a function pointer :/ Ya, that part is quite gross. >

Re: [PATCH v2 05/13] perf: Force architectures to opt-in to guest callbacks

2021-09-21 Thread Sean Christopherson
On Tue, Sep 21, 2021, Paolo Bonzini wrote: > On 28/08/21 21:47, Peter Zijlstra wrote: > > > +config HAVE_GUEST_PERF_EVENTS > > > + bool > > depends on HAVE_KVM > > It won't really do anything, since Kconfig does not detects conflicts > between select' and 'depends on' clauses. It does throw a

Re: [PATCH V10 01/18] perf/core: Use static_call to optimize perf_guest_info_callbacks

2021-09-21 Thread Sean Christopherson
On Wed, Sep 15, 2021, Zhu, Lingshan wrote: > > > On 8/27/2021 3:59 AM, Sean Christopherson wrote: > > TL;DR: Please don't merge this patch, it's broken and is also built on a > > shoddy > > foundation that I would like to fix. > Hi Sean,Peter,

[PATCH v3 01/16] perf: Ensure perf_guest_cbs aren't reloaded between !NULL check and deref

2021-09-21 Thread Sean Christopherson
t_do_nmi+0x6b/0x170 exc_nmi+0x103/0x130 asm_exc_nmi+0x76/0xbf Fixes: 39447b386c84 ("perf: Enhance perf to allow for guest statistic collection from host") Cc: sta...@vger.kernel.org Signed-off-by: Sean Christopherson --- arch/arm/kernel/perf_callchain.c | 17 ++

[PATCH v3 00/16] perf: KVM: Fix, optimize, and clean up callbacks

2021-09-21 Thread Sean Christopherson
ee with READ_ONCE(), WRITE_ONCE(), and synchronize_rcu(). [Peter] - Avoid new exports like the plague. [Peter] v1: - https://lkml.kernel.org/r/20210827005718.585190-1-sea...@google.com v10 static_call: - https://lkml.kernel.org/r/20210806133802.3528-2-lingshan@intel.com Like X

[PATCH v3 02/16] KVM: x86: Register perf callbacks after calling vendor's hardware_setup()

2021-09-21 Thread Sean Christopherson
Alexander Shishkin Cc: Artem Kashkanov Cc: sta...@vger.kernel.org Signed-off-by: Sean Christopherson --- arch/x86/kvm/x86.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 86539c1686fa..fb6015f97f9e 100644 --- a/arch/x86/kvm/x

[PATCH v3 03/16] KVM: x86: Register Processor Trace interrupt hook iff PT enabled in guest

2021-09-21 Thread Sean Christopherson
t;KVM: x86: Inject PMI for KVM guest") Cc: sta...@vger.kernel.org Cc: Like Xu Reported-by: Alexander Shishkin Reported-by: Artem Kashkanov Signed-off-by: Sean Christopherson --- arch/x86/include/asm/kvm_host.h | 1 + arch/x86/kvm/vmx/vmx.c | 1 + arch/x86/kvm/x86.c |

[PATCH v3 04/16] perf: Stop pretending that perf can handle multiple guest callbacks

2021-09-21 Thread Sean Christopherson
be co-tenant hypervisors, and if there are, that allowing multiple callbacks to be registered is desirable or even correct. Opportunistically rename callbacks=>cbs in the affected declarations to match their definitions. No functional change intended. Signed-off-by: Sean Christopherson

[PATCH v3 05/16] perf: Drop dead and useless guest "support" from arm, csky, nds32 and riscv

2021-09-21 Thread Sean Christopherson
and at best wasting cycles. A future patch will also add a Kconfig to force architcture to opt into the callbacks to make it more difficult for uses "support" to sneak in in the future. No functional change intended. Signed-off-by: Sean Christopherson --- arch/arm/

[PATCH v3 06/16] perf/core: Rework guest callbacks to prepare for static_call support

2021-09-21 Thread Sean Christopherson
stra (Intel) Signed-off-by: Like Xu Signed-off-by: Zhu Lingshan [sean: extracted from static_call patch, fixed get_ip() bug, wrote changelog] Signed-off-by: Sean Christopherson --- arch/arm64/kernel/perf_callchain.c | 13 +- arch/arm64/kvm/perf.c | 35 +++---

[PATCH v3 07/16] perf: Add wrappers for invoking guest callbacks

2021-09-21 Thread Sean Christopherson
ething_ in this case. Signed-off-by: Sean Christopherson --- arch/arm64/kernel/perf_callchain.c | 16 +--- arch/x86/events/core.c | 15 +-- arch/x86/events/intel/core.c | 5 + include/linux/perf_event.h | 24 4 fi

[PATCH v3 09/16] perf/core: Use static_call to optimize perf_guest_info_callbacks

2021-09-21 Thread Sean Christopherson
c: Like Xu Signed-off-by: Sean Christopherson --- include/linux/perf_event.h | 28 ++-- kernel/events/core.c | 15 +++ 2 files changed, 21 insertions(+), 22 deletions(-) diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h index eefa197d

[PATCH v3 08/16] perf: Force architectures to opt-in to guest callbacks

2021-09-21 Thread Sean Christopherson
the happy bonus of avoiding a load of perf_guest_cbs when GUEST_PERF_EVENTS=n on arm64/x86. Signed-off-by: Sean Christopherson --- arch/arm64/kvm/Kconfig | 1 + arch/x86/kvm/Kconfig | 1 + arch/x86/xen/Kconfig | 1 + include/linux/perf_event.h | 6 ++ init/Kconfig

[PATCH v3 10/16] KVM: x86: Drop current_vcpu for kvm_running_vcpu + kvm_arch_vcpu variable

2021-09-21 Thread Sean Christopherson
e non-NULL when handling_intr_from_guest is non-zero. Switching to kvm_get_running_vcpu() will allows moving KVM's perf callbacks to generic code, and the new flag will be used in a future patch to more precisely identify the "NMI from guest" case. Signed-off-by: Sean Christophers

[PATCH v3 13/16] KVM: x86: Move Intel Processor Trace interrupt handler to vmx.c

2021-09-21 Thread Sean Christopherson
Now that all state needed for VMX's PT interrupt handler is exposed to vmx.c (specifically the currently running vCPU), move the handler into vmx.c where it belongs. Signed-off-by: Sean Christopherson --- arch/x86/include/asm/kvm_host.h | 2 +- arch/x86/kvm/vmx/vmx.c

  1   2   >