Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp1778280ybh; Mon, 20 Jul 2020 07:04:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzy/yOJmfXfw2rgLAEC2Sd8Mlfr6fEj9YxPwGL5XIRC5be77wCHsz0TfxzsfmqngNFczKSB X-Received: by 2002:a17:906:6d56:: with SMTP id a22mr21842323ejt.440.1595253883738; Mon, 20 Jul 2020 07:04:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595253883; cv=none; d=google.com; s=arc-20160816; b=LUrTddSwq/8EtFXT7kPQNiOKpAGRuQBDiwLc2s3AAZmx8FYH1cD2ooqG8S5cA6/CKl hAqkpKGqrELLNFXQYz2hqCkWYPuMJdOt8feTrUHnKMkj9QXKy6qbIXzSg21Wtkuf8OEk 7ZDJyc1+ZudD5ySiF4O6dUz0+b3IeFoXrKgK9e2W0b9SU/zwn6GZUbFHuCSpXxx5jZIP aOdU/E0xP14dpTMCThJrJt2g2UgY1D9S9SiVn9P5frOf2+rPV9UrAfKwZ3oFeSNaWZL/ 7R7NHjVr0ukG7lG2EpYUTpxLdZ/x2IvPtPy+OSV5oRE7Mag2VsPXCLpceSxkyBFLCihr 5OcA== 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=RuN8rv4wV5CSf4VOMXF6nCH4q/5OPJ/BhW+5fMNjIJ0=; b=eKOd7C5GB8flEQuTF4t2rYaFyMeUf6rFiexCg2GWxo0bUYkF9H++C/btvXrgFNtfQG DK3z1RprsTw8jLjBexzK7NJNQ0NxY8GaoirYHR6mOfSqA5BNvf1WfcBuN11NJDU92z8x iqHZgDZ2I5wjn6AhjcOgvj/1WxEwbWtGvhM90Qg5vliRGp73iLEafnMXIeaTEOIhCAZG 4r0RwkCCpxmeYNSrhW70F6hY1z2XjQviU/3TYghzzgN8ehF7ANNZYIK2djyAQOYmloqK febIgclzMAo0t1tB/MK42dDgrh8U2gSj4kKU/fjS2EugOxqRNsT6sqbpZ9Uqd1A1xUty /yZA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h1si10608466ejk.3.2020.07.20.07.04.20; Mon, 20 Jul 2020 07:04:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726686AbgGTOBz (ORCPT + 99 others); Mon, 20 Jul 2020 10:01:55 -0400 Received: from verein.lst.de ([213.95.11.211]:47092 "EHLO verein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725815AbgGTOBz (ORCPT ); Mon, 20 Jul 2020 10:01:55 -0400 Received: by verein.lst.de (Postfix, from userid 2407) id 8993568BFE; Mon, 20 Jul 2020 16:01:51 +0200 (CEST) Date: Mon, 20 Jul 2020 16:01:51 +0200 From: Christoph Hellwig To: Logan Gunthorpe Cc: linux-kernel@vger.kernel.org, linux-nvme@lists.infradead.org, Christoph Hellwig , Sagi Grimberg , Keith Busch , Jens Axboe , Chaitanya Kulkarni , Max Gurtovoy , Stephen Bates Subject: Re: [PATCH v15 1/9] nvme-core: Clear any SGL flags in passthru commands Message-ID: <20200720140151.GA4627@lst.de> References: <20200716203319.16022-1-logang@deltatee.com> <20200716203319.16022-2-logang@deltatee.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200716203319.16022-2-logang@deltatee.com> 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 Thu, Jul 16, 2020 at 02:33:11PM -0600, Logan Gunthorpe wrote: > The host driver should decide whether to use SGLs or PRPs and they > currently assume the flags are cleared after the call to > nvme_setup_cmd(). However, passed-through commands may erroneously > set these bits; so clear them for all cases. > > Signed-off-by: Logan Gunthorpe > Reviewed-by: Sagi Grimberg > --- > drivers/nvme/host/core.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c > index f49085bcaa42..63a59186e68b 100644 > --- a/drivers/nvme/host/core.c > +++ b/drivers/nvme/host/core.c > @@ -759,6 +759,8 @@ blk_status_t nvme_setup_cmd(struct nvme_ns *ns, struct request *req, > case REQ_OP_DRV_IN: > case REQ_OP_DRV_OUT: > memcpy(cmd, nvme_req(req)->cmd, sizeof(*cmd)); > + /* passthru commands should let the driver set the SGL flags */ > + cmd->common.flags &= ~NVME_CMD_SGL_ALL; > break; This probably wants to be split into a little helper like the other cases.