From: Paolo Bonzini <pbonzini@redhat.com>
To: Thomas Huth <thuth@redhat.com>, Nadav Amit <namit@vmware.com>
Cc: kvm@vger.kernel.org
Subject: Re: [kvm-unit-tests PATCH] x86: Initialize segment selectors
Date: Wed, 24 Jun 2020 16:10:16 +0200 [thread overview]
Message-ID: <a9956a6f-5049-af9f-4e26-e37eb26e19c6@redhat.com> (raw)
In-Reply-To: <40203296-7f31-16c7-bebb-e1f1cd478a19@redhat.com>
On 24/06/20 14:52, Thomas Huth wrote:
> On 23/06/2020 10.41, Nadav Amit wrote:
>> Currently, the BSP's segment selectors are not initialized in 32-bit
>> (cstart.S). As a result the tests implicitly rely on the segment
>> selector values that are set by the BIOS. If this assumption is not
>> kept, the task-switch test fails.
>>
>> Fix it by initializing them.
>>
>> Signed-off-by: Nadav Amit <namit@vmware.com>
>> ---
>> x86/cstart.S | 17 +++++++++++------
>> 1 file changed, 11 insertions(+), 6 deletions(-)
>
> I'm sorry to be the bearer of bad news again, but this commit broke
> another set of tests in the Travis CI:
>
> https://travis-ci.com/github/huth/kvm-unit-tests/jobs/353103187#L796
>
> smptest, smptest3, kvmclock_test, hyperv_synic and hyperv_stimer are
> failing now in the 32-bit kvm-unit-tests :-(
And that's just bad testing (both Nadav's and mine). Writing to %gs
clobbers the PERCPU area. The fix is as simple as this:
diff --git a/x86/cstart.S b/x86/cstart.S
index 5ad70b5..77dc34d 100644
--- a/x86/cstart.S
+++ b/x86/cstart.S
@@ -106,6 +106,7 @@ MSR_GS_BASE = 0xc0000101
.globl start
start:
mov $stacktop, %esp
+ setup_segments
push %ebx
call setup_multiboot
call setup_libcflat
@@ -118,7 +119,6 @@ start:
prepare_32:
lgdtl gdt32_descr
- setup_segments
mov %cr4, %eax
bts $4, %eax // pse
next prev parent reply other threads:[~2020-06-24 14:10 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-23 8:41 [kvm-unit-tests PATCH] x86: Initialize segment selectors Nadav Amit
2020-06-23 18:28 ` Jim Mattson
2020-06-24 6:42 ` Paolo Bonzini
2020-06-24 12:52 ` Thomas Huth
2020-06-24 14:10 ` Paolo Bonzini [this message]
2020-06-24 17:28 ` Nadav Amit
2020-06-25 7:53 ` Paolo Bonzini
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=a9956a6f-5049-af9f-4e26-e37eb26e19c6@redhat.com \
--to=pbonzini@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=namit@vmware.com \
--cc=thuth@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox