Re: [PATCH v6 23/25] KVM: x86: Enable CET virtualization for VMX and advertise to userspace

From: Yang, Weijiang
Date: Sun Sep 24 2023 - 20:26:45 EST



It's due to lack of capability check, I will fix the calltrace in next verison.

On 9/24/2023 9:38 PM, kernel test robot wrote:

Hello,

kernel test robot noticed "WARNING:at_arch/x86/kvm/vmx/vmx.c:#vmwrite_error[kvm_intel]" on:

commit: 68d0338a67df85ab18482295976e7bd873987165 ("[PATCH v6 23/25] KVM: x86: Enable CET virtualization for VMX and advertise to userspace")
url: https://github.com/intel-lab-lkp/linux/commits/Yang-Weijiang/x86-fpu-xstate-Manually-check-and-add-XFEATURE_CET_USER-xstate-bit/20230914-174056
patch link: https://lore.kernel.org/all/20230914063325.85503-24-weijiang.yang@xxxxxxxxx/
patch subject: [PATCH v6 23/25] KVM: x86: Enable CET virtualization for VMX and advertise to userspace

in testcase: kvm-unit-tests-qemu
version:
with following parameters:




compiler: gcc-12
test machine: 128 threads 2 sockets Intel(R) Xeon(R) Platinum 8358 CPU @ 2.60GHz (Ice Lake) with 128G memory

(please refer to attached dmesg/kmsg for entire log/backtrace)



If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <oliver.sang@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-lkp/202309242050.90b36814-oliver.sang@xxxxxxxxx



The kernel config and materials to reproduce are available at:
https://download.01.org/0day-ci/archive/20230924/202309242050.90b36814-oliver.sang@xxxxxxxxx



