From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 81F04A057B; Thu, 2 Apr 2020 12:10:55 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 58AF91B91B; Thu, 2 Apr 2020 12:10:55 +0200 (CEST) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id 526102C15 for ; Thu, 2 Apr 2020 12:10:53 +0200 (CEST) IronPort-SDR: vVCUhAECH9da+irp3f1hhQ+INRZDZVFa6merUxZ8GmbEbmlFxVXzx5i5z0xRgQz1EfLHxtUr+o izMu+Vm7QCzQ== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Apr 2020 03:10:52 -0700 IronPort-SDR: UBf1Ni/fHBd3JawuHHfbQD2a/A/DH26d7MT4DsQt2ppxNkJx34HeJ+vXwy3t3C8+1PxHjOFWDA a7G/1IUIuhJw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,335,1580803200"; d="scan'208";a="243022823" Received: from aburakov-mobl.ger.corp.intel.com (HELO [10.251.89.135]) ([10.251.89.135]) by orsmga008.jf.intel.com with ESMTP; 02 Apr 2020 03:10:51 -0700 To: Michael Haeuptle , dev@dpdk.org References: <20200331165657.29368-1-michael.haeuptle@hpe.com> From: "Burakov, Anatoly" Message-ID: Date: Thu, 2 Apr 2020 11:10:50 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.6.0 MIME-Version: 1.0 In-Reply-To: <20200331165657.29368-1-michael.haeuptle@hpe.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH] eal: Fixes VFIO/sysfs race condition 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On 31-Mar-20 5:56 PM, Michael Haeuptle wrote: > This fix treats a 0 return value from vfio_open_group_fd > in vfio_get_group_fd as the intended error condition instead > of putting an incorrect 0 file descriptor in the vfio_group table. > > Sometimes, the creation of device files in sysfs is not > instantaneously causing vfio_open_groupfd to return 0. > This has been observed when hot removing/adding multiple > NVMe devices (>=4). > > Signed-off-by: Michael Haeuptle > --- > lib/librte_eal/linux/eal_vfio.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/lib/librte_eal/linux/eal_vfio.c b/lib/librte_eal/linux/eal_vfio.c > index 4502aefed..1979f6fdd 100644 > --- a/lib/librte_eal/linux/eal_vfio.c > +++ b/lib/librte_eal/linux/eal_vfio.c > @@ -379,7 +379,7 @@ vfio_get_group_fd(struct vfio_config *vfio_cfg, > } > > vfio_group_fd = vfio_open_group_fd(iommu_group_num); > - if (vfio_group_fd < 0) { > + if (vfio_group_fd <= 0) { > RTE_LOG(ERR, EAL, "Failed to open group %d\n", iommu_group_num); > return -1; > } > If it's returning an invalid value, is that a kernel bug? I mean, looks fine to me, so Acked-by: Anatoly Burakov -- Thanks, Anatoly