From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Han, Weidong" Subject: RE: [rfc 1/2] pt_irq_time_out() should act on all machine_irq Date: Tue, 10 Mar 2009 15:40:21 +0800 Message-ID: <715D42877B251141A38726ABF5CABF2C0195B5C568@pdsmsx503.ccr.corp.intel.com> References: <20090309090128.520709596@vergenet.net> <20090309091434.543270605@vergenet.net> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Return-path: In-Reply-To: <20090309091434.543270605@vergenet.net> Content-Language: en-US List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: 'Simon Horman' , 'Xen-devel' Cc: 'Yuji Shimada' , 'Keir Fraser' List-Id: xen-devel@lists.xenproject.org Simon Horman wrote: > In pt_irq_time_out() the following code loops through all used > guest_gsi: >=20 > list_for_each_entry ( digl, &irq_map->digl_list, list ) > { > guest_gsi =3D digl->gsi; > machine_gsi =3D dpci->girq[guest_gsi].machine_gsi; > ... > } >=20 > And a little later on machine_gsi is used. > That is the last machine_gsi found is used, > rather than all of the machine_gsi that are found. >=20 > This seems to be incorrect to me, > but I am unsure of how to test this. > Timer is set for each machine GSI, so all the machine_gsi found in loop are= the same. More than one devices may share machine GSI, but assume they won= 't share guest gsi. digl_list contains all guest GSIs which are correspond = to this a machine GSI. Now you want pass-throughed devices share guest gsi, you needs to change it= obviously. Your below change looks fine for me. Regards, Weidong =20 > This code appears to have been introduced in > "vt-d: Support intra-domain shared interrupt" by Weidong Han. >=20 > Cc: Weidong Han > Cc: Yuji Shimada > Signed-off-by: Simon Horman >=20 > Index: xen-unstable.hg/xen/drivers/passthrough/io.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- xen-unstable.hg.orig/xen/drivers/passthrough/io.c 2009-03-09 > 12:44:48.000000000 +1100 +++ > xen-unstable.hg/xen/drivers/passthrough/io.c 2009-03-09 > 12:58:28.000000000 +1100 @@ -37,6 +37,9 @@ static void > pt_irq_time_out(void *data) struct hvm_irq_dpci *dpci =3D NULL; > struct dev_intx_gsi_link *digl; uint32_t device, intx; > + DECLARE_BITMAP(machine_gsi_map, NR_IRQS); > + > + bitmap_zero(machine_gsi_map, NR_IRQS); >=20 > spin_lock(&irq_map->dom->event_lock); >=20 > @@ -46,16 +49,31 @@ static void pt_irq_time_out(void *data) > { > guest_gsi =3D digl->gsi; > machine_gsi =3D dpci->girq[guest_gsi].machine_gsi; > + set_bit(machine_gsi, machine_gsi_map); > device =3D digl->device; > intx =3D digl->intx; > hvm_pci_intx_deassert(irq_map->dom, device, intx); > } >=20 > - clear_bit(machine_gsi, dpci->dirq_mask); > - vector =3D domain_irq_to_vector(irq_map->dom, machine_gsi); > - dpci->mirq[machine_gsi].pending =3D 0; > + for ( machine_gsi =3D find_first_bit(machine_gsi_map, NR_IRQS); > + machine_gsi < NR_IRQS; > + machine_gsi =3D find_next_bit(machine_gsi_map, NR_IRQS, > + machine_gsi + 1) ) > + { > + clear_bit(machine_gsi, dpci->dirq_mask); > + vector =3D domain_irq_to_vector(irq_map->dom, machine_gsi); > + dpci->mirq[machine_gsi].pending =3D 0; > + } > + > spin_unlock(&irq_map->dom->event_lock); > - pirq_guest_eoi(irq_map->dom, machine_gsi); > + > + for ( machine_gsi =3D find_first_bit(machine_gsi_map, NR_IRQS); > + machine_gsi < NR_IRQS; > + machine_gsi =3D find_next_bit(machine_gsi_map, NR_IRQS, > + machine_gsi + 1) ) > + { > + pirq_guest_eoi(irq_map->dom, machine_gsi); > + } > } >=20 > int pt_irq_create_bind_vtd( >=20 > --