From: Paolo Bonzini <pbonzini@redhat.com>
To: Arthur Chunqi Li <yzt356@gmail.com>
Cc: Gleb Natapov <gleb@redhat.com>, kvm <kvm@vger.kernel.org>,
Jan Kiszka <jan.kiszka@web.de>
Subject: Re: [PATCH v4 0/2] Basic nested VMX test suite
Date: Wed, 17 Jul 2013 16:10:46 +0200 [thread overview]
Message-ID: <51E6A5E6.4020605@redhat.com> (raw)
In-Reply-To: <CABpY8M+dGQ31y8CXsOeXQTU+f3F3gf1MoQ0XxPym38FuGFVbMg@mail.gmail.com>
Il 17/07/2013 15:48, Arthur Chunqi Li ha scritto:
> Actually, both structure are kind to me and except for some concerns
> Gleb's solutions seems easier to read.
>
> The first concern is Gleb's way cannot set a seperate stack for
> HOST_RSP, which I predefined this can be set by test suite's init
> function. I have discussed with Jan and he said we don't have such
> test cases.
>
> The second is huge function and more assembler codes, I will separate
> vmx_handler codes and this is not important.
>
> I have another question, I write codes like this:
>
> asm volatile("vmlaunch;seta %0\n\t" : "=m"(ret));
Note that this asm needs a "memory" clobber too. This is what I
referred to as "more complications in where to put compiler barriers" in
my earlier message. In general, bypassing compiler optimizations is why
I preferred your earlier solution.
> /* Should not reach here */
> printf("%s : vmlaunch failed, ret=%d.\n", __func__, ret);
> goto err;
>
> while(1) {
> ....
> }
>
> Then because we use -O1 optimization param for our test cases, all the
> codes after "goto" are gone and I got the following error:
>
> /root/xelatex.kvm-unit-tests-vmx.git/x86/vmx.c:247: undefined
> reference to `vmx_return'
> collect2: ld returned 1 exit status
>
> So how could I disable the opt for this function or bypass such occasion?
You can do something like
ret = 0;
asm volatile("vmlaunch;seta %0\n\t" : "=m"(ret) : : "memory");
/* Actually we go straight to the while(1) below if ret==0 */
if (ret) {
printf("%s : vmlaunch failed, ret=%d.\n", __func__, ret);
goto err;
}
while(1) {
...
}
or if you want to make it more explicit to the compiler:
ret = 0;
/* asm goto cannot have outputs :( */
asm volatile goto ("vmlaunch;seta (%0)\n\t" : : "r"(&ret)
: "memory" : resume);
printf("%s : vmlaunch failed, ret=%d.\n", __func__, ret);
goto err;
resume:
while(1) {
...
}
Paolo
prev parent reply other threads:[~2013-07-17 14:10 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-17 6:05 [PATCH v4 0/2] Basic nested VMX test suite Arthur Chunqi Li
2013-07-17 6:05 ` [PATCH v4 1/2] kvm-unit-tests : Add setjmp/longjmp to libcflat Arthur Chunqi Li
2013-07-17 6:05 ` [PATCH v4 2/2] kvm-unit-tests : The first version of VMX nested test case Arthur Chunqi Li
2013-07-17 6:26 ` Jan Kiszka
2013-07-17 6:36 ` Arthur Chunqi Li
2013-07-17 10:13 ` Paolo Bonzini
2013-07-17 6:08 ` [PATCH v4 0/2] Basic nested VMX test suite Arthur Chunqi Li
2013-07-17 6:21 ` Gleb Natapov
2013-07-17 7:52 ` Paolo Bonzini
2013-07-17 9:03 ` Gleb Natapov
2013-07-17 10:19 ` Paolo Bonzini
2013-07-17 10:31 ` Gleb Natapov
2013-07-17 10:46 ` Jan Kiszka
2013-07-17 10:54 ` Paolo Bonzini
2013-07-17 13:48 ` Arthur Chunqi Li
2013-07-17 14:10 ` Paolo Bonzini [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=51E6A5E6.4020605@redhat.com \
--to=pbonzini@redhat.com \
--cc=gleb@redhat.com \
--cc=jan.kiszka@web.de \
--cc=kvm@vger.kernel.org \
--cc=yzt356@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.