From: Sean Christopherson <seanjc@google.com>
To: Isaku Yamahata <isaku.yamahata@gmail.com>
Cc: SU Hang <darcy.sh@antgroup.com>,
kvm@vger.kernel.org, Lai Jiangshan <jiangshan.ljs@antgroup.com>,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
"H. Peter Anvin" <hpa@zytor.com>,
x86@kernel.org, Paolo Bonzini <pbonzini@redhat.com>,
Radim Kr???m?????? <rkrcmar@redhat.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 2/2] KVM: x86/mmu: Derive EPT violation RWX bits from EPTE RWX bits
Date: Fri, 8 Apr 2022 21:32:33 +0000 [thread overview]
Message-ID: <YlCp8RrWeHPt3rJo@google.com> (raw)
In-Reply-To: <20220408211140.GE857847@ls.amr.corp.intel.com>
On Fri, Apr 08, 2022, Isaku Yamahata wrote:
> On Tue, Mar 29, 2022 at 11:01:07AM +0800,
> SU Hang <darcy.sh@antgroup.com> wrote:
>
> > From: Sean Christopherson <seanjc@google.com>
> >
> > Derive the mask of RWX bits reported on EPT violations from the mask of
> > RWX bits that are shoved into EPT entries; the layout is the same, the
> > EPT violation bits are simply shifted by three. Use the new shift and a
> > slight copy-paste of the mask derivation instead of completely open
> > coding the same to convert between the EPT entry bits and the exit
> > qualification when synthesizing a nested EPT Violation.
> >
> > No functional change intended.
> >
> > Cc: SU Hang <darcy.sh@antgroup.com>
> > Signed-off-by: Sean Christopherson <seanjc@google.com>
> > ---
> > arch/x86/include/asm/vmx.h | 7 +------
> > arch/x86/kvm/mmu/paging_tmpl.h | 8 +++++++-
> > arch/x86/kvm/vmx/vmx.c | 4 +---
> > 3 files changed, 9 insertions(+), 10 deletions(-)
> >
> > diff --git a/arch/x86/include/asm/vmx.h b/arch/x86/include/asm/vmx.h
> > index 3586d4aeaac7..46bc7072f6a2 100644
> > --- a/arch/x86/include/asm/vmx.h
> > +++ b/arch/x86/include/asm/vmx.h
> > @@ -543,17 +543,12 @@ enum vm_entry_failure_code {
> > #define EPT_VIOLATION_ACC_READ_BIT 0
> > #define EPT_VIOLATION_ACC_WRITE_BIT 1
> > #define EPT_VIOLATION_ACC_INSTR_BIT 2
> > -#define EPT_VIOLATION_READABLE_BIT 3
> > -#define EPT_VIOLATION_WRITABLE_BIT 4
> > -#define EPT_VIOLATION_EXECUTABLE_BIT 5
> > #define EPT_VIOLATION_GVA_IS_VALID_BIT 7
> > #define EPT_VIOLATION_GVA_TRANSLATED_BIT 8
> > #define EPT_VIOLATION_ACC_READ (1 << EPT_VIOLATION_ACC_READ_BIT)
> > #define EPT_VIOLATION_ACC_WRITE (1 << EPT_VIOLATION_ACC_WRITE_BIT)
> > #define EPT_VIOLATION_ACC_INSTR (1 << EPT_VIOLATION_ACC_INSTR_BIT)
> > -#define EPT_VIOLATION_READABLE (1 << EPT_VIOLATION_READABLE_BIT)
> > -#define EPT_VIOLATION_WRITABLE (1 << EPT_VIOLATION_WRITABLE_BIT)
> > -#define EPT_VIOLATION_EXECUTABLE (1 << EPT_VIOLATION_EXECUTABLE_BIT)
> > +#define EPT_VIOLATION_RWX_MASK (VMX_EPT_RWX_MASK << EPT_VIOLATION_RWX_SHIFT)
>
>
> "#define EPT_VIOLATION_RWX_SHIFT 3" is missing.
> It fails to compile.
>
> CC [M] arch/x86/kvm/vmx/vmx.o
> In file included from linux/arch/x86/include/asm/virtext.h:18,
> from /linux/arch/x86/kvm/vmx/vmx.c:49:
> /linux/arch/x86/kvm/vmx/vmx.c: In function 'handle_ept_violation':
> /linux/arch/x86/include/asm/vmx.h:551:54: error: 'EPT_VIOLATION_RWX_SHIFT' undeclared (first use in this function); did you mean 'EPT_VIOLATION_RWX_MASK'?
> 551 | #define EPT_VIOLATION_RWX_MASK (VMX_EPT_RWX_MASK << EPT_VIOLATION_RWX_SHIFT)
> | ^~~~~~~~~~~~~~~~~~~~~~~
Yeah, not sure how that one line got dropped.
https://lore.kernel.org/all/20220408202815.386932-1-seanjc@google.com
next prev parent reply other threads:[~2022-04-08 21:32 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-29 3:01 [PATCH v2 0/2] KVM: x86: Replace magic number with readable macro SU Hang
2022-03-29 3:01 ` [PATCH v2 1/2] KVM: VMX: replace 0x180 with EPT_VIOLATION_* definition SU Hang
2022-03-29 16:00 ` Sean Christopherson
2022-03-29 3:01 ` [PATCH v2 2/2] KVM: x86/mmu: Derive EPT violation RWX bits from EPTE RWX bits SU Hang
2022-04-08 21:11 ` Isaku Yamahata
2022-04-08 21:32 ` Sean Christopherson [this message]
2022-04-08 16:48 ` [PATCH v2 0/2] KVM: x86: Replace magic number with readable macro Paolo Bonzini
-- strict thread matches above, loose matches on Subject: below --
2022-03-25 0:30 [PATCH 2/2] KVM: X86: use EPT_VIOLATION_* instead of 0x7 Sean Christopherson
2022-04-11 4:55 ` [PATCH v2 2/2] KVM: x86/mmu: Derive EPT violation RWX bits from EPTE RWX bits SU Hang
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=YlCp8RrWeHPt3rJo@google.com \
--to=seanjc@google.com \
--cc=bp@alien8.de \
--cc=darcy.sh@antgroup.com \
--cc=hpa@zytor.com \
--cc=isaku.yamahata@gmail.com \
--cc=jiangshan.ljs@antgroup.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=pbonzini@redhat.com \
--cc=rkrcmar@redhat.com \
--cc=tglx@linutronix.de \
--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