Re: [PATCH] KVM: x86: Add support for cmpxchg16b emulation

kernel test robot
2026-03-07T02:40:34Z

Hi Sairaj,

kernel test robot noticed the following build warnings:

[auto build test WARNING on kvm/queue]
[also build test WARNING on kvm/next tip/master linus/master v7.0-rc2 next-20260306]
[cannot apply to kvm/linux-next tip/auto-latest]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/Sairaj-Kodilkar/KVM-x86-Add-support-for-cmpxchg16b-emulation/20260306-182915
base: https://git.kernel.org/pub/scm/virt/kvm/kvm.git queue
patch link: https://lore.kernel.org/r/20260306102047.29760-1-sarunkod%40amd.com
patch subject: [PATCH] KVM: x86: Add support for cmpxchg16b emulation
config: i386-randconfig-005-20260307 (https://download.01.org/0day-ci/archive/20260307/202603071055.Wi43mREW-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.4.0-5) 12.4.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260307/202603071055.Wi43mREW-lkp@intel.com/reproduce)

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 <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202603071055.Wi43mREW-lkp@intel.com/

All warnings (new ones prefixed by >>):

In file included from arch/x86/kvm/emulate.c:24:
arch/x86/kvm/kvm_emulate.h:271:17: error: unknown type name '__uint128_t'
271 | __uint128_t val128;
| ^~~~~~~~~~~
arch/x86/kvm/emulate.c: In function '__handle_cmpxchg16b':
arch/x86/kvm/emulate.c:2215:9: error: unknown type name '__uint128_t'; did you mean '__int128__'?
2215 | __uint128_t old128 = ctxt->dst.val128;
| ^~~~~~~~~~~
| __int128__
>> arch/x86/kvm/emulate.c:2222:28: warning: right shift count >= width of type [-Wshift-count-overflow]
2222 | ((u64) (old128 >> 64) != (u64) reg_read(ctxt, VCPU_REGS_RDX))) {
| ^~
arch/x86/kvm/emulate.c:2224:65: warning: right shift count >= width of type [-Wshift-count-overflow]
2224 | *reg_write(ctxt, VCPU_REGS_RDX) = (u64) (old128 >> 64);
| ^~
arch/x86/kvm/emulate.c:2228:27: error: '__uint128_t' undeclared (first use in this function); did you mean '__int128__'?
2228 | ((__uint128_t) reg_read(ctxt, VCPU_REGS_RCX) << 64) |
| ^~~~~~~~~~~
| __int128__
arch/x86/kvm/emulate.c:2228:27: note: each undeclared identifier is reported only once for each function it appears in
arch/x86/kvm/emulate.c:2228:39: error: expected ')' before 'reg_read'
2228 | ((__uint128_t) reg_read(ctxt, VCPU_REGS_RCX) << 64) |
| ~ ^~~~~~~~~
| )

vim +2222 arch/x86/kvm/emulate.c

2212
2213 static int __handle_cmpxchg16b(struct x86_emulate_ctxt *ctxt)
2214 {
2215 __uint128_t old128 = ctxt->dst.val128;
2216
2217 /* Use of the REX.W prefix promotes operation to 128 bits */
2218 if (!(ctxt->rex_bits & REX_W))
2219 return X86EMUL_UNHANDLEABLE;
2220
2221 if (((u64) (old128 >> 0) != (u64) reg_read(ctxt, VCPU_REGS_RAX)) ||
> 2222 ((u64) (old128 >> 64) != (u64) reg_read(ctxt, VCPU_REGS_RDX))) {
2223 *reg_write(ctxt, VCPU_REGS_RAX) = (u64) (old128 >> 0);
2224 *reg_write(ctxt, VCPU_REGS_RDX) = (u64) (old128 >> 64);
2225 ctxt->eflags &= ~X86_EFLAGS_ZF;
2226 } else {
2227 ctxt->dst.val128 =
2228 ((__uint128_t) reg_read(ctxt, VCPU_REGS_RCX) << 64) |
2229 (u64) reg_read(ctxt, VCPU_REGS_RBX);
2230
2231 ctxt->eflags |= X86_EFLAGS_ZF;
2232 }
2233 return X86EMUL_CONTINUE;
2234 }
2235

--
0-DAY CI Kernel Test Service