All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Radim Krčmář" <rkrcmar@redhat.com>
To: Nadav Amit <nadav.amit@gmail.com>
Cc: Nadav Amit <namit@cs.technion.ac.il>,
	pbonzini@redhat.com, kvm@vger.kernel.org
Subject: Re: [PATCH 4/6] KVM: x86: Fix determining flat mode in recalculate_apic_map
Date: Wed, 1 Oct 2014 20:27:16 +0200	[thread overview]
Message-ID: <20141001182715.GD12083@potion.brq.redhat.com> (raw)
In-Reply-To: <CB4E8732-CAC2-4E67-9DDA-C933DD56B02C@gmail.com>

2014-10-01 20:30+0300, Nadav Amit:
> On Oct 1, 2014, at 7:04 PM, Radim Krčmář <rkrcmar@redhat.com> wrote:
> > 2014-09-30 20:49+0300, Nadav Amit:
> The condition “!new->cid_mask” is certainly always true (unless we already set the cid/lid according to cluster-mode settings).

Exactly, it "optimizes" the switch to a non-default clustered mode.

> I did not feel comfortable removing it without replacing it with something “equivalent”.
> 
> > 
> >> 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.
> > 
> > It could, for the check is just an optimization.
> > (This whole code deserves a rewrite though ...)
> 
> I did not hit such bug, but IMO the code is buggy.
> The APIC mode is determined by processors that enabled their apic enabled (in the spurious vector), and all the enabled one should configure the same mode.
> Nonetheless, as stated in the SDM 10.4.7.2 "Local APIC State After It Has Been Software Disabled APICs” - the disabled APICs should still respond to NMIs, INIT, etc.
> So it appears the loop should be broken into two loops - first determine the apic mode, according to the first enabled APIC. Then, iterate again over vCPUs and build the logical map.

Our assumption that all have the same mode is horrible.
(Do they all have be the same?)

The only thing we allow out of your scenario that I can see is software
disabled x2apic after enabled clustered xapic processors and that
doesn't need two loops, just a sw check at x2apic.
Practically, it is a harmless bug :)

  reply	other threads:[~2014-10-01 18:27 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ář [this message]
2014-10-01 19:16         ` Nadav Amit
2014-10-01 20:58           ` Radim Krčmář
2014-10-04  6:50   ` Gleb Natapov
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=20141001182715.GD12083@potion.brq.redhat.com \
    --to=rkrcmar@redhat.com \
    --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 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.