From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <zhiyong.yang@intel.com>
Received: from mga03.intel.com (mga03.intel.com [134.134.136.65])
 by dpdk.org (Postfix) with ESMTP id 5FCF516E;
 Fri, 29 Dec 2017 03:10:30 +0100 (CET)
X-Amp-Result: SKIPPED(no attachment in message)
X-Amp-File-Uploaded: False
Received: from orsmga006.jf.intel.com ([10.7.209.51])
 by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;
 28 Dec 2017 18:10:29 -0800
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.45,473,1508828400"; 
   d="scan'208";a="6538907"
Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203])
 by orsmga006.jf.intel.com with ESMTP; 28 Dec 2017 18:10:28 -0800
Received: from FMSMSX110.amr.corp.intel.com (10.18.116.10) by
 FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS)
 id 14.3.319.2; Thu, 28 Dec 2017 18:10:28 -0800
Received: from bgsmsx103.gar.corp.intel.com (10.223.4.130) by
 fmsmsx110.amr.corp.intel.com (10.18.116.10) with Microsoft SMTP Server (TLS)
 id 14.3.319.2; Thu, 28 Dec 2017 18:10:28 -0800
Received: from bgsmsx101.gar.corp.intel.com ([169.254.1.245]) by
 BGSMSX103.gar.corp.intel.com ([10.223.4.130]) with mapi id 14.03.0319.002;
 Fri, 29 Dec 2017 07:40:25 +0530
From: "Yang, Zhiyong" <zhiyong.yang@intel.com>
To: Thomas Monjalon <thomas@monjalon.net>
CC: "dev@dpdk.org" <dev@dpdk.org>, "Yigit, Ferruh" <ferruh.yigit@intel.com>,
 "stable@dpdk.org" <stable@dpdk.org>, "Tan, Jianfeng" <jianfeng.tan@intel.com>
Thread-Topic: [PATCH] bus/pci: fix wrong intr_handle.type with uio_pci_generic
Thread-Index: AQHTf6LcTBVp1cGaDEm3rgSInrYCoqNYGm8AgABfkYD//72GgIABW4KQ
Date: Fri, 29 Dec 2017 02:10:24 +0000
Message-ID: <E182254E98A5DA4EB1E657AC7CB9BD2A8B01C9E7@BGSMSX101.gar.corp.intel.com>
References: <20171228061210.64767-1-zhiyong.yang@intel.com>
 <3562024.UbNHMEjv39@xps>
 <E182254E98A5DA4EB1E657AC7CB9BD2A8B01C7E5@BGSMSX101.gar.corp.intel.com>
 <6678594.XHcc9ld5bA@xps>
In-Reply-To: <6678594.XHcc9ld5bA@xps>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
dlp-product: dlpe-windows
dlp-version: 11.0.0.116
dlp-reaction: no-action
x-originating-ip: [10.223.10.10]
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
Subject: Re: [dpdk-dev] [PATCH] bus/pci: fix wrong intr_handle.type with
	uio_pci_generic
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://dpdk.org/ml/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Fri, 29 Dec 2017 02:10:31 -0000



> -----Original Message-----
> From: Thomas Monjalon [mailto:thomas@monjalon.net]
> Sent: Thursday, December 28, 2017 6:49 PM
> To: Yang, Zhiyong <zhiyong.yang@intel.com>
> Cc: dev@dpdk.org; Yigit, Ferruh <ferruh.yigit@intel.com>; stable@dpdk.org
> Subject: Re: [PATCH] bus/pci: fix wrong intr_handle.type with uio_pci_gen=
eric
>=20
> 28/12/2017 10:37, Yang, Zhiyong:
> > Hi Thomas,
> >
> > > -----Original Message-----
> > > From: Thomas Monjalon [mailto:thomas@monjalon.net]
> > > Sent: Thursday, December 28, 2017 5:05 PM
> > > To: Yang, Zhiyong <zhiyong.yang@intel.com>
> > > Cc: dev@dpdk.org; Yigit, Ferruh <ferruh.yigit@intel.com>;
> > > stable@dpdk.org
> > > Subject: Re: [PATCH] bus/pci: fix wrong intr_handle.type with
> > > uio_pci_generic
> > >
> > > 28/12/2017 07:12, Zhiyong Yang:
> > > > In the function rte_pci_ioport_map, if uio_pci_generic is used on
> > > > X86 platform, pci_ioport_map() is invoked, the operation
> > > > ev->intr_handle.type =3D RTE_INTR_HANDLE_UNKNOWN; is execused
> > > > ev->directly,
> > > > it causes the wrong assignment for uio_pci_generic, the patch fixes=
 it.
> > > [...]
> > > > --- a/drivers/bus/pci/linux/pci.c
> > > > +++ b/drivers/bus/pci/linux/pci.c
> > > > @@ -723,7 +723,9 @@ pci_ioport_map(struct rte_pci_device *dev, int
> > > > bar
> > > __rte_unused,
> > > >  	if (!found)
> > > >  		return -1;
> > > >
> > > > -	dev->intr_handle.type =3D RTE_INTR_HANDLE_UNKNOWN;
> > > > +	if (dev->kdrv =3D=3D RTE_KDRV_NONE)
> > > > +		dev->intr_handle.type =3D RTE_INTR_HANDLE_UNKNOWN;
> > >
> > > I don't understand the logic.
> > > NONE is different of UNKNOWN.
> > >
> > > Your are talking about uio_pci_generic. In this case, it should be
> > > RTE_KDRV_UIO_GENERIC.
> >
> > If we use uio_pci_generic,  dev->intr_handle.type has already been
> > assigned to The right value RTE_INTR_HANDLE_UIO_INTX before it, but in
> > the function pci_ioport_map the wrong value is assigned to
> > dev->intr_handle.type =3D RTE_INTR_HANDLE_UNKNOWN; Two cases both call
> pci_ioport_map  on x86 platform.
> > one is RTE_KDRV_UIO_GENERIC
> > the other is RTE_KDRV_NONE
> > if I understand right, for uio_generic, it should not be assigned to
> > RTE_INTR_HANDLE_UNKNOWN; This case has already the right value, don't
> need to assign again.
> > The original code should be considered to handle RTE_KDRV_NONE case onl=
y.
>=20
> OK thanks for the explanation.
> I had overlooked your patch.
>=20
> Please, could add some of this text in v2?
> I think it is good to explain that the right value is already set, and we=
 must avoid
> overwriting the default "UNKNOWN" value.

Ok.  add the text in V2 later.

>=20
> One more question, why is it needed to set the value to "UNKNOWN" in this
> function? It should already be set to this value (0) at init.

Good suggestion, we should remove it to fix issue . Any different opinion? =
 Everyone.

BTW,  The bug can be seen if run the following test case.

Testpmd startup fails  using uio_pci_generic running on virtio legacy devic=
e.

Thanks
Zhiyong