From: "Radim Krčmář" <rkrcmar@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: David Hildenbrand <david@redhat.com>,
linux-kernel@vger.kernel.org, kvm@vger.kernel.org,
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 18:15:36 +0100 [thread overview]
Message-ID: <20161214171535.GA6799@potion> (raw)
In-Reply-To: <35f6b1f8-6769-935e-633f-9013e496af16@redhat.com>
2016-12-14 17:59+0100, Paolo Bonzini:
> On 14/12/2016 17:15, David Hildenbrand wrote:
>>
>>> kvm_for_each_vcpu(i, vcpu, kvm)
>>> if (kvm_apic_present(vcpu))
>>> - max_id = max(max_id, kvm_apic_id(vcpu->arch.apic));
>>> + max_id = max(max_id, kvm_x2apic_id(vcpu->arch.apic));
>>>
>>> new = kvm_kvzalloc(sizeof(struct kvm_apic_map) +
>>> sizeof(struct kvm_lapic *) * ((u64)max_id + 1));
>>> @@ -179,16 +189,23 @@ static void recalculate_apic_map(struct kvm *kvm)
>>> struct kvm_lapic *apic = vcpu->arch.apic;
>>> struct kvm_lapic **cluster;
>>> u16 mask;
>>> - u32 ldr, aid;
>>> + u32 ldr;
>>> + u8 xapic_id;
>>> + u32 x2apic_id;
>>>
>>> if (!kvm_apic_present(vcpu))
>>> continue;
>>>
>>> - aid = kvm_apic_id(apic);
>>
>> think I'd even prefer here a simple
>>
>> aid = kvm_xapic_id(apic);
>> if (apic_x2apic_mode(apic))
>> aid = kvm_x2apic_id(apic);
>>
>> that would keep changes minimal and I don't really see any benefit in
>> the code when splitting handling up.
>>
>> Patch 4 then simply can fixup setting code
>>
>> if (aid <= new->max_apic_id && !new->phys_map[aid])
>> new->phys_map[aid] = apic;
>>
>> (if I am not missing some important corner case here)
>
> Radim, what do you think? I wanted to get these in before Christmas,
> but it's your call.
There was a reason why it was so ugly ... it's not a hack for nothing.
I can hope to make the patches/code more understandable, but the
function shouldn't change, unless we want to take a different approach.
next prev parent reply other threads:[~2016-12-14 17:15 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
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ář [this message]
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=20161214171535.GA6799@potion \
--to=rkrcmar@redhat.com \
--cc=david@redhat.com \
--cc=imammedo@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--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.