LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] KVM: 'asm' operand has impossible constraints
@ 2007-01-25 23:40 S.Çağlar Onur
2007-01-27 9:05 ` Avi Kivity
0 siblings, 1 reply; 8+ messages in thread
From: S.Çağlar Onur @ 2007-01-25 23:40 UTC (permalink / raw)
To: lkml; +Cc: Avi Kivity, kvm-devel
[-- Attachment #1: Type: text/plain, Size: 1142 bytes --]
Hi;
-rc6 fails with latest gcc 4.2 snapshot as following;
CC [M] drivers/kvm/svm.o
drivers/kvm/svm.c:206: warning: 'inject_db' defined but not used
drivers/kvm/svm.c: In function 'svm_vcpu_run':
drivers/kvm/kvm.h:560: error: 'asm' operand has impossible constraints
make[2]: *** [drivers/kvm/svm.o] Error 1
make[1]: *** [drivers/kvm] Error 2
make: *** [drivers] Error 2
And according to this thread http://lkml.org/lkml/2006/11/11/129, solution is
converting g to rm, patch follows
Signed-off-by: S.Çağlar Onur <caglar@pardus.org.tr>
Index: linux-2.6/drivers/kvm/kvm.h
===================================================================
--- linux-2.6.orig/drivers/kvm/kvm.h 2007-01-26 01:38:35.000000000 +0200
+++ linux-2.6/drivers/kvm/kvm.h 2007-01-26 01:37:48.000000000 +0200
@@ -557,7 +557,7 @@
#ifndef load_ldt
static inline void load_ldt(u16 sel)
{
- asm ("lldt %0" : : "g"(sel));
+ asm ("lldt %0" : : "rm"(sel));
}
#endif
--
S.Çağlar Onur <caglar@pardus.org.tr>
http://cekirdek.pardus.org.tr/~caglar/
Linux is like living in a teepee. No Windows, no Gates and an Apache in house!
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] KVM: 'asm' operand has impossible constraints
2007-01-25 23:40 [PATCH] KVM: 'asm' operand has impossible constraints S.Çağlar Onur
@ 2007-01-27 9:05 ` Avi Kivity
2007-01-27 16:36 ` Paweł Sikora
2007-01-27 21:28 ` S.Çağlar Onur
0 siblings, 2 replies; 8+ messages in thread
From: Avi Kivity @ 2007-01-27 9:05 UTC (permalink / raw)
To: caglar; +Cc: lkml, kvm-devel
S.Çağlar Onur wrote:
> Hi;
>
> -rc6 fails with latest gcc 4.2 snapshot as following;
>
> CC [M] drivers/kvm/svm.o
> drivers/kvm/svm.c:206: warning: 'inject_db' defined but not used
> drivers/kvm/svm.c: In function 'svm_vcpu_run':
> drivers/kvm/kvm.h:560: error: 'asm' operand has impossible constraints
> make[2]: *** [drivers/kvm/svm.o] Error 1
> make[1]: *** [drivers/kvm] Error 2
> make: *** [drivers] Error 2
>
> And according to this thread http://lkml.org/lkml/2006/11/11/129, solution is
> converting g to rm, patch follows
>
>
The patch looks correct, but I don't understand the gcc error message.
Are we sure this isn't a gcc 4.2 bug?
"g" appears to be equivalent to "rmi", if "i" is impossible, gcc is free
to use "r" or "m", no?
> Signed-off-by: S.Çağlar Onur <caglar@pardus.org.tr>
>
> Index: linux-2.6/drivers/kvm/kvm.h
> ===================================================================
> --- linux-2.6.orig/drivers/kvm/kvm.h 2007-01-26 01:38:35.000000000 +0200
> +++ linux-2.6/drivers/kvm/kvm.h 2007-01-26 01:37:48.000000000 +0200
> @@ -557,7 +557,7 @@
> #ifndef load_ldt
> static inline void load_ldt(u16 sel)
> {
> - asm ("lldt %0" : : "g"(sel));
> + asm ("lldt %0" : : "rm"(sel));
> }
> #endif
>
>
>
--
Do not meddle in the internals of kernels, for they are subtle and quick to panic.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] KVM: 'asm' operand has impossible constraints
2007-01-27 9:05 ` Avi Kivity
@ 2007-01-27 16:36 ` Paweł Sikora
2007-01-28 9:41 ` Avi Kivity
2007-01-27 21:28 ` S.Çağlar Onur
1 sibling, 1 reply; 8+ messages in thread
From: Paweł Sikora @ 2007-01-27 16:36 UTC (permalink / raw)
To: linux-kernel; +Cc: Avi Kivity, caglar, kvm-devel
On Saturday 27 of January 2007 10:05:53 Avi Kivity wrote:
> "g" appears to be equivalent to "rmi", if "i" is impossible, gcc is free
> to use "r" or "m", no?
`r'
A register operand is allowed provided that it is in a general
register.
`g'
Any register, memory or immediate integer operand is allowed,
except for registers that are not general registers.
so, it looks like g == !r for registers ( not general vs. general regs ).
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] KVM: 'asm' operand has impossible constraints
2007-01-27 16:36 ` Paweł Sikora
@ 2007-01-28 9:41 ` Avi Kivity
0 siblings, 0 replies; 8+ messages in thread
From: Avi Kivity @ 2007-01-28 9:41 UTC (permalink / raw)
To: Paweł Sikora; +Cc: linux-kernel, caglar, kvm-devel
Paweł Sikora wrote:
> On Saturday 27 of January 2007 10:05:53 Avi Kivity wrote:
>
>
>> "g" appears to be equivalent to "rmi", if "i" is impossible, gcc is free
>> to use "r" or "m", no?
>>
>
> `r'
> A register operand is allowed provided that it is in a general
> register.
> `g'
> Any register, memory or immediate integer operand is allowed,
> except for registers that are not general registers.
>
> so, it looks like g == !r for registers ( not general vs. general regs ).
>
I read it as g == !!r for registers ("except" and "not" constitute a
double negative).
--
error compiling committee.c: too many arguments to function
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] KVM: 'asm' operand has impossible constraints
2007-01-27 9:05 ` Avi Kivity
2007-01-27 16:36 ` Paweł Sikora
@ 2007-01-27 21:28 ` S.Çağlar Onur
2007-01-27 21:46 ` D. Hazelton
` (2 more replies)
1 sibling, 3 replies; 8+ messages in thread
From: S.Çağlar Onur @ 2007-01-27 21:28 UTC (permalink / raw)
To: Avi Kivity; +Cc: lkml, kvm-devel
[-- Attachment #1: Type: text/plain, Size: 717 bytes --]
27 Oca 2007 Cts tarihinde, Avi Kivity şunları yazmıştı:
> The patch looks correct, but I don't understand the gcc error message.
> Are we sure this isn't a gcc 4.2 bug?
>
> "g" appears to be equivalent to "rmi", if "i" is impossible, gcc is free
> to use "r" or "m", no?
Accorgind to GCC devs. its not a bug
(http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29808), on comment #5 the
problem described like;
"g" means "r"+"i" so the register allocator in the -O0 case is selecting "r"
while in the optimize case is selecting "i"
--
S.Çağlar Onur <caglar@pardus.org.tr>
http://cekirdek.pardus.org.tr/~caglar/
Linux is like living in a teepee. No Windows, no Gates and an Apache in house!
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] KVM: 'asm' operand has impossible constraints
2007-01-27 21:28 ` S.Çağlar Onur
@ 2007-01-27 21:46 ` D. Hazelton
2007-01-28 7:55 ` H. Peter Anvin
2007-01-28 9:45 ` Avi Kivity
2 siblings, 0 replies; 8+ messages in thread
From: D. Hazelton @ 2007-01-27 21:46 UTC (permalink / raw)
To: caglar; +Cc: Avi Kivity, lkml, kvm-devel
On Saturday 27 January 2007 16:28, S.Çağlar Onur wrote:
> 27 Oca 2007 Cts tarihinde, Avi Kivity şunları yazmıştı:
> > The patch looks correct, but I don't understand the gcc error message.
> > Are we sure this isn't a gcc 4.2 bug?
> >
> > "g" appears to be equivalent to "rmi", if "i" is impossible, gcc is free
> > to use "r" or "m", no?
>
> Accorgind to GCC devs. its not a bug
> (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29808), on comment #5 the
> problem described like;
>
> "g" means "r"+"i" so the register allocator in the -O0 case is selecting
> "r" while in the optimize case is selecting "i"
Sounds like a bug to me! After all, shouldn't the different sections of code
be selecting the *same* bits ?
DRH
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] KVM: 'asm' operand has impossible constraints
2007-01-27 21:28 ` S.Çağlar Onur
2007-01-27 21:46 ` D. Hazelton
@ 2007-01-28 7:55 ` H. Peter Anvin
2007-01-28 9:45 ` Avi Kivity
2 siblings, 0 replies; 8+ messages in thread
From: H. Peter Anvin @ 2007-01-28 7:55 UTC (permalink / raw)
To: caglar; +Cc: Avi Kivity, lkml, kvm-devel
S.Çağlar Onur wrote:
>
> "g" means "r"+"i" so the register allocator in the -O0 case is selecting "r"
> while in the optimize case is selecting "i"
>
"g" means "rmi", not "ri".
-hpa
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] KVM: 'asm' operand has impossible constraints
2007-01-27 21:28 ` S.Çağlar Onur
2007-01-27 21:46 ` D. Hazelton
2007-01-28 7:55 ` H. Peter Anvin
@ 2007-01-28 9:45 ` Avi Kivity
2 siblings, 0 replies; 8+ messages in thread
From: Avi Kivity @ 2007-01-28 9:45 UTC (permalink / raw)
To: caglar; +Cc: lkml, kvm-devel
S.Çağlar Onur wrote:
> 27 Oca 2007 Cts tarihinde, Avi Kivity şunları yazmıştı:
>
>> The patch looks correct, but I don't understand the gcc error message.
>> Are we sure this isn't a gcc 4.2 bug?
>>
>> "g" appears to be equivalent to "rmi", if "i" is impossible, gcc is free
>> to use "r" or "m", no?
>>
>
> Accorgind to GCC devs. its not a bug
> (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29808), on comment #5 the
> problem described like;
>
> "g" means "r"+"i" so the register allocator in the -O0 case is selecting "r"
> while in the optimize case is selecting "i"
>
>
That's a different bug. The gcc PR has an assembler error message, as
expected, whereas the kvm miscompile has a compiler error, which I don't
understand.
Anyhow, your patch is correct (because selecting "i" is indeed
erroneous) so I'll apply it, but I'm worried that there's a gcc bug in
there that we ought to report.
--
error compiling committee.c: too many arguments to function
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2007-01-28 9:45 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-01-25 23:40 [PATCH] KVM: 'asm' operand has impossible constraints S.Çağlar Onur
2007-01-27 9:05 ` Avi Kivity
2007-01-27 16:36 ` Paweł Sikora
2007-01-28 9:41 ` Avi Kivity
2007-01-27 21:28 ` S.Çağlar Onur
2007-01-27 21:46 ` D. Hazelton
2007-01-28 7:55 ` H. Peter Anvin
2007-01-28 9:45 ` Avi Kivity
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).