All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] KVM: VMX: Correct asm constraint in vmcs_load()
@ 2010-12-20  9:06 Avi Kivity
  2010-12-20 16:56 ` Randy Dunlap
  0 siblings, 1 reply; 9+ messages in thread
From: Avi Kivity @ 2010-12-20  9:06 UTC (permalink / raw)
  To: Marcelo Tosatti, kvm; +Cc: Randy Dunlap

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

Signed-off-by: Avi Kivity <avi@redhat.com>
---
 arch/x86/kvm/vmx.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index c195260..a92fdde 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -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",
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH] KVM: VMX: Correct asm constraint in vmcs_load()
  2010-12-20  9:06 [PATCH] KVM: VMX: Correct asm constraint in vmcs_load() Avi Kivity
@ 2010-12-20 16:56 ` Randy Dunlap
  2010-12-20 17:47   ` Avi Kivity
  0 siblings, 1 reply; 9+ messages in thread
From: Randy Dunlap @ 2010-12-20 16:56 UTC (permalink / raw)
  To: Avi Kivity; +Cc: Marcelo Tosatti, kvm

On 12/20/10 01:06, Avi Kivity wrote:
> 'error' is byte sized, so use a byte register constraint.

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


> Signed-off-by: Avi Kivity <avi@redhat.com>
> ---
>  arch/x86/kvm/vmx.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
> index c195260..a92fdde 100644
> --- a/arch/x86/kvm/vmx.c
> +++ b/arch/x86/kvm/vmx.c
> @@ -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",


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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] KVM: VMX: Correct asm constraint in vmcs_load()
  2010-12-20 16:56 ` Randy Dunlap
@ 2010-12-20 17:47   ` Avi Kivity
  2010-12-20 17:53     ` Randy Dunlap
  0 siblings, 1 reply; 9+ messages in thread
From: Avi Kivity @ 2010-12-20 17:47 UTC (permalink / raw)
  To: Randy Dunlap; +Cc: Marcelo Tosatti, kvm

On 12/20/2010 06:56 PM, Randy Dunlap wrote:
> On 12/20/10 01:06, Avi Kivity wrote:
> >  '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?

-- 
I have a truly marvellous patch that fixes the bug which this
signature is too narrow to contain.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] KVM: VMX: Correct asm constraint in vmcs_load()
  2010-12-20 17:47   ` Avi Kivity
@ 2010-12-20 17:53     ` Randy Dunlap
  2010-12-20 17:57       ` Avi Kivity
  0 siblings, 1 reply; 9+ messages in thread
From: Randy Dunlap @ 2010-12-20 17:53 UTC (permalink / raw)
  To: Avi Kivity; +Cc: Marcelo Tosatti, kvm

On 12/20/10 09:47, Avi Kivity wrote:
> On 12/20/2010 06:56 PM, Randy Dunlap wrote:
>> On 12/20/10 01:06, Avi Kivity wrote:
>> >  '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;


> What gcc are you using?

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

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] KVM: VMX: Correct asm constraint in vmcs_load()
  2010-12-20 17:53     ` Randy Dunlap
@ 2010-12-20 17:57       ` Avi Kivity
  2010-12-20 17:58         ` Avi Kivity
  0 siblings, 1 reply; 9+ messages in thread
From: Avi Kivity @ 2010-12-20 17:57 UTC (permalink / raw)
  To: Randy Dunlap; +Cc: Marcelo Tosatti, kvm

On 12/20/2010 07:53 PM, Randy Dunlap wrote:
> On 12/20/10 09:47, Avi Kivity wrote:
> >  On 12/20/2010 06:56 PM, Randy Dunlap wrote:
> >>  On 12/20/10 01:06, Avi Kivity wrote:
> >>  >   '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'
>

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

> which is on the "u8 error;" line below:
>
> static void vmcs_load(struct vmcs *vmcs)
> {
> 	u64 phys_addr = __pa(vmcs);
> 	u8 error;
>
>
> >  What gcc are you using?
>
> >  gcc --version
> gcc (GCC) 4.4.1 20090725 (Red Hat 4.4.1-2)

Good choice.

-- 
I have a truly marvellous patch that fixes the bug which this
signature is too narrow to contain.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] KVM: VMX: Correct asm constraint in vmcs_load()
  2010-12-20 17:57       ` Avi Kivity
@ 2010-12-20 17:58         ` Avi Kivity
  2010-12-20 18:22           ` Randy Dunlap
  0 siblings, 1 reply; 9+ messages in thread
From: Avi Kivity @ 2010-12-20 17:58 UTC (permalink / raw)
  To: Randy Dunlap; +Cc: Marcelo Tosatti, kvm

On 12/20/2010 07:57 PM, Avi Kivity wrote:
> On 12/20/2010 07:53 PM, Randy Dunlap wrote:
>> On 12/20/10 09:47, Avi Kivity wrote:
>> >  On 12/20/2010 06:56 PM, Randy Dunlap wrote:
>> >>  On 12/20/10 01:06, Avi Kivity wrote:
>> >> >   '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'
>>
>
> And line 488 was one of those under #if 0?
>
>> 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.

-- 
I have a truly marvellous patch that fixes the bug which this
signature is too narrow to contain.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] KVM: VMX: Correct asm constraint in vmcs_load()
  2010-12-20 17:58         ` Avi Kivity
