Skip to contentSkip to conversation

KVM: VMX: Correct asm constraint in vmcs_load()

PATCH Superseded Avi Kivity 2 participants 9 messages Dec 20, 2010

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Avi Kivity

author
#0 lore raw

PATCH 1/1 KVM: VMX: Correct asm constraint in vmcs_load()

'error' is byte sized, so use a byte register constraint.

---
 arch/x86/kvm/vmx.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/x86/kvm/vmx.c +1 -1
index c195260..a92fdde 100644
@@ -488,7 +488,7 @@ static void vmcs_load(struct vmcs *vmcs)
 	u8 error;
 
 	asm volatile (__ex(ASM_VMX_VMPTRLD_RAX) "; setna %0"
-			: "=g"(error) : "a"(&phys_addr), "m"(phys_addr)
+			: "=qm"(error) : "a"(&phys_addr), "m"(phys_addr)
 			: "cc", "memory");
 	if (error)
 		printk(KERN_ERR "kvm: vmptrld %p/%llx fail\n",
Signature · 1 line
1.7.1
#1 lore raw
Quoted 1 line · Avi Kivity

'error' is byte sized, so use a byte register constraint.

Hm, OK, but I still get the same build error.

Quoted 18 lines
---
 arch/x86/kvm/vmx.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/x86/kvm/vmx.c +1 -1
index c195260..a92fdde 100644
@@ -488,7 +488,7 @@ static void vmcs_load(struct vmcs *vmcs)
 	u8 error;
 
 	asm volatile (__ex(ASM_VMX_VMPTRLD_RAX) "; setna %0"
-			: "=g"(error) : "a"(&phys_addr), "m"(phys_addr)
+			: "=qm"(error) : "a"(&phys_addr), "m"(phys_addr)
 			: "cc", "memory");
 	if (error)
 		printk(KERN_ERR "kvm: vmptrld %p/%llx fail\n",
Signature · 3 lines
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***
desserts:  http://www.xenotime.net/linux/recipes/
author
#2 lore raw
Quoted 4 lines · Randy Dunlap
Quoted 1 line · Avi Kivity

'error' is byte sized, so use a byte register constraint.

Hm, OK, but I still get the same build error.

Not okay then. Can you verify that by removing the content of the function the problem goes away?

What gcc are you using?

Signature · 2 lines
I have a truly marvellous patch that fixes the bug which this
signature is too narrow to contain.
#3 lore raw
Quoted 8 lines · Avi Kivity
Quoted 4 lines · Randy Dunlap
Quoted 1 line · Avi Kivity

'error' is byte sized, so use a byte register constraint.

Hm, OK, but I still get the same build error.

Not okay then. Can you verify that by removing the content of the function the problem goes away?

Nope. I put #if 0 / #endif around the asm() and if (error) lines but I still get the error message:

linux-next-20101217/arch/x86/kvm/vmx.c: Assembler messages:
linux-next-20101217/arch/x86/kvm/vmx.c:488: Error: bad register name `%sil'

which is on the "u8 error;" line below:

static void vmcs_load(struct vmcs *vmcs)

{
	u64 phys_addr = __pa(vmcs);
	u8 error;
Quoted 3 lines

What gcc are you using?

gcc --version

gcc (GCC) 4.4.1 20090725 (Red Hat 4.4.1-2)

Signature · 3 lines
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***
desserts:  http://www.xenotime.net/linux/recipes/
author
#4 lore raw
Quoted 7 lines · Randy Dunlap
Quoted 6 lines · Avi Kivity
Quoted 4 lines · Randy Dunlap
Quoted 1 line · Avi Kivity

'error' is byte sized, so use a byte register constraint.

Hm, OK, but I still get the same build error.

Quoted 9 lines
Quoted 2 lines

Not okay then. Can you verify that by removing the content of the function the problem goes away?

Nope. I put #if 0 / #endif around the asm() and if (error) lines but I still get the error message:

linux-next-20101217/arch/x86/kvm/vmx.c: Assembler messages:
linux-next-20101217/arch/x86/kvm/vmx.c:488: Error: bad register name `%sil'

And line 488 was one of those under #if 0?

Quoted 8 lines

which is on the "u8 error;" line below:

static void vmcs_load(struct vmcs *vmcs)

{
	u64 phys_addr = __pa(vmcs);
	u8 error;
Quoted 4 lines
Quoted 3 lines

What gcc are you using?

gcc --version

gcc (GCC) 4.4.1 20090725 (Red Hat 4.4.1-2)

Good choice.

Signature · 2 lines
I have a truly marvellous patch that fixes the bug which this
signature is too narrow to contain.
author
#5 lore raw
Quoted 11 lines · Avi Kivity
Quoted 10 lines · Randy Dunlap
Quoted 8 lines · Avi Kivity
Quoted 4 lines · Randy Dunlap
Quoted 1 line · Avi Kivity

'error' is byte sized, so use a byte register constraint.

Hm, OK, but I still get the same build error.

Not okay then. Can you verify that by removing the content of the function the problem goes away?

Quoted 16 lines
Quoted 6 lines

Nope. I put #if 0 / #endif around the asm() and if (error) lines but I still get the error message:

linux-next-20101217/arch/x86/kvm/vmx.c: Assembler messages:
linux-next-20101217/arch/x86/kvm/vmx.c:488: Error: bad register name `%sil'

And line 488 was one of those under #if 0?

Quoted 7 lines

which is on the "u8 error;" line below:

static void vmcs_load(struct vmcs *vmcs)

{
    u64 phys_addr = __pa(vmcs);
    u8 error;

Er, you just answered me. Are you sure gcc saw your update? what happens if you comment that line as well? assign to 'error' instead?

Wierd.

Signature · 2 lines
I have a truly marvellous patch that fixes the bug which this
signature is too narrow to contain.
#6 lore raw
Quoted 30 lines · Avi Kivity
Quoted 14 lines · Avi Kivity
Quoted 13 lines · Randy Dunlap
Quoted 8 lines · Avi Kivity
Quoted 4 lines · Randy Dunlap
Quoted 1 line · Avi Kivity

'error' is byte sized, so use a byte register constraint.

Hm, OK, but I still get the same build error.

Not okay then. Can you verify that by removing the content of the function the problem goes away?

Nope. I put #if 0 / #endif around the asm() and if (error) lines but I still get the error message:

Quoted 14 lines
Quoted 4 lines

linux-next-20101217/arch/x86/kvm/vmx.c: Assembler messages:
linux-next-20101217/arch/x86/kvm/vmx.c:488: Error: bad register name `%sil'

And line 488 was one of those under #if 0?

Quoted 7 lines

which is on the "u8 error;" line below:

static void vmcs_load(struct vmcs *vmcs)

{
    u64 phys_addr = __pa(vmcs);
    u8 error;
Quoted 4 lines

Er, you just answered me. Are you sure gcc saw your update? what happens if you comment that line as well? assign to 'error' instead?

pwd

/lnx/src/NEXT/linux-next-20101217

Quoted 1 line

quilt ser -v

= kvm-asm-constraint12.patch

Quoted 1 line

make ARCH=i386 O=X32 all 2>&1 | tee kvm7.out

<kconfig messages deleted>
Using /lnx/src/NEXT/linux-next-20101217 as source for kernel

  GEN     /lnx/src/NEXT/linux-next-20101217/X32/Makefile
  CHK     include/linux/version.h
  CHK     include/generated/utsrelease.h
  CALL    /lnx/src/NEXT/linux-next-20101217/scripts/checksyscalls.sh
  CHK     include/generated/compile.h
  CC      arch/x86/kvm/vmx.o

/lnx/src/NEXT/linux-next-20101217/arch/x86/kvm/vmx.c: Assembler messages:
/lnx/src/NEXT/linux-next-20101217/arch/x86/kvm/vmx.c:488: Error: bad register name `%sil' make[3]: *** [arch/x86/kvm/vmx.o] Error 1
make[2]: *** [arch/x86/kvm] Error 2
make[1]: *** [arch/x86] Error 2
make: *** [sub-make] Error 2

This is with the entire function being empty (no code, no data).

Quoted 1 line

Wierd.

Definitely. I can't explain it.

Signature · 3 lines
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***
desserts:  http://www.xenotime.net/linux/recipes/
author
#7 lore raw
Quoted 57 lines · Randy Dunlap
Quoted 30 lines · Avi Kivity
Quoted 14 lines · Avi Kivity
Quoted 13 lines · Randy Dunlap
Quoted 8 lines · Avi Kivity
Quoted 4 lines · Randy Dunlap
Quoted 1 line · Avi Kivity

'error' is byte sized, so use a byte register constraint.

Hm, OK, but I still get the same build error.

Not okay then. Can you verify that by removing the content of the function the problem goes away?

Nope. I put #if 0 / #endif around the asm() and if (error) lines but I still get the error message:

Quoted 14 lines
Quoted 4 lines

linux-next-20101217/arch/x86/kvm/vmx.c: Assembler messages:
linux-next-20101217/arch/x86/kvm/vmx.c:488: Error: bad register name `%sil'

And line 488 was one of those under #if 0?

Quoted 7 lines

which is on the "u8 error;" line below:

static void vmcs_load(struct vmcs *vmcs)

 {
     u64 phys_addr = __pa(vmcs);
     u8 error;
Quoted 4 lines

Er, you just answered me. Are you sure gcc saw your update? what happens if you comment that line as well? assign to 'error' instead?

pwd

/lnx/src/NEXT/linux-next-20101217

Quoted 1 line

quilt ser -v

= kvm-asm-constraint12.patch

Quoted 1 line

make ARCH=i386 O=X32 all 2>&1 | tee kvm7.out

<kconfig messages deleted>
Using /lnx/src/NEXT/linux-next-20101217 as source for kernel

   GEN     /lnx/src/NEXT/linux-next-20101217/X32/Makefile
   CHK     include/linux/version.h
   CHK     include/generated/utsrelease.h
   CALL    /lnx/src/NEXT/linux-next-20101217/scripts/checksyscalls.sh
   CHK     include/generated/compile.h
   CC      arch/x86/kvm/vmx.o

/lnx/src/NEXT/linux-next-20101217/arch/x86/kvm/vmx.c: Assembler messages:
/lnx/src/NEXT/linux-next-20101217/arch/x86/kvm/vmx.c:488: Error: bad register name `%sil' make[3]: *** [arch/x86/kvm/vmx.o] Error 1
make[2]: *** [arch/x86/kvm] Error 2
make[1]: *** [arch/x86] Error 2
make: *** [sub-make] Error 2

Quoted 6 lines

This is with the entire function being empty (no code, no data).

Quoted 1 line

Wierd.

Definitely. I can't explain it.

Maybe it's the vmcs_clear() above. Try the same treatment?

Signature · 2 lines
I have a truly marvellous patch that fixes the bug which this
signature is too narrow to contain.
#8 lore raw
Quoted 60 lines · Avi Kivity
Quoted 59 lines · Randy Dunlap
Quoted 10 lines · Avi Kivity
Quoted 9 lines · Avi Kivity
Quoted 8 lines · Randy Dunlap
Quoted 7 lines · Avi Kivity
Quoted 4 lines · Randy Dunlap
Quoted 1 line · Avi Kivity

'error' is byte sized, so use a byte register constraint.

Hm, OK, but I still get the same build error.

Not okay then. Can you verify that by removing the content

of the

Quoted 20 lines
Quoted 5 lines
Quoted 5 lines
Quoted 1 line

function the problem goes away?

Nope. I put #if 0 / #endif around the asm() and if (error) lines but I still get the error message:

Quoted 14 lines
Quoted 4 lines

linux-next-20101217/arch/x86/kvm/vmx.c: Assembler messages:
linux-next-20101217/arch/x86/kvm/vmx.c:488: Error: bad register name `%sil'

And line 488 was one of those under #if 0?

Quoted 7 lines

which is on the "u8 error;" line below:

static void vmcs_load(struct vmcs *vmcs)

 {
     u64 phys_addr = __pa(vmcs);
     u8 error;
Quoted 4 lines

Er, you just answered me. Are you sure gcc saw your update? what happens if you comment that line as well? assign to 'error' instead?

pwd

/lnx/src/NEXT/linux-next-20101217

Quoted 1 line

quilt ser -v

= kvm-asm-constraint12.patch

Quoted 1 line

make ARCH=i386 O=X32 all 2>&1 | tee kvm7.out

<kconfig messages deleted>
Using /lnx/src/NEXT/linux-next-20101217 as source for kernel

   GEN     /lnx/src/NEXT/linux-next-20101217/X32/Makefile
   CHK     include/linux/version.h
   CHK     include/generated/utsrelease.h
   CALL    /lnx/src/NEXT/linux-next-20101217/scripts/checksyscalls.sh
   CHK     include/generated/compile.h
   CC      arch/x86/kvm/vmx.o

/lnx/src/NEXT/linux-next-20101217/arch/x86/kvm/vmx.c: Assembler messages:
/lnx/src/NEXT/linux-next-20101217/arch/x86/kvm/vmx.c:488: Error: bad register name `%sil'
make[3]: *** [arch/x86/kvm/vmx.o] Error 1
make[2]: *** [arch/x86/kvm] Error 2
make[1]: *** [arch/x86] Error 2
make: *** [sub-make] Error 2

Quoted 8 lines
Quoted 6 lines

This is with the entire function being empty (no code, no data).

Quoted 1 line

Wierd.

Definitely. I can't explain it.

Maybe it's the vmcs_clear() above. Try the same treatment?

Good call. Changing the =g to =qm there fixes the build problem. Thanks.

Signature · 3 lines
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***
desserts:  http://www.xenotime.net/linux/recipes/