[PATCH 3/6] KVM: x86: hyper-v: Fix warnings for missing export.h header inclusion

Naman Jain posted 6 patches 4 months ago
[PATCH 3/6] KVM: x86: hyper-v: Fix warnings for missing export.h header inclusion
Posted by Naman Jain 4 months ago
Fix below warning in Hyper-V drivers that comes when kernel is compiled
with W=1 option. Include export.h in driver files to fix it.
* warning: EXPORT_SYMBOL() is used, but #include <linux/export.h>
is missing

Signed-off-by: Naman Jain <namjain@linux.microsoft.com>
---
 arch/x86/kvm/hyperv.c       | 1 +
 arch/x86/kvm/kvm_onhyperv.c | 1 +
 2 files changed, 2 insertions(+)

diff --git a/arch/x86/kvm/hyperv.c b/arch/x86/kvm/hyperv.c
index 24f0318c50d7..09f9de4555dd 100644
--- a/arch/x86/kvm/hyperv.c
+++ b/arch/x86/kvm/hyperv.c
@@ -33,6 +33,7 @@
 #include <linux/sched/cputime.h>
 #include <linux/spinlock.h>
 #include <linux/eventfd.h>
+#include <linux/export.h>
 
 #include <asm/apicdef.h>
 #include <asm/mshyperv.h>
diff --git a/arch/x86/kvm/kvm_onhyperv.c b/arch/x86/kvm/kvm_onhyperv.c
index ded0bd688c65..ba45f8364187 100644
--- a/arch/x86/kvm/kvm_onhyperv.c
+++ b/arch/x86/kvm/kvm_onhyperv.c
@@ -5,6 +5,7 @@
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 
 #include <linux/kvm_host.h>
+#include <linux/export.h>
 #include <asm/mshyperv.h>
 
 #include "hyperv.h"
-- 
2.34.1
Re: [PATCH 3/6] KVM: x86: hyper-v: Fix warnings for missing export.h header inclusion
Posted by Sean Christopherson 4 months ago
On Wed, Jun 11, 2025, Naman Jain wrote:
> Fix below warning in Hyper-V drivers

KVM is quite obviously not a Hyper-V driver.

> that comes when kernel is compiled with W=1 option. Include export.h in
> driver files to fix it.  * warning: EXPORT_SYMBOL() is used, but #include
> <linux/export.h> is missing

NAK.  I agree with Heiko[*], this is absurd.  And if the W=1 change isn't reverted
for some reason, I'd rather "fix" all of KVM in one shot, not update random files
just because of their name.

Sorry.

[*] https://lore.kernel.org/all/20250611075533.8102A57-hca@linux.ibm.com

> Signed-off-by: Naman Jain <namjain@linux.microsoft.com>
> ---
>  arch/x86/kvm/hyperv.c       | 1 +
>  arch/x86/kvm/kvm_onhyperv.c | 1 +
>  2 files changed, 2 insertions(+)
> 
> diff --git a/arch/x86/kvm/hyperv.c b/arch/x86/kvm/hyperv.c
> index 24f0318c50d7..09f9de4555dd 100644
> --- a/arch/x86/kvm/hyperv.c
> +++ b/arch/x86/kvm/hyperv.c
> @@ -33,6 +33,7 @@
>  #include <linux/sched/cputime.h>
>  #include <linux/spinlock.h>
>  #include <linux/eventfd.h>
> +#include <linux/export.h>
>  
>  #include <asm/apicdef.h>
>  #include <asm/mshyperv.h>
> diff --git a/arch/x86/kvm/kvm_onhyperv.c b/arch/x86/kvm/kvm_onhyperv.c
> index ded0bd688c65..ba45f8364187 100644
> --- a/arch/x86/kvm/kvm_onhyperv.c
> +++ b/arch/x86/kvm/kvm_onhyperv.c
> @@ -5,6 +5,7 @@
>  #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
>  
>  #include <linux/kvm_host.h>
> +#include <linux/export.h>
>  #include <asm/mshyperv.h>
>  
>  #include "hyperv.h"
> -- 
> 2.34.1
>
Re: [PATCH 3/6] KVM: x86: hyper-v: Fix warnings for missing export.h header inclusion
Posted by Naman Jain 4 months ago

On 6/11/2025 6:28 PM, Sean Christopherson wrote:
> On Wed, Jun 11, 2025, Naman Jain wrote:
>> Fix below warning in Hyper-V drivers
> 
> KVM is quite obviously not a Hyper-V driver.
> 
>> that comes when kernel is compiled with W=1 option. Include export.h in
>> driver files to fix it.  * warning: EXPORT_SYMBOL() is used, but #include
>> <linux/export.h> is missing
> 
> NAK.  I agree with Heiko[*], this is absurd.  And if the W=1 change isn't reverted
> for some reason, I'd rather "fix" all of KVM in one shot, not update random files
> just because of their name.
> 
> Sorry.
> 
> [*] https://lore.kernel.org/all/20250611075533.8102A57-hca@linux.ibm.com
> 

Sure, thanks for reviewing.

Regards,
Naman

>> Signed-off-by: Naman Jain <namjain@linux.microsoft.com>
>> ---
>>   arch/x86/kvm/hyperv.c       | 1 +
>>   arch/x86/kvm/kvm_onhyperv.c | 1 +
>>   2 files changed, 2 insertions(+)
>>
>> diff --git a/arch/x86/kvm/hyperv.c b/arch/x86/kvm/hyperv.c
>> index 24f0318c50d7..09f9de4555dd 100644
>> --- a/arch/x86/kvm/hyperv.c
>> +++ b/arch/x86/kvm/hyperv.c
>> @@ -33,6 +33,7 @@
>>   #include <linux/sched/cputime.h>
>>   #include <linux/spinlock.h>
>>   #include <linux/eventfd.h>
>> +#include <linux/export.h>
>>   
>>   #include <asm/apicdef.h>
>>   #include <asm/mshyperv.h>
>> diff --git a/arch/x86/kvm/kvm_onhyperv.c b/arch/x86/kvm/kvm_onhyperv.c
>> index ded0bd688c65..ba45f8364187 100644
>> --- a/arch/x86/kvm/kvm_onhyperv.c
>> +++ b/arch/x86/kvm/kvm_onhyperv.c
>> @@ -5,6 +5,7 @@
>>   #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
>>   
>>   #include <linux/kvm_host.h>
>> +#include <linux/export.h>
>>   #include <asm/mshyperv.h>
>>   
>>   #include "hyperv.h"
>> -- 
>> 2.34.1
>>