DPDK patches and discussions
 help / color / mirror / Atom feed
From: Shijith Thotton <shijith.thotton@caviumnetworks.com>
To: "Tan, Jianfeng" <jianfeng.tan@intel.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>,
	"Yigit, Ferruh" <ferruh.yigit@intel.com>,
	Gregory Etelson <gregory@weka.io>,
	Thomas Monjalon <thomas@monjalon.net>,
	Stephen Hemminger <stephen@networkplumber.org>,
	"Lu, Wenzhuo" <wenzhuo.lu@intel.com>
Subject: Re: [dpdk-dev] [PATCH v2] igb_uio: issue FLR during open and release of device file
Date: Mon, 10 Jul 2017 16:12:30 +0530	[thread overview]
Message-ID: <20170710104229.GA6580@localhost.localdomain> (raw)
In-Reply-To: <ED26CBA2FAD1BF48A8719AEF02201E365122EB9C@SHSMSX103.ccr.corp.intel.com>

On Mon, Jul 10, 2017 at 09:00:38AM +0000, Tan, Jianfeng wrote:
> 
> 
> > -----Original Message-----
> > From: Shijith Thotton [mailto:shijith.thotton@caviumnetworks.com]
> > Sent: Monday, July 10, 2017 3:11 PM
> > To: Tan, Jianfeng
> > Cc: dev@dpdk.org; Yigit, Ferruh; Gregory Etelson; Thomas Monjalon;
> > Stephen Hemminger; Lu, Wenzhuo
> > Subject: Re: [PATCH v2] igb_uio: issue FLR during open and release of device
> > file
> > 
> > On Mon, Jul 10, 2017 at 03:38:34AM +0000, Tan, Jianfeng wrote:
> > > Hi Thotton,
> > >
> > > > -----Original Message-----
> > > > From: Shijith Thotton [mailto:shijith.thotton@caviumnetworks.com]
> > > > Sent: Friday, July 7, 2017 7:14 PM
> > > > To: dev@dpdk.org
> > > > Cc: Yigit, Ferruh; Gregory Etelson; Thomas Monjalon; Stephen
> > Hemminger;
> > > > Tan, Jianfeng; Lu, Wenzhuo
> > > > Subject: [PATCH v2] igb_uio: issue FLR during open and release of device
> > file
> > > >
> > > > Set UIO info device file operations open and release. Call pci reset
> > > > function inside open and release to clear device state at start and end.
> > > > Copied this behaviour from vfio_pci kernel module code. With this patch,
> > > > it is not mandatory to issue FLR by PMD's during init and close.
> > >
> > > I'm afraid this will not work for restarted DPDK process. In current probe(),
> > we set up the I/O mem and I/O port; and those sys files are used by EAL
> > IGB_UIO initialization code to map I/O mem and port. After reset in release(),
> > we will lose those sys files in next open().
> > >
> > > Thanks,
> > > Jianfeng
> > >
> > > >
> > > > Bus master enable and disable are added in open and release
> > respectively
> > > > to take care of device DMA.
> > > >
> > > > Signed-off-by: Shijith Thotton <shijith.thotton@caviumnetworks.com>
> > > > ---
> > > > v2 changes:
> > > >  - Replaced pci_try_reset_function with pci_reset_function as it is not
> > > >    available in older kernel versions.
> > > >
> > > > v1 changes:
> > > >  - Added pci set master inside open and clear master inside release.
> > > >  - Remove obvious comments.
> > > >
> > > > RFC: http://dpdk.org/ml/archives/dev/2017-May/066917.html
> > > >
> > > >  lib/librte_eal/linuxapp/igb_uio/igb_uio.c | 33
> > > > +++++++++++++++++++++++++++++++
> > > >  1 file changed, 33 insertions(+)
> > > >
> > > > diff --git a/lib/librte_eal/linuxapp/igb_uio/igb_uio.c
> > > > b/lib/librte_eal/linuxapp/igb_uio/igb_uio.c
> > > > index b9d427c..07a19a3 100644
> > > > --- a/lib/librte_eal/linuxapp/igb_uio/igb_uio.c
> > > > +++ b/lib/librte_eal/linuxapp/igb_uio/igb_uio.c
> > > > @@ -170,6 +170,37 @@ struct rte_uio_pci_dev {
> > > >  	return IRQ_HANDLED;
> > > >  }
> > > >
> > > > +/**
> > > > + * This gets called while opening uio device file.
> > > > + */
> > > > +static int
> > > > +igbuio_pci_open(struct uio_info *info, struct inode *inode)
> > > > +{
> > > > +	struct rte_uio_pci_dev *udev = info->priv;
> > > > +	struct pci_dev *dev = udev->pdev;
> > > > +
> > > > +	pci_reset_function(dev);
> > > > +
> > > > +	/* set bus master, which was cleared by the reset function */
> > > > +	pci_set_master(dev);
> > > > +
> > > > +	return 0;
> > > > +}
> > > > +
> > > > +static int
> > > > +igbuio_pci_release(struct uio_info *info, struct inode *inode)
> > > > +{
> > > > +	struct rte_uio_pci_dev *udev = info->priv;
> > > > +	struct pci_dev *dev = udev->pdev;
> > > > +
> > > > +	/* stop the device from further DMA */
> > > > +	pci_clear_master(dev);
> > > > +
> > > > +	pci_reset_function(dev);
> > > > +
> > > > +	return 0;
> > > > +}
> > > > +
> > > >  #ifdef CONFIG_XEN_DOM0
> > > >  static int
> > > >  igbuio_dom0_mmap_phys(struct uio_info *info, struct vm_area_struct
> > > > *vma)
> > > > @@ -372,6 +403,8 @@ struct rte_uio_pci_dev {
> > > >  	udev->info.version = "0.1";
> > > >  	udev->info.handler = igbuio_pci_irqhandler;
> > > >  	udev->info.irqcontrol = igbuio_pci_irqcontrol;
> > > > +	udev->info.open = igbuio_pci_open;
> > > > +	udev->info.release = igbuio_pci_release;
> > > >  #ifdef CONFIG_XEN_DOM0
> > > >  	/* check if the driver run on Xen Dom0 */
> > > >  	if (xen_initial_domain())
> > > > --
> > > > 1.8.3.1
> > >
> > 
> > Hi Jianfeng,
> > 
> > I have tested the patch with LiquidIO VFs in VM using testpmd and could not
> > see
> > any issue over multiple runs.
> 
> I got that, you are using pci_reset_function() instead of pci_disable_device (the function I was trying). So only one question left, from the comment of pci_reset_function(), it "saves and restores device state over  the reset", then is __pci_reset_function() is more proper here?

Per comments of __pci_reset_function:
 * Resetting the device will make the contents of PCI configuration space
 * random, so any caller of this must be prepared to reinitialise the
 * device including MSI, bus mastering, BARs, decoding IO and memory spaces,
 * etc.

So thought, pci_reset_function would be proper as it saves and restores state.
Please correct if I assumed it wrong.

Shijith

  reply	other threads:[~2017-07-10 10:42 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-24 11:22 [dpdk-dev] i40e igb_uio: reset pci on process exit Gregory Etelson
2017-05-25 18:42 ` Stephen Hemminger
2017-05-26  4:30   ` Gregory Etelson
2017-05-26  6:05     ` Shijith Thotton
2017-05-26  6:17       ` Gregory Etelson
2017-05-26 15:53         ` Stephen Hemminger
2017-05-26 16:14           ` Gregory Etelson
2017-05-29  9:48             ` Shijith Thotton
2017-05-29 10:01               ` Gregory Etelson
2017-05-29 11:01                 ` Shijith Thotton
2017-05-29 11:21                   ` Gregory Etelson
2017-05-31 11:09                     ` [dpdk-dev] [RFC PATCH] igb_uio: issue FLR during open and release of device file Shijith Thotton
2017-05-31 12:20                       ` Ferruh Yigit
2017-05-31 15:30                         ` Stephen Hemminger
2017-05-31 17:11                           ` Ferruh Yigit
2017-06-01 11:35                             ` Shijith Thotton
2017-06-01 11:14                         ` Gregory Etelson
2017-06-04  7:22                         ` Gregory Etelson
2017-06-05  2:29                           ` Tan, Jianfeng
2017-06-05  5:57                             ` Gregory Etelson
2017-05-31 15:29                       ` Stephen Hemminger
2017-06-12  9:38                       ` [dpdk-dev] [PATCH] " Shijith Thotton
2017-07-05 23:42                         ` Thomas Monjalon
2017-07-06 16:41                         ` Ferruh Yigit
2017-07-06 17:27                           ` Gregory Etelson
2017-07-07 10:03                             ` Shijith Thotton
2017-07-07 10:16                               ` Ferruh Yigit
2017-07-07 11:13                         ` [dpdk-dev] [PATCH v2] " Shijith Thotton
2017-07-07 15:10                           ` Ferruh Yigit
2017-07-10  3:07                             ` Gregory Etelson
2017-07-11  5:42                               ` Gregory Etelson
2017-07-11 11:36                                 ` Gregory Etelson
2017-07-10  3:38                           ` Tan, Jianfeng
2017-07-10  7:10                             ` Shijith Thotton
2017-07-10  9:00                               ` Tan, Jianfeng
2017-07-10 10:42                                 ` Shijith Thotton [this message]
2017-07-12  3:37                                   ` Tan, Jianfeng
2017-07-12  3:40                           ` Tan, Jianfeng
2017-07-16  4:22                             ` Gregory Etelson
2017-07-19 13:32                             ` Ferruh Yigit
2017-07-19 16:19                               ` Gregory Etelson
2017-07-20 22:36                                 ` Thomas Monjalon

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=20170710104229.GA6580@localhost.localdomain \
    --to=shijith.thotton@caviumnetworks.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=gregory@weka.io \
    --cc=jianfeng.tan@intel.com \
    --cc=stephen@networkplumber.org \
    --cc=thomas@monjalon.net \
    --cc=wenzhuo.lu@intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).