mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] LoongArch: KVM: Move some variable declaration to file paravirt.h
@ 2026-05-08  1:30 Bibo Mao
  2026-05-08  2:56 ` Huacai Chen
  0 siblings, 1 reply; 8+ messages in thread
From: Bibo Mao @ 2026-05-08  1:30 UTC (permalink / raw)
  To: Huacai Chen; +Cc: kernel, kvm, loongarch, linux-kernel, kernel test robot

Some variables relative with paravirt feature are declared in header file
asm/qspinlock.h, however this file can be included only when option
CONFIG_SMP is on. There is compiling warning if CONFIG_SMP is off since
it is not declared.

Move these variable declaration to header file asm/paravirt.h to avoid
compiling warning.

Fixes: c43dce6f13fb ("LoongArch: KVM: Make vcpu_is_preempted() as a macro rather than function")
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202605061313.O8Hswm2b-lkp@intel.com/
Signed-off-by: Bibo Mao <maobibo@loongson.cn>
---
 arch/loongarch/include/asm/paravirt.h  | 4 ++++
 arch/loongarch/include/asm/qspinlock.h | 5 +----
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/arch/loongarch/include/asm/paravirt.h b/arch/loongarch/include/asm/paravirt.h
index 0111f0ad5f73..dbc64908017f 100644
--- a/arch/loongarch/include/asm/paravirt.h
+++ b/arch/loongarch/include/asm/paravirt.h
@@ -3,6 +3,10 @@
 #define _ASM_LOONGARCH_PARAVIRT_H
 
 #ifdef CONFIG_PARAVIRT
+#include <linux/jump_label.h>
+DECLARE_STATIC_KEY_FALSE(virt_preempt_key);
+DECLARE_STATIC_KEY_FALSE(virt_spin_lock_key);
+DECLARE_PER_CPU(struct kvm_steal_time, steal_time);
 
 int __init pv_ipi_init(void);
 int __init pv_time_init(void);
diff --git a/arch/loongarch/include/asm/qspinlock.h b/arch/loongarch/include/asm/qspinlock.h
index 0ee15b3b3937..fbfc6be82f26 100644
--- a/arch/loongarch/include/asm/qspinlock.h
+++ b/arch/loongarch/include/asm/qspinlock.h
@@ -3,12 +3,9 @@
 #define _ASM_LOONGARCH_QSPINLOCK_H
 
 #include <asm/kvm_para.h>
-#include <linux/jump_label.h>
+#include <asm/paravirt.h>
 
 #ifdef CONFIG_PARAVIRT
-DECLARE_STATIC_KEY_FALSE(virt_preempt_key);
-DECLARE_STATIC_KEY_FALSE(virt_spin_lock_key);
-DECLARE_PER_CPU(struct kvm_steal_time, steal_time);
 
 #define virt_spin_lock virt_spin_lock
 

base-commit: 74fe02ce122a6103f207d29fafc8b3a53de6abaf
-- 
2.39.3


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

* Re: [PATCH] LoongArch: KVM: Move some variable declaration to file paravirt.h
  2026-05-08  1:30 [PATCH] LoongArch: KVM: Move some variable declaration to file paravirt.h Bibo Mao
@ 2026-05-08  2:56 ` Huacai Chen
  2026-05-08  3:05   ` Bibo Mao
  0 siblings, 1 reply; 8+ messages in thread
From: Huacai Chen @ 2026-05-08  2:56 UTC (permalink / raw)
  To: Bibo Mao; +Cc: kernel, kvm, loongarch, linux-kernel, kernel test robot

Hi, Bibo,

On Fri, May 8, 2026 at 9:30 AM Bibo Mao <maobibo@loongson.cn> wrote:
>
> Some variables relative with paravirt feature are declared in header file
> asm/qspinlock.h, however this file can be included only when option
> CONFIG_SMP is on. There is compiling warning if CONFIG_SMP is off since
> it is not declared.
>
> Move these variable declaration to header file asm/paravirt.h to avoid
> compiling warning.
Have you reproduced the warning? I cannot reproduce it in my
environment with the config file from lkp report, so I also cannot
confirm whether it is fixed.

Another question:
Is paravirt.h a better place than kvm_para.h?

Huacai

>
> Fixes: c43dce6f13fb ("LoongArch: KVM: Make vcpu_is_preempted() as a macro rather than function")
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202605061313.O8Hswm2b-lkp@intel.com/
> Signed-off-by: Bibo Mao <maobibo@loongson.cn>
> ---
>  arch/loongarch/include/asm/paravirt.h  | 4 ++++
>  arch/loongarch/include/asm/qspinlock.h | 5 +----
>  2 files changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/arch/loongarch/include/asm/paravirt.h b/arch/loongarch/include/asm/paravirt.h
> index 0111f0ad5f73..dbc64908017f 100644
> --- a/arch/loongarch/include/asm/paravirt.h
> +++ b/arch/loongarch/include/asm/paravirt.h
> @@ -3,6 +3,10 @@
>  #define _ASM_LOONGARCH_PARAVIRT_H
>
>  #ifdef CONFIG_PARAVIRT
> +#include <linux/jump_label.h>
> +DECLARE_STATIC_KEY_FALSE(virt_preempt_key);
> +DECLARE_STATIC_KEY_FALSE(virt_spin_lock_key);
> +DECLARE_PER_CPU(struct kvm_steal_time, steal_time);
>
>  int __init pv_ipi_init(void);
>  int __init pv_time_init(void);
> diff --git a/arch/loongarch/include/asm/qspinlock.h b/arch/loongarch/include/asm/qspinlock.h
> index 0ee15b3b3937..fbfc6be82f26 100644
> --- a/arch/loongarch/include/asm/qspinlock.h
> +++ b/arch/loongarch/include/asm/qspinlock.h
> @@ -3,12 +3,9 @@
>  #define _ASM_LOONGARCH_QSPINLOCK_H
>
>  #include <asm/kvm_para.h>
> -#include <linux/jump_label.h>
> +#include <asm/paravirt.h>
>
>  #ifdef CONFIG_PARAVIRT
> -DECLARE_STATIC_KEY_FALSE(virt_preempt_key);
> -DECLARE_STATIC_KEY_FALSE(virt_spin_lock_key);
> -DECLARE_PER_CPU(struct kvm_steal_time, steal_time);
>
>  #define virt_spin_lock virt_spin_lock
>
>
> base-commit: 74fe02ce122a6103f207d29fafc8b3a53de6abaf
> --
> 2.39.3
>

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

* Re: [PATCH] LoongArch: KVM: Move some variable declaration to file paravirt.h
  2026-05-08  2:56 ` Huacai Chen
