Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp183816ybl; Wed, 21 Aug 2019 17:14:49 -0700 (PDT) X-Google-Smtp-Source: APXvYqwcbPtAph0i8i6ufSs8Wq/QkSrlYMTJ53ZA8ZyYKcRPWFhcGtvvoUWwhcGCOn3nt+VnA8Rn X-Received: by 2002:a17:902:8d8d:: with SMTP id v13mr36307979plo.137.1566432889489; Wed, 21 Aug 2019 17:14:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566432889; cv=none; d=google.com; s=arc-20160816; b=Glchjp5Ljzldh+UXp751k2E3+XOTLHvxA0qF3qsXbRLzgUoGD2+aqGsUdUuUNdOjzE xkh5ScBFNpBbDdaRSgeoCr2r39ZcQOMGuy5Nx+bUlj8/5nrveBEuK2m6EEQHWDcwVbEQ OJEELohnooRvsKHlXpdGdlMd5LZeCgsOg7eKFJJ811BZTVTGaQVHOyqH5o2V6IxazKPN cOOopVtYxx8kXHhTIKLhV5BY4ZRweEg4q67qWmKEqazXienmnQ7bvjT/uO5wZI9fvzNB /YS4s8MPdj7rG9QSjz/y9DORGbt/LNMAIV5G8tqBkwx5Eb8Kqk5d09g8diokkBDseX6P FXhA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=RL/HYIMRFI+nEG8s05HkRP/NdA4eHLUAZju9oliAous=; b=PI9133vyO/pwon4EIBpD95pk6HUVpUqlduMfliPH1EOWmvCgkDfdMlMliZKWKL9Sgv vSyOS0dfyhR2SDNJFpv2hvFx6kEKTJHCylYVu+7UYI7XKSOShPCGSOjmmrvSjm3GqBtL CALqOWGu7ABAPgB/Q9gQnza7NAV8ry4HPkzmUfdNmx5RYNsVsHbYxU0efTcp43tS4+kV O1EwATXd9N/hOYHu+d+bfFGi3wwLjVyJChJonVTFC7LcYK/4xgPmqak+a2z9Ajm/7gX/ BEH7E22FEFihPJ8xKCIJ5HlU3+cW05IhBdue9jj5ASVEVkEoNLTo2/5qS44hgDrsG6KY g4bA== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n9si15224111pgq.240.2019.08.21.17.14.34; Wed, 21 Aug 2019 17:14:49 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728451AbfHVAG5 (ORCPT + 99 others); Wed, 21 Aug 2019 20:06:57 -0400 Received: from verein.lst.de ([213.95.11.211]:41942 "EHLO verein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726828AbfHVAG5 (ORCPT ); Wed, 21 Aug 2019 20:06:57 -0400 Received: by verein.lst.de (Postfix, from userid 2407) id AEBD168C7B; Thu, 22 Aug 2019 02:06:52 +0200 (CEST) Date: Thu, 22 Aug 2019 02:06:52 +0200 From: Christoph Hellwig To: Marta Rybczynska Cc: kbusch@kernel.org, axboe@fb.com, hch@lst.de, sagi@grimberg.me, linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org, Samuel Jones , Guillaume Missonnier Subject: Re: [PATCH v2] nvme: allow 64-bit results in passthru commands Message-ID: <20190822000652.GF9511@lst.de> References: <89520652.56920183.1565948841909.JavaMail.zimbra@kalray.eu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <89520652.56920183.1565948841909.JavaMail.zimbra@kalray.eu> User-Agent: Mutt/1.5.17 (2007-11-01) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Aug 16, 2019 at 11:47:21AM +0200, Marta Rybczynska wrote: > It is not possible to get 64-bit results from the passthru commands, > what prevents from getting for the Capabilities (CAP) property value. > > As a result, it is not possible to implement IOL's NVMe Conformance > test 4.3 Case 1 for Fabrics targets [1] (page 123). > > This issue has been already discussed [2], but without a solution. > > This patch solves the problem by adding new ioctls with a new > passthru structure, including 64-bit results. The older ioctls stay > unchanged. Ok, with my idea not being suitable I think I'm fine with this approach, a little nitpick below: > +static bool is_admin_cmd(unsigned int cmd) > +{ > + if ((cmd == NVME_IOCTL_ADMIN_CMD) || (cmd == NVME_IOCTL_ADMIN64_CMD)) > + return true; > + return false; > +} No need for the inner braces. But I'm actually not sure the current code structure is very suitable for extending it. > + > static int nvme_ioctl(struct block_device *bdev, fmode_t mode, > unsigned int cmd, unsigned long arg) > { > @@ -1418,13 +1473,13 @@ static int nvme_ioctl(struct block_device *bdev, fmode_t mode, > * seperately and drop the ns SRCU reference early. This avoids a > * deadlock when deleting namespaces using the passthrough interface. > */ > - if (cmd == NVME_IOCTL_ADMIN_CMD || is_sed_ioctl(cmd)) { > + if (is_admin_cmd(cmd) || is_sed_ioctl(cmd)) { So maybe for this check we should have a is_ctrl_iocl() helper instead that includes the is_sed_ioctl check. > struct nvme_ctrl *ctrl = ns->ctrl; > > nvme_get_ctrl(ns->ctrl); > nvme_put_ns_from_disk(head, srcu_idx); > > - if (cmd == NVME_IOCTL_ADMIN_CMD) > + if (is_admin_cmd(cmd)) > ret = nvme_user_cmd(ctrl, NULL, argp); > else > ret = sed_ioctl(ctrl->opal_dev, cmd, argp); And then we can move this whole branch into a helper function, which then switches on the ioctl cmd, with sed_ioctl as the fallback.