From: Dave Hansen <dave.hansen@intel.com>
To: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
Cc: 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,
seanjc@google.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 11:14:13 -0700 [thread overview]
Message-ID: <c761e774-8014-6fa9-cf21-e7cd8f7aca54@intel.com> (raw)
In-Reply-To: <20220517174042.v6s7wm3u5j2ebaoq@black.fi.intel.com>
On 5/17/22 10:40, Kirill A. Shutemov wrote:
>>
>> ve_info is a software structure. Why not just add a:
>>
>> bool ip_adjusted;
>>
>> which defaults to false, then we have:
>>
>> /*
>> * Adjust RIP if the exception was handled
>> * but RIP was not adjusted.
>> */
>> if (!ret && !ve_info->ip_adjusted)
>> regs->ip += ve_info->instr_len;
>>
>> One other oddity I just stumbled upon:
>>
>> static bool handle_mmio(struct pt_regs *regs, struct ve_info *ve)
>> {
>> ...
>> ve->instr_len = insn.length;
>>
>> Why does that need to override 've->instr_len'? What was wrong with the
>> gunk in r10 that came out of TDX_GET_VEINFO?
> TDX module doesn't decode MMIO instruction and does not provide valid size
> of it. We had to do it manually, based on decoding.
That's worth a comment, don't you think? I'd add one both in where the
ve_info is filled and where ve->instr_len is adjusted.
> Given that we had to adjust IP in handle_mmio() anyway, do you still think
> "ve->instr_len = 0;" is wrong? I dislike ip_adjusted more.
Something is wrong about it.
You could call it 've->instr_bytes_to_handle' or something. Then it
makes actual logical sense when you handle it to zero it out. I just
want it to be more explicit when the upper levels need to do something.
Does ve->instr_len==0 both when the TDX module isn't providing
instruction sizes *and* when no handling is necessary? That seems like
an unfortunate logical multiplexing of 0.
next prev parent reply other threads:[~2022-05-17 18:15 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-17 15:30 [PATCH] x86/tdx: Handle load_unaligned_zeropad() page-cross to a shared page 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 [this message]
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
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=c761e774-8014-6fa9-cf21-e7cd8f7aca54@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