mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Wilczynski, Michal" <michal.wilczynski@intel.com>
To: Yunhong Jiang <yunhong.jiang@linux.intel.com>
Cc: <seanjc@google.com>, <pbonzini@redhat.com>, <mlevitsk@redhat.com>,
	<tglx@linutronix.de>, <mingo@redhat.com>, <bp@alien8.de>,
	<dave.hansen@linux.intel.com>, <x86@kernel.org>, <hpa@zytor.com>,
	<kvm@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<dedekind1@gmail.com>, <yuan.yao@intel.com>,
	Zheyu Ma <zheyuma97@gmail.com>
Subject: Re: [PATCH v2] KVM: x86: nSVM/nVMX: Fix handling triple fault on RSM instruction
Date: Tue, 30 Jan 2024 21:07:37 +0100	[thread overview]
Message-ID: <e78d535c-172a-42d2-a946-d648f6b7259e@intel.com> (raw)
In-Reply-To: <20240125005710.GA8443@yjiang5-mobl.amr.corp.intel.com>



On 1/25/2024 1:57 AM, Yunhong Jiang wrote:
> On Tue, Jan 23, 2024 at 02:15:55AM +0200, Michal Wilczynski wrote:
>> To resolve this, introduce a new emulator flag indicating the need for
>> HW VM-Enter to complete emulating RSM. Based on this flag, a decision can
>> be made in vendor-specific triple fault handlers about whether
>> nested_pending_run needs to be cleared.
> Would it be ok to move the followed emulator_leave_smm() code into
> vmx_leave_smm, before setting nested_run_pending bit? It avoids changing
> the generic emulator code.
> 
> #ifdef CONFIG_X86_64
>         if (guest_cpuid_has(vcpu, X86_FEATURE_LM))
>                 return rsm_load_state_64(ctxt, &smram.smram64);
>         else
> #endif
>                 return rsm_load_state_32(ctxt, &smram.smram32);
> 
> --jyh
> 

Moving rsm_load_state_* to the vendor structs would be architecturally
incorrect as vendor callbacks should only do vendor specific stuff, and
recovering state from SMRAM is VMX/SVM independent, and should be kept
that way.

nested_pending_run is unfortunately buried in vendor-specific structs so
it's zeroeing has to be done in vendor specific callbacks.

The way I structured this fix is hopefully in line with the discussion
under v1 of this patch, where Sean gave some background on the code and
proposed ways to fix.

Thanks for your input !
Michał


  reply	other threads:[~2024-01-30 20:07 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-23  0:15 Michal Wilczynski
2024-01-25  0:57 ` Yunhong Jiang
2024-01-30 20:07   ` Wilczynski, Michal [this message]
2024-02-08 10:31   ` Paolo Bonzini
2024-02-08 13:18     ` Wilczynski, Michal
2024-02-08 17:45       ` Paolo Bonzini
2024-02-09 15:04         ` Sean Christopherson
2024-02-09 22:03           ` Paolo Bonzini
2024-02-08  9:04 ` Wilczynski, Michal

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=e78d535c-172a-42d2-a946-d648f6b7259e@intel.com \
    --to=michal.wilczynski@intel.com \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=dedekind1@gmail.com \
    --cc=hpa@zytor.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=mlevitsk@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=seanjc@google.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    --cc=yuan.yao@intel.com \
    --cc=yunhong.jiang@linux.intel.com \
    --cc=zheyuma97@gmail.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

all inboxes | Powered by JetHome®