kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] kvm: x86: disable the narrow guest module parameter on unload
@ 2021-06-23 20:34 Aaron Lewis
  2021-06-23 20:47 ` Jim Mattson
  2021-06-23 21:36 ` Paolo Bonzini
  0 siblings, 2 replies; 4+ messages in thread
From: Aaron Lewis @ 2021-06-23 20:34 UTC (permalink / raw)
  To: kvm; +Cc: jmattson, pbonzini, mgamal, Aaron Lewis

When the kvm_intel module unloads the module parameter
'allow_smaller_maxphyaddr' is not cleared because it is also used in the
kvm module.  As a result, if the module parameter's state was set before
kvm_intel unloads, it will also be set when it reloads.  Explicitly
clear the state in vmx_exit() to prevent this from happening.

Signed-off-by: Aaron Lewis <aaronlewis@google.com>
---
 arch/x86/kvm/vmx/vmx.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c
index c2a779b688e6..fd161c9a83fd 100644
--- a/arch/x86/kvm/vmx/vmx.c
+++ b/arch/x86/kvm/vmx/vmx.c
@@ -7996,6 +7996,8 @@ static void vmx_exit(void)
 	}
 #endif
 	vmx_cleanup_l1d_flush();
+
+	allow_smaller_maxphyaddr = false;
 }
 module_exit(vmx_exit);
 
-- 
2.32.0.93.g670b81a890-goog


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] kvm: x86: disable the narrow guest module parameter on unload
  2021-06-23 20:34 [PATCH] kvm: x86: disable the narrow guest module parameter on unload Aaron Lewis
@ 2021-06-23 20:47 ` Jim Mattson
  2021-06-23 21:37   ` Paolo Bonzini
  2021-06-23 21:36 ` Paolo Bonzini
  1 sibling, 1 reply; 4+ messages in thread
From: Jim Mattson @ 2021-06-23 20:47 UTC (permalink / raw)
  To: Aaron Lewis; +Cc: kvm, pbonzini, mgamal

On Wed, Jun 23, 2021 at 1:35 PM Aaron Lewis <aaronlewis@google.com> wrote:
>
> When the kvm_intel module unloads the module parameter
> 'allow_smaller_maxphyaddr' is not cleared because it is also used in the

...because the backing variable is defined in the

(Or something like that.)

> kvm module.  As a result, if the module parameter's state was set before
> kvm_intel unloads, it will also be set when it reloads.  Explicitly
> clear the state in vmx_exit() to prevent this from happening.
>
> Signed-off-by: Aaron Lewis <aaronlewis@google.com>
> ---
>  arch/x86/kvm/vmx/vmx.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c
> index c2a779b688e6..fd161c9a83fd 100644
> --- a/arch/x86/kvm/vmx/vmx.c
> +++ b/arch/x86/kvm/vmx/vmx.c
> @@ -7996,6 +7996,8 @@ static void vmx_exit(void)
>         }
>  #endif
>         vmx_cleanup_l1d_flush();
> +
> +       allow_smaller_maxphyaddr = false;
>  }
>  module_exit(vmx_exit);

This seems reasonable to me. Another option is to move the backing
variable to the kvm_intel module, given the recent suggestion that it
should never be enabled for AMD.

Reviewed-by: Jim Mattson <jmattson@google.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] kvm: x86: disable the narrow guest module parameter on unload
  2021-06-23 20:34 [PATCH] kvm: x86: disable the narrow guest module parameter on unload Aaron Lewis
  2021-06-23 20:47 ` Jim Mattson
@ 2021-06-23 21:36 ` Paolo Bonzini
  1 sibling, 0 replies; 4+ messages in thread
From: Paolo Bonzini @ 2021-06-23 21:36 UTC (permalink / raw)
  To: Aaron Lewis, kvm; +Cc: jmattson, mgamal

On 23/06/21 22:34, Aaron Lewis wrote:
> When the kvm_intel module unloads the module parameter
> 'allow_smaller_maxphyaddr' is not cleared because it is also used in the
> kvm module.  As a result, if the module parameter's state was set before
> kvm_intel unloads, it will also be set when it reloads.  Explicitly
> clear the state in vmx_exit() to prevent this from happening.
> 
> Signed-off-by: Aaron Lewis <aaronlewis@google.com>
> ---
>   arch/x86/kvm/vmx/vmx.c | 2 ++
>   1 file changed, 2 insertions(+)
> 
> diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c
> index c2a779b688e6..fd161c9a83fd 100644
> --- a/arch/x86/kvm/vmx/vmx.c
> +++ b/arch/x86/kvm/vmx/vmx.c
> @@ -7996,6 +7996,8 @@ static void vmx_exit(void)
>   	}
>   #endif
>   	vmx_cleanup_l1d_flush();
> +
> +	allow_smaller_maxphyaddr = false;
>   }
>   module_exit(vmx_exit);
>   
> 

Queued, thanks.

Paolo


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] kvm: x86: disable the narrow guest module parameter on unload
  2021-06-23 20:47 ` Jim Mattson
@ 2021-06-23 21:37   ` Paolo Bonzini
  0 siblings, 0 replies; 4+ messages in thread
From: Paolo Bonzini @ 2021-06-23 21:37 UTC (permalink / raw)
  To: Jim Mattson, Aaron Lewis; +Cc: kvm, mgamal

On 23/06/21 22:47, Jim Mattson wrote:
> This seems reasonable to me. Another option is to move the backing
> variable to the kvm_intel module, given the recent suggestion that it
> should never be enabled for AMD.

Why wouldn't it be enabled for shadow paging, since the issue with AMD 
is specific to the ordering of nested vs. guest page faults?

Paolo


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-06-23 21:38 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-23 20:34 [PATCH] kvm: x86: disable the narrow guest module parameter on unload Aaron Lewis
2021-06-23 20:47 ` Jim Mattson
2021-06-23 21:37   ` Paolo Bonzini
2021-06-23 21:36 ` Paolo Bonzini

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 NNTP newsgroup(s).