Content-Type: multipart/mixed; boundary="===============8134208831867561382==" MIME-Version: 1.0 From: Sean Christopherson To: kbuild-all@lists.01.org Subject: Re: [PATCH 3/5] KVM: x86: Use __try_cmpxchg_user() to update guest PTE A/D bits Date: Tue, 01 Feb 2022 19:44:47 +0000 Message-ID: In-Reply-To: <202202011400.EaZmWZ48-lkp@intel.com> List-Id: --===============8134208831867561382== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable On Tue, Feb 01, 2022, kernel test robot wrote: > COMPILER_INSTALL_PATH=3D$HOME/0day COMPILER=3Dclang make.cross W= =3D1 O=3Dbuild_dir ARCH=3Di386 SHELL=3D/bin/bash > = > If you fix the issue, kindly add following tag as appropriate > Reported-by: kernel test robot > = > All errors (new ones prefixed by >>): > = > In file included from arch/x86/kvm/mmu/mmu.c:4246: > >> arch/x86/kvm/mmu/paging_tmpl.h:244:9: error: invalid output size for c= onstraint '+a' > ret =3D __try_cmpxchg_user(ptep_user, &orig_pte, pte, = fault); > ^ > arch/x86/include/asm/uaccess.h:629:11: note: expanded from macro '__tr= y_cmpxchg_user' > __ret =3D !unsafe_try_cmpxchg_user(_ptr, _oldp, _nval, _label)= ; \ > ^ > arch/x86/include/asm/uaccess.h:606:18: note: expanded from macro 'unsa= fe_try_cmpxchg_user' > case 1: __ret =3D __try_cmpxchg_user_asm("b", "q", = \ > ^ > arch/x86/include/asm/uaccess.h:467:22: note: expanded from macro '__tr= y_cmpxchg_user_asm' > [old] "+a" (__old) = \ #$*&(#$ clang. clang isn't smart enough to avoid compiling the impossible conditions it wi= ll throw away in the end, i.e. it compiles all cases given: switch (8) { case 1: case 2: case 4: case 8: } I can fudge around that by casting the pointer, which I don't think can go = sideways if the pointer value is a signed type? @@ -604,15 +602,15 @@ extern void __try_cmpxchg_user_wrong_size(void); bool __ret; \ switch (sizeof(*(_ptr))) { \ case 1: __ret =3D __try_cmpxchg_user_asm("b", "q", \ - (_ptr), (_oldp), \ + (u8 *)(_ptr), (_oldp), \ (_nval), _label); \ break; \ case 2: __ret =3D __try_cmpxchg_user_asm("w", "r", \ - (_ptr), (_oldp), \ + (u16 *)(_ptr), (_oldp), \ (_nval), _label); \ break; \ case 4: __ret =3D __try_cmpxchg_user_asm("l", "r", \ - (_ptr), (_oldp), \ + (u32 *)(_ptr), (_oldp), \ (_nval), _label); \ break; \ case 8: __ret =3D __try_cmpxchg64_user_asm((_ptr), (_oldp), \ clang also lacks the intelligence to realize that it can/should use a single register for encoding the memory operand and consumes both ESI and EDI, lea= ving no register for the __err "+r" param in __try_cmpxchg64_user_asm(). That c= an be avoided by open coding CC_SET and using a single output register for both t= he result and the -EFAULT error path. --===============8134208831867561382==--