diff mbox

potential gcc bug causes kvm-userspace build break

Message ID 49B7FE80.1010307@linux.vnet.ibm.com (mailing list archive)
State Accepted
Headers show

Commit Message

Jochen Roth March 11, 2009, 6:10 p.m. UTC
FYI

I just discovered a potential gcc bug which causes kvm-userspace builds 
to break.
I looks like it happens only with the latest fedora rawhide gcc 4.4
https://bugzilla.redhat.com/show_bug.cgi?id=489753

The following patch circumvents this problem by just renaming R to REG.
People facing the same problem might find this patch useful.



--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Glauber Costa March 11, 2009, 6:11 p.m. UTC | #1
On Wed, Mar 11, 2009 at 3:10 PM, Jochen Roth <jroth@linux.vnet.ibm.com> wrote:
> FYI
>
> I just discovered a potential gcc bug which causes kvm-userspace builds to
> break.
> I looks like it happens only with the latest fedora rawhide gcc 4.4
> https://bugzilla.redhat.com/show_bug.cgi?id=489753
>
> The following patch circumvents this problem by just renaming R to REG.
> People facing the same problem might find this patch useful.
>
Adding a space between the R is a much better fix, since nothing guarantees
gcc won't use "REG" in the future too.

Eduardo sent a fix for this a while ago, but it was not applied.
Jochen Roth March 11, 2009, 6:30 p.m. UTC | #2
Glauber Costa wrote:
> On Wed, Mar 11, 2009 at 3:10 PM, Jochen Roth <jroth@linux.vnet.ibm.com> wrote:
>> FYI
>>
>> I just discovered a potential gcc bug which causes kvm-userspace builds to
>> break.
>> I looks like it happens only with the latest fedora rawhide gcc 4.4
>> https://bugzilla.redhat.com/show_bug.cgi?id=489753
>>
>> The following patch circumvents this problem by just renaming R to REG.
>> People facing the same problem might find this patch useful.
>>
> Adding a space between the R is a much better fix, since nothing guarantees
> gcc won't use "REG" in the future too.
> 
> Eduardo sent a fix for this a while ago, but it was not applied.
> 

Jakub just closed the bug. It works as designed:
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2442.htm

Shall I send another patch with spaces or do you plan to apply Eduardo's 
patch?
Glauber Costa March 11, 2009, 6:32 p.m. UTC | #3
On Wed, Mar 11, 2009 at 3:30 PM, Jochen Roth <jroth@linux.vnet.ibm.com> wrote:
> Glauber Costa wrote:
>>
>> On Wed, Mar 11, 2009 at 3:10 PM, Jochen Roth <jroth@linux.vnet.ibm.com>
>> wrote:
>>>
>>> FYI
>>>
>>> I just discovered a potential gcc bug which causes kvm-userspace builds
>>> to
>>> break.
>>> I looks like it happens only with the latest fedora rawhide gcc 4.4
>>> https://bugzilla.redhat.com/show_bug.cgi?id=489753
>>>
>>> The following patch circumvents this problem by just renaming R to REG.
>>> People facing the same problem might find this patch useful.
>>>
>> Adding a space between the R is a much better fix, since nothing
>> guarantees
>> gcc won't use "REG" in the future too.
>>
>> Eduardo sent a fix for this a while ago, but it was not applied.
>>
>
> Jakub just closed the bug. It works as designed:
> http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2442.htm
>
> Shall I send another patch with spaces or do you plan to apply Eduardo's
> patch?

