diff mbox series

x86/kvm: Don't waste kvmclock memory if there is nopv parameter

Message ID 1646727529-11774-1-git-send-email-wanpengli@tencent.com (mailing list archive)
State New, archived
Headers show
Series x86/kvm: Don't waste kvmclock memory if there is nopv parameter | expand

Commit Message

Wanpeng Li March 8, 2022, 8:18 a.m. UTC
From: Wanpeng Li <wanpengli@tencent.com>

When the "nopv" command line parameter is used, it should not waste 
memory for kvmclock.

Signed-off-by: Wanpeng Li <wanpengli@tencent.com>
---
 arch/x86/kernel/kvmclock.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Paolo Bonzini March 8, 2022, 12:13 p.m. UTC | #1
On 3/8/22 09:18, Wanpeng Li wrote:
> From: Wanpeng Li <wanpengli@tencent.com>
> 
> When the "nopv" command line parameter is used, it should not waste
> memory for kvmclock.
> 
> Signed-off-by: Wanpeng Li <wanpengli@tencent.com>
> ---
>   arch/x86/kernel/kvmclock.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/x86/kernel/kvmclock.c b/arch/x86/kernel/kvmclock.c
> index c5caa73..16333ba 100644
> --- a/arch/x86/kernel/kvmclock.c
> +++ b/arch/x86/kernel/kvmclock.c
> @@ -239,7 +239,7 @@ static void __init kvmclock_init_mem(void)
>   
>   static int __init kvm_setup_vsyscall_timeinfo(void)
>   {
> -	if (!kvm_para_available() || !kvmclock)
> +	if (!kvm_para_available() || !kvmclock || nopv)
>   		return 0;
>   
>   	kvmclock_init_mem();

Perhaps instead !kvm_para_available() && nopv should clear the kvmclock 
variable?

Paolo
Wanpeng Li March 9, 2022, 1:36 a.m. UTC | #2
On Tue, 8 Mar 2022 at 20:13, Paolo Bonzini <pbonzini@redhat.com> wrote:
>
> On 3/8/22 09:18, Wanpeng Li wrote:
> > From: Wanpeng Li <wanpengli@tencent.com>
> >
> > When the "nopv" command line parameter is used, it should not waste
> > memory for kvmclock.
> >
> > Signed-off-by: Wanpeng Li <wanpengli@tencent.com>
> > ---
> >   arch/x86/kernel/kvmclock.c | 2 +-
> >   1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/arch/x86/kernel/kvmclock.c b/arch/x86/kernel/kvmclock.c
> > index c5caa73..16333ba 100644
> > --- a/arch/x86/kernel/kvmclock.c
> > +++ b/arch/x86/kernel/kvmclock.c
> > @@ -239,7 +239,7 @@ static void __init kvmclock_init_mem(void)
> >
> >   static int __init kvm_setup_vsyscall_timeinfo(void)
> >   {
> > -     if (!kvm_para_available() || !kvmclock)
> > +     if (!kvm_para_available() || !kvmclock || nopv)
> >               return 0;
> >
> >       kvmclock_init_mem();
>
> Perhaps instead !kvm_para_available() && nopv should clear the kvmclock
> variable?

Do you mean if (!kvm_para_available() && nopv) return 0? I
misunderstand why they are the same. :)

    Wanpeng
Wanpeng Li April 8, 2022, 7:44 a.m. UTC | #3
ping,
On Tue, 8 Mar 2022 at 16:19, Wanpeng Li <kernellwp@gmail.com> wrote:
>
> From: Wanpeng Li <wanpengli@tencent.com>
>
> When the "nopv" command line parameter is used, it should not waste
> memory for kvmclock.
>
> Signed-off-by: Wanpeng Li <wanpengli@tencent.com>
> ---
>  arch/x86/kernel/kvmclock.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/x86/kernel/kvmclock.c b/arch/x86/kernel/kvmclock.c
> index c5caa73..16333ba 100644
> --- a/arch/x86/kernel/kvmclock.c
> +++ b/arch/x86/kernel/kvmclock.c
> @@ -239,7 +239,7 @@ static void __init kvmclock_init_mem(void)
>
>  static int __init kvm_setup_vsyscall_timeinfo(void)
>  {
> -       if (!kvm_para_available() || !kvmclock)
> +       if (!kvm_para_available() || !kvmclock || nopv)
>                 return 0;
>
>         kvmclock_init_mem();
> --
> 2.7.4
>
Paolo Bonzini April 8, 2022, 4:47 p.m. UTC | #4
Queued, thanks.

Paolo
diff mbox series

Patch

diff --git a/arch/x86/kernel/kvmclock.c b/arch/x86/kernel/kvmclock.c
index c5caa73..16333ba 100644
--- a/arch/x86/kernel/kvmclock.c
+++ b/arch/x86/kernel/kvmclock.c
@@ -239,7 +239,7 @@  static void __init kvmclock_init_mem(void)
 
 static int __init kvm_setup_vsyscall_timeinfo(void)
 {
-	if (!kvm_para_available() || !kvmclock)
+	if (!kvm_para_available() || !kvmclock || nopv)
 		return 0;
 
 	kvmclock_init_mem();