From: Sean Christopherson <seanjc@google.com>
To: Like Xu <like.xu.linux@gmail.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
Andi Kleen <ak@linux.intel.com>,
kvm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] KVM: x86/intr: Explicitly check NMI from guest to eliminate false positives
Date: Mon, 26 Feb 2024 16:11:04 -0800 [thread overview]
Message-ID: <Zd0omLAgMu2P3lWX@google.com> (raw)
In-Reply-To: <585a36d2-6e46-44a0-8224-8d4cd54d0dd3@gmail.com>
On Sun, Feb 18, 2024, Like Xu wrote:
> On 7/2/2024 5:08 am, Sean Christopherson wrote:
> > On Tue, Feb 06, 2024, Sean Christopherson wrote:
> > Never mind, this causes KUT's pmu_pebs test to fail:
> >
> > FAIL: Multiple (0x700000055): No OVF irq, none PEBS records.
> > FAIL: Adaptive (0x1): Multiple (0x700000055): No OVF irq, none PEBS records.
> > FAIL: Adaptive (0x2): Multiple (0x700000055): No OVF irq, none PEBS records.
> > FAIL: Adaptive (0x4): Multiple (0x700000055): No OVF irq, none PEBS records.
> > FAIL: Adaptive (0x1f000008): Multiple (0x700000055): No OVF irq, none PEBS records.
> > FAIL: GP counter 0 (0xfffffffffffe): No OVF irq, none PEBS records.
> > FAIL: Multiple (0x700000055): No OVF irq, none PEBS records.
> > FAIL: Adaptive (0x1): GP counter 0 (0xfffffffffffe): No OVF irq, none PEBS records.
> > FAIL: Adaptive (0x1): Multiple (0x700000055): No OVF irq, none PEBS records.
> > FAIL: Adaptive (0x2): GP counter 0 (0xfffffffffffe): No OVF irq, none PEBS records.
> > FAIL: Adaptive (0x2): Multiple (0x700000055): No OVF irq, none PEBS records.
> > FAIL: Adaptive (0x4): GP counter 0 (0xfffffffffffe): No OVF irq, none PEBS records.
> > FAIL: Adaptive (0x4): Multiple (0x700000055): No OVF irq, none PEBS records.
> > FAIL: Adaptive (0x1f000008): GP counter 0 (0xfffffffffffe): No OVF irq, none PEBS records.
> > FAIL: Adaptive (0x1f000008): Multiple (0x700000055): No OVF irq, none PEBS records.
> > FAIL: Multiple (0x700000055): No OVF irq, none PEBS records.
> > FAIL: Adaptive (0x1): Multiple (0x700000055): No OVF irq, none PEBS records.
> > FAIL: Adaptive (0x2): Multiple (0x700000055): No OVF irq, none PEBS records.
> > FAIL: Adaptive (0x4): Multiple (0x700000055): No OVF irq, none PEBS records.
> > FAIL: Adaptive (0x1f000008): Multiple (0x700000055): No OVF irq, none PEBS records.
> >
> > It might be a test bug, but I have neither the time nor the inclination to
> > investigate.
>
> For PEBS ovf case, we have "in_nmi() = 0x100000" from the core kernel and
> the following diff fixes the issue:
>
> diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
> index 995760ba072f..dcf665251fce 100644
> --- a/arch/x86/include/asm/kvm_host.h
> +++ b/arch/x86/include/asm/kvm_host.h
> @@ -1891,7 +1891,7 @@ enum kvm_intr_type {
> /* Enable perf NMI and timer modes to work, and minimise false positives. */
> #define kvm_arch_pmi_in_guest(vcpu) \
> ((vcpu) && (vcpu)->arch.handling_intr_from_guest && \
> - (in_nmi() == ((vcpu)->arch.handling_intr_from_guest == KVM_HANDLING_NMI)))
> + (!!in_nmi() == ((vcpu)->arch.handling_intr_from_guest == KVM_HANDLING_NMI)))
>
> void __init kvm_mmu_x86_module_init(void);
> int kvm_mmu_vendor_module_init(void);
>
> , does it help (tests passed on ICX) ?
Yes, that resolves the issues I was seeing. I'll get this applied with the above
squashed.
I'll also see if the tip tree folks would be open to converting the in_{nmi,hardirq,...}()
macros to functions that return bools (or at least casting to bools in the macros).
I can't see any reason for in_nmi() to effectively return an int since it's just
a wrapper to nmi_count(), and this seems like a disaster waiting to happen.
> > If you want any chance of your patches going anywhere but my trash folder, you
> > need to change your upstream workflow to actually run tests. I would give most
> > people the benefit of the doubt, e.g. assume they didn't have the requisite
> > hardware, or didn't realize which tests would be relevant/important. But this
> > is a recurring problem, and you have been warned, multiple times.
>
> Sorry, my CI resources are diverted to other downstream projects.
> But there's no doubt it's my fault and this behavior will be corrected.
Thank you.
next prev parent reply other threads:[~2024-02-27 0:11 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-06 3:20 [PATCH v2] KVM: x86/intr: Explicitly check NMI from guest to eliminate false positives Like Xu
2023-12-06 15:30 ` Sean Christopherson
2023-12-07 2:12 ` Like Xu
2023-12-07 16:31 ` Sean Christopherson
2023-12-07 15:32 ` Maxim Levitsky
2023-12-13 7:28 ` Dongli Zhang
2023-12-13 8:24 ` Like Xu
2023-12-13 17:01 ` Sean Christopherson
2024-02-06 19:38 ` Sean Christopherson
2024-02-06 21:08 ` Sean Christopherson
2024-02-18 9:51 ` Like Xu
2024-02-27 0:11 ` Sean Christopherson [this message]
2024-02-27 2:21 ` 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=Zd0omLAgMu2P3lWX@google.com \
--to=seanjc@google.com \
--cc=ak@linux.intel.com \
--cc=kvm@vger.kernel.org \
--cc=like.xu.linux@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=pbonzini@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.