[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202007241003.jHovywNN%lkp@intel.com>
Date: Fri, 24 Jul 2020 10:07:07 +0800
From: kernel test robot <lkp@...el.com>
To: Luc Van Oostenryck <luc.vanoostenryck@...il.com>
Cc: kbuild-all@...ts.01.org, linux-kernel@...r.kernel.org
Subject: arch/x86/kvm/lapic.c:255:15: sparse: struct kvm_apic_map __rcu
COPYING CREDITS Documentation Kbuild Kconfig LICENSES MAINTAINERS Makefile
README arch block certs crypto drivers fs include init ipc kernel lib mm net
samples scripts security sound tools usr virt
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: d15be546031cf65a0fc34879beca02fd90fe7ac7
commit: 670d0a4b10704667765f7d18f7592993d02783aa sparse: use identifiers to define address spaces
date: 5 weeks ago
config: i386-randconfig-s002-20200724 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-14) 9.3.0
reproduce:
# apt-get install sparse
# sparse version: v0.6.2-93-g4c6cbe55-dirty
git checkout 670d0a4b10704667765f7d18f7592993d02783aa
# save the attached .config to linux build tree
make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=i386
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@...el.com>
sparse warnings: (new ones prefixed by >>)
arch/x86/kvm/lapic.c:255:15: sparse: sparse: incompatible types in comparison expression (different address spaces):
>> arch/x86/kvm/lapic.c:255:15: sparse: struct kvm_apic_map [noderef] __rcu *
arch/x86/kvm/lapic.c:255:15: sparse: struct kvm_apic_map *
arch/x86/kvm/lapic.c:257:9: sparse: sparse: incompatible types in comparison expression (different address spaces):
arch/x86/kvm/lapic.c:257:9: sparse: struct kvm_apic_map [noderef] __rcu *
arch/x86/kvm/lapic.c:257:9: sparse: struct kvm_apic_map *
arch/x86/kvm/lapic.c:615:15: sparse: sparse: incompatible types in comparison expression (different address spaces):
arch/x86/kvm/lapic.c:615:15: sparse: struct kvm_apic_map [noderef] __rcu *
arch/x86/kvm/lapic.c:615:15: sparse: struct kvm_apic_map *
arch/x86/kvm/lapic.c:972:15: sparse: sparse: incompatible types in comparison expression (different address spaces):
arch/x86/kvm/lapic.c:972:15: sparse: struct kvm_apic_map [noderef] __rcu *
arch/x86/kvm/lapic.c:972:15: sparse: struct kvm_apic_map *
arch/x86/kvm/lapic.c:1014:15: sparse: sparse: incompatible types in comparison expression (different address spaces):
arch/x86/kvm/lapic.c:1014:15: sparse: struct kvm_apic_map [noderef] __rcu *
arch/x86/kvm/lapic.c:1014:15: sparse: struct kvm_apic_map *
arch/x86/kvm/lapic.c:1151:15: sparse: sparse: incompatible types in comparison expression (different address spaces):
arch/x86/kvm/lapic.c:1151:15: sparse: struct kvm_apic_map [noderef] __rcu *
arch/x86/kvm/lapic.c:1151:15: sparse: struct kvm_apic_map *
--
arch/x86/kvm/pmu.c:190:18: sparse: sparse: incompatible types in comparison expression (different address spaces):
>> arch/x86/kvm/pmu.c:190:18: sparse: struct kvm_pmu_event_filter [noderef] __rcu *
arch/x86/kvm/pmu.c:190:18: sparse: struct kvm_pmu_event_filter *
arch/x86/kvm/pmu.c:251:18: sparse: sparse: incompatible types in comparison expression (different address spaces):
arch/x86/kvm/pmu.c:251:18: sparse: struct kvm_pmu_event_filter [noderef] __rcu *
arch/x86/kvm/pmu.c:251:18: sparse: struct kvm_pmu_event_filter *
arch/x86/kvm/pmu.c:511:18: sparse: sparse: incompatible types in comparison expression (different address spaces):
arch/x86/kvm/pmu.c:511:18: sparse: struct kvm_pmu_event_filter [noderef] __rcu *
arch/x86/kvm/pmu.c:511:18: sparse: struct kvm_pmu_event_filter *
arch/x86/kvm/pmu.c:511:18: sparse: sparse: incompatible types in comparison expression (different address spaces):
arch/x86/kvm/pmu.c:511:18: sparse: struct kvm_pmu_event_filter [noderef] __rcu *
arch/x86/kvm/pmu.c:511:18: sparse: struct kvm_pmu_event_filter *
--
>> arch/x86/kvm/x86.c:2667:38: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const [noderef] __user * @@ got unsigned char [usertype] * @@
>> arch/x86/kvm/x86.c:2667:38: sparse: expected void const [noderef] __user *
arch/x86/kvm/x86.c:2667:38: sparse: got unsigned char [usertype] *
arch/x86/kvm/x86.c:7630:15: sparse: sparse: incompatible types in comparison expression (different address spaces):
>> arch/x86/kvm/x86.c:7630:15: sparse: struct kvm_apic_map [noderef] __rcu *
arch/x86/kvm/x86.c:7630:15: sparse: struct kvm_apic_map *
arch/x86/kvm/x86.c:10004:16: sparse: sparse: incompatible types in comparison expression (different address spaces):
arch/x86/kvm/x86.c:10004:16: sparse: struct kvm_apic_map [noderef] __rcu *
arch/x86/kvm/x86.c:10004:16: sparse: struct kvm_apic_map *
arch/x86/kvm/x86.c:10005:15: sparse: sparse: incompatible types in comparison expression (different address spaces):
>> arch/x86/kvm/x86.c:10005:15: sparse: struct kvm_pmu_event_filter [noderef] __rcu *
arch/x86/kvm/x86.c:10005:15: sparse: struct kvm_pmu_event_filter *
arch/x86/kvm/x86.c: note: in included file (through include/linux/notifier.h, include/linux/memory_hotplug.h, include/linux/mmzone.h, ...):
include/linux/srcu.h:179:9: sparse: sparse: context imbalance in 'vcpu_enter_guest' - unexpected unlock
vim +255 arch/x86/kvm/lapic.c
3b5a5ffa928a3f8 Radim Krčmář 2015-02-12 171
4abaffce4d25aa4 Wanpeng Li 2020-02-26 172 void kvm_recalculate_apic_map(struct kvm *kvm)
1e08ec4a130e274 Gleb Natapov 2012-09-13 173 {
1e08ec4a130e274 Gleb Natapov 2012-09-13 174 struct kvm_apic_map *new, *old = NULL;
1e08ec4a130e274 Gleb Natapov 2012-09-13 175 struct kvm_vcpu *vcpu;
1e08ec4a130e274 Gleb Natapov 2012-09-13 176 int i;
6e50043912d9c9c Radim Krčmář 2016-12-15 177 u32 max_id = 255; /* enough space for any xAPIC ID */
1e08ec4a130e274 Gleb Natapov 2012-09-13 178
4abaffce4d25aa4 Wanpeng Li 2020-02-26 179 if (!kvm->arch.apic_map_dirty) {
4abaffce4d25aa4 Wanpeng Li 2020-02-26 180 /*
4abaffce4d25aa4 Wanpeng Li 2020-02-26 181 * Read kvm->arch.apic_map_dirty before
4abaffce4d25aa4 Wanpeng Li 2020-02-26 182 * kvm->arch.apic_map
4abaffce4d25aa4 Wanpeng Li 2020-02-26 183 */
4abaffce4d25aa4 Wanpeng Li 2020-02-26 184 smp_rmb();
4abaffce4d25aa4 Wanpeng Li 2020-02-26 185 return;
4abaffce4d25aa4 Wanpeng Li 2020-02-26 186 }
4abaffce4d25aa4 Wanpeng Li 2020-02-26 187
1e08ec4a130e274 Gleb Natapov 2012-09-13 188 mutex_lock(&kvm->arch.apic_map_lock);
4abaffce4d25aa4 Wanpeng Li 2020-02-26 189 if (!kvm->arch.apic_map_dirty) {
4abaffce4d25aa4 Wanpeng Li 2020-02-26 190 /* Someone else has updated the map. */
4abaffce4d25aa4 Wanpeng Li 2020-02-26 191 mutex_unlock(&kvm->arch.apic_map_lock);
4abaffce4d25aa4 Wanpeng Li 2020-02-26 192 return;
4abaffce4d25aa4 Wanpeng Li 2020-02-26 193 }
1e08ec4a130e274 Gleb Natapov 2012-09-13 194
0ca52e7b81a3726 Radim Krčmář 2016-07-12 195 kvm_for_each_vcpu(i, vcpu, kvm)
0ca52e7b81a3726 Radim Krčmář 2016-07-12 196 if (kvm_apic_present(vcpu))
6e50043912d9c9c Radim Krčmář 2016-12-15 197 max_id = max(max_id, kvm_x2apic_id(vcpu->arch.apic));
0ca52e7b81a3726 Radim Krčmář 2016-07-12 198
a7c3e901a46ff54 Michal Hocko 2017-05-08 199 new = kvzalloc(sizeof(struct kvm_apic_map) +
254272ce6505948 Ben Gardon 2019-02-11 200 sizeof(struct kvm_lapic *) * ((u64)max_id + 1),
254272ce6505948 Ben Gardon 2019-02-11 201 GFP_KERNEL_ACCOUNT);
0ca52e7b81a3726 Radim Krčmář 2016-07-12 202
1e08ec4a130e274 Gleb Natapov 2012-09-13 203 if (!new)
1e08ec4a130e274 Gleb Natapov 2012-09-13 204 goto out;
1e08ec4a130e274 Gleb Natapov 2012-09-13 205
0ca52e7b81a3726 Radim Krčmář 2016-07-12 206 new->max_apic_id = max_id;
0ca52e7b81a3726 Radim Krčmář 2016-07-12 207
173beedc1601f51 Nadav Amit 2014-11-02 208 kvm_for_each_vcpu(i, vcpu, kvm) {
173beedc1601f51 Nadav Amit 2014-11-02 209 struct kvm_lapic *apic = vcpu->arch.apic;
e45115b62f9abb1 Radim Krčmář 2016-07-12 210 struct kvm_lapic **cluster;
e45115b62f9abb1 Radim Krčmář 2016-07-12 211 u16 mask;
5bd5db385b3e13c Radim Krčmář 2016-12-15 212 u32 ldr;
5bd5db385b3e13c Radim Krčmář 2016-12-15 213 u8 xapic_id;
5bd5db385b3e13c Radim Krčmář 2016-12-15 214 u32 x2apic_id;
1e08ec4a130e274 Gleb Natapov 2012-09-13 215
df04d1d191a5fea Radim Krčmář 2015-01-29 216 if (!kvm_apic_present(vcpu))
df04d1d191a5fea Radim Krčmář 2015-01-29 217 continue;
df04d1d191a5fea Radim Krčmář 2015-01-29 218
5bd5db385b3e13c Radim Krčmář 2016-12-15 219 xapic_id = kvm_xapic_id(apic);
5bd5db385b3e13c Radim Krčmář 2016-12-15 220 x2apic_id = kvm_x2apic_id(apic);
5bd5db385b3e13c Radim Krčmář 2016-12-15 221
5bd5db385b3e13c Radim Krčmář 2016-12-15 222 /* Hotplug hack: see kvm_apic_match_physical_addr(), ... */
5bd5db385b3e13c Radim Krčmář 2016-12-15 223 if ((apic_x2apic_mode(apic) || x2apic_id > 0xff) &&
5bd5db385b3e13c Radim Krčmář 2016-12-15 224 x2apic_id <= new->max_apic_id)
5bd5db385b3e13c Radim Krčmář 2016-12-15 225 new->phys_map[x2apic_id] = apic;
5bd5db385b3e13c Radim Krčmář 2016-12-15 226 /*
5bd5db385b3e13c Radim Krčmář 2016-12-15 227 * ... xAPIC ID of VCPUs with APIC ID > 0xff will wrap-around,
5bd5db385b3e13c Radim Krčmář 2016-12-15 228 * prevent them from masking VCPUs with APIC ID <= 0xff.
5bd5db385b3e13c Radim Krčmář 2016-12-15 229 */
5bd5db385b3e13c Radim Krčmář 2016-12-15 230 if (!apic_x2apic_mode(apic) && !new->phys_map[xapic_id])
5bd5db385b3e13c Radim Krčmář 2016-12-15 231 new->phys_map[xapic_id] = apic;
3548a259f6990d8 Radim Krčmář 2015-02-12 232
b14c876b994f208 Radim Krcmar 2019-08-13 233 if (!kvm_apic_sw_enabled(apic))
b14c876b994f208 Radim Krcmar 2019-08-13 234 continue;
b14c876b994f208 Radim Krcmar 2019-08-13 235
6e50043912d9c9c Radim Krčmář 2016-12-15 236 ldr = kvm_lapic_get_reg(apic, APIC_LDR);
6e50043912d9c9c Radim Krčmář 2016-12-15 237
3b5a5ffa928a3f8 Radim Krčmář 2015-02-12 238 if (apic_x2apic_mode(apic)) {
3b5a5ffa928a3f8 Radim Krčmář 2015-02-12 239 new->mode |= KVM_APIC_MODE_X2APIC;
3b5a5ffa928a3f8 Radim Krčmář 2015-02-12 240 } else if (ldr) {
3b5a5ffa928a3f8 Radim Krčmář 2015-02-12 241 ldr = GET_APIC_LOGICAL_ID(ldr);
dfb9595429c65f7 Suravee Suthikulpanit 2016-05-04 242 if (kvm_lapic_get_reg(apic, APIC_DFR) == APIC_DFR_FLAT)
3b5a5ffa928a3f8 Radim Krčmář 2015-02-12 243 new->mode |= KVM_APIC_MODE_XAPIC_FLAT;
3b5a5ffa928a3f8 Radim Krčmář 2015-02-12 244 else
3b5a5ffa928a3f8 Radim Krčmář 2015-02-12 245 new->mode |= KVM_APIC_MODE_XAPIC_CLUSTER;
3b5a5ffa928a3f8 Radim Krčmář 2015-02-12 246 }
3b5a5ffa928a3f8 Radim Krčmář 2015-02-12 247
e45115b62f9abb1 Radim Krčmář 2016-07-12 248 if (!kvm_apic_map_get_logical_dest(new, ldr, &cluster, &mask))
3548a259f6990d8 Radim Krčmář 2015-02-12 249 continue;
3548a259f6990d8 Radim Krčmář 2015-02-12 250
e45115b62f9abb1 Radim Krčmář 2016-07-12 251 if (mask)
e45115b62f9abb1 Radim Krčmář 2016-07-12 252 cluster[ffs(mask) - 1] = apic;
1e08ec4a130e274 Gleb Natapov 2012-09-13 253 }
1e08ec4a130e274 Gleb Natapov 2012-09-13 254 out:
1e08ec4a130e274 Gleb Natapov 2012-09-13 @255 old = rcu_dereference_protected(kvm->arch.apic_map,
1e08ec4a130e274 Gleb Natapov 2012-09-13 256 lockdep_is_held(&kvm->arch.apic_map_lock));
1e08ec4a130e274 Gleb Natapov 2012-09-13 257 rcu_assign_pointer(kvm->arch.apic_map, new);
4abaffce4d25aa4 Wanpeng Li 2020-02-26 258 /*
4abaffce4d25aa4 Wanpeng Li 2020-02-26 259 * Write kvm->arch.apic_map before
4abaffce4d25aa4 Wanpeng Li 2020-02-26 260 * clearing apic->apic_map_dirty
4abaffce4d25aa4 Wanpeng Li 2020-02-26 261 */
4abaffce4d25aa4 Wanpeng Li 2020-02-26 262 smp_wmb();
4abaffce4d25aa4 Wanpeng Li 2020-02-26 263 kvm->arch.apic_map_dirty = false;
1e08ec4a130e274 Gleb Natapov 2012-09-13 264 mutex_unlock(&kvm->arch.apic_map_lock);
1e08ec4a130e274 Gleb Natapov 2012-09-13 265
1e08ec4a130e274 Gleb Natapov 2012-09-13 266 if (old)
af1bae5497b98cb Radim Krčmář 2016-07-12 267 call_rcu(&old->rcu, kvm_apic_map_free);
c7c9c56ca26f7b9 Yang Zhang 2013-01-25 268
b053b2aef25d007 Steve Rutherford 2015-07-29 269 kvm_make_scan_ioapic_request(kvm);
1e08ec4a130e274 Gleb Natapov 2012-09-13 270 }
1e08ec4a130e274 Gleb Natapov 2012-09-13 271
:::::: The code at line 255 was first introduced by commit
:::::: 1e08ec4a130e2745d96df169e67c58df98a07311 KVM: optimize apic interrupt delivery
:::::: TO: Gleb Natapov <gleb@...hat.com>
:::::: CC: Avi Kivity <avi@...hat.com>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
Download attachment ".config.gz" of type "application/gzip" (28937 bytes)
Powered by blists - more mailing lists