linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] KVM: Remove unnecessary export of kvm_{inc,dec}_notifier_count()
@ 2021-09-02 17:59 Sean Christopherson
  2021-09-05  7:12 ` Maxim Levitsky
  0 siblings, 1 reply; 3+ messages in thread
From: Sean Christopherson @ 2021-09-02 17:59 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: kvm, linux-kernel, Maxim Levitsky, Sean Christopherson

Don't export KVM's MMU notifier count helpers, under no circumstance
should any downstream module, including x86's vendor code, have a
legitimate reason to piggyback KVM's MMU notifier logic.  E.g in the x86
case, only KVM's MMU should be elevating the notifier count, and that
code is always built into the core kvm.ko module.

Fixes: edb298c663fc ("KVM: x86/mmu: bump mmu notifier count in kvm_zap_gfn_range")
Cc: Maxim Levitsky <mlevitsk@redhat.com>
Signed-off-by: Sean Christopherson <seanjc@google.com>
---
 virt/kvm/kvm_main.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index 3e67c93ca403..140c7d311021 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -638,7 +638,6 @@ void kvm_inc_notifier_count(struct kvm *kvm, unsigned long start,
 			max(kvm->mmu_notifier_range_end, end);
 	}
 }
-EXPORT_SYMBOL_GPL(kvm_inc_notifier_count);
 
 static int kvm_mmu_notifier_invalidate_range_start(struct mmu_notifier *mn,
 					const struct mmu_notifier_range *range)
@@ -690,8 +689,6 @@ void kvm_dec_notifier_count(struct kvm *kvm, unsigned long start,
 	 */
 	kvm->mmu_notifier_count--;
 }
-EXPORT_SYMBOL_GPL(kvm_dec_notifier_count);
-
 
 static void kvm_mmu_notifier_invalidate_range_end(struct mmu_notifier *mn,
 					const struct mmu_notifier_range *range)
-- 
2.33.0.153.gba50c8fa24-goog


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

* Re: [PATCH] KVM: Remove unnecessary export of kvm_{inc,dec}_notifier_count()
  2021-09-02 17:59 [PATCH] KVM: Remove unnecessary export of kvm_{inc,dec}_notifier_count() Sean Christopherson
@ 2021-09-05  7:12 ` Maxim Levitsky
  2021-09-06 10:21   ` Paolo Bonzini
  0 siblings, 1 reply; 3+ messages in thread
From: Maxim Levitsky @ 2021-09-05  7:12 UTC (permalink / raw)
  To: Sean Christopherson, Paolo Bonzini; +Cc: kvm, linux-kernel

On Thu, 2021-09-02 at 10:59 -0700, Sean Christopherson wrote:
> Don't export KVM's MMU notifier count helpers, under no circumstance
> should any downstream module, including x86's vendor code, have a
> legitimate reason to piggyback KVM's MMU notifier logic.  E.g in the x86
> case, only KVM's MMU should be elevating the notifier count, and that
> code is always built into the core kvm.ko module.
> 
> Fixes: edb298c663fc ("KVM: x86/mmu: bump mmu notifier count in kvm_zap_gfn_range")
> Cc: Maxim Levitsky <mlevitsk@redhat.com>
> Signed-off-by: Sean Christopherson <seanjc@google.com>
> ---
>  virt/kvm/kvm_main.c | 3 ---
>  1 file changed, 3 deletions(-)
> 
> diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
> index 3e67c93ca403..140c7d311021 100644
> --- a/virt/kvm/kvm_main.c
> +++ b/virt/kvm/kvm_main.c
> @@ -638,7 +638,6 @@ void kvm_inc_notifier_count(struct kvm *kvm, unsigned long start,
>  			max(kvm->mmu_notifier_range_end, end);
>  	}
>  }
> -EXPORT_SYMBOL_GPL(kvm_inc_notifier_count);
>  
>  static int kvm_mmu_notifier_invalidate_range_start(struct mmu_notifier *mn,
>  					const struct mmu_notifier_range *range)
> @@ -690,8 +689,6 @@ void kvm_dec_notifier_count(struct kvm *kvm, unsigned long start,
>  	 */
>  	kvm->mmu_notifier_count--;
>  }
> -EXPORT_SYMBOL_GPL(kvm_dec_notifier_count);
> -
>  
>  static void kvm_mmu_notifier_invalidate_range_end(struct mmu_notifier *mn,
>  					const struct mmu_notifier_range *range)

Ah, I somehow thought when I wrote this that those two will be used by kvm_amd.

Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com>

Best regards,
	Maxim Levitsky


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

* Re: [PATCH] KVM: Remove unnecessary export of kvm_{inc,dec}_notifier_count()
  2021-09-05  7:12 ` Maxim Levitsky
@ 2021-09-06 10:21   ` Paolo Bonzini
  0 siblings, 0 replies; 3+ messages in thread
From: Paolo Bonzini @ 2021-09-06 10:21 UTC (permalink / raw)
  To: Maxim Levitsky, Sean Christopherson; +Cc: kvm, linux-kernel

On 05/09/21 09:12, Maxim Levitsky wrote:
> On Thu, 2021-09-02 at 10:59 -0700, Sean Christopherson wrote:
>> Don't export KVM's MMU notifier count helpers, under no circumstance
>> should any downstream module, including x86's vendor code, have a
>> legitimate reason to piggyback KVM's MMU notifier logic.  E.g in the x86
>> case, only KVM's MMU should be elevating the notifier count, and that
>> code is always built into the core kvm.ko module.
>>
>> Fixes: edb298c663fc ("KVM: x86/mmu: bump mmu notifier count in kvm_zap_gfn_range")
>> Cc: Maxim Levitsky <mlevitsk@redhat.com>
>> Signed-off-by: Sean Christopherson <seanjc@google.com>
>> ---
>>   virt/kvm/kvm_main.c | 3 ---
>>   1 file changed, 3 deletions(-)
>>
>> diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
>> index 3e67c93ca403..140c7d311021 100644
>> --- a/virt/kvm/kvm_main.c
>> +++ b/virt/kvm/kvm_main.c
>> @@ -638,7 +638,6 @@ void kvm_inc_notifier_count(struct kvm *kvm, unsigned long start,
>>   			max(kvm->mmu_notifier_range_end, end);
>>   	}
>>   }
>> -EXPORT_SYMBOL_GPL(kvm_inc_notifier_count);
>>   
>>   static int kvm_mmu_notifier_invalidate_range_start(struct mmu_notifier *mn,
>>   					const struct mmu_notifier_range *range)
>> @@ -690,8 +689,6 @@ void kvm_dec_notifier_count(struct kvm *kvm, unsigned long start,
>>   	 */
>>   	kvm->mmu_notifier_count--;
>>   }
>> -EXPORT_SYMBOL_GPL(kvm_dec_notifier_count);
>> -
>>   
>>   static void kvm_mmu_notifier_invalidate_range_end(struct mmu_notifier *mn,
>>   					const struct mmu_notifier_range *range)
> 
> Ah, I somehow thought when I wrote this that those two will be used by kvm_amd.
> 
> Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com>
> 
> Best regards,
> 	Maxim Levitsky
> 

Queued, thanks.

Paolo


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

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

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-02 17:59 [PATCH] KVM: Remove unnecessary export of kvm_{inc,dec}_notifier_count() Sean Christopherson
2021-09-05  7:12 ` Maxim Levitsky
2021-09-06 10:21   ` 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).