From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr0-f182.google.com (mail-wr0-f182.google.com [209.85.128.182]) by dpdk.org (Postfix) with ESMTP id 78E6D7CD9 for ; Sun, 4 Jun 2017 09:22:08 +0200 (CEST) Received: by mail-wr0-f182.google.com with SMTP id q97so24081472wrb.2 for ; Sun, 04 Jun 2017 00:22:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=weka.io; s=google; h=from:to:cc:subject:date:message-id:organization:in-reply-to :references:mime-version:content-transfer-encoding; bh=2ZbOwAysdUfy+1cyrfLj2i66MGImXbEss5s+tcDhghs=; b=UFWGYLXr4/3nwZN21rSJhW/omAKCLY0miZPuzOVDqPpy2je1LVX3i/9psBkySHs7/H ib57VrbuVuxFpYq3taPKWhneZ3gxUiHlUBIMbsfRJvdbe9VAHx12CGCghToFbcMyRD6Y tmBKMFxhBwujL3Nrys0koq2vB7YYIf82peL74= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:organization :in-reply-to:references:mime-version:content-transfer-encoding; bh=2ZbOwAysdUfy+1cyrfLj2i66MGImXbEss5s+tcDhghs=; b=U7b0bpWLHEAsRdngm1xBy7H5CNq3baZwFDFQo/HSgS26S8ZY4W+NELIjCvnsWcWxqn 5G8E3j3kpBO4r83QTn6IXGJpJ8IeZ3sB+ZVL80yedu1cWsG1L07UZGVj1msgova1qzbZ 7XXTHYOegVi7bFS4tLQ/zll1Aoz9L8+ROmD+gz1e73nAdJCY/0YMZTcCPiBAYUNcPBnW fd9DzeQp+rPzZrjUMJsQPqC3TOJyJIJzDk20fjvkb6BC/VVtoBXoVkyjJtZuvAiU8GVY tEtZW9TA8AXcGq1FYHttZxPN6a/RmswaLUgczM/ol325F5TXvzEFZ5FxlSCHTdw666s9 cbnA== X-Gm-Message-State: AODbwcAqwARC46hv+V96kfHBUiNBvx4HLp38FPdSa1Hx7guAP5sKZKsd ewzluQ0XJYgv5wpcPeo= X-Received: by 10.223.164.75 with SMTP id e11mr10180401wra.101.1496560927971; Sun, 04 Jun 2017 00:22:07 -0700 (PDT) Received: from polaris.localnet (bzq-82-81-85-138.red.bezeqint.net. [82.81.85.138]) by smtp.gmail.com with ESMTPSA id v27sm21991411wra.19.2017.06.04.00.22.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 04 Jun 2017 00:22:07 -0700 (PDT) From: Gregory Etelson To: Ferruh Yigit Cc: Shijith Thotton , Stephen Hemminger , dev@dpdk.org, Qi Zhang , Wenzhuo Lu , Thomas Monjalon , Jianfeng Tan Date: Sun, 04 Jun 2017 10:22:05 +0300 Message-ID: <2232995.tDUxtNZcgW@polaris> Organization: Weka.IO In-Reply-To: References: <1748341.rbpcFmWp0q@polaris> <1496228966-18573-1-git-send-email-shijith.thotton@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7Bit X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Subject: Re: [dpdk-dev] [RFC PATCH] igb_uio: issue FLR during open and release of device file X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Jun 2017 07:22:08 -0000 In my environment I could reproduce server crash after applying the patch Regards, Gregory On Wednesday, 31 May 2017 15:20:08 IDT Ferruh Yigit wrote: > On 5/31/2017 12:09 PM, Shijith Thotton wrote: > > 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 > > change, it is not mandatory to issue FLR by PMD's during init and close. > > Cc: Jianfeng Tan > > Jianfeng also implemented following patch: > http://dpdk.org/dev/patchwork/patch/17495/ > > Which also implements release and open ops, for slightly different > reason (prevent DMA access after app exit), but mainly both are to > gracefully handle application exit status. > > btw, for Jianfeng's case, can adding pci_clear_master() in release and > moving pci_set_master() to open help preventing unwanted DMA? > > > Gregory, > > Can you please check if this patch fixes your issue? > > Thanks, > ferruh > > > > > Signed-off-by: Shijith Thotton > > --- > > lib/librte_eal/linuxapp/igb_uio/igb_uio.c | 30 ++++++++++++++++++++++++++++++ > > 1 file changed, 30 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..5bc58d2 100644 > > --- a/lib/librte_eal/linuxapp/igb_uio/igb_uio.c > > +++ b/lib/librte_eal/linuxapp/igb_uio/igb_uio.c > > @@ -170,6 +170,34 @@ struct rte_uio_pci_dev { > > return IRQ_HANDLED; > > } > > > > +/** > > + * This gets called while opening uio device file. It clears any previous state > > + * associated with the pci device. > > + */ > > +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; > > + > > + /* reset the pci device */ > > + pci_reset_function(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; > > + > > + /* try to reset the pci device */ > > + pci_try_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 +400,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()) > > > >