mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: David Hildenbrand <david@redhat.com>
To: "Radim Krčmář" <rkrcmar@redhat.com>,
	linux-kernel@vger.kernel.org, kvm@vger.kernel.org
Cc: Paolo Bonzini <pbonzini@redhat.com>, Igor Mammedov <imammedo@redhat.com>
Subject: Re: [PATCH v2 2/4] KVM: x86: replace kvm_apic_id with kvm_{x,x2}apic_id
Date: Wed, 14 Dec 2016 13:39:05 +0100	[thread overview]
Message-ID: <cfab968d-9f94-0d25-ba2a-69a1af5a4f4f@redhat.com> (raw)
In-Reply-To: <20161213163001.4567-3-rkrcmar@redhat.com>

Am 13.12.2016 um 17:29 schrieb Radim Krčmář:
> There were three calls sites:
>  - recalculate_apic_map and kvm_apic_match_physical_addr, where it would
>    only complicate implementation of x2APIC hotplug;
>  - in apic_debug, where it was still somewhat preserved, but keeping the
>    old function just for apic_debug was not worth it
>
> Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
> ---
>  arch/x86/kvm/lapic.c | 41 ++++++++++++++++++++++++++++++-----------
>  arch/x86/kvm/lapic.h | 11 -----------
>  2 files changed, 30 insertions(+), 22 deletions(-)
>
> diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c
> index 09edd32b8e42..e645b4bc6437 100644
> --- a/arch/x86/kvm/lapic.c
> +++ b/arch/x86/kvm/lapic.c
> @@ -115,6 +115,16 @@ static inline int apic_enabled(struct kvm_lapic *apic)
>  	(LVT_MASK | APIC_MODE_MASK | APIC_INPUT_POLARITY | \
>  	 APIC_LVT_REMOTE_IRR | APIC_LVT_LEVEL_TRIGGER)
>
> +static inline u8 kvm_xapic_id(struct kvm_lapic *apic)
> +{
> +	return kvm_lapic_get_reg(apic, APIC_ID) >> 24;
> +}
> +
> +static inline u32 kvm_x2apic_id(struct kvm_lapic *apic)
> +{
> +	return apic->vcpu->vcpu_id;
> +}
> +
>  static inline bool kvm_apic_map_get_logical_dest(struct kvm_apic_map *map,
>  		u32 dest_id, struct kvm_lapic ***cluster, u16 *mask) {
>  	switch (map->mode) {
> @@ -159,13 +169,13 @@ static void recalculate_apic_map(struct kvm *kvm)
>  	struct kvm_apic_map *new, *old = NULL;
>  	struct kvm_vcpu *vcpu;
>  	int i;
> -	u32 max_id = 255;
> +	u32 max_id = 256; /* enough space for any xAPIC ID */

Why exactly do we have to increase this?

I thought the maximum xapic id is 255, and we correctly allocate
255+1 slots.

Now, we would allocate 257 slots and set max_apic_id to 256.

Can you elaborate?


-- 

David

  reply	other threads:[~2016-12-14 12:39 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-13 16:29 [PATCH v2 0/4] KVM: x86: allow hotplug of VCPU with APIC ID over 0xff Radim Krčmář
2016-12-13 16:29 ` [PATCH v2 1/4] KVM: x86: use delivery to self in hyperv synic Radim Krčmář
2016-12-13 16:29 ` [PATCH v2 2/4] KVM: x86: replace kvm_apic_id with kvm_{x,x2}apic_id Radim Krčmář
2016-12-14 12:39   ` David Hildenbrand [this message]
2016-12-14 13:41     ` Radim Krčmář
2016-12-14 15:50       ` Paolo Bonzini
2016-12-14 16:15   ` David Hildenbrand
2016-12-14 16:59     ` Paolo Bonzini
2016-12-14 17:15       ` Radim Krčmář
2016-12-14 17:12     ` Radim Krčmář
2016-12-14 17:26       ` David Hildenbrand
2016-12-13 16:30 ` [PATCH v2 3/4] KVM: x86: make interrupt delivery fast and slow path behave the same Radim Krčmář
2016-12-13 16:30 ` [PATCH v2 4/4] KVM: x86: allow hotplug of VCPU with APIC ID over 0xff 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=cfab968d-9f94-0d25-ba2a-69a1af5a4f4f@redhat.com \
    --to=david@redhat.com \
    --cc=imammedo@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=rkrcmar@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

all inboxes | Powered by JetHome®