On Thu, 24 Jan 2008, Avi Kivity wrote:
>
>  make -C user test_cases
>  user/kvmctl user/test/x86/bootstrap user/test/x86/access.flat

Ah, thanks!

> > -    smp_init(ac_test_run);
> > +    smp_init((void (*)(void))ac_test_run);
> 
> Better to add a wrapper that conforms to the expected signature, and makes
> sure the return value of ac_test_run() is not lost.
> 
> Haven't run access.flat on smp for a long while; the results should be
> interesting after the page fault scaling work.

On my E6850, running 2.6.24-rc7-ish x86_64 kernel with kvm-59,

user/kvmctl -s2 user/test/x86/bootstrap user/test/x86x/(tried all).flat

just hangs without any output, kvmctl consuming 100% of one core.
I could try with kvm-60 at a later time.

Since that means that I can't test any fix I would be able to do along
your suggestion, I removed that hunk from the patch to keep the warning.

> > -   unsigned long tmp;
> > +   unsigned long tmp = 0;
> 
> I'm needlessly pedantic, but the correct fix is to pass the constraint
> "=&r"(tmp) in the write section.  This tells gcc the register is clobbered
> ("=") and not to pass any inputs in it ("&").

I ran the test case now, and interestingly, the testcase appeared indeed
broken here (kernel modules were still kvm-59), and the change above didn't
change that behaviour:

ser/kvmctl   user/test/x86/bootstrap user/test/x86/emulator.flat 
GUEST: paging enabled
GUEST: PASS: mov reg, r/m (1)
GUEST: PASS: repe/cmpsb (1)
GUEST: PASS: repe/cmpsw (1)
GUEST: PASS: repe/cmpll (1)
GUEST: PASS: repe/cmpsq (1)
GUEST: PASS: repe/cmpsb (2)
GUEST: PASS: repe/cmpsw (2)
GUEST: PASS: repe/cmpll (2)
GUEST: PASS: repe/cmpsq (2)
(command hung here, no further output)

Using "=&r"(tmp) fixed this (gcc only accepted this after moving the tmp operand
to the input operands section, but then, only having "=r"(tmp) - (the '=' was 
demanded
by gcc in the input section)only fixes it so far as this:

GUEST: paging enabled
GUEST: PASS: mov reg, r/m (1)
GUEST: PASS: repe/cmpsb (1)
GUEST: PASS: repe/cmpsw (1)
GUEST: PASS: repe/cmpll (1)
GUEST: PASS: repe/cmpsq (1)
GUEST: PASS: repe/cmpsb (2)
GUEST: PASS: repe/cmpsw (2)
GUEST: PASS: repe/cmpll (2)
GUEST: PASS: repe/cmpsq (2)
GUEST: PASS: push $imm8
GUEST: PASS: push %reg
GUEST: FAIL: push mem
GUEST: PASS: mov %cr8
GUEST: 
GUEST: SUMMARY: 13 tests, 1 failures

and using "=&r"(tmp) all the test work:

GUEST: paging enabled
GUEST: PASS: mov reg, r/m (1)
GUEST: PASS: repe/cmpsb (1)
GUEST: PASS: repe/cmpsw (1)
GUEST: PASS: repe/cmpll (1)
GUEST: PASS: repe/cmpsq (1)
GUEST: PASS: repe/cmpsb (2)
GUEST: PASS: repe/cmpsw (2)
GUEST: PASS: repe/cmpll (2)
GUEST: PASS: repe/cmpsq (2)
GUEST: PASS: push $imm8
GUEST: PASS: push %reg
GUEST: PASS: push mem
GUEST: PASS: mov %cr8
GUEST: 
GUEST: SUMMARY: 13 tests, 0 failures

Please find the updated patch below,
Bernhard

This patch fixes user/test/x86/emulator.flat on kvm-59 with x86_64/E6850
and three other warnings:

test/x86/access.c: In function 'ac_test_exec':
test/x86/access.c:541: warning: implicit declaration of function 'strcat'

test/x86/emulator.c: In function 'test_cmps':
test/x86/emulator.c:26: warning: unused variable 'i'
test/x86/emulator.c: In function 'test_push':
test/x86/emulator.c:115: warning: 'tmp' is used uninitialized in this function

test/x86/lib/printf.c: In function 'vsnprintf':
test/x86/lib/printf.c:95: warning: unused variable 'n'

Signed-off-by: Bernhard Kaindl <[EMAIL PROTECTED]>

--- kvm-60/user/test/x86/access.c
+++ kvm-60/user/test/x86/access.c
@@ -1,6 +1,7 @@
 
 #include "smp.h"
 #include "printf.h"
+#include "string.h"
 
 #define true 1
 #define false 0
--- kvm-60/user/test/x86/emulator.c
+++ kvm-60/user/test/x86/emulator.c
@@ -23,7 +23,6 @@
        unsigned char m3[1024];
        void *rsi, *rdi;
        long rcx, tmp;
-       int i;
 
        for (int i = 0; i < 100; ++i)
                m1[i] = m2[i] = m3[i] = i;
@@ -119,8 +118,8 @@
                     "pushq (%[mem]) \n\t"
                     "mov %%rsp, %[new_stack_top] \n\t"
                     "mov %[tmp], %%rsp"
-                    : [new_stack_top]"=r"(new_stack_top)
-                    : [tmp]"r"(tmp), [stack_top]"r"(stack_top),
+                    : [tmp]"=&r"(tmp), [new_stack_top]"=r"(new_stack_top)
+                    : [stack_top]"r"(stack_top),
                       [reg]"r"(-17l), [mem]"r"(&memw)
                     : "memory");
 
--- kvm-60/user/test/x86/lib/printf.c
+++ kvm-60/user/test/x86/lib/printf.c   2008/01/24 15:10:35
@@ -92,7 +92,6 @@
 
 int vsnprintf(char *buf, int size, const char *fmt, va_list va)
 {
-    int n;
     pstream_t s;
 
     s.buffer = buf;

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel

Reply via email to