[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ce687c5d-eb19-e9b5-e03a-97dd2a04b4ea@deltatee.com>
Date: Mon, 20 Apr 2020 16:34:14 -0600
From: Logan Gunthorpe <logang@...tatee.com>
To: Keith Busch <kbusch@...nel.org>
Cc: linux-kernel@...r.kernel.org, linux-nvme@...ts.infradead.org,
Christoph Hellwig <hch@....de>,
Sagi Grimberg <sagi@...mberg.me>, Jens Axboe <axboe@...com>,
Chaitanya Kulkarni <Chaitanya.Kulkarni@....com>,
Max Gurtovoy <maxg@...lanox.com>,
Stephen Bates <sbates@...thlin.com>
Subject: Re: [PATCH v12 1/9] nvme-core: Clear any SGL flags in passthru
commands
On 2020-04-20 4:26 p.m., Keith Busch wrote:
> On Mon, Apr 20, 2020 at 10:46:52AM -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 <logang@...tatee.com>
>> Reviewed-by: Sagi Grimberg <sagi@...mberg.me>
>> ---
>> 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 91c1bd659947..f5283b300e87 100644
>> --- a/drivers/nvme/host/core.c
>> +++ b/drivers/nvme/host/core.c
>> @@ -756,6 +756,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;
>
> Is this really necessary? The passthrough handler currently rejects user
> commands that set command flags:
Yes, the flags coming from the passthru target's host (in subsequent
patches in this series) may have these set and we need to clear them
somewhere. The passthru code submits the requests directly using
blk_execute_rq_nowait() and thus the check in nvme_user_cmd() doesn't apply.
If I recall correctly, we had originally cleared the flags in the target
code, but Christoph had suggested it should be done more generally in
nvme_setup_cmd().
Logan
Powered by blists - more mailing lists