From: Kanchan Joshi <joshi.k@samsung.com>
To: hmi.jeon@samsung.com, "kbusch@kernel.org" <kbusch@kernel.org>,
"axboe@kernel.dk" <axboe@kernel.dk>
Cc: "sven@kernel.org" <sven@kernel.org>,
"j@jannau.net" <j@jannau.net>, "neal@gompa.dev" <neal@gompa.dev>,
"hch@lst.de" <hch@lst.de>, "sagi@grimberg.me" <sagi@grimberg.me>,
"justin.tee@broadcom.com" <justin.tee@broadcom.com>,
"nareshgottumukkala83@gmail.com" <nareshgottumukkala83@gmail.com>,
"paul.ely@broadcom.com" <paul.ely@broadcom.com>,
"kch@nvidia.com" <kch@nvidia.com>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
"linux-nvme@lists.infradead.org" <linux-nvme@lists.infradead.org>,
"asahi@lists.linux.dev" <asahi@lists.linux.dev>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] nvme: Move nvme_setup_cmd before hot_pathing
Date: Fri, 20 Mar 2026 19:13:37 +0530 [thread overview]
Message-ID: <981ab856-9c79-4e08-9906-a81ec298a688@samsung.com> (raw)
In-Reply-To: <20260320052101epcms2p42ae135da60b36685e9b7fca6849b57a6@epcms2p4>
On 3/20/2026 10:51 AM, 전민식 wrote:
> diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
> index b78ba239c8ea..ad0363f7e681 100644
> --- a/drivers/nvme/host/pci.c
> +++ b/drivers/nvme/host/pci.c
> @@ -1376,10 +1376,6 @@ static blk_status_t nvme_prep_rq(struct request *req)
> iod->meta_total_len = 0;
> iod->nr_dma_vecs = 0;
>
> - ret = nvme_setup_cmd(req->q->queuedata, req);
> - if (ret)
> - return ret;
> -
> if (blk_rq_nr_phys_segments(req)) {
> ret = nvme_map_data(req);
> if (ret)
> @@ -1418,6 +1414,10 @@ static blk_status_t nvme_queue_rq(struct blk_mq_hw_ctx *hctx,
> if (unlikely(!test_bit(NVMEQ_ENABLED, &nvmeq->flags)))
> return BLK_STS_IOERR;
>
> + ret = nvme_setup_cmd(req->q->queuedata, req);
> + if (ret)
> + return ret;
> +
> if (unlikely(!nvme_check_ready(&dev->ctrl, req, true)))
> return nvme_fail_nonready_command(&dev->ctrl, req);
The intent is to improve the observability in case controller was not
ready, but the patch may need rework so that it does not cause the
memory leak for this scenario.
Currently nvme_prep_rq() calls nvme_setup_cmd(), and in case failure
occurs after that, it also does explicit cleanup with
nvme_cleanup_cmd(). For discard request, this cleanup involves freeing
memory that was allocated.
This patch moves nvme_setup_cmd() to caller (i.e. nvme_queue_rq), checks
for controller not being ready and asks block-layer to retry without
ever freeing the resource.
next prev parent reply other threads:[~2026-03-20 13:43 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20260320052101epcms2p42ae135da60b36685e9b7fca6849b57a6@epcms2p4>
2026-03-20 5:21 ` 전민식
2026-03-20 13:43 ` Kanchan Joshi [this message]
2026-03-22 7:16 ` kernel test robot
2026-03-22 8:22 ` kernel test robot
2026-03-22 12:09 ` kernel test robot
[not found] ` <CGME20260320052101epcms2p42ae135da60b36685e9b7fca6849b57a6@epcms2p3>
2026-03-23 1:04 ` [PATCH v2] " 전민식
2026-03-24 23:55 ` [PATCH] " Justin Tee
[not found] ` <CGME20260320052101epcms2p42ae135da60b36685e9b7fca6849b57a6@epcms2p6>
2026-03-25 6:33 ` [PATCH v3] nvme: Add nvme_setup_cmd to host_path_error 전민식
2026-03-25 18:37 ` Justin Tee
2026-03-25 19:03 ` Keith Busch
[not found] ` <CGME20260320052101epcms2p42ae135da60b36685e9b7fca6849b57a6@epcms2p1>
2026-03-26 1:44 ` [PATCH v4] nvme: Skip trace complete_rq on host path error 전민식
2026-03-26 6:14 ` hch
[not found] ` <CGME20260320052101epcms2p42ae135da60b36685e9b7fca6849b57a6@epcms2p5>
2026-03-26 6:51 ` [PATCH v5] " 전민식
2026-03-26 14:20 ` hch
2026-03-26 14:28 ` Keith Busch
2026-03-26 14:31 ` hch
2026-03-26 14:43 ` Keith Busch
2026-03-27 6:19 ` 전민식
2026-03-27 6:37 ` 전민식
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=981ab856-9c79-4e08-9906-a81ec298a688@samsung.com \
--to=joshi.k@samsung.com \
--cc=asahi@lists.linux.dev \
--cc=axboe@kernel.dk \
--cc=hch@lst.de \
--cc=hmi.jeon@samsung.com \
--cc=j@jannau.net \
--cc=justin.tee@broadcom.com \
--cc=kbusch@kernel.org \
--cc=kch@nvidia.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=nareshgottumukkala83@gmail.com \
--cc=neal@gompa.dev \
--cc=paul.ely@broadcom.com \
--cc=sagi@grimberg.me \
--cc=sven@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®