linux-coco.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: Sean Christopherson <seanjc@google.com>
To: isaku.yamahata@intel.com
Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
	 isaku.yamahata@gmail.com, Michael Roth <michael.roth@amd.com>,
	 Paolo Bonzini <pbonzini@redhat.com>,
	linux-coco@lists.linux.dev,
	 Chao Peng <chao.p.peng@linux.intel.com>
Subject: Re: [PATCH 09/12] KVM: X86: Add debugfs to inject machine check on VM exit
Date: Thu, 19 Oct 2023 17:38:12 -0700	[thread overview]
Message-ID: <ZTHL9NQ87LNdB8qk@google.com> (raw)
In-Reply-To: <47c8a177d81762e0561fc47cc274076de901edbf.1696926843.git.isaku.yamahata@intel.com>

On Tue, Oct 10, 2023, isaku.yamahata@intel.com wrote:
> From: Isaku Yamahata <isaku.yamahata@intel.com>
> 
> The KVM/x86 handles machine-check in the guest specially.  It sets up the
> guest so that vcpu exits from running guests, checks the exit reason and,
> manually raises the machine check by calling do_machine_check().
> 
> To test the KVM machine check execution path, KVM wants to inject the
> machine check in the context of vcpu instead of the context of the process
> of MCE injection.  Wire up the MCE injection framework for KVM to trigger
> MCE in the vcpu context.  Add a kvm vcpu debugfs entry for an operator to
> tell KVM to inject MCE.

But this isn't "injecting" a #MC, it's just having KVM call do_machine_check()
before enabling IRQs after a VM-Exit.  I don't see how that is interesting enough
to warrant a dedicated knob and code in KVM's run loop.

> @@ -10814,6 +10823,11 @@ static int vcpu_enter_guest(struct kvm_vcpu *vcpu)
>  		fpu_sync_guest_vmexit_xfd_state();
>  
>  	static_call(kvm_x86_handle_exit_irqoff)(vcpu);
> +	if (unlikely(req_mce_inject)) {
> +		mce_call_atomic_injector_chain(smp_processor_id());
> +		kvm_machine_check();
> +		mce_inject_unlock();
> +	}
>  
>  	if (vcpu->arch.guest_fpu.xfd_err)
>  		wrmsrl(MSR_IA32_XFD_ERR, 0);
> -- 
> 2.25.1
> 

  reply	other threads:[~2023-10-20  0:38 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-10  8:35 [PATCH 00/12] x86/mce, KVM: X86: KVM memory poison and MCE injector support isaku.yamahata
2023-10-10  8:35 ` [PATCH 01/12] x86/mce: Fix hw MCE injection feature detection isaku.yamahata
2023-10-13 15:05   ` Dave Hansen
2023-10-10  8:35 ` [PATCH 02/12] X86/mce/inject: Add mcgstatus for mce-inject debugfs isaku.yamahata
2023-10-10  8:35 ` [PATCH 03/12] x86/mce/inject: Add notrigger entry to suppress MCE injection isaku.yamahata
2023-10-10  8:35 ` [PATCH 04/12] x86/mce: Move and export inject_mce() from inject.c to core.c isaku.yamahata
2023-10-10  8:35 ` [PATCH 05/12] mm/fadvise: Add flags to inject hwpoison for posix_fadvise() isaku.yamahata
2023-10-10  8:35 ` [PATCH 06/12] mm/fadvise: Add FADV_MCE_INJECT flag " isaku.yamahata
2023-10-10  8:35 ` [PATCH 07/12] x86/mce/inject: Wire up the x86 MCE injector to FADV_MCE_INJECT isaku.yamahata
2023-10-10  8:35 ` [PATCH 08/12] x86/mce: Define a notifier chain for mce injector isaku.yamahata
2023-10-10  8:35 ` [PATCH 09/12] KVM: X86: Add debugfs to inject machine check on VM exit isaku.yamahata
2023-10-20  0:38   ` Sean Christopherson [this message]
2023-10-10  8:35 ` [PATCH 10/12] KVM: selftests: Allow mapping guest memory without host alias isaku.yamahata
2023-10-10  8:35 ` [PATCH 11/12] KVM: selftests: lib: Add src memory type for hwpoison test isaku.yamahata
2023-10-10  8:35 ` [PATCH 12/12] KVM: selftests: hwpoison/mce failure injection isaku.yamahata

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=ZTHL9NQ87LNdB8qk@google.com \
    --to=seanjc@google.com \
    --cc=chao.p.peng@linux.intel.com \
    --cc=isaku.yamahata@gmail.com \
    --cc=isaku.yamahata@intel.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-coco@lists.linux.dev \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michael.roth@amd.com \
    --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 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).