[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <f483a0a7-08c5-8329-1078-7b00fe7ef404@redhat.com>
Date: Fri, 1 Jul 2016 10:42:00 +0200
From: Paolo Bonzini <pbonzini@...hat.com>
To: Andrew Honig <ahonig@...gle.com>,
Radim Krčmář <rkrcmar@...hat.com>
Cc: linux-kernel@...r.kernel.org, kvm <kvm@...r.kernel.org>,
"Lan, Tianyu" <tianyu.lan@...el.com>,
Igor Mammedov <imammedo@...hat.com>,
Jan Kiszka <jan.kiszka@....de>, Peter Xu <peterx@...hat.com>
Subject: Re: [PATCH v1 03/11] KVM: x86: dynamic kvm_apic_map
On 01/07/2016 00:15, Andrew Honig wrote:
>> > + /* kvm_apic_map_get_logical_dest() expects multiples of 16 */
>> > + size = round_up(max_id + 1, 16);
> Now that you're using the full range of apic_id values, could this
> calculation overflow? Perhaps max_id could be u64?
Good point, but I wonder if it's a good idea to let userspace allocate
32 GB of memory. :)
Let's put a limit on the maximum supported APIC ID, and report it
through KVM_CHECK_EXTENSION on the new KVM_CAP_X2APIC_API capability.
If 767 is enough for Knights Landing, the allocation below fits in two
pages. If you need to make it higher, please change the allocation to
use kvm_kvzalloc and kvfree.
Last but not least...
>> > + new = kzalloc(sizeof(struct kvm_apic_map) +
>> > + sizeof(struct kvm_lapic) * size, GFP_KERNEL);
^^^^^^^^^^^^^^^^^^^^^^^^
... the sizeof here must be sizeof(struct kvm_lapic *).
Thanks,
Paolo
Powered by blists - more mailing lists