Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp5445209ybl; Tue, 27 Aug 2019 04:57:53 -0700 (PDT) X-Google-Smtp-Source: APXvYqwXkq/iThdXyXz3LGbHysUkEUtdZ+SqLP5pHin/xNHykztnlGAxJbHLeFlyedGxByoUU+HW X-Received: by 2002:a17:90a:b884:: with SMTP id o4mr24808679pjr.52.1566907073223; Tue, 27 Aug 2019 04:57:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566907073; cv=none; d=google.com; s=arc-20160816; b=J3O2xnR9uwsIf+i+L7BTToMjEEXfTSk8xFaC07wQNIgi9HXyNNayoQfNJhfeZ1kIG7 jn6XceSbHMKXmEQaVSiolkgIeTGLCLrmxcPbsZENCjNCLqbV3PNJfEgc9MGhSWO8bcbr Ip6SLeEg1x4f8qE3j/Y7x3ZmViHKPiUc+3m5shY7K4cqaPUM8xUZlOt0ahLhxbNPDft8 dvwLlqAgvYiwVCAOVEmOmFdPp7J4ztd03EtQZRlwJKgDMSL8eg+5QSURkRLY3PFwNHlt y24p5zdea3zNILCm6O8ioRcxYo+369c5yVF5hIwDzrCVeThQuqpdHn0Jisic1Ni7RXKf ZQeA== 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=zZpvRz2v3inOuOv5K/+P+s9yOJj7TlaMWb2pU9U1HFg=; b=ZTbUEdQlVHe/O27IqSVTphYD+d7yn1m/DcV/HfzptVNiE/xRkFzkFLYndEg9lsptgd apVGXFFzVYXrDBUCr7YyIHzYeIJ8mAEbyZ6hyxgKAa3QvW7vaWyoaa/R0o6PeE2UbHWg dCp/sK1YxDruAyk9oOZY5lLamYRRpar9f/nDxdxfbUHE5wTXlPtSHea9cGPgl3Y108wH KveBG5ZDw9kSyxrriMG/JsVh4iqRqAs5QZiRa5XfesYjeDGTl/+XQYzWeJGe1SNA6r6H I1IMXvJIoSMy0NvrcjyHnhNgbf2AkntLLWAH4ZoB31VyUf5jrWuhxvtRZFBIHq/2rvxl dUpA== 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 y13si13556120pfc.251.2019.08.27.04.57.37; Tue, 27 Aug 2019 04:57:53 -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 S1729470AbfH0Lze (ORCPT + 99 others); Tue, 27 Aug 2019 07:55:34 -0400 Received: from mx1.redhat.com ([209.132.183.28]:57206 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725850AbfH0Lze (ORCPT ); Tue, 27 Aug 2019 07:55:34 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B9806C057E9F; Tue, 27 Aug 2019 11:55:33 +0000 (UTC) Received: from gondolin (dhcp-192-222.str.redhat.com [10.33.192.222]) by smtp.corp.redhat.com (Postfix) with ESMTP id ECF53194B2; Tue, 27 Aug 2019 11:55:29 +0000 (UTC) Date: Tue, 27 Aug 2019 13:55:27 +0200 From: Cornelia Huck To: Parav Pandit Cc: "alex.williamson@redhat.com" , Jiri Pirko , "kwankhede@nvidia.com" , "davem@davemloft.net" , "kvm@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "netdev@vger.kernel.org" Subject: Re: [PATCH 3/4] mdev: Expose mdev alias in sysfs tree Message-ID: <20190827135527.7c9d3940.cohuck@redhat.com> In-Reply-To: References: <20190826204119.54386-1-parav@mellanox.com> <20190826204119.54386-4-parav@mellanox.com> <20190827124706.7e726794.cohuck@redhat.com> <20190827133432.156f7db3.cohuck@redhat.com> Organization: Red Hat GmbH MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Tue, 27 Aug 2019 11:55:33 +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 11:52:21 +0000 Parav Pandit wrote: > > -----Original Message----- > > From: Cornelia Huck > > Sent: Tuesday, August 27, 2019 5:05 PM > > To: Parav Pandit > > Cc: alex.williamson@redhat.com; Jiri Pirko ; > > kwankhede@nvidia.com; davem@davemloft.net; kvm@vger.kernel.org; linux- > > kernel@vger.kernel.org; netdev@vger.kernel.org > > Subject: Re: [PATCH 3/4] mdev: Expose mdev alias in sysfs tree > > > > On Tue, 27 Aug 2019 11:07:37 +0000 > > Parav Pandit wrote: > > > > > > -----Original Message----- > > > > From: Cornelia Huck > > > > Sent: Tuesday, August 27, 2019 4:17 PM > > > > To: Parav Pandit > > > > Cc: alex.williamson@redhat.com; Jiri Pirko ; > > > > kwankhede@nvidia.com; davem@davemloft.net; kvm@vger.kernel.org; > > > > linux- kernel@vger.kernel.org; netdev@vger.kernel.org > > > > Subject: Re: [PATCH 3/4] mdev: Expose mdev alias in sysfs tree > > > > > > > > On Mon, 26 Aug 2019 15:41:18 -0500 > > > > Parav Pandit wrote: > > > > > > > +static ssize_t alias_show(struct device *device, > > > > > + struct device_attribute *attr, char *buf) { > > > > > + struct mdev_device *dev = mdev_from_dev(device); > > > > > + > > > > > + if (!dev->alias) > > > > > + return -EOPNOTSUPP; > > > > > > > > I'm wondering how to make this consumable by userspace in the easiest > > way. > > > > - As you do now (userspace gets an error when trying to read)? > > > > - Returning an empty value (nothing to see here, move along)? > > > No. This is confusing, to return empty value, because it says that there is an > > alias but it is some weird empty string. > > > If there is alias, it shows exactly what it is. > > > If no alias it returns an error code = unsupported -> inline with other widely > > used subsystem. > > > > > > > - Or not creating the attribute at all? That would match what userspace > > > > sees on older kernels, so it needs to be able to deal with that > > > New sysfs files can appear. Tool cannot say that I was not expecting this file > > here. > > > User space is supposed to work with the file they are off interest. > > > Mdev interface has option to specify vendor specific files, though in usual > > manner it's not recommended. > > > So there is no old user space, new kernel issue here. > > > > I'm not talking about old userspace/new kernel, but new userspace/old kernel. > > Code that wants to consume this attribute needs to be able to cope with its > > absence anyway. > > > Old kernel doesn't have alias file. > If some tool tries to read this file it will fail to open non existing file; open() system call is already taking care of it. Yes, that was exactly my argument?