Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp4901781imm; Fri, 18 May 2018 12:39:33 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpBpFjHmTwtmndMhcvIyLWP0aSxVBA8VXx1AuO5lmIkcKjUNvcIFVma79V8eRcOcTn95B5c X-Received: by 2002:a17:902:5c6:: with SMTP id f64-v6mr10721107plf.50.1526672373537; Fri, 18 May 2018 12:39:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526672373; cv=none; d=google.com; s=arc-20160816; b=zkxe4mb9DdPc8slpo7u9NWoNP59CiZ1UmsdytBpLNOyj8rLCPOSjr+aNqSJVqSV551 uiegza1TcGh++jKXFwSCWLvg6+19YpaqhL7D3ttgy7KGpAuMAvIR07HtKUIXIzW9JFe6 BFH+Lz62Diysk8cchFGb2PjIcWbB8vUl3zfQgKk2a4FLcvklKfsE3yALKcEMjP6epnNO q27TvE5Gz3DNogesuun7PXJGQe793YhERg3nZ+3qT0VzdHse/M/7PP6XKUFgyzBc8u56 Hc94Eq9lbBUTFqeNVwF/2dkZqRe4H12TRIzHmpixJKo4ta+4QCQVpiWc6C63hX3UFYYr l5dg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:date:message-id:from :references:cc:to:subject:arc-authentication-results; bh=e9KviDbeaWFVHR03QaqiCNlyRNJ1BFSKb9MjRVi4pzI=; b=iiVhq+EMALQ4PkU4Hv/ceIXahlLPZYjiP+Mq1nG2sLWa9oWNnveaLtRCyQzMf5C/qI b6nOs7XSbFLRkt8H/kFLnE5OPEtBCwDenUxK1w6ZN1f9/tY8LdUgjc1YREjSN3gCc7xf QC1NG4z/xly6OTPV68O1HAx08AGRanvWhV0twtaldeBACQOYQwIHIdKujWk8P+83FINX ieXhpHoCCmvr8hJiBn71a6d7AHz0SIq4skiwpplG32bjwGfu/nlKW9eiTg8eCZ1+zYiY tlaw2zrijE+E/EAYQWOS51qAjF1aa1AJe80Ro50ZNxCYB9wJXzOpLntGWk31SF5KbF+9 vNfQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e9-v6si8134116pli.576.2018.05.18.12.39.18; Fri, 18 May 2018 12:39:33 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752336AbeERTiX (ORCPT + 99 others); Fri, 18 May 2018 15:38:23 -0400 Received: from hqemgate14.nvidia.com ([216.228.121.143]:17995 "EHLO hqemgate14.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752291AbeERTiR (ORCPT ); Fri, 18 May 2018 15:38:17 -0400 Received: from hqpgpgate101.nvidia.com (Not Verified[216.228.121.13]) by hqemgate14.nvidia.com (using TLS: TLSv1, AES128-SHA) id ; Fri, 18 May 2018 12:38:16 -0700 Received: from HQMAIL101.nvidia.com ([172.20.161.6]) by hqpgpgate101.nvidia.com (PGP Universal service); Fri, 18 May 2018 12:38:17 -0700 X-PGP-Universal: processed; by hqpgpgate101.nvidia.com on Fri, 18 May 2018 12:38:17 -0700 Received: from BGMAIL102.nvidia.com (10.25.59.11) by HQMAIL101.nvidia.com (172.20.187.10) with Microsoft SMTP Server (TLS) id 15.0.1347.2; Fri, 18 May 2018 19:38:16 +0000 Received: from [10.24.70.199] (10.24.70.199) by bgmail102.nvidia.com (10.25.59.11) with Microsoft SMTP Server (TLS) id 15.0.1347.2; Fri, 18 May 2018 19:38:11 +0000 Subject: Re: [PATCH v4 2/2] vfio/mdev: Re-order sysfs attribute creation To: Alex Williamson CC: , , , References: <20180518190145.3187.7620.stgit@gimli.home> <20180518191035.3187.77957.stgit@gimli.home> X-Nvconfidentiality: public From: Kirti Wankhede Message-ID: <30699b42-a587-7235-5fec-e745cd5c925d@nvidia.com> Date: Sat, 19 May 2018 01:08:07 +0530 MIME-Version: 1.0 In-Reply-To: <20180518191035.3187.77957.stgit@gimli.home> X-Originating-IP: [10.24.70.199] X-ClientProxiedBy: DRBGMAIL104.nvidia.com (10.18.16.23) To bgmail102.nvidia.com (10.25.59.11) Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 5/19/2018 12:40 AM, Alex Williamson wrote: > There exists a gap at the end of mdev_device_create() where the device > is visible to userspace, but we're not yet ready to handle removal, as > triggered through the 'remove' attribute. We handle this properly in > mdev_device_remove() with an -EAGAIN return, but we can marginally > reduce this gap by adding this attribute as a final step of our sysfs > setup. > > Signed-off-by: Alex Williamson Looks good. Reviewed by: Kirti Wankhede > --- > drivers/vfio/mdev/mdev_sysfs.c | 14 +++++++------- > 1 file changed, 7 insertions(+), 7 deletions(-) > > diff --git a/drivers/vfio/mdev/mdev_sysfs.c b/drivers/vfio/mdev/mdev_sysfs.c > index 802df210929b..249472f05509 100644 > --- a/drivers/vfio/mdev/mdev_sysfs.c > +++ b/drivers/vfio/mdev/mdev_sysfs.c > @@ -257,24 +257,24 @@ int mdev_create_sysfs_files(struct device *dev, struct mdev_type *type) > { > int ret; > > - ret = sysfs_create_files(&dev->kobj, mdev_device_attrs); > - if (ret) > - return ret; > - > ret = sysfs_create_link(type->devices_kobj, &dev->kobj, dev_name(dev)); > if (ret) > - goto device_link_failed; > + return ret; > > ret = sysfs_create_link(&dev->kobj, &type->kobj, "mdev_type"); > if (ret) > goto type_link_failed; > > + ret = sysfs_create_files(&dev->kobj, mdev_device_attrs); > + if (ret) > + goto create_files_failed; > + > return ret; > > +create_files_failed: > + sysfs_remove_link(&dev->kobj, "mdev_type"); > type_link_failed: > sysfs_remove_link(type->devices_kobj, dev_name(dev)); > -device_link_failed: > - sysfs_remove_files(&dev->kobj, mdev_device_attrs); > return ret; > } > >