Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp1014005pxv; Thu, 15 Jul 2021 22:55:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy51CvNdB5pe/gIOBwTqApanSi5Gi1uUsPrfqoumepT5JLfWi4fXjTvwNKO5kUecrQW8Lsp X-Received: by 2002:a17:906:3693:: with SMTP id a19mr10201518ejc.237.1626414904247; Thu, 15 Jul 2021 22:55:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626414904; cv=none; d=google.com; s=arc-20160816; b=JKt6ujvUGtyVhrsL6UtoYgdKZnyhSS+fMXz3+4iac6qv4cXCy1QmwLCfx0ef2ulD9L PzU+9UJTXohsIgjsPZtBGyCK+3HVIfWMUgt6YmnftNi18czuOItgSSj+LbcWWIMBKapJ SXMpWYGtwryanSruHa4r0UqPwJgDhOvXqFuLQAP76XeDGDv4JSpdVKFnRRvNRzShUCxu ljOOsjP9Kmf+0FWZMYEtuc7hKKqZwnJXlYu5SZhhqmRS+KTPaZg3YqpzduapMMRZyYyI 9IYz5RJ6xoV13I/xI/j/Tt05qsYtPa8gtwfta8zzBr6jOrDZfBkUdrEC7xQLyvXVEUF7 kHqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=tld40cpEkGCNsmVNqC9ejnCY9hMvScB5LN5M3UpSOec=; b=f6YYe2MyWbo57TO1hv0AHwI6kWlFf39KfmTiNWV4QpsTMgyzSjrWjrmNz9hT/WVCoC b9mJng1vego1NCyxYkQQ4VPnv99Hesy6rzDV5ZVma4N14fThSvYd800FEAqqZM+97xh6 y1/RBZAMeBLuC+4DEYnxXO8iXE6uMAgQh9onpnNDiYYWwePqu2ZzNYOo9Gge6d4uu0Tu Mlw4qT3gxTR43Tw01xeehFASVm9gAX0nzDFpyEO5BH1LlcSiFvG5GTCm4nLA3hR+pBga f3q8qWF1SlhICAiKQOlxaPcLE7UT30pRQwc8PTHW99KK9JtCEsT+BINkmVRUcojnhYIG lzRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@natalenko.name header.s=dkim-20170712 header.b=NcYFQaS9; 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=REJECT sp=REJECT dis=NONE) header.from=natalenko.name Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m19si10624525edd.427.2021.07.15.22.54.41; Thu, 15 Jul 2021 22:55:04 -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=@natalenko.name header.s=dkim-20170712 header.b=NcYFQaS9; 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=REJECT sp=REJECT dis=NONE) header.from=natalenko.name Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234457AbhGPF43 (ORCPT + 99 others); Fri, 16 Jul 2021 01:56:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37208 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231458AbhGPF43 (ORCPT ); Fri, 16 Jul 2021 01:56:29 -0400 Received: from vulcan.natalenko.name (vulcan.natalenko.name [IPv6:2001:19f0:6c00:8846:5400:ff:fe0c:dfa0]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E3C62C06175F for ; Thu, 15 Jul 2021 22:53:34 -0700 (PDT) Received: from spock.localnet (unknown [151.237.229.131]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by vulcan.natalenko.name (Postfix) with ESMTPSA id 2AF0BB37293; Fri, 16 Jul 2021 07:53:31 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=natalenko.name; s=dkim-20170712; t=1626414811; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=tld40cpEkGCNsmVNqC9ejnCY9hMvScB5LN5M3UpSOec=; b=NcYFQaS95iwX4RFWyB1v+WBBTnfwwBGtEj4uv6HRuluQnEjny4JbKehbhlsBUnLiB//Zkf vHU1h2JsFU4FZ3iXqR+I4fxnIrnWLqJ9IGoBjG7dZDrhM4hBaLWCEehKb4F/VKcjlvIIae r9kwMgMzBzTGcpqhOWraBJBan88gTz4= From: Oleksandr Natalenko To: Ming Lei Cc: linux-kernel@vger.kernel.org, Jens Axboe , Christoph Hellwig , Sagi Grimberg , linux-nvme@lists.infradead.org, David Jeffery , Laurence Oberman , Paolo Valente , Jan Kara , Sasha Levin , Greg Kroah-Hartman , Keith Busch Subject: Re: New warning in nvme_setup_discard Date: Fri, 16 Jul 2021 07:53:28 +0200 Message-ID: <81322754.HEIg0oD171@natalenko.name> In-Reply-To: References: <4729812.CpyZKHjjVO@natalenko.name> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello. On p=C3=A1tek 16. =C4=8Dervence 2021 4:16:18 CEST Ming Lei wrote: > > 850 if (WARN_ON_ONCE(n !=3D segments)) { >=20 > What is 'n' and 'segments'? So, I used this change to check that: ``` diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index 66973bb56305..0a64f2f77daf 100644 =2D-- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -847,7 +847,8 @@ static blk_status_t nvme_setup_discard(struct nvme_ns *= ns,=20 struct request *req, n++; } =20 =2D if (WARN_ON_ONCE(n !=3D segments)) { + if (unlikely(n !=3D segments)) { + pr_warn("nvme_setup_discard: n !=3D segments (%u !=3D %u)\n", n,=20 segments); if (virt_to_page(range) =3D=3D ns->ctrl->discard_page) clear_bit_unlock(0, &ns->ctrl->discard_page_busy); else ``` and the result is: ``` nvme_setup_discard: n !=3D segments (3 !=3D 2) nvme_setup_discard: n !=3D segments (12 !=3D 11) ``` (those are from different boots) Thanks. =2D-=20 Oleksandr Natalenko (post-factum)