anthony?
Anthony Liguori March 11, 2009, 6:41 p.m. UTC | #4
Glauber Costa wrote:
> On Wed, Mar 11, 2009 at 3:30 PM, Jochen Roth <jroth@linux.vnet.ibm.com> wrote:
>   
>> Glauber Costa wrote:
>>     
>>> On Wed, Mar 11, 2009 at 3:10 PM, Jochen Roth <jroth@linux.vnet.ibm.com>
>>> wrote:
>>>       
>>>> FYI
>>>>
>>>> I just discovered a potential gcc bug which causes kvm-userspace builds
>>>> to
>>>> break.
>>>> I looks like it happens only with the latest fedora rawhide gcc 4.4
>>>> https://bugzilla.redhat.com/show_bug.cgi?id=489753
>>>>
>>>> The following patch circumvents this problem by just renaming R to REG.
>>>> People facing the same problem might find this patch useful.
>>>>
>>>>         
>>> Adding a space between the R is a much better fix, since nothing
>>> guarantees
>>> gcc won't use "REG" in the future too.
>>>
>>> Eduardo sent a fix for this a while ago, but it was not applied.
>>>
>>>       
>> Jakub just closed the bug. It works as designed:
>> http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2442.htm
>>
>> Shall I send another patch with spaces or do you plan to apply Eduardo's
>> patch?
>>     
>
> anthony?
>   

I haven't seen a patch against QEMU...  Was it sent to qemu-devel?

Regards,

Anthony Liguori


--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/user/test/x86/apic.c b/user/test/x86/apic.c
index 9c6205b..ec3777c 100644
--- a/user/test/x86/apic.c
+++ b/user/test/x86/apic.c
@@ -35,9 +35,9 @@  typedef struct {
  } isr_regs_t;

  #ifdef __x86_64__
-#  define R "r"
+#  define REG "r"
  #else
-#  define R "e"
+#  define REG "e"
  #endif

  extern char isr_entry_point[];
@@ -54,14 +54,14 @@  asm (
      "push %r9  \n\t"
      "push %r8  \n\t"
  #endif
-    "push %"R"di \n\t"
-    "push %"R"si \n\t"
-    "push %"R"bp \n\t"
-    "push %"R"sp \n\t"
-    "push %"R"bx \n\t"
-    "push %"R"dx \n\t"
-    "push %"R"cx \n\t"
-    "push %"R"ax \n\t"
+    "push %"REG"di \n\t"
+    "push %"REG"si \n\t"
+    "push %"REG"bp \n\t"
+    "push %"REG"sp \n\t"
+    "push %"REG"bx \n\t"
+    "push %"REG"dx \n\t"
+    "push %"REG"cx \n\t"
+    "push %"REG"ax \n\t"
  #ifdef __x86_64__
      "mov %rsp, %rdi \n\t"
      "callq *8*16(%rsp) \n\t"
@@ -70,14 +70,14 @@  asm (
      "calll *4+4*8(%esp) \n\t"
      "add $4, %esp \n\t"
  #endif
-    "pop %"R"ax \n\t"
-    "pop %"R"cx \n\t"
-    "pop %"R"dx \n\t"
-    "pop %"R"bx \n\t"
-    "pop %"R"bp \n\t"
-    "pop %"R"bp \n\t"
-    "pop %"R"si \n\t"
-    "pop %"R"di \n\t"
+    "pop %"REG"ax \n\t"
+    "pop %"REG"cx \n\t"
+    "pop %"REG"dx \n\t"
+    "pop %"REG"bx \n\t"
+    "pop %"REG"bp \n\t"
+    "pop %"REG"bp \n\t"
+    "pop %"REG"si \n\t"
+    "pop %"REG"di \n\t"
  #ifdef __x86_64__
      "pop %r8  \n\t"
      "pop %r9  \n\t"
diff --git a/user/test/x86/vmexit.c b/user/test/x86/vmexit.c
index bd57bfa..bc81be9 100644
--- a/user/test/x86/vmexit.c
+++ b/user/test/x86/vmexit.c
@@ -19,9 +19,9 @@  static inline unsigned long long rdtsc()
  #define N (1 << 22)

  #ifdef __x86_64__
-#  define R "r"
+#  define REG "r"
  #else
-#  define R "e"
+#  define REG "e"
  #endif

  int main()
@@ -31,7 +31,7 @@  int main()

  	t1 = rdtsc();
  	for (i = 0; i < N; ++i)
-		asm volatile ("push %%"R"bx; cpuid; pop %%"R"bx"
+		asm volatile ("push %%"REG"bx; cpuid; pop %%"REG"bx"
  			      : : : "eax", "ecx", "edx");
  	t2 = rdtsc();
  	printf("vmexit latency: %d\n", (int)((t2 - t1) / N));