* [PATCH v2] x86/svm: Decouple types in struct nestedsvm
@ 2023-02-27 11:35 Andrew Cooper
2023-02-27 11:41 ` Jan Beulich
0 siblings, 1 reply; 3+ messages in thread
From: Andrew Cooper @ 2023-02-27 11:35 UTC (permalink / raw
To: Xen-devel; +Cc: Andrew Cooper, Jan Beulich, Xenia Ragiadakou
struct nestedvm uses mostly plain integer types, except for virt_ext_t which
is a union wrapping two bitfield names.
However, it turns out that this is a write-only variable. Delete it, allowing
us to drop the include of vmcb.h
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
CC: Jan Beulich <JBeulich@suse.com>
CC: Xenia Ragiadakou <burzalodowa@gmail.com>
v2:
* Delete the variable entirely.
This probably means that nested lbr/vmloadsave is broken, but that wouldn't be
a surprise at all.
---
xen/arch/x86/hvm/svm/nestedsvm.c | 5 -----
xen/arch/x86/include/asm/hvm/svm/nestedsvm.h | 5 -----
2 files changed, 10 deletions(-)
diff --git a/xen/arch/x86/hvm/svm/nestedsvm.c b/xen/arch/x86/hvm/svm/nestedsvm.c
index 92316c6624ce..63ed9fc248e1 100644
--- a/xen/arch/x86/hvm/svm/nestedsvm.c
+++ b/xen/arch/x86/hvm/svm/nestedsvm.c
@@ -164,7 +164,6 @@ int cf_check nsvm_vcpu_reset(struct vcpu *v)
svm->ns_exception_intercepts = 0;
svm->ns_general1_intercepts = 0;
svm->ns_general2_intercepts = 0;
- svm->ns_virt_ext.bytes = 0;
svm->ns_hap_enabled = 0;
svm->ns_vmcb_guestcr3 = 0;
@@ -524,10 +523,6 @@ static int nsvm_vmcb_prepare4vmrun(struct vcpu *v, struct cpu_user_regs *regs)
/* Pending Interrupts */
n2vmcb->event_inj = ns_vmcb->event_inj;
- /* LBR and other virtualization */
- if ( !clean.lbr )
- svm->ns_virt_ext = ns_vmcb->virt_ext;
-
n2vmcb->virt_ext.bytes =
n1vmcb->virt_ext.bytes | ns_vmcb->virt_ext.bytes;
diff --git a/xen/arch/x86/include/asm/hvm/svm/nestedsvm.h b/xen/arch/x86/include/asm/hvm/svm/nestedsvm.h
index 94d45d2e8d47..230f818df80c 100644
--- a/xen/arch/x86/include/asm/hvm/svm/nestedsvm.h
+++ b/xen/arch/x86/include/asm/hvm/svm/nestedsvm.h
@@ -20,8 +20,6 @@
#include <xen/types.h>
-#include <asm/hvm/svm/vmcb.h>
-
struct nestedsvm {
bool ns_gif;
uint64_t ns_msr_hsavepa; /* MSR HSAVE_PA value */
@@ -43,9 +41,6 @@ struct nestedsvm {
uint32_t ns_general1_intercepts;
uint32_t ns_general2_intercepts;
- /* Cached real lbr and other virtual extentions of the l2 guest */
- virt_ext_t ns_virt_ext;
-
/* Cached real MSR permission bitmaps of the l2 guest */
unsigned long *ns_cached_msrpm;
/* Merged MSR permission bitmap */
--
2.30.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2] x86/svm: Decouple types in struct nestedsvm
2023-02-27 11:35 [PATCH v2] x86/svm: Decouple types in struct nestedsvm Andrew Cooper
@ 2023-02-27 11:41 ` Jan Beulich
2023-02-27 11:44 ` Andrew Cooper
0 siblings, 1 reply; 3+ messages in thread
From: Jan Beulich @ 2023-02-27 11:41 UTC (permalink / raw
To: Andrew Cooper; +Cc: Xenia Ragiadakou, Xen-devel
On 27.02.2023 12:35, Andrew Cooper wrote:
> struct nestedvm uses mostly plain integer types, except for virt_ext_t which
> is a union wrapping two bitfield names.
>
> However, it turns out that this is a write-only variable. Delete it, allowing
> us to drop the include of vmcb.h
>
> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
> ---
> CC: Jan Beulich <JBeulich@suse.com>
> CC: Xenia Ragiadakou <burzalodowa@gmail.com>
>
> v2:
> * Delete the variable entirely.
>
> This probably means that nested lbr/vmloadsave is broken, but that wouldn't be
> a surprise at all.
Well, yes, short of figuring out what's missing this is probably the least
bad option:
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Jan
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] x86/svm: Decouple types in struct nestedsvm
2023-02-27 11:41 ` Jan Beulich
@ 2023-02-27 11:44 ` Andrew Cooper
0 siblings, 0 replies; 3+ messages in thread
From: Andrew Cooper @ 2023-02-27 11:44 UTC (permalink / raw
To: Jan Beulich; +Cc: Xenia Ragiadakou, Xen-devel
On 27/02/2023 11:41 am, Jan Beulich wrote:
> On 27.02.2023 12:35, Andrew Cooper wrote:
>> struct nestedvm uses mostly plain integer types, except for virt_ext_t which
>> is a union wrapping two bitfield names.
>>
>> However, it turns out that this is a write-only variable. Delete it, allowing
>> us to drop the include of vmcb.h
>>
>> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
>> ---
>> CC: Jan Beulich <JBeulich@suse.com>
>> CC: Xenia Ragiadakou <burzalodowa@gmail.com>
>>
>> v2:
>> * Delete the variable entirely.
>>
>> This probably means that nested lbr/vmloadsave is broken, but that wouldn't be
>> a surprise at all.
> Well, yes, short of figuring out what's missing this is probably the least
> bad option:
> Reviewed-by: Jan Beulich <jbeulich@suse.com>
Thanks.
I'm pretty certain a working version of nested virt won't need this
cached information like this at all. I'm pretty sure it's buggy not to
be referencing the appropriate one of the 3 relevant VMCBs.
~Andrew
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-02-27 11:45 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-02-27 11:35 [PATCH v2] x86/svm: Decouple types in struct nestedsvm Andrew Cooper
2023-02-27 11:41 ` Jan Beulich
2023-02-27 11:44 ` Andrew Cooper
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 read-only IMAP folder(s) and NNTP newsgroup(s).