[ 271.856711][T15436] ------------[ cut here ]------------
[ 271.863011][T15436] vmwrite failed: field=682a val=0 err=12
[ 271.869458][T15436] WARNING: CPU: 117 PID: 15436 at arch/x86/kvm/vmx/vmx.c:444 vmwrite_error+0x16b/0x2e0 [kvm_intel]
[ 271.880940][T15436] Modules linked in: kvm_intel kvm irqbypass btrfs blake2b_generic xor raid6_pq zstd_compress libcrc32c sd_mod t10_pi crc64_rocksoft_generic crc64_rocksoft crc64 sg intel_rapl_msr intel_rapl_common x86_pkg_temp_thermal intel_powerclamp coretemp crct10dif_pclmul crc32_pclmul crc32c_intel ghash_clmulni_intel sha512_ssse3 rapl intel_cstate ipmi_ssif ahci ast libahci mei_me drm_shmem_helper intel_uncore dax_hmem ioatdma joydev drm_kms_helper acpi_ipmi libata mei intel_pch_thermal dca wmi ipmi_si ipmi_devintf ipmi_msghandler acpi_power_meter acpi_pad fuse drm ip_tables [last unloaded: irqbypass]
[ 271.939752][T15436] CPU: 117 PID: 15436 Comm: qemu-system-x86 Not tainted 6.5.0-12553-g68d0338a67df #1
[ 271.950090][T15436] RIP: 0010:vmwrite_error+0x16b/0x2e0 [kvm_intel]
[ 271.957256][T15436] Code: ff c6 05 f1 4b 82 ff 01 66 90 b9 00 44 00 00 0f 78 c9 0f 86 e0 00 00 00 48 89 ea 48 89 de 48 c7 c7 80 1c d9 c0 e8 c5 b7 c4 bf <0f> 0b e9 ae fe ff ff 48 c7 c0 a0 6f d9 c0 48 ba 00 00 00 00 00 fc
[ 271.978720][T15436] RSP: 0018:ffa000000e117980 EFLAGS: 00010286
[ 271.985599][T15436] RAX: 0000000000000000 RBX: 000000000000682a RCX: ffffffff82216eee
[ 271.994345][T15436] RDX: 1fe2200403fd57c8 RSI: 0000000000000008 RDI: ffa000000e117738
[ 272.003044][T15436] RBP: 0000000000000000 R08: 0000000000000001 R09: fff3fc0001c22ee7
[ 272.011865][T15436] R10: ffa000000e11773f R11: 0000000000000001 R12: ff110011b12a4b20
[ 272.020632][T15436] R13: 0000000000000000 R14: 0000000000000000 R15: ff110011b12a4980
[ 272.029340][T15436] FS: 00007f79fd975700(0000) GS:ff1100201fe80000(0000) knlGS:0000000000000000
[ 272.039141][T15436] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 272.046484][T15436] CR2: 00007f79e8000010 CR3: 00000010d23c0003 CR4: 0000000000773ee0
[ 272.055167][T15436] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[ 272.063980][T15436] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
[ 272.072749][T15436] PKRU: 55555554
[ 272.076985][T15436] Call Trace:
[ 272.080947][T15436] <TASK>
[ 272.084650][T15436] ? __warn+0xcd/0x260
[ 272.089420][T15436] ? vmwrite_error+0x16b/0x2e0 [kvm_intel]
[ 272.096014][T15436] ? report_bug+0x267/0x2d0
[ 272.101163][T15436] ? handle_bug+0x3c/0x70
[ 272.106130][T15436] ? exc_invalid_op+0x17/0x40
[ 272.111483][T15436] ? asm_exc_invalid_op+0x1a/0x20
[ 272.117132][T15436] ? llist_add_batch+0xbe/0x130
[ 272.122685][T15436] ? vmwrite_error+0x16b/0x2e0 [kvm_intel]
[ 272.129113][T15436] vmx_vcpu_reset+0x2382/0x30b0 [kvm_intel]
[ 272.135741][T15436] ? init_vmcs+0x7230/0x7230 [kvm_intel]
[ 272.141988][T15436] ? irq_work_sync+0x8a/0x1f0
[ 272.147302][T15436] ? kvm_clear_async_pf_completion_queue+0x2e6/0x4c0 [kvm]
[ 272.155191][T15436] kvm_vcpu_reset+0x8cc/0x1080 [kvm]
[ 272.161154][T15436] kvm_arch_vcpu_create+0x8c5/0xbd0 [kvm]
[ 272.167584][T15436] kvm_vm_ioctl_create_vcpu+0x4be/0xe20 [kvm]
[ 272.174297][T15436] ? __alloc_pages+0x1d5/0x440
[ 272.179723][T15436] ? kvm_get_dirty_log_protect+0x5f0/0x5f0 [kvm]
[ 272.186757][T15436] ? __alloc_pages_slowpath+0x1cf0/0x1cf0
[ 272.194079][T15436] ? do_user_addr_fault+0x26c/0xac0
[ 272.199837][T15436] ? mem_cgroup_handle_over_high+0x570/0x570
[ 272.206405][T15436] ? _raw_spin_lock+0x85/0xe0
[ 272.211721][T15436] ? _raw_write_lock_irq+0xe0/0xe0
[ 272.217414][T15436] kvm_vm_ioctl+0x939/0xde0 [kvm]
[ 272.223014][T15436] ? __mod_memcg_lruvec_state+0x100/0x220
[ 272.229278][T15436] ? kvm_unregister_device_ops+0x90/0x90 [kvm]
[ 272.235978][T15436] ? __mod_lruvec_page_state+0x1ad/0x3a0
[ 272.242092][T15436] ? perf_trace_mm_lru_insertion+0x7c0/0x7c0
[ 272.248627][T15436] ? folio_batch_add_and_move+0xc1/0x110
[ 272.254832][T15436] ? do_anonymous_page+0x5e2/0xc10
[ 272.260431][T15436] ? up_write+0x52/0x90
[ 272.265006][T15436] ? vfs_fileattr_set+0x4e0/0x4e0
[ 272.270502][T15436] ? copy_page_range+0x880/0x880
[ 272.275831][T15436] ? __count_memcg_events+0xdd/0x1e0
[ 272.281564][T15436] ? handle_mm_fault+0x187/0x7a0
[ 272.286855][T15436] ? __fget_light+0x236/0x4d0
[ 272.291883][T15436] __x64_sys_ioctl+0x130/0x1a0
[ 272.296994][T15436] do_syscall_64+0x38/0x80
[ 272.301756][T15436] entry_SYSCALL_64_after_hwframe+0x63/0xcd
[ 272.307993][T15436] RIP: 0033:0x7f79fe886237
[ 272.312758][T15436] Code: 00 00 00 48 8b 05 59 cc 0d 00 64 c7 00 26 00 00 00 48 c7 c0 ff ff ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 b8 10 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d 29 cc 0d 00 f7 d8 64 89 01 48
[ 272.333241][T15436] RSP: 002b:00007f79fd974808 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
[ 272.342024][T15436] RAX: ffffffffffffffda RBX: 000000000000ae41 RCX: 00007f79fe886237
[ 272.350428][T15436] RDX: 0000000000000000 RSI: 000000000000ae41 RDI: 000000000000000d
[ 272.358789][T15436] RBP: 00005606ece4cc90 R08: 0000000000000000 R09: 0000000000000000
[ 272.367151][T15436] R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
[ 272.375587][T15436] R13: 00007ffefe5a1daf R14: 00007f79fd974a80 R15: 0000000000802000
[ 272.383950][T15436] </TASK>
[ 272.387416][T15436] ---[ end trace 0000000000000000 ]---
[ 272.393295][T15436] kvm_intel: vmwrite failed: field=682a val=0 err=12