Fix the following sparse warning:
arch/x86/kernel/kvm.c:58:1: warning: symbol '__pcpu_scope_steal_time'
was not declared. Should it be static?
Reported-by: Hulk Robot <[email protected]>
Signed-off-by: Jason Yan <[email protected]>
---
arch/x86/kernel/kvm.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/x86/kernel/kvm.c b/arch/x86/kernel/kvm.c
index 6efe0410fb72..f75010cde5d5 100644
--- a/arch/x86/kernel/kvm.c
+++ b/arch/x86/kernel/kvm.c
@@ -55,7 +55,7 @@ static int __init parse_no_stealacc(char *arg)
early_param("no-steal-acc", parse_no_stealacc);
static DEFINE_PER_CPU_DECRYPTED(struct kvm_vcpu_pv_apf_data, apf_reason) __aligned(64);
-DEFINE_PER_CPU_DECRYPTED(struct kvm_steal_time, steal_time) __aligned(64) __visible;
+static DEFINE_PER_CPU_DECRYPTED(struct kvm_steal_time, steal_time) __aligned(64) __visible;
static int has_steal_clock = 0;
/*
--
2.21.1
On 15/04/20 10:49, Jason Yan wrote:
> Fix the following sparse warning:
>
> arch/x86/kernel/kvm.c:58:1: warning: symbol '__pcpu_scope_steal_time'
> was not declared. Should it be static?
>
> Reported-by: Hulk Robot <[email protected]>
> Signed-off-by: Jason Yan <[email protected]>
> ---
> arch/x86/kernel/kvm.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/x86/kernel/kvm.c b/arch/x86/kernel/kvm.c
> index 6efe0410fb72..f75010cde5d5 100644
> --- a/arch/x86/kernel/kvm.c
> +++ b/arch/x86/kernel/kvm.c
> @@ -55,7 +55,7 @@ static int __init parse_no_stealacc(char *arg)
> early_param("no-steal-acc", parse_no_stealacc);
>
> static DEFINE_PER_CPU_DECRYPTED(struct kvm_vcpu_pv_apf_data, apf_reason) __aligned(64);
> -DEFINE_PER_CPU_DECRYPTED(struct kvm_steal_time, steal_time) __aligned(64) __visible;
> +static DEFINE_PER_CPU_DECRYPTED(struct kvm_steal_time, steal_time) __aligned(64) __visible;
> static int has_steal_clock = 0;
>
> /*
>
Queued, thanks.
Paolo
Hi Jason,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on kvm/linux-next]
[also build test WARNING on v5.7-rc1 next-20200415]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
url: https://github.com/0day-ci/linux/commits/Jason-Yan/x86-kvm-make-steal_time-static/20200416-010910
base: https://git.kernel.org/pub/scm/virt/kvm/kvm.git linux-next
config: i386-debian-10.3 (attached as .config)
compiler: gcc-7 (Ubuntu 7.5.0-6ubuntu2) 7.5.0
reproduce:
# save the attached .config to linux build tree
make ARCH=i386
If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <[email protected]>
All warnings (new ones prefixed by >>):
In file included from include/asm-generic/percpu.h:7:0,
from arch/x86/include/asm/percpu.h:556,
from arch/x86/include/asm/current.h:6,
from include/linux/sched.h:12,
from include/linux/context_tracking.h:5,
from arch/x86/kernel/kvm.c:10:
>> arch/x86/kernel/kvm.c:58:40: warning: '__externally_visible__' attribute have effect only on public objects [-Wattributes]
static DEFINE_PER_CPU_DECRYPTED(struct kvm_steal_time, steal_time) __aligned(64) __visible;
^
include/linux/percpu-defs.h:104:31: note: in definition of macro 'DEFINE_PER_CPU_SECTION'
__PCPU_ATTRS(sec) __typeof__(type) name
^~~~
>> include/linux/percpu-defs.h:185:46: note: in expansion of macro 'DEFINE_PER_CPU'
#define DEFINE_PER_CPU_DECRYPTED(type, name) DEFINE_PER_CPU(type, name)
^~~~~~~~~~~~~~
>> arch/x86/kernel/kvm.c:58:8: note: in expansion of macro 'DEFINE_PER_CPU_DECRYPTED'
static DEFINE_PER_CPU_DECRYPTED(struct kvm_steal_time, steal_time) __aligned(64) __visible;
^~~~~~~~~~~~~~~~~~~~~~~~
vim +/__externally_visible__ +58 arch/x86/kernel/kvm.c
> 10 #include <linux/context_tracking.h>
11 #include <linux/init.h>
12 #include <linux/kernel.h>
13 #include <linux/kvm_para.h>
14 #include <linux/cpu.h>
15 #include <linux/mm.h>
16 #include <linux/highmem.h>
17 #include <linux/hardirq.h>
18 #include <linux/notifier.h>
19 #include <linux/reboot.h>
20 #include <linux/hash.h>
21 #include <linux/sched.h>
22 #include <linux/slab.h>
23 #include <linux/kprobes.h>
24 #include <linux/debugfs.h>
25 #include <linux/nmi.h>
26 #include <linux/swait.h>
27 #include <asm/timer.h>
28 #include <asm/cpu.h>
29 #include <asm/traps.h>
30 #include <asm/desc.h>
31 #include <asm/tlbflush.h>
32 #include <asm/apic.h>
33 #include <asm/apicdef.h>
34 #include <asm/hypervisor.h>
35 #include <asm/tlb.h>
36 #include <asm/cpuidle_haltpoll.h>
37
38 static int kvmapf = 1;
39
40 static int __init parse_no_kvmapf(char *arg)
41 {
42 kvmapf = 0;
43 return 0;
44 }
45
46 early_param("no-kvmapf", parse_no_kvmapf);
47
48 static int steal_acc = 1;
49 static int __init parse_no_stealacc(char *arg)
50 {
51 steal_acc = 0;
52 return 0;
53 }
54
55 early_param("no-steal-acc", parse_no_stealacc);
56
57 static DEFINE_PER_CPU_DECRYPTED(struct kvm_vcpu_pv_apf_data, apf_reason) __aligned(64);
> 58 static DEFINE_PER_CPU_DECRYPTED(struct kvm_steal_time, steal_time) __aligned(64) __visible;
59 static int has_steal_clock = 0;
60
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]
在 2020/4/15 22:42, Paolo Bonzini 写道:
> On 15/04/20 10:49, Jason Yan wrote:
>> Fix the following sparse warning:
>>
>> arch/x86/kernel/kvm.c:58:1: warning: symbol '__pcpu_scope_steal_time'
>> was not declared. Should it be static?
>>
>> Reported-by: Hulk Robot <[email protected]>
>> Signed-off-by: Jason Yan <[email protected]>
>> ---
>> arch/x86/kernel/kvm.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/arch/x86/kernel/kvm.c b/arch/x86/kernel/kvm.c
>> index 6efe0410fb72..f75010cde5d5 100644
>> --- a/arch/x86/kernel/kvm.c
>> +++ b/arch/x86/kernel/kvm.c
>> @@ -55,7 +55,7 @@ static int __init parse_no_stealacc(char *arg)
>> early_param("no-steal-acc", parse_no_stealacc);
>>
>> static DEFINE_PER_CPU_DECRYPTED(struct kvm_vcpu_pv_apf_data, apf_reason) __aligned(64);
>> -DEFINE_PER_CPU_DECRYPTED(struct kvm_steal_time, steal_time) __aligned(64) __visible;
>> +static DEFINE_PER_CPU_DECRYPTED(struct kvm_steal_time, steal_time) __aligned(64) __visible;
>> static int has_steal_clock = 0;
>>
>> /*
>>
>
> Queued, thanks.
>
Sorry that I found 14e581c381b9 ("x86/kvm: Make steal_time visible")
said that it is used by assembler code but I didn't find where.
Please drop this patch if it's true.
Sorry to make this trouble again.
Thanks,
Jason
> Paolo
>
>
> .
>
On 16/04/20 04:15, Jason Yan wrote:
>>
>
> Sorry that I found 14e581c381b9 ("x86/kvm: Make steal_time visible")
> said that it is used by assembler code but I didn't find where.
> Please drop this patch if it's true.
>
> Sorry to make this trouble again.
Here:
arch/x86/kernel/kvm.c:"cmpb $0, " __stringify(KVM_STEAL_TIME_preempted) "+steal_time(%rax);"
The __visible argument shouldn't be needed, __used should be enough. I'll take a look.
Paolo