Linux-NVME Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Guixin Liu <kanie@linux.alibaba.com>
To: Chaitanya Kulkarni <chaitanyak@nvidia.com>,
	Keith Busch <kbusch@kernel.org>, Jens Axboe <axboe@kernel.dk>,
	Sagi Grimberg <sagi@grimberg.me>
Cc: "linux-nvme@lists.infradead.org" <linux-nvme@lists.infradead.org>
Subject: Re: [PATCH] nvme: introduce panic_on_double_cqe param
Date: Wed, 29 Oct 2025 09:42:11 +0800	[thread overview]
Message-ID: <36c2cec2-7d0b-4ee6-a79f-d5e318a8fee0@linux.alibaba.com> (raw)
In-Reply-To: <6dc4c33e-8183-481c-a101-8a2b6596d2b1@nvidia.com>



在 2025/10/23 13:14, Chaitanya Kulkarni 写道:
> On 10/22/25 6:54 AM, Guixin Liu wrote:
>> Add a new debug switch to control whether to trigger a kernel crash
>> when duplicate CQEs are detected, in order to preserve the kernel
>> context, such as sq, cq, and so on, for subsequent debugging and
>> analysis.
>>
>> Signed-off-by: Guixin Liu <kanie@linux.alibaba.com>
>> ---
>>    drivers/nvme/host/core.c | 5 +++++
>>    drivers/nvme/host/nvme.h | 3 +++
>>    2 files changed, 8 insertions(+)
>>
>> diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
>> index fa4181d7de73..7a3f9129a39c 100644
>> --- a/drivers/nvme/host/core.c
>> +++ b/drivers/nvme/host/core.c
>> @@ -95,6 +95,11 @@ module_param(apst_secondary_latency_tol_us, ulong, 0644);
>>    MODULE_PARM_DESC(apst_secondary_latency_tol_us,
>>    	"secondary APST latency tolerance in us");
>>    
>> +bool panic_on_double_cqe;
>> +EXPORT_SYMBOL_GPL(panic_on_double_cqe);
>> +module_param(panic_on_double_cqe, bool, 0644);
>> +MODULE_PARM_DESC(panic_on_double_cqe, "crash the kernel to save the scene");
>> +
>>    /*
>>     * Older kernels didn't enable protection information if it was at an offset.
>>     * Newer kernels do, so it breaks reads on the upgrade if such formats were
>> diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h
>> index 102fae6a231c..24010d5d15ce 100644
>> --- a/drivers/nvme/host/nvme.h
>> +++ b/drivers/nvme/host/nvme.h
>> @@ -595,6 +595,8 @@ static inline u16 nvme_cid(struct request *rq)
>>    	return nvme_cid_install_genctr(nvme_req(rq)->genctr) | rq->tag;
>>    }
>>    
>> +extern bool panic_on_double_cqe;
>> +
>>    static inline struct request *nvme_find_rq(struct blk_mq_tags *tags,
>>    		u16 command_id)
>>    {
>> @@ -612,6 +614,7 @@ static inline struct request *nvme_find_rq(struct blk_mq_tags *tags,
>>    		dev_err(nvme_req(rq)->ctrl->device,
>>    			"request %#x genctr mismatch (got %#x expected %#x)\n",
>>    			tag, genctr, nvme_genctr_mask(nvme_req(rq)->genctr));
>> +		BUG_ON(panic_on_double_cqe);
>>    		return NULL;
>>    	}
>>    	return rq;
>
> I'm really not sure this is a good idea, I'll leave to others.
>
>
> -ck
Yeah, I think so too, and I'd also like to find a more elegant solution.

Best Regards,
Guixin Liu



  reply	other threads:[~2025-10-29  1:42 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-22 13:54 [PATCH] nvme: introduce panic_on_double_cqe param Guixin Liu
2025-10-23  5:14 ` Chaitanya Kulkarni
2025-10-29  1:42   ` Guixin Liu [this message]
2025-10-29  4:17     ` Chaitanya Kulkarni
2025-10-29  5:03       ` Chaitanya Kulkarni

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=36c2cec2-7d0b-4ee6-a79f-d5e318a8fee0@linux.alibaba.com \
    --to=kanie@linux.alibaba.com \
    --cc=axboe@kernel.dk \
    --cc=chaitanyak@nvidia.com \
    --cc=kbusch@kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=sagi@grimberg.me \
    /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