@ 2010-12-20 18:22           ` Randy Dunlap
  2010-12-20 18:26             ` Avi Kivity
  0 siblings, 1 reply; 9+ messages in thread
From: Randy Dunlap @ 2010-12-20 18:22 UTC (permalink / raw)
  To: Avi Kivity; +Cc: Marcelo Tosatti, kvm

On 12/20/10 09:58, Avi Kivity wrote:
> On 12/20/2010 07:57 PM, Avi Kivity wrote:
>> On 12/20/2010 07:53 PM, Randy Dunlap wrote:
>>> On 12/20/10 09:47, Avi Kivity wrote:
>>> >  On 12/20/2010 06:56 PM, Randy Dunlap wrote:
>>> >>  On 12/20/10 01:06, Avi Kivity wrote:
>>> >> >   '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'
>>>
>>
>> And line 488 was one of those under #if 0?
>>
>>> 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?

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

> quilt ser -v
= kvm-asm-constraint12.patch

> 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).

> Wierd.

Definitely.  I can't explain it.

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] KVM: VMX: Correct asm constraint in vmcs_load()
  2010-12-20 18:22           ` Randy Dunlap
@ 2010-12-20 18:26             ` Avi Kivity
  2010-12-20 19:16               ` Randy Dunlap
  0 siblings, 1 reply; 9+ messages in thread
From: Avi Kivity @ 2010-12-20 18:26 UTC (permalink / raw)
  To: Randy Dunlap; +Cc: Marcelo Tosatti, kvm

On 12/20/2010 08:22 PM, Randy Dunlap wrote:
> On 12/20/10 09:58, Avi Kivity wrote:
> >  On 12/20/2010 07:57 PM, Avi Kivity wrote:
> >>  On 12/20/2010 07:53 PM, Randy Dunlap wrote:
> >>>  On 12/20/10 09:47, Avi Kivity wrote:
> >>>  >   On 12/20/2010 06:56 PM, Randy Dunlap wrote:
> >>>  >>   On 12/20/10 01:06, Avi Kivity wrote:
> >>>  >>  >    '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'
> >>>
> >>
> >>  And line 488 was one of those under #if 0?
> >>
> >>>  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?
>
> >  pwd
> /lnx/src/NEXT/linux-next-20101217
>
> >  quilt ser -v
> = kvm-asm-constraint12.patch
>
> >  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).
>
> >  Wierd.
>
> Definitely.  I can't explain it.
>

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

-- 
I have a truly marvellous patch that fixes the bug which this
signature is too narrow to contain.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] KVM: VMX: Correct asm constraint in vmcs_load()
  2010-12-20 18:26             ` Avi Kivity
@ 2010-12-20 19:16               ` Randy Dunlap
  0 siblings, 0 replies; 9+ messages in thread
From: Randy Dunlap @ 2010-12-20 19:16 UTC (permalink / raw)
  To: Avi Kivity; +Cc: Marcelo Tosatti, kvm

On 12/20/10 10:26, Avi Kivity wrote:
> On 12/20/2010 08:22 PM, Randy Dunlap wrote:
>> On 12/20/10 09:58, Avi Kivity wrote:
>> >  On 12/20/2010 07:57 PM, Avi Kivity wrote:
>> >>  On 12/20/2010 07:53 PM, Randy Dunlap wrote:
>> >>>  On 12/20/10 09:47, Avi Kivity wrote:
>> >>>  >   On 12/20/2010 06:56 PM, Randy Dunlap wrote:
>> >>>  >>   On 12/20/10 01:06, Avi Kivity wrote:
>> >>>  >>  >    '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'
>> >>>
>> >>
>> >>  And line 488 was one of those under #if 0?
>> >>
>> >>>  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?
>>
>> >  pwd
>> /lnx/src/NEXT/linux-next-20101217
>>
>> >  quilt ser -v
>> = kvm-asm-constraint12.patch
>>
>> >  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).
>>
>> >  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.

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2010-12-20 19:16 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-12-20  9:06 [PATCH] KVM: VMX: Correct asm constraint in vmcs_load() Avi Kivity
2010-12-20 16:56 ` Randy Dunlap
2010-12-20 17:47   ` Avi Kivity
2010-12-20 17:53     ` Randy Dunlap
2010-12-20 17:57       ` Avi Kivity
2010-12-20 17:58         ` Avi Kivity
2010-12-20 18:22           ` Randy Dunlap
2010-12-20 18:26             ` Avi Kivity
2010-12-20 19:16               ` Randy Dunlap

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.