[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <E959C4978C3B6342920538CF579893F002718968@SHSMSX104.ccr.corp.intel.com>
Date: Thu, 17 Sep 2015 13:36:08 +0000
From: "Wu, Feng" <feng.wu@...el.com>
To: Paolo Bonzini <pbonzini@...hat.com>,
"alex.williamson@...hat.com" <alex.williamson@...hat.com>,
"joro@...tes.org" <joro@...tes.org>,
"mtosatti@...hat.com" <mtosatti@...hat.com>
CC: "eric.auger@...aro.org" <eric.auger@...aro.org>,
"kvm@...r.kernel.org" <kvm@...r.kernel.org>,
"iommu@...ts.linux-foundation.org" <iommu@...ts.linux-foundation.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"Wu, Feng" <feng.wu@...el.com>
Subject: RE: [PATCH v8 03/13] KVM: Define a new interface
kvm_intr_is_single_vcpu()
> -----Original Message-----
> From: Paolo Bonzini [mailto:pbonzini@...hat.com]
> Sent: Thursday, September 17, 2015 5:42 PM
> To: Wu, Feng; alex.williamson@...hat.com; joro@...tes.org;
> mtosatti@...hat.com
> Cc: eric.auger@...aro.org; kvm@...r.kernel.org;
> iommu@...ts.linux-foundation.org; linux-kernel@...r.kernel.org
> Subject: Re: [PATCH v8 03/13] KVM: Define a new interface
> kvm_intr_is_single_vcpu()
>
>
>
> On 17/09/2015 05:17, Wu, Feng wrote:
> >>> > > + if (irq->dest_mode == APIC_DEST_PHYSICAL) {
> >>> > > + if (irq->dest_id == 0xFF)
> >>> > > + goto out;
> >>> > > +
> >>> > > + if (irq->dest_id >= ARRAY_SIZE(map->phys_map)) {
> >> >
> >> > Warning here is wrong, the guest can trigger it.
> > Could you please share more information about how the guest
> > triggers these conditions (including the following two), Thanks
> > a lot!
>
> irq->dest_id is a 16-bit value, so it can be > 255.
Yes, irq->dest_id is defined as u32, but by looking the current KVM
code, seems desst_id is used as an u8 variable, even in x2apic mode
the dest_id will not beyond 255 (except for broadcast dest in in x2apic
mode). Correct me if I am wrong. Thanks a lot!
>
> > + if (!kvm_apic_logical_map_valid(map)) {
> > + WARN_ON_ONCE(1);
>
> Here, the guest can trigger it by setting a few APICs in flat mode and
> others in cluster mode, for example.
Oh, right, the logical map works only when the destination mode of all
the vCPUs are the same.
>
> > + if (cid >= ARRAY_SIZE(map->logical_map)) {
> > + WARN_ON_ONCE(1);
>
> In x2apic mode irq->dest_id could have bits 12..15 set.
cid is gotten from bit 16 ..31 of the ldr (in apic_logical_id()), and
in x2apic mode, ldr is constructed in kvm_apic_set_x2apic_id() as
below:
u32 ldr = ((id >> 4) << 16) | (1 << (id & 0xf));
So in fact, cid is (id >> 4), I cannot think of why cid can beyond 15.
Do I miss something here? Thanks!
Thanks,
Feng
>
> Paolo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists