Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp5696539ybl; Tue, 27 Aug 2019 08:25:28 -0700 (PDT) X-Google-Smtp-Source: APXvYqw/o0e8CuBTLtNeRYHqz/o+g1x3aof8geeOwm6vXNDIdwGUsoPGSO02tpClIcEILDW1KRYS X-Received: by 2002:a63:4823:: with SMTP id v35mr21765835pga.138.1566919528188; Tue, 27 Aug 2019 08:25:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566919528; cv=none; d=google.com; s=arc-20160816; b=0e+IfOmuKZYr17nOTzrNyL1t0P9ggfTvuASK1oS7jzc4EAG+Ta689kLc/nHs57BevP 6rXhwaytHN+NqVg4UE+L97YyWQYjCObAgiItUv/qkYE8Nd0VFeX5tTBfVZJApASXMOed TX3I0idT3lNteqAoG5l1QuxH6BQXEacm1ZXdl05EQ/vexmI0QNPgr7Y3xESOYGBx02Mn RSoM6w/OwaDjKsBzyrtDO/Wcpt5KX2AeV0F5+qN5tEWNdB/p+w0ZWGbFI5KHskW+1A6J usUkn7CqnfZk5nnJJc485LvDrgh1wX4wdorDpDZYImPFS/qDM45KTXsHOKPds98jzflO aHPA== 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:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date; bh=N9ATVDDsyopB/+4NVBBOkGBdDhHhD8i730QllOec3bM=; b=dkPvYzlOOgehwhYwhczuj+bBLBO9I89TbhTuGwzCe98idfs8o2AclmJ51iUGBXP2n8 7FPlt3fmryBcA6+34Jko52gIn2uUEQOSDYNuKTYYjxnMp5x7+q70fg51m3uZOyUEoRan NzQwcFCJp9UHTurgOw1y8wPvSt0xyKWHlATkbF/GYxYX0KkguNbTNpuYAfStwOZEkuvY QfFIkqlFfTSomGxIjqpza1gM26hxcWrHqw2sIMvepaCZM9lZtWvQehc/QMhJS6GgqGgp 2MeLeMtsnj/JEuVN659SoBmFhC1/zMKIoZUnpP//RJv8CBHERVZ102RnX4xWuO4iwD/v ZsEw== 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f10si14273706pfq.194.2019.08.27.08.25.12; Tue, 27 Aug 2019 08:25:28 -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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730291AbfH0PXw convert rfc822-to-8bit (ORCPT + 99 others); Tue, 27 Aug 2019 11:23:52 -0400 Received: from mx1.redhat.com ([209.132.183.28]:52920 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730196AbfH0PXt (ORCPT ); Tue, 27 Aug 2019 11:23:49 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D3FE410F23EB; Tue, 27 Aug 2019 15:23:48 +0000 (UTC) Received: from x1.home (ovpn-116-99.phx2.redhat.com [10.3.116.99]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6523D1E0; Tue, 27 Aug 2019 15:23:47 +0000 (UTC) Date: Tue, 27 Aug 2019 09:23:46 -0600 From: Alex Williamson To: Parav Pandit Cc: Mark Bloch , Jiri Pirko , "kwankhede@nvidia.com" , "cohuck@redhat.com" , "davem@davemloft.net" , "kvm@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "netdev@vger.kernel.org" Subject: Re: [PATCH 2/4] mdev: Make mdev alias unique among all mdevs Message-ID: <20190827092346.66bb73f1@x1.home> In-Reply-To: References: <20190826204119.54386-1-parav@mellanox.com> <20190826204119.54386-3-parav@mellanox.com> <6601940a-4832-08d2-e0f6-f9ac24758cdc@mellanox.com> Organization: Red Hat MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.66]); Tue, 27 Aug 2019 15:23:48 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 27 Aug 2019 04:28:37 +0000 Parav Pandit wrote: > Hi Mark, > > > -----Original Message----- > > From: Mark Bloch > > Sent: Tuesday, August 27, 2019 4:32 AM > > To: Parav Pandit ; alex.williamson@redhat.com; Jiri > > Pirko ; kwankhede@nvidia.com; cohuck@redhat.com; > > davem@davemloft.net > > Cc: kvm@vger.kernel.org; linux-kernel@vger.kernel.org; > > netdev@vger.kernel.org > > Subject: Re: [PATCH 2/4] mdev: Make mdev alias unique among all mdevs > > > > > > > > On 8/26/19 1:41 PM, Parav Pandit wrote: > > > Mdev alias should be unique among all the mdevs, so that when such > > > alias is used by the mdev users to derive other objects, there is no > > > collision in a given system. > > > > > > Signed-off-by: Parav Pandit > > > --- > > > drivers/vfio/mdev/mdev_core.c | 5 +++++ > > > 1 file changed, 5 insertions(+) > > > > > > diff --git a/drivers/vfio/mdev/mdev_core.c > > > b/drivers/vfio/mdev/mdev_core.c index e825ff38b037..6eb37f0c6369 > > > 100644 > > > --- a/drivers/vfio/mdev/mdev_core.c > > > +++ b/drivers/vfio/mdev/mdev_core.c > > > @@ -375,6 +375,11 @@ int mdev_device_create(struct kobject *kobj, > > struct device *dev, > > > ret = -EEXIST; > > > goto mdev_fail; > > > } > > > + if (tmp->alias && strcmp(tmp->alias, alias) == 0) { > > > > alias can be NULL here no? > > > If alias is NULL, tmp->alias would also be null because for given parent either we have alias or we don’t. > So its not possible to have tmp->alias as null and alias as non null. > But it may be good/defensive to add check for both. mdev_list is a global list of all mdev devices, how can we make any assumptions that an element has the same parent? Thanks, Alex > > > + mutex_unlock(&mdev_list_lock); > > > + ret = -EEXIST; > > > + goto mdev_fail; > > > + } > > > } > > > > > > mdev = kzalloc(sizeof(*mdev), GFP_KERNEL); > > > > > > > Mark