arch/x86/kvm/x86.c:3354:1: error: unsupported size for integer register
From: kernel test robot
Date: Sun Nov 14 2021 - 02:19:48 EST
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: c8c109546a19613d323a319d0c921cb1f317e629
commit: 7e2175ebd695f17860c5bd4ad7616cce12ed4591 KVM: x86: Fix recording of guest steal time / preempted status
date: 3 days ago
config: i386-randconfig-a004-20210930 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce (this is a W=1 build):
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=7e2175ebd695f17860c5bd4ad7616cce12ed4591
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 7e2175ebd695f17860c5bd4ad7616cce12ed4591
# save the attached .config to linux build tree
mkdir build_dir
make W=1 O=build_dir ARCH=i386 SHELL=/bin/bash arch/x86/kvm/
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>
All errors (new ones prefixed by >>):
arch/x86/kvm/x86.c: In function 'record_steal_time':
>> arch/x86/kvm/x86.c:3354:1: error: unsupported size for integer register
3354 | }
| ^
vim +3354 arch/x86/kvm/x86.c
0baedd79271306 Vitaly Kuznetsov 2020-03-25 3260
c9aaa8957f203b Glauber Costa 2011-07-11 3261 static void record_steal_time(struct kvm_vcpu *vcpu)
c9aaa8957f203b Glauber Costa 2011-07-11 3262 {
7e2175ebd695f1 David Woodhouse 2021-11-02 3263 struct gfn_to_hva_cache *ghc = &vcpu->arch.st.cache;
7e2175ebd695f1 David Woodhouse 2021-11-02 3264 struct kvm_steal_time __user *st;
7e2175ebd695f1 David Woodhouse 2021-11-02 3265 struct kvm_memslots *slots;
7e2175ebd695f1 David Woodhouse 2021-11-02 3266 u64 steal;
7e2175ebd695f1 David Woodhouse 2021-11-02 3267 u32 version;
b043138246a410 Boris Ostrovsky 2019-12-05 3268
30b5c851af7991 David Woodhouse 2021-03-01 3269 if (kvm_xen_msr_enabled(vcpu->kvm)) {
30b5c851af7991 David Woodhouse 2021-03-01 3270 kvm_xen_runstate_set_running(vcpu);
30b5c851af7991 David Woodhouse 2021-03-01 3271 return;
30b5c851af7991 David Woodhouse 2021-03-01 3272 }
30b5c851af7991 David Woodhouse 2021-03-01 3273
c9aaa8957f203b Glauber Costa 2011-07-11 3274 if (!(vcpu->arch.st.msr_val & KVM_MSR_ENABLED))
c9aaa8957f203b Glauber Costa 2011-07-11 3275 return;
c9aaa8957f203b Glauber Costa 2011-07-11 3276
7e2175ebd695f1 David Woodhouse 2021-11-02 3277 if (WARN_ON_ONCE(current->mm != vcpu->kvm->mm))
c9aaa8957f203b Glauber Costa 2011-07-11 3278 return;
c9aaa8957f203b Glauber Costa 2011-07-11 3279
7e2175ebd695f1 David Woodhouse 2021-11-02 3280 slots = kvm_memslots(vcpu->kvm);
7e2175ebd695f1 David Woodhouse 2021-11-02 3281
7e2175ebd695f1 David Woodhouse 2021-11-02 3282 if (unlikely(slots->generation != ghc->generation ||
7e2175ebd695f1 David Woodhouse 2021-11-02 3283 kvm_is_error_hva(ghc->hva) || !ghc->memslot)) {
7e2175ebd695f1 David Woodhouse 2021-11-02 3284 gfn_t gfn = vcpu->arch.st.msr_val & KVM_STEAL_VALID_BITS;
7e2175ebd695f1 David Woodhouse 2021-11-02 3285
7e2175ebd695f1 David Woodhouse 2021-11-02 3286 /* We rely on the fact that it fits in a single page. */
7e2175ebd695f1 David Woodhouse 2021-11-02 3287 BUILD_BUG_ON((sizeof(*st) - 1) & KVM_STEAL_VALID_BITS);
7e2175ebd695f1 David Woodhouse 2021-11-02 3288
7e2175ebd695f1 David Woodhouse 2021-11-02 3289 if (kvm_gfn_to_hva_cache_init(vcpu->kvm, ghc, gfn, sizeof(*st)) ||
7e2175ebd695f1 David Woodhouse 2021-11-02 3290 kvm_is_error_hva(ghc->hva) || !ghc->memslot)
7e2175ebd695f1 David Woodhouse 2021-11-02 3291 return;
7e2175ebd695f1 David Woodhouse 2021-11-02 3292 }
7e2175ebd695f1 David Woodhouse 2021-11-02 3293
7e2175ebd695f1 David Woodhouse 2021-11-02 3294 st = (struct kvm_steal_time __user *)ghc->hva;
7e2175ebd695f1 David Woodhouse 2021-11-02 3295 if (!user_access_begin(st, sizeof(*st)))
7e2175ebd695f1 David Woodhouse 2021-11-02 3296 return;
b043138246a410 Boris Ostrovsky 2019-12-05 3297
f38a7b75267f1f Wanpeng Li 2017-12-12 3298 /*
f38a7b75267f1f Wanpeng Li 2017-12-12 3299 * Doing a TLB flush here, on the guest's behalf, can avoid
f38a7b75267f1f Wanpeng Li 2017-12-12 3300 * expensive IPIs.
f38a7b75267f1f Wanpeng Li 2017-12-12 3301 */
66570e966dd9cb Oliver Upton 2020-08-18 3302 if (guest_pv_has(vcpu, KVM_FEATURE_PV_TLB_FLUSH)) {
7e2175ebd695f1 David Woodhouse 2021-11-02 3303 u8 st_preempted = 0;
7e2175ebd695f1 David Woodhouse 2021-11-02 3304 int err = -EFAULT;
7e2175ebd695f1 David Woodhouse 2021-11-02 3305
7e2175ebd695f1 David Woodhouse 2021-11-02 3306 asm volatile("1: xchgb %0, %2\n"
7e2175ebd695f1 David Woodhouse 2021-11-02 3307 "xor %1, %1\n"
7e2175ebd695f1 David Woodhouse 2021-11-02 3308 "2:\n"
7e2175ebd695f1 David Woodhouse 2021-11-02 3309 _ASM_EXTABLE_UA(1b, 2b)
7e2175ebd695f1 David Woodhouse 2021-11-02 3310 : "+r" (st_preempted),
7e2175ebd695f1 David Woodhouse 2021-11-02 3311 "+&r" (err)
7e2175ebd695f1 David Woodhouse 2021-11-02 3312 : "m" (st->preempted));
7e2175ebd695f1 David Woodhouse 2021-11-02 3313 if (err)
7e2175ebd695f1 David Woodhouse 2021-11-02 3314 goto out;
7e2175ebd695f1 David Woodhouse 2021-11-02 3315
7e2175ebd695f1 David Woodhouse 2021-11-02 3316 user_access_end();
7e2175ebd695f1 David Woodhouse 2021-11-02 3317
7e2175ebd695f1 David Woodhouse 2021-11-02 3318 vcpu->arch.st.preempted = 0;
af3511ff7fa210 Lai Jiangshan 2021-06-01 3319
b382f44e98506b Wanpeng Li 2019-08-05 3320 trace_kvm_pv_tlb_flush(vcpu->vcpu_id,
af3511ff7fa210 Lai Jiangshan 2021-06-01 3321 st_preempted & KVM_VCPU_FLUSH_TLB);
af3511ff7fa210 Lai Jiangshan 2021-06-01 3322 if (st_preempted & KVM_VCPU_FLUSH_TLB)
0baedd79271306 Vitaly Kuznetsov 2020-03-25 3323 kvm_vcpu_flush_tlb_guest(vcpu);
0b9f6c4615c993 Pan Xinhui 2016-11-02 3324
7e2175ebd695f1 David Woodhouse 2021-11-02 3325 if (!user_access_begin(st, sizeof(*st)))
7e2175ebd695f1 David Woodhouse 2021-11-02 3326 goto dirty;
7e2175ebd695f1 David Woodhouse 2021-11-02 3327 } else {
7e2175ebd695f1 David Woodhouse 2021-11-02 3328 unsafe_put_user(0, &st->preempted, out);
a6bd811f1209fe Boris Ostrovsky 2019-12-06 3329 vcpu->arch.st.preempted = 0;
7e2175ebd695f1 David Woodhouse 2021-11-02 3330 }
35f3fae1784979 Wanpeng Li 2016-05-03 3331
7e2175ebd695f1 David Woodhouse 2021-11-02 3332 unsafe_get_user(version, &st->version, out);
7e2175ebd695f1 David Woodhouse 2021-11-02 3333 if (version & 1)
7e2175ebd695f1 David Woodhouse 2021-11-02 3334 version += 1; /* first time write, random junk */
35f3fae1784979 Wanpeng Li 2016-05-03 3335
7e2175ebd695f1 David Woodhouse 2021-11-02 3336 version += 1;
7e2175ebd695f1 David Woodhouse 2021-11-02 3337 unsafe_put_user(version, &st->version, out);
35f3fae1784979 Wanpeng Li 2016-05-03 3338
35f3fae1784979 Wanpeng Li 2016-05-03 3339 smp_wmb();
35f3fae1784979 Wanpeng Li 2016-05-03 3340
7e2175ebd695f1 David Woodhouse 2021-11-02 3341 unsafe_get_user(steal, &st->steal, out);
7e2175ebd695f1 David Woodhouse 2021-11-02 3342 steal += current->sched_info.run_delay -
c54cdf141c40a5 Liang Chen 2016-03-16 3343 vcpu->arch.st.last_steal;
c54cdf141c40a5 Liang Chen 2016-03-16 3344 vcpu->arch.st.last_steal = current->sched_info.run_delay;
7e2175ebd695f1 David Woodhouse 2021-11-02 3345 unsafe_put_user(steal, &st->steal, out);
35f3fae1784979 Wanpeng Li 2016-05-03 3346
7e2175ebd695f1 David Woodhouse 2021-11-02 3347 version += 1;
7e2175ebd695f1 David Woodhouse 2021-11-02 3348 unsafe_put_user(version, &st->version, out);
c9aaa8957f203b Glauber Costa 2011-07-11 3349
7e2175ebd695f1 David Woodhouse 2021-11-02 3350 out:
7e2175ebd695f1 David Woodhouse 2021-11-02 3351 user_access_end();
7e2175ebd695f1 David Woodhouse 2021-11-02 3352 dirty:
7e2175ebd695f1 David Woodhouse 2021-11-02 3353 mark_page_dirty_in_slot(vcpu->kvm, ghc->memslot, gpa_to_gfn(ghc->gpa));
c9aaa8957f203b Glauber Costa 2011-07-11 @3354 }
c9aaa8957f203b Glauber Costa 2011-07-11 3355
:::::: The code at line 3354 was first introduced by commit
:::::: c9aaa8957f203bd6df83b002fb40b98390bed078 KVM: Steal time implementation
:::::: TO: Glauber Costa <glommer@xxxxxxxxxx>
:::::: CC: Avi Kivity <avi@xxxxxxxxxx>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx
Attachment:
.config.gz
Description: application/gzip