Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3257677pxk; Mon, 21 Sep 2020 09:03:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxi2WmRB+iCk4J0Qko5gcWrCdmqV9MRCB39o+jhCFu1zHPTpEYURLQ3DjS/d6tAuMLep2M7 X-Received: by 2002:a17:906:4c8b:: with SMTP id q11mr76985eju.531.1600704203718; Mon, 21 Sep 2020 09:03:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600704203; cv=none; d=google.com; s=arc-20160816; b=TxkPRqWOnAwcN/UswiIyVIsgYoCiHQwiBmHlHWlgxBCOTdcUMB+W3HwwLYq0Cy0dvy xm6tUYBj2pVO7tatjNt50IovPnCb2whTD0JNKE+JU8jIcwjPpjwK4DOeBlU41C25Z5jr fV/Z+C1b8yQroiq4muMkx6YseKc1H0gUeAg+HRwTIIkqKNfqgJjy6yPYA6fj3UUFS3k9 tKcnVoualfMhagXiI9CxGMhBHEPViBj4XGNdFUsxgTgsq1jUHexLMV766vYIz6ezbnr6 RXItHIQ1jTcuvIcHtkdRTTWkCWo0oRZ0+p7MEP/fOrtKnmD+6tT8RLZjht1oBxHngi2l ZlzA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=9miz8OP40byKJUH+3X3NFcfOtrMlN+XOfm2Egf3Gmso=; b=UpOw8xXE3eOFU/rzQeXoPrF+1It3I/cjxPbYaB2rcO6wZGtQxxWavbiwLXseTrEvVH rrNEvdsi7TsmHMqfTBzqr0ay7zeVb8Hqa2D4qQc5XcCJPov6O8MRIZDeqMsFLY03YHt/ Yan05iGkx+jIAID6Spoq1Q65B6VwCciG+6ZKgtZ5uIE2H0rQCRYXza1N4+q4g7SMS8hp 0Tay6tj1NmvbHUMLa3I88pcSPUPxRYG4NBbgGf+gP8PPZNhM75fmT2pQ1hSh9AAuow42 r1X+bqntExQCVz+BCf3dHQj2jSENEcn9LADsFMTA3EwIdiXGHR/0QNDuhiWooJLBciYK GlBg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=pJTjxoP8; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n26si8570544ejg.134.2020.09.21.09.02.57; Mon, 21 Sep 2020 09:03:23 -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; dkim=pass header.i=@kernel.org header.s=default header.b=pJTjxoP8; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727305AbgIUP7j (ORCPT + 99 others); Mon, 21 Sep 2020 11:59:39 -0400 Received: from mail.kernel.org ([198.145.29.99]:34642 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726696AbgIUP7j (ORCPT ); Mon, 21 Sep 2020 11:59:39 -0400 Received: from dhcp-10-100-145-180.wdl.wdc.com (unknown [199.255.45.60]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D719320BED; Mon, 21 Sep 2020 15:59:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600703978; bh=9RNKVnKU6oMm/T5XzdOadmOTCrQNuIHYEHTu8tyj7sM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=pJTjxoP8496QFcMbS8DMSLStRqJJTMUY3ZnYwiSeMN/fCwzqGs6AToPwRPrxvr6eq FAci+TQ12mjbCnLrp7wqF9kreBb2x+lmOnDG0zi+xZeXaNu2JhX3LuEq1t+KLpUguC vW0TF0ysuIJ40uzcNKKzdOG8uldEhsVQylViOojE= Date: Mon, 21 Sep 2020 08:59:25 -0700 From: Keith Busch To: Tianxianting Cc: "axboe@fb.com" , "hch@lst.de" , "sagi@grimberg.me" , "linux-nvme@lists.infradead.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH] nvme: replace meaningless judgement by checking whether req is null Message-ID: <20200921155925.GA4034241@dhcp-10-100-145-180.wdl.wdc.com> References: <20200921021052.10462-1-tian.xianting@h3c.com> <20200921150824.GA4034182@dhcp-10-100-145-180.wdl.wdc.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Sep 21, 2020 at 03:49:09PM +0000, Tianxianting wrote: > HI Keith, > Thanks for your comments, > I will submit a new patch of version 2 for the further reviewing, v2 patch will contains: > 1, retain existing judgement and dev_warn; No no, go ahead and remove the existing check just as you've done. That check becomes redundant with the safer one you're adding, and we don't want redundant checks in the fast path. My only suggestion is to use the same dev_warn() in your new check. > 2, add the check whether req is null(already did in this patch) > 3, simplify and make the changelog succinct according to you said " This is what I'm thinking:". > Is it right? > Should I retain the nvme_irq crash log in changelog, mention the difference between nvmeq->q_depth and tagset queue_depth? The tagset's queue_depth is a valid point to mention as well. The dirver's current indirect check is not necessarily in sync with the actual tagset. > Thanks > > -----Original Message----- > From: Keith Busch [mailto:kbusch@kernel.org] > Sent: Monday, September 21, 2020 11:08 PM > To: tianxianting (RD) > Cc: axboe@fb.com; hch@lst.de; sagi@grimberg.me; linux-nvme@lists.infradead.org; linux-kernel@vger.kernel.org > Subject: Re: [PATCH] nvme: replace meaningless judgement by checking whether req is null > > On Mon, Sep 21, 2020 at 10:10:52AM +0800, Xianting Tian wrote: > > @@ -940,13 +940,6 @@ static inline void nvme_handle_cqe(struct nvme_queue *nvmeq, u16 idx) > > struct nvme_completion *cqe = &nvmeq->cqes[idx]; > > struct request *req; > > > > - if (unlikely(cqe->command_id >= nvmeq->q_depth)) { > > - dev_warn(nvmeq->dev->ctrl.device, > > - "invalid id %d completed on queue %d\n", > > - cqe->command_id, le16_to_cpu(cqe->sq_id)); > > - return; > > - } > > - > > /* > > * AEN requests are special as they don't time out and can > > * survive any kind of queue freeze and often don't respond to @@ > > -960,6 +953,13 @@ static inline void nvme_handle_cqe(struct nvme_queue *nvmeq, u16 idx) > > } > > > > req = blk_mq_tag_to_rq(nvme_queue_tagset(nvmeq), cqe->command_id); > > + if (unlikely(!req)) { > > + dev_warn(nvmeq->dev->ctrl.device, > > + "req is null for tag %d completed on queue %d\n", > > + cqe->command_id, le16_to_cpu(cqe->sq_id)); > > + return; > > + } > > This is making sense now, though I think we should retain the existing > dev_warn() since it's still accurate and provides continuity for people who are used to looking for these sorts of messages. > > Your changelog is a bit much though. I think we can say it a bit more succinctly. This is what I'm thinking: > > The driver registers interrupts for queues before initializing the > tagset because it uses the number of successful request_irq() calls > to configure the tagset parameters. This allows a race condition with > the current tag validity check if the controller happens to produce > an interrupt with a corrupted CQE before the tagset is initialized. > > Replace the driver's indirect tag check with the one already provided > by the block layer.