From: Marcelo Tosatti <mtosatti@redhat.com>
To: Avi Kivity <avi@qumranet.com>
Cc: kvm@vger.kernel.org
Subject: Re: [patch 1/3] KVM: task switch: translate guest segment limit to virt-extension byte granular field
Date: Sun, 20 Jul 2008 13:43:52 -0300 [thread overview]
Message-ID: <20080720164352.GA5494@dmt.cnet> (raw)
In-Reply-To: <488303BF.40702@qumranet.com>
On Sun, Jul 20, 2008 at 12:22:07PM +0300, Avi Kivity wrote:
> Marcelo Tosatti wrote:
>> If 'g' is one then limit is 4kb granular.
>>
>> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
>>
>> Index: kvm-vmx-checks/arch/x86/kvm/x86.c
>> ===================================================================
>> --- kvm-vmx-checks.orig/arch/x86/kvm/x86.c
>> +++ kvm-vmx-checks/arch/x86/kvm/x86.c
>> @@ -3195,6 +3195,10 @@ static void seg_desct_to_kvm_desct(struc
>> kvm_desct->base |= seg_desc->base2 << 24;
>> kvm_desct->limit = seg_desc->limit0;
>> kvm_desct->limit |= seg_desc->limit << 16;
>> + if (seg_desc->g) {
>> + kvm_desct->limit <<= 12;
>> + kvm_desct->limit |= 0xfff;
>> + }
>> kvm_desct->selector = selector;
>> kvm_desct->type = seg_desc->type;
>> kvm_desct->present = seg_desc->p;
>>
>
> This looks good,
>
>> @@ -3222,8 +3226,12 @@ static void get_segment_descritptor_dtab
>> if (kvm_seg.unusable)
>> dtable->limit = 0;
>> - else
>> - dtable->limit = kvm_seg.limit;
>> + else {
>> + if (kvm_seg.g)
>> + dtable->limit = kvm_seg.limit >> 12;
>> + else
>> + dtable->limit = kvm_seg.limit;
>> + }
>> dtable->base = kvm_seg.base;
>>
>
> But this doesn't. As far as I can tell, users of
> get_segment_descritptor_dtable() expect a normalized limit (always in
> bytes).
Ouch, yes. Here's it:
KVM: task switch: translate guest segment limit to virt-extension byte granular field
If 'g' is one then limit is 4kb granular.
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Index: kvm-vmx-checks/arch/x86/kvm/x86.c
===================================================================
--- kvm-vmx-checks.orig/arch/x86/kvm/x86.c
+++ kvm-vmx-checks/arch/x86/kvm/x86.c
@@ -3195,6 +3195,10 @@ static void seg_desct_to_kvm_desct(struc
kvm_desct->base |= seg_desc->base2 << 24;
kvm_desct->limit = seg_desc->limit0;
kvm_desct->limit |= seg_desc->limit << 16;
+ if (seg_desc->g) {
+ kvm_desct->limit <<= 12;
+ kvm_desct->limit |= 0xfff;
+ }
kvm_desct->selector = selector;
kvm_desct->type = seg_desc->type;
kvm_desct->present = seg_desc->p;
next prev parent reply other threads:[~2008-07-20 16:44 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-19 22:08 [patch 0/3] task switch fixes Marcelo Tosatti
2008-07-19 22:08 ` [patch 1/3] KVM: task switch: translate guest segment limit to virt-extension byte granular field Marcelo Tosatti
2008-07-20 9:22 ` Avi Kivity
2008-07-20 16:43 ` Marcelo Tosatti [this message]
2008-07-21 8:14 ` Avi Kivity
2008-07-19 22:08 ` [patch 2/3] KVM: task switch: check task busy state Marcelo Tosatti
2008-07-19 22:08 ` [patch 3/3] KVM: task switch: check for segment base translation failure Marcelo Tosatti
2008-07-20 9:24 ` Avi Kivity
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=20080720164352.GA5494@dmt.cnet \
--to=mtosatti@redhat.com \
--cc=avi@qumranet.com \
--cc=kvm@vger.kernel.org \
/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.