Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3327191pxk; Mon, 21 Sep 2020 10:42:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyFMiq2fQoDIiebDs19Vl+Dsht7M2R7UjXw6SGw8RRzEhEBt20MIgRsZjFp5hZNRh/w0QT3 X-Received: by 2002:a17:906:3553:: with SMTP id s19mr610143eja.178.1600710162597; Mon, 21 Sep 2020 10:42:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600710162; cv=none; d=google.com; s=arc-20160816; b=OzxeuUXsLAoT/K35fLEOJWndXR5enKQfFVCL9cKt/l7ZBrYTUjtoGxk2DTqkKaBWZ2 Na8SGNnTlZrpLVHq7hLJtltmQd/jNupZA5msUgFDhvUAi/raTLzQkBaTTte6crFKFitp v4ID8GrTOkpv7yAQSLydJKtD+MjRpCeCqEfSHhVyTV7VGFG7M8If3FneB4fVPeonEF3Q zWdY5KAUDv5+nPTBgzo6w9++UqnIGPcRB41uLYdp4rFtIhpTvRk14BOh17SeBYw2ucDU 5UyNUDTWZ/Fmu0o8P5M+g3oAYft8dmYvnwCD16PtR+hHdhBNN2PxxDyGhVQ2nOJdZEEn J88g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :content-language:accept-language:in-reply-to:references:message-id :date:thread-index:thread-topic:subject:cc:to:from; bh=uZgXA4Hzmuu0lXDVjkxRR3CzLLvRpnHowUEHXxq4QDc=; b=PSzXAvhqMKFTpiaZq7lQ6UMKQ2YxiE6eztor7JCdajIOmgU8ojl7xQ15p8djFR+ViY /seYvj6D0cCG0z+Af6+T8wcL6BYeZLDGz1lLccV7kaUp1b8gpEO/VzH+Roei7g9fgKzS L+u/EU6DRJmXnVFCM3EMBVmv+mMc7sTwLcTrJAbrINyTe/fgQ60JRYqCiANaX5EpPr70 wFAoSAFRtSc5Xns4BUau4CLCVwdAksONpMoQqln/UTS76lRdJqfo6n4bsrPP0+GfClS0 huAJ7ESDtFXfRL+QKIxgGj8oTsfxrNJeo2PwKbYUtjfMkBav/kKMjlOqoQQ6hvGM/Vb2 wnyw== 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 pv7si9358784ejb.753.2020.09.21.10.42.18; Mon, 21 Sep 2020 10:42:42 -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 S1727480AbgIURkw convert rfc822-to-8bit (ORCPT + 99 others); Mon, 21 Sep 2020 13:40:52 -0400 Received: from smtp.h3c.com ([60.191.123.56]:58488 "EHLO h3cspam01-ex.h3c.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726419AbgIURkw (ORCPT ); Mon, 21 Sep 2020 13:40:52 -0400 Received: from h3cspam01-ex.h3c.com (localhost [127.0.0.2] (may be forged)) by h3cspam01-ex.h3c.com with ESMTP id 08LG9wdY032740 for ; Tue, 22 Sep 2020 00:09:58 +0800 (GMT-8) (envelope-from tian.xianting@h3c.com) Received: from DAG2EX08-IDC.srv.huawei-3com.com ([10.8.0.71]) by h3cspam01-ex.h3c.com with ESMTPS id 08LG8qpq032307 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 22 Sep 2020 00:08:52 +0800 (GMT-8) (envelope-from tian.xianting@h3c.com) Received: from DAG2EX03-BASE.srv.huawei-3com.com (10.8.0.66) by DAG2EX08-IDC.srv.huawei-3com.com (10.8.0.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Tue, 22 Sep 2020 00:08:56 +0800 Received: from DAG2EX03-BASE.srv.huawei-3com.com ([fe80::5d18:e01c:bbbd:c074]) by DAG2EX03-BASE.srv.huawei-3com.com ([fe80::5d18:e01c:bbbd:c074%7]) with mapi id 15.01.1713.004; Tue, 22 Sep 2020 00:08:56 +0800 From: Tianxianting To: Keith Busch 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 Thread-Topic: [PATCH] nvme: replace meaningless judgement by checking whether req is null Thread-Index: AQHWj71pi81Rb9ZmlEuvVhznKWqiEqlyrIIAgACJanD//4TXgIAAiHDQ Date: Mon, 21 Sep 2020 16:08:56 +0000 Message-ID: <0efc3ee511534cf789073ed5ddfa61a2@h3c.com> References: <20200921021052.10462-1-tian.xianting@h3c.com> <20200921150824.GA4034182@dhcp-10-100-145-180.wdl.wdc.com> <20200921155925.GA4034241@dhcp-10-100-145-180.wdl.wdc.com> In-Reply-To: <20200921155925.GA4034241@dhcp-10-100-145-180.wdl.wdc.com> Accept-Language: en-US Content-Language: zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.99.141.128] x-sender-location: DAG2 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 X-DNSRBL: X-MAIL: h3cspam01-ex.h3c.com 08LG8qpq032307 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org I get it now, thanks Keith:) -----Original Message----- From: Keith Busch [mailto:kbusch@kernel.org] Sent: Monday, September 21, 2020 11:59 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 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.