From: Gleb Natapov <gleb@kernel.org>
To: Nadav Amit <namit@cs.technion.ac.il>
Cc: pbonzini@redhat.com, kvm@vger.kernel.org, nadav.amit@gmail.com
Subject: Re: [PATCH 4/6] KVM: x86: Fix determining flat mode in recalculate_apic_map
Date: Sat, 4 Oct 2014 09:50:28 +0300 [thread overview]
Message-ID: <20141004065027.GQ26540@minantech.com> (raw)
In-Reply-To: <1412099359-5316-5-git-send-email-namit@cs.technion.ac.il>
On Tue, Sep 30, 2014 at 08:49:17PM +0300, Nadav Amit wrote:
> Determining flat mode according to cid_mask is wrong, since currently KVM
> supports zero clusters in x2apic mode. Use ldr_bits instead.
As a comment above the 'if' you are fixing says the code assumes all APICs are in
the same mode (if they are not that's an OS bug). In that case the code never gets
here with x2apic mode.
>
> Since we recalculate the apic map whenever the DFR is changed, the bug appears
> to have no effect, and perhaps the entire check can be removed.
>
> Signed-off-by: Nadav Amit <namit@cs.technion.ac.il>
> ---
> arch/x86/kvm/lapic.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c
> index b8345dd..cfce429 100644
> --- a/arch/x86/kvm/lapic.c
> +++ b/arch/x86/kvm/lapic.c
> @@ -171,7 +171,7 @@ static void recalculate_apic_map(struct kvm *kvm)
> new->cid_mask = (1 << KVM_X2APIC_CID_BITS) - 1;
> new->lid_mask = 0xffff;
> } else if (kvm_apic_sw_enabled(apic) &&
> - !new->cid_mask /* flat mode */ &&
> + new->ldr_bits == 8 /* flat mode */ &&
> kvm_apic_get_reg(apic, APIC_DFR) == APIC_DFR_CLUSTER) {
> new->cid_shift = 4;
> new->cid_mask = 0xf;
> --
> 1.9.1
>
> --
> 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
--
Gleb.
next prev parent reply other threads:[~2014-10-04 6:50 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-30 17:49 [PATCH 0/6] KVM: x86: Miscellaneous bug fixes Nadav Amit
2014-09-30 17:49 ` [PATCH 1/6] KVM: x86: DR7.GD should be cleared upon any #DB exception Nadav Amit
2014-10-01 15:24 ` Radim Krčmář
2014-10-01 18:22 ` Nadav Amit
2014-10-01 19:22 ` Radim Krčmář
2014-09-30 17:49 ` [PATCH 2/6] KVM: x86: Wrong error code on limit violation during emulation Nadav Amit
2014-10-01 15:44 ` Radim Krčmář
2014-10-27 14:37 ` Paolo Bonzini
2014-10-27 14:46 ` Nadav Amit
2014-10-27 14:48 ` Paolo Bonzini
2014-09-30 17:49 ` [PATCH 3/6] KVM: x86: NoBigReal was mistakenly considering la instead of ea Nadav Amit
2014-10-01 15:58 ` Radim Krčmář
2014-10-02 14:52 ` Nadav Amit
2014-10-03 12:50 ` Radim Krčmář
2014-10-06 15:19 ` Nadav Amit
2014-09-30 17:49 ` [PATCH 4/6] KVM: x86: Fix determining flat mode in recalculate_apic_map Nadav Amit
2014-10-01 16:04 ` Radim Krčmář
2014-10-01 17:30 ` Nadav Amit
2014-10-01 18:27 ` Radim Krčmář
2014-10-01 19:16 ` Nadav Amit
2014-10-01 20:58 ` Radim Krčmář
2014-10-04 6:50 ` Gleb Natapov [this message]
2014-09-30 17:49 ` [PATCH 5/6] KVM: x86: Wrong assertion on paging_tmpl.h Nadav Amit
2014-10-01 16:26 ` Radim Krčmář
2014-10-01 17:14 ` Nadav Amit
2014-10-01 17:54 ` Radim Krčmář
2014-10-08 9:17 ` Paolo Bonzini
2014-09-30 17:49 ` [PATCH 6/6] KVM: x86: Emulator does not calculate address correctly Nadav Amit
2014-10-01 17:21 ` Radim Krčmář
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=20141004065027.GQ26540@minantech.com \
--to=gleb@kernel.org \
--cc=kvm@vger.kernel.org \
--cc=nadav.amit@gmail.com \
--cc=namit@cs.technion.ac.il \
--cc=pbonzini@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;
as well as URLs for NNTP newsgroup(s).