From: Dave Hansen <dave.hansen@intel.com>
To: Sean Christopherson <seanjc@google.com>
Cc: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
tglx@linutronix.de, mingo@redhat.com, bp@alien8.de,
luto@kernel.org, peterz@infradead.org,
sathyanarayanan.kuppuswamy@linux.intel.com, ak@linux.intel.com,
dan.j.williams@intel.com, david@redhat.com, hpa@zytor.com,
thomas.lendacky@amd.com, x86@kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] x86/tdx: Handle load_unaligned_zeropad() page-cross to a shared page
Date: Tue, 17 May 2022 15:52:03 -0700 [thread overview]
Message-ID: <4ee65514-2b08-9ca8-84e8-92a6ab1d9652@intel.com> (raw)
In-Reply-To: <YoQkTtrMiU2bff9i@google.com>
On 5/17/22 15:40, Sean Christopherson wrote:
> On Tue, May 17, 2022, Dave Hansen wrote:
>> The SDM makes it sound like we should be more judicious about using
>> 've->instr_len' though. "All VM exits other than those listed in the
>> above items leave this field undefined." Looking over
>> virt_exception_kernel(), we've got five cases from CPU instructions that
>> cause unconditional VMEXITs:
>
> None of the below exit unconditionally.
...
> For fault-like VM exits due to attempts to execute one of the following
> instructions that cause VM exits unconditionally or based on the settings of
> VM-execution controls.
Ahh, got it, thanks. I bailed on reading that sentence before I got to
the "VM-execution controls" bit.
>> Then handle_mmio() can say:
>>
>> /*
>> * VM-exit instruction length is not provided for the EPT
>> * violations that MMIO causes. Use the insn_decode() length:
>
> This is inaccurate. The instruction length _is_ provided on EPT Violation VM-Exits
> (it's also provided by all Intel CPUs on EPT Misconfigs even though the SDM doesn't
> say so).
>
> The instruction length is wrong in the TDX case because there is no EPT Violation
> VM-Exit. The EPT Violation is morphed to a #VE by the CPU, and the instruction
> length isn't one of the fields that's saved into the #VE info struct by the CPU.
> When the TDX Module gets control on the TDCALL, VMCS.INSTRUCTION_LENGTH will hold
> the length of the TDCALL, not the instruction that caused the #VE, i.e. the TDX
> Module can't provide the correct length.
>
> For all other #VE cases in TDX, the #VE is injected by software (TDX module) after
> the instruction-based VM-Exit. Before injecting the #VE, the TDX module grabs the
> length from the VMCS and manually records it in the #VE info struct.
That's horribly entertaining background. :)
But, it doesn't get us much closer to deciding when we can consume the
instruction length out of the ve_info. It seems like magic that jut
happens to work at the moment.
next prev parent reply other threads:[~2022-05-17 22:52 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-17 15:30 Kirill A. Shutemov
2022-05-17 16:36 ` Dave Hansen
2022-05-17 17:40 ` Kirill A. Shutemov
2022-05-17 18:14 ` Dave Hansen
2022-05-17 20:17 ` Kirill A. Shutemov
2022-05-17 22:16 ` Dave Hansen
2022-05-17 22:40 ` Sean Christopherson
2022-05-17 22:52 ` Dave Hansen [this message]
2022-05-17 22:52 ` Sean Christopherson
2022-05-19 18:19 ` Kirill A. Shutemov
2022-05-19 18:35 ` Dave Hansen
2022-05-19 18:07 ` Kirill A. Shutemov
2022-05-19 18:33 ` Dave Hansen
2022-05-18 8:39 ` David Laight
2022-05-18 12:18 ` Kirill A. Shutemov
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=4ee65514-2b08-9ca8-84e8-92a6ab1d9652@intel.com \
--to=dave.hansen@intel.com \
--cc=ak@linux.intel.com \
--cc=bp@alien8.de \
--cc=dan.j.williams@intel.com \
--cc=david@redhat.com \
--cc=hpa@zytor.com \
--cc=kirill.shutemov@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=sathyanarayanan.kuppuswamy@linux.intel.com \
--cc=seanjc@google.com \
--cc=tglx@linutronix.de \
--cc=thomas.lendacky@amd.com \
--cc=x86@kernel.org \
/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®