@ 2026-05-08  3:05   ` Bibo Mao
  2026-05-08  3:11     ` Huacai Chen
  0 siblings, 1 reply; 8+ messages in thread
From: Bibo Mao @ 2026-05-08  3:05 UTC (permalink / raw)
  To: Huacai Chen; +Cc: kernel, kvm, loongarch, linux-kernel, kernel test robot



On 2026/5/8 上午10:56, Huacai Chen wrote:
> Hi, Bibo,
> 
> On Fri, May 8, 2026 at 9:30 AM Bibo Mao <maobibo@loongson.cn> wrote:
>>
>> Some variables relative with paravirt feature are declared in header file
>> asm/qspinlock.h, however this file can be included only when option
>> CONFIG_SMP is on. There is compiling warning if CONFIG_SMP is off since
>> it is not declared.
>>
>> Move these variable declaration to header file asm/paravirt.h to avoid
>> compiling warning.
> Have you reproduced the warning? I cannot reproduce it in my
> environment with the config file from lkp report, so I also cannot
> confirm whether it is fixed.
yes, I can reproduce this and it is fixed. The warning is reported from 
sparse tool, rather than LLVM.
> 
> Another question:
> Is paravirt.h a better place than kvm_para.h?
en, here kvm_para.h seems better, will send V2 version in next time.

Regards
Bibo Mao

> 
> Huacai
> 
>>
>> Fixes: c43dce6f13fb ("LoongArch: KVM: Make vcpu_is_preempted() as a macro rather than function")
>> Reported-by: kernel test robot <lkp@intel.com>
>> Closes: https://lore.kernel.org/oe-kbuild-all/202605061313.O8Hswm2b-lkp@intel.com/
>> Signed-off-by: Bibo Mao <maobibo@loongson.cn>
>> ---
>>   arch/loongarch/include/asm/paravirt.h  | 4 ++++
>>   arch/loongarch/include/asm/qspinlock.h | 5 +----
>>   2 files changed, 5 insertions(+), 4 deletions(-)
>>
>> diff --git a/arch/loongarch/include/asm/paravirt.h b/arch/loongarch/include/asm/paravirt.h
>> index 0111f0ad5f73..dbc64908017f 100644
>> --- a/arch/loongarch/include/asm/paravirt.h
>> +++ b/arch/loongarch/include/asm/paravirt.h
>> @@ -3,6 +3,10 @@
>>   #define _ASM_LOONGARCH_PARAVIRT_H
>>
>>   #ifdef CONFIG_PARAVIRT
>> +#include <linux/jump_label.h>
>> +DECLARE_STATIC_KEY_FALSE(virt_preempt_key);
>> +DECLARE_STATIC_KEY_FALSE(virt_spin_lock_key);
>> +DECLARE_PER_CPU(struct kvm_steal_time, steal_time);
>>
>>   int __init pv_ipi_init(void);
>>   int __init pv_time_init(void);
>> diff --git a/arch/loongarch/include/asm/qspinlock.h b/arch/loongarch/include/asm/qspinlock.h
>> index 0ee15b3b3937..fbfc6be82f26 100644
>> --- a/arch/loongarch/include/asm/qspinlock.h
>> +++ b/arch/loongarch/include/asm/qspinlock.h
>> @@ -3,12 +3,9 @@
>>   #define _ASM_LOONGARCH_QSPINLOCK_H
>>
>>   #include <asm/kvm_para.h>
>> -#include <linux/jump_label.h>
>> +#include <asm/paravirt.h>
>>
>>   #ifdef CONFIG_PARAVIRT
>> -DECLARE_STATIC_KEY_FALSE(virt_preempt_key);
>> -DECLARE_STATIC_KEY_FALSE(virt_spin_lock_key);
>> -DECLARE_PER_CPU(struct kvm_steal_time, steal_time);
>>
>>   #define virt_spin_lock virt_spin_lock
>>
>>
>> base-commit: 74fe02ce122a6103f207d29fafc8b3a53de6abaf
>> --
>> 2.39.3
>>


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

* Re: [PATCH] LoongArch: KVM: Move some variable declaration to file paravirt.h
  2026-05-08  3:05   ` Bibo Mao
@ 2026-05-08  3:11     ` Huacai Chen
  2026-05-08  3:16       ` Bibo Mao
  0 siblings, 1 reply; 8+ messages in thread
From: Huacai Chen @ 2026-05-08  3:11 UTC (permalink / raw)
  To: Bibo Mao; +Cc: kernel, kvm, loongarch, linux-kernel, kernel test robot

On Fri, May 8, 2026 at 11:08 AM Bibo Mao <maobibo@loongson.cn> wrote:
>
>
>
> On 2026/5/8 上午10:56, Huacai Chen wrote:
> > Hi, Bibo,
> >
> > On Fri, May 8, 2026 at 9:30 AM Bibo Mao <maobibo@loongson.cn> wrote:
> >>
> >> Some variables relative with paravirt feature are declared in header file
> >> asm/qspinlock.h, however this file can be included only when option
> >> CONFIG_SMP is on. There is compiling warning if CONFIG_SMP is off since
> >> it is not declared.
> >>
> >> Move these variable declaration to header file asm/paravirt.h to avoid
> >> compiling warning.
> > Have you reproduced the warning? I cannot reproduce it in my
> > environment with the config file from lkp report, so I also cannot
> > confirm whether it is fixed.
> yes, I can reproduce this and it is fixed. The warning is reported from
> sparse tool, rather than LLVM.
> >
> > Another question:
> > Is paravirt.h a better place than kvm_para.h?
> en, here kvm_para.h seems better, will send V2 version in next time.
Frankly, I don't know the difference between the two files. kvm_para.h
is kvm specific and paravirt.h is generic? Or kvm_para.h is the
hypervisor side and paravirt.h is the guest side?

Huacai

>
> Regards
> Bibo Mao
>
> >
> > Huacai
> >
> >>
> >> Fixes: c43dce6f13fb ("LoongArch: KVM: Make vcpu_is_preempted() as a macro rather than function")
> >> Reported-by: kernel test robot <lkp@intel.com>
> >> Closes: https://lore.kernel.org/oe-kbuild-all/202605061313.O8Hswm2b-lkp@intel.com/
> >> Signed-off-by: Bibo Mao <maobibo@loongson.cn>
> >> ---
> >>   arch/loongarch/include/asm/paravirt.h  | 4 ++++
> >>   arch/loongarch/include/asm/qspinlock.h | 5 +----
> >>   2 files changed, 5 insertions(+), 4 deletions(-)
> >>
> >> diff --git a/arch/loongarch/include/asm/paravirt.h b/arch/loongarch/include/asm/paravirt.h
> >> index 0111f0ad5f73..dbc64908017f 100644
> >> --- a/arch/loongarch/include/asm/paravirt.h
> >> +++ b/arch/loongarch/include/asm/paravirt.h
> >> @@ -3,6 +3,10 @@
> >>   #define _ASM_LOONGARCH_PARAVIRT_H
> >>
> >>   #ifdef CONFIG_PARAVIRT
> >> +#include <linux/jump_label.h>
> >> +DECLARE_STATIC_KEY_FALSE(virt_preempt_key);
> >> +DECLARE_STATIC_KEY_FALSE(virt_spin_lock_key);
> >> +DECLARE_PER_CPU(struct kvm_steal_time, steal_time);
> >>
> >>   int __init pv_ipi_init(void);
> >>   int __init pv_time_init(void);
> >> diff --git a/arch/loongarch/include/asm/qspinlock.h b/arch/loongarch/include/asm/qspinlock.h
> >> index 0ee15b3b3937..fbfc6be82f26 100644
> >> --- a/arch/loongarch/include/asm/qspinlock.h
> >> +++ b/arch/loongarch/include/asm/qspinlock.h
> >> @@ -3,12 +3,9 @@
> >>   #define _ASM_LOONGARCH_QSPINLOCK_H
> >>
> >>   #include <asm/kvm_para.h>
> >> -#include <linux/jump_label.h>
> >> +#include <asm/paravirt.h>
> >>
> >>   #ifdef CONFIG_PARAVIRT
> >> -DECLARE_STATIC_KEY_FALSE(virt_preempt_key);
> >> -DECLARE_STATIC_KEY_FALSE(virt_spin_lock_key);
> >> -DECLARE_PER_CPU(struct kvm_steal_time, steal_time);
> >>
> >>   #define virt_spin_lock virt_spin_lock
> >>
> >>
> >> base-commit: 74fe02ce122a6103f207d29fafc8b3a53de6abaf
> >> --
> >> 2.39.3
> >>
>

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

* Re: [PATCH] LoongArch: KVM: Move some variable declaration to file paravirt.h
  2026-05-08  3:11     ` Huacai Chen
@ 2026-05-08  3:16       ` Bibo Mao
  2026-05-08 13:04         ` Huacai Chen
  0 siblings, 1 reply; 8+ messages in thread
From: Bibo Mao @ 2026-05-08  3:16 UTC (permalink / raw)
  To: Huacai Chen; +Cc: kernel, kvm, loongarch, linux-kernel, kernel test robot



On 2026/5/8 上午11:11, Huacai Chen wrote:
> On Fri, May 8, 2026 at 11:08 AM Bibo Mao <maobibo@loongson.cn> wrote:
>>
>>
>>
>> On 2026/5/8 上午10:56, Huacai Chen wrote:
>>> Hi, Bibo,
>>>
>>> On Fri, May 8, 2026 at 9:30 AM Bibo Mao <maobibo@loongson.cn> wrote:
>>>>
>>>> Some variables relative with paravirt feature are declared in header file
>>>> asm/qspinlock.h, however this file can be included only when option
>>>> CONFIG_SMP is on. There is compiling warning if CONFIG_SMP is off since
>>>> it is not declared.
>>>>
>>>> Move these variable declaration to header file asm/paravirt.h to avoid
>>>> compiling warning.
>>> Have you reproduced the warning? I cannot reproduce it in my
>>> environment with the config file from lkp report, so I also cannot
>>> confirm whether it is fixed.
>> yes, I can reproduce this and it is fixed. The warning is reported from
>> sparse tool, rather than LLVM.
>>>
>>> Another question:
>>> Is paravirt.h a better place than kvm_para.h?
>> en, here kvm_para.h seems better, will send V2 version in next time.
> Frankly, I don't know the difference between the two files. kvm_para.h
> is kvm specific and paravirt.h is generic? Or kvm_para.h is the
> hypervisor side and paravirt.h is the guest side?
kvm_para.h is shared by hypervisor and guest kernel, paravirt.h is only 
used by guest kernel. And option CONFIG_PARAVIRT is useful with guest 
kernel, CONFIG_PARAVIRT has no much meaning with hypervisor.

Regards
Bibo Mao
> 
> Huacai
> 
>>
>> Regards
>> Bibo Mao
>>
>>>
>>> Huacai
>>>
>>>>
>>>> Fixes: c43dce6f13fb ("LoongArch: KVM: Make vcpu_is_preempted() as a macro rather than function")
>>>> Reported-by: kernel test robot <lkp@intel.com>
>>>> Closes: https://lore.kernel.org/oe-kbuild-all/202605061313.O8Hswm2b-lkp@intel.com/
>>>> Signed-off-by: Bibo Mao <maobibo@loongson.cn>
>>>> ---
>>>>    arch/loongarch/include/asm/paravirt.h  | 4 ++++
>>>>    arch/loongarch/include/asm/qspinlock.h | 5 +----
>>>>    2 files changed, 5 insertions(+), 4 deletions(-)
>>>>
>>>> diff --git a/arch/loongarch/include/asm/paravirt.h b/arch/loongarch/include/asm/paravirt.h
>>>> index 0111f0ad5f73..dbc64908017f 100644
>>>> --- a/arch/loongarch/include/asm/paravirt.h
>>>> +++ b/arch/loongarch/include/asm/paravirt.h
>>>> @@ -3,6 +3,10 @@
>>>>    #define _ASM_LOONGARCH_PARAVIRT_H
>>>>
>>>>    #ifdef CONFIG_PARAVIRT
>>>> +#include <linux/jump_label.h>
>>>> +DECLARE_STATIC_KEY_FALSE(virt_preempt_key);
>>>> +DECLARE_STATIC_KEY_FALSE(virt_spin_lock_key);
>>>> +DECLARE_PER_CPU(struct kvm_steal_time, steal_time);
>>>>
>>>>    int __init pv_ipi_init(void);
>>>>    int __init pv_time_init(void);
>>>> diff --git a/arch/loongarch/include/asm/qspinlock.h b/arch/loongarch/include/asm/qspinlock.h
>>>> index 0ee15b3b3937..fbfc6be82f26 100644
>>>> --- a/arch/loongarch/include/asm/qspinlock.h
>>>> +++ b/arch/loongarch/include/asm/qspinlock.h
>>>> @@ -3,12 +3,9 @@
>>>>    #define _ASM_LOONGARCH_QSPINLOCK_H
>>>>
>>>>    #include <asm/kvm_para.h>
>>>> -#include <linux/jump_label.h>
>>>> +#include <asm/paravirt.h>
>>>>
>>>>    #ifdef CONFIG_PARAVIRT
>>>> -DECLARE_STATIC_KEY_FALSE(virt_preempt_key);
>>>> -DECLARE_STATIC_KEY_FALSE(virt_spin_lock_key);
>>>> -DECLARE_PER_CPU(struct kvm_steal_time, steal_time);
>>>>
>>>>    #define virt_spin_lock virt_spin_lock
>>>>
>>>>
>>>> base-commit: 74fe02ce122a6103f207d29fafc8b3a53de6abaf
>>>> --
>>>> 2.39.3
>>>>
>>


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

* Re: [PATCH] LoongArch: KVM: Move some variable declaration to file paravirt.h
  2026-05-08  3:16       ` Bibo Mao
@ 2026-05-08 13:04         ` Huacai Chen
  2026-05-09  1:31           ` Bibo Mao
  0 siblings, 1 reply; 8+ messages in thread
From: Huacai Chen @ 2026-05-08 13:04 UTC (permalink / raw)
  To: Bibo Mao; +Cc: kernel, kvm, loongarch, linux-kernel, kernel test robot

On Fri, May 8, 2026 at 11:19 AM Bibo Mao <maobibo@loongson.cn> wrote:
>
>
>
> On 2026/5/8 上午11:11, Huacai Chen wrote:
> > On Fri, May 8, 2026 at 11:08 AM Bibo Mao <maobibo@loongson.cn> wrote:
> >>
> >>
> >>
> >> On 2026/5/8 上午10:56, Huacai Chen wrote:
> >>> Hi, Bibo,
> >>>
> >>> On Fri, May 8, 2026 at 9:30 AM Bibo Mao <maobibo@loongson.cn> wrote:
> >>>>
> >>>> Some variables relative with paravirt feature are declared in header file
> >>>> asm/qspinlock.h, however this file can be included only when option
> >>>> CONFIG_SMP is on. There is compiling warning if CONFIG_SMP is off since
> >>>> it is not declared.
> >>>>
> >>>> Move these variable declaration to header file asm/paravirt.h to avoid
> >>>> compiling warning.
> >>> Have you reproduced the warning? I cannot reproduce it in my
> >>> environment with the config file from lkp report, so I also cannot
> >>> confirm whether it is fixed.
> >> yes, I can reproduce this and it is fixed. The warning is reported from
> >> sparse tool, rather than LLVM.
> >>>
> >>> Another question:
> >>> Is paravirt.h a better place than kvm_para.h?
> >> en, here kvm_para.h seems better, will send V2 version in next time.
> > Frankly, I don't know the difference between the two files. kvm_para.h
> > is kvm specific and paravirt.h is generic? Or kvm_para.h is the
> > hypervisor side and paravirt.h is the guest side?
> kvm_para.h is shared by hypervisor and guest kernel, paravirt.h is only
> used by guest kernel. And option CONFIG_PARAVIRT is useful with guest
> kernel, CONFIG_PARAVIRT has no much meaning with hypervisor.
If so, paravirt.h seems better to declare these variables.

Huacai

>
> Regards
> Bibo Mao
> >
> > Huacai
> >
> >>
> >> Regards
> >> Bibo Mao
> >>
> >>>
> >>> Huacai
> >>>
> >>>>
> >>>> Fixes: c43dce6f13fb ("LoongArch: KVM: Make vcpu_is_preempted() as a macro rather than function")
> >>>> Reported-by: kernel test robot <lkp@intel.com>
> >>>> Closes: https://lore.kernel.org/oe-kbuild-all/202605061313.O8Hswm2b-lkp@intel.com/
> >>>> Signed-off-by: Bibo Mao <maobibo@loongson.cn>
> >>>> ---
> >>>>    arch/loongarch/include/asm/paravirt.h  | 4 ++++
> >>>>    arch/loongarch/include/asm/qspinlock.h | 5 +----
> >>>>    2 files changed, 5 insertions(+), 4 deletions(-)
> >>>>
> >>>> diff --git a/arch/loongarch/include/asm/paravirt.h b/arch/loongarch/include/asm/paravirt.h
> >>>> index 0111f0ad5f73..dbc64908017f 100644
> >>>> --- a/arch/loongarch/include/asm/paravirt.h
> >>>> +++ b/arch/loongarch/include/asm/paravirt.h
> >>>> @@ -3,6 +3,10 @@
> >>>>    #define _ASM_LOONGARCH_PARAVIRT_H
> >>>>
> >>>>    #ifdef CONFIG_PARAVIRT
> >>>> +#include <linux/jump_label.h>
> >>>> +DECLARE_STATIC_KEY_FALSE(virt_preempt_key);
> >>>> +DECLARE_STATIC_KEY_FALSE(virt_spin_lock_key);
> >>>> +DECLARE_PER_CPU(struct kvm_steal_time, steal_time);
> >>>>
> >>>>    int __init pv_ipi_init(void);
> >>>>    int __init pv_time_init(void);
> >>>> diff --git a/arch/loongarch/include/asm/qspinlock.h b/arch/loongarch/include/asm/qspinlock.h
> >>>> index 0ee15b3b3937..fbfc6be82f26 100644
> >>>> --- a/arch/loongarch/include/asm/qspinlock.h
> >>>> +++ b/arch/loongarch/include/asm/qspinlock.h
> >>>> @@ -3,12 +3,9 @@
> >>>>    #define _ASM_LOONGARCH_QSPINLOCK_H
> >>>>
> >>>>    #include <asm/kvm_para.h>
> >>>> -#include <linux/jump_label.h>
> >>>> +#include <asm/paravirt.h>
> >>>>
> >>>>    #ifdef CONFIG_PARAVIRT
> >>>> -DECLARE_STATIC_KEY_FALSE(virt_preempt_key);
> >>>> -DECLARE_STATIC_KEY_FALSE(virt_spin_lock_key);
> >>>> -DECLARE_PER_CPU(struct kvm_steal_time, steal_time);
> >>>>
> >>>>    #define virt_spin_lock virt_spin_lock
> >>>>
> >>>>
> >>>> base-commit: 74fe02ce122a6103f207d29fafc8b3a53de6abaf
> >>>> --
> >>>> 2.39.3
> >>>>
> >>
>

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

* Re: [PATCH] LoongArch: KVM: Move some variable declaration to file paravirt.h
  2026-05-08 13:04         ` Huacai Chen
@ 2026-05-09  1:31           ` Bibo Mao
  2026-05-09 14:11             ` Huacai Chen
  0 siblings, 1 reply; 8+ messages in thread
From: Bibo Mao @ 2026-05-09  1:31 UTC (permalink / raw)
  To: Huacai Chen; +Cc: kernel, kvm, loongarch, linux-kernel, kernel test robot



On 2026/5/8 下午9:04, Huacai Chen wrote:
> On Fri, May 8, 2026 at 11:19 AM Bibo Mao <maobibo@loongson.cn> wrote:
>>
>>
>>
>> On 2026/5/8 上午11:11, Huacai Chen wrote:
>>> On Fri, May 8, 2026 at 11:08 AM Bibo Mao <maobibo@loongson.cn> wrote:
>>>>
>>>>
>>>>
>>>> On 2026/5/8 上午10:56, Huacai Chen wrote:
>>>>> Hi, Bibo,
>>>>>
>>>>> On Fri, May 8, 2026 at 9:30 AM Bibo Mao <maobibo@loongson.cn> wrote:
>>>>>>
>>>>>> Some variables relative with paravirt feature are declared in header file
>>>>>> asm/qspinlock.h, however this file can be included only when option
>>>>>> CONFIG_SMP is on. There is compiling warning if CONFIG_SMP is off since
>>>>>> it is not declared.
>>>>>>
>>>>>> Move these variable declaration to header file asm/paravirt.h to avoid
>>>>>> compiling warning.
>>>>> Have you reproduced the warning? I cannot reproduce it in my
>>>>> environment with the config file from lkp report, so I also cannot
>>>>> confirm whether it is fixed.
>>>> yes, I can reproduce this and it is fixed. The warning is reported from
>>>> sparse tool, rather than LLVM.
>>>>>
>>>>> Another question:
>>>>> Is paravirt.h a better place than kvm_para.h?
>>>> en, here kvm_para.h seems better, will send V2 version in next time.
>>> Frankly, I don't know the difference between the two files. kvm_para.h
>>> is kvm specific and paravirt.h is generic? Or kvm_para.h is the
>>> hypervisor side and paravirt.h is the guest side?
>> kvm_para.h is shared by hypervisor and guest kernel, paravirt.h is only
>> used by guest kernel. And option CONFIG_PARAVIRT is useful with guest
>> kernel, CONFIG_PARAVIRT has no much meaning with hypervisor.
> If so, paravirt.h seems better to declare these variables.
yes, paravirt.h seems better than kvm_para.h :)

Regards
Bibo Mao
> 
> Huacai
> 
>>
>> Regards
>> Bibo Mao
>>>
>>> Huacai
>>>
>>>>
>>>> Regards
>>>> Bibo Mao
>>>>
>>>>>
>>>>> Huacai
>>>>>
>>>>>>
>>>>>> Fixes: c43dce6f13fb ("LoongArch: KVM: Make vcpu_is_preempted() as a macro rather than function")
>>>>>> Reported-by: kernel test robot <lkp@intel.com>
>>>>>> Closes: https://lore.kernel.org/oe-kbuild-all/202605061313.O8Hswm2b-lkp@intel.com/
>>>>>> Signed-off-by: Bibo Mao <maobibo@loongson.cn>
>>>>>> ---
>>>>>>     arch/loongarch/include/asm/paravirt.h  | 4 ++++
>>>>>>     arch/loongarch/include/asm/qspinlock.h | 5 +----
>>>>>>     2 files changed, 5 insertions(+), 4 deletions(-)
>>>>>>
>>>>>> diff --git a/arch/loongarch/include/asm/paravirt.h b/arch/loongarch/include/asm/paravirt.h
>>>>>> index 0111f0ad5f73..dbc64908017f 100644
>>>>>> --- a/arch/loongarch/include/asm/paravirt.h
>>>>>> +++ b/arch/loongarch/include/asm/paravirt.h
>>>>>> @@ -3,6 +3,10 @@
>>>>>>     #define _ASM_LOONGARCH_PARAVIRT_H
>>>>>>
>>>>>>     #ifdef CONFIG_PARAVIRT
>>>>>> +#include <linux/jump_label.h>
>>>>>> +DECLARE_STATIC_KEY_FALSE(virt_preempt_key);
>>>>>> +DECLARE_STATIC_KEY_FALSE(virt_spin_lock_key);
>>>>>> +DECLARE_PER_CPU(struct kvm_steal_time, steal_time);
>>>>>>
>>>>>>     int __init pv_ipi_init(void);
>>>>>>     int __init pv_time_init(void);
>>>>>> diff --git a/arch/loongarch/include/asm/qspinlock.h b/arch/loongarch/include/asm/qspinlock.h
>>>>>> index 0ee15b3b3937..fbfc6be82f26 100644
>>>>>> --- a/arch/loongarch/include/asm/qspinlock.h
>>>>>> +++ b/arch/loongarch/include/asm/qspinlock.h
>>>>>> @@ -3,12 +3,9 @@
>>>>>>     #define _ASM_LOONGARCH_QSPINLOCK_H
>>>>>>
>>>>>>     #include <asm/kvm_para.h>
>>>>>> -#include <linux/jump_label.h>
>>>>>> +#include <asm/paravirt.h>
>>>>>>
>>>>>>     #ifdef CONFIG_PARAVIRT
>>>>>> -DECLARE_STATIC_KEY_FALSE(virt_preempt_key);
>>>>>> -DECLARE_STATIC_KEY_FALSE(virt_spin_lock_key);
>>>>>> -DECLARE_PER_CPU(struct kvm_steal_time, steal_time);
>>>>>>
>>>>>>     #define virt_spin_lock virt_spin_lock
>>>>>>
>>>>>>
>>>>>> base-commit: 74fe02ce122a6103f207d29fafc8b3a53de6abaf
>>>>>> --
>>>>>> 2.39.3
>>>>>>
>>>>
>>


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

* Re: [PATCH] LoongArch: KVM: Move some variable declaration to file paravirt.h
  2026-05-09  1:31           ` Bibo Mao
@ 2026-05-09 14:11             ` Huacai Chen
  0 siblings, 0 replies; 8+ messages in thread
From: Huacai Chen @ 2026-05-09 14:11 UTC (permalink / raw)
  To: Bibo Mao; +Cc: kernel, kvm, loongarch, linux-kernel, kernel test robot

On Sat, May 9, 2026 at 9:34 AM Bibo Mao <maobibo@loongson.cn> wrote:
>
>
>
> On 2026/5/8 下午9:04, Huacai Chen wrote:
> > On Fri, May 8, 2026 at 11:19 AM Bibo Mao <maobibo@loongson.cn> wrote:
> >>
> >>
> >>
> >> On 2026/5/8 上午11:11, Huacai Chen wrote:
> >>> On Fri, May 8, 2026 at 11:08 AM Bibo Mao <maobibo@loongson.cn> wrote:
> >>>>
> >>>>
> >>>>
> >>>> On 2026/5/8 上午10:56, Huacai Chen wrote:
> >>>>> Hi, Bibo,
> >>>>>
> >>>>> On Fri, May 8, 2026 at 9:30 AM Bibo Mao <maobibo@loongson.cn> wrote:
> >>>>>>
> >>>>>> Some variables relative with paravirt feature are declared in header file
> >>>>>> asm/qspinlock.h, however this file can be included only when option
> >>>>>> CONFIG_SMP is on. There is compiling warning if CONFIG_SMP is off since
> >>>>>> it is not declared.
> >>>>>>
> >>>>>> Move these variable declaration to header file asm/paravirt.h to avoid
> >>>>>> compiling warning.
> >>>>> Have you reproduced the warning? I cannot reproduce it in my
> >>>>> environment with the config file from lkp report, so I also cannot
> >>>>> confirm whether it is fixed.
> >>>> yes, I can reproduce this and it is fixed. The warning is reported from
> >>>> sparse tool, rather than LLVM.
> >>>>>
> >>>>> Another question:
> >>>>> Is paravirt.h a better place than kvm_para.h?
> >>>> en, here kvm_para.h seems better, will send V2 version in next time.
> >>> Frankly, I don't know the difference between the two files. kvm_para.h
> >>> is kvm specific and paravirt.h is generic? Or kvm_para.h is the
> >>> hypervisor side and paravirt.h is the guest side?
> >> kvm_para.h is shared by hypervisor and guest kernel, paravirt.h is only
> >> used by guest kernel. And option CONFIG_PARAVIRT is useful with guest
> >> kernel, CONFIG_PARAVIRT has no much meaning with hypervisor.
> > If so, paravirt.h seems better to declare these variables.
> yes, paravirt.h seems better than kvm_para.h :)
Applied, thanks.

Huacai
>
> Regards
> Bibo Mao
> >
> > Huacai
> >
> >>
> >> Regards
> >> Bibo Mao
> >>>
> >>> Huacai
> >>>
> >>>>
> >>>> Regards
> >>>> Bibo Mao
> >>>>
> >>>>>
> >>>>> Huacai
> >>>>>
> >>>>>>
> >>>>>> Fixes: c43dce6f13fb ("LoongArch: KVM: Make vcpu_is_preempted() as a macro rather than function")
> >>>>>> Reported-by: kernel test robot <lkp@intel.com>
> >>>>>> Closes: https://lore.kernel.org/oe-kbuild-all/202605061313.O8Hswm2b-lkp@intel.com/
> >>>>>> Signed-off-by: Bibo Mao <maobibo@loongson.cn>
> >>>>>> ---
> >>>>>>     arch/loongarch/include/asm/paravirt.h  | 4 ++++
> >>>>>>     arch/loongarch/include/asm/qspinlock.h | 5 +----
> >>>>>>     2 files changed, 5 insertions(+), 4 deletions(-)
> >>>>>>
> >>>>>> diff --git a/arch/loongarch/include/asm/paravirt.h b/arch/loongarch/include/asm/paravirt.h
> >>>>>> index 0111f0ad5f73..dbc64908017f 100644
> >>>>>> --- a/arch/loongarch/include/asm/paravirt.h
> >>>>>> +++ b/arch/loongarch/include/asm/paravirt.h
> >>>>>> @@ -3,6 +3,10 @@
> >>>>>>     #define _ASM_LOONGARCH_PARAVIRT_H
> >>>>>>
> >>>>>>     #ifdef CONFIG_PARAVIRT
> >>>>>> +#include <linux/jump_label.h>
> >>>>>> +DECLARE_STATIC_KEY_FALSE(virt_preempt_key);
> >>>>>> +DECLARE_STATIC_KEY_FALSE(virt_spin_lock_key);
> >>>>>> +DECLARE_PER_CPU(struct kvm_steal_time, steal_time);
> >>>>>>
> >>>>>>     int __init pv_ipi_init(void);
> >>>>>>     int __init pv_time_init(void);
> >>>>>> diff --git a/arch/loongarch/include/asm/qspinlock.h b/arch/loongarch/include/asm/qspinlock.h
> >>>>>> index 0ee15b3b3937..fbfc6be82f26 100644
> >>>>>> --- a/arch/loongarch/include/asm/qspinlock.h
> >>>>>> +++ b/arch/loongarch/include/asm/qspinlock.h
> >>>>>> @@ -3,12 +3,9 @@
> >>>>>>     #define _ASM_LOONGARCH_QSPINLOCK_H
> >>>>>>
> >>>>>>     #include <asm/kvm_para.h>
> >>>>>> -#include <linux/jump_label.h>
> >>>>>> +#include <asm/paravirt.h>
> >>>>>>
> >>>>>>     #ifdef CONFIG_PARAVIRT
> >>>>>> -DECLARE_STATIC_KEY_FALSE(virt_preempt_key);
> >>>>>> -DECLARE_STATIC_KEY_FALSE(virt_spin_lock_key);
> >>>>>> -DECLARE_PER_CPU(struct kvm_steal_time, steal_time);
> >>>>>>
> >>>>>>     #define virt_spin_lock virt_spin_lock
> >>>>>>
> >>>>>>
> >>>>>> base-commit: 74fe02ce122a6103f207d29fafc8b3a53de6abaf
> >>>>>> --
> >>>>>> 2.39.3
> >>>>>>
> >>>>
> >>
>
>

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

end of thread, other threads:[~2026-05-09 14:11 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-05-08  1:30 [PATCH] LoongArch: KVM: Move some variable declaration to file paravirt.h Bibo Mao
2026-05-08  2:56 ` Huacai Chen
2026-05-08  3:05   ` Bibo Mao
2026-05-08  3:11     ` Huacai Chen
2026-05-08  3:16       ` Bibo Mao
2026-05-08 13:04         ` Huacai Chen
2026-05-09  1:31           ` Bibo Mao
2026-05-09 14:11             ` Huacai Chen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®