Received: by 2002:a05:6a10:8395:0:0:0:0 with SMTP id n21csp269313pxh; Wed, 10 Nov 2021 01:22:07 -0800 (PST) X-Google-Smtp-Source: ABdhPJz8G82eCcNBDGu+mhLbObUcdqAP6oIqExKm6H0ZA9De25ipCbwqk+qe3dnBLr7JekDcCjD0 X-Received: by 2002:a17:907:7242:: with SMTP id ds2mr19217302ejc.269.1636536127597; Wed, 10 Nov 2021 01:22:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1636536127; cv=none; d=google.com; s=arc-20160816; b=MtpJZUqnoS0KTaw2GbmpgSo/8kH94zOOiVevHtqjaX41Jou1yEEF27e90vLYq687kw 4ptCve5apbzJfywcjyHf5LvKth1hVDPnS1IGT9RjtGkgymr5wjOtaH7u+VDPH6gICSs2 Zo6LBf+ttDkxhZMehCVzZ4RXpGldPh5UTNmrQjyPn+d9dzZxwOIapnleFY+FTNVOVUF6 KXLY/UdabIYiDp/aMEbkYmXyfKjLTYo9ozA8xDQsKwTI/iZIqlJxwHbaHDU+IVuC+1Mc gkyA1W3EXq0GKDz1WuS6b+sNBzdImiPJex2yFxjHOJk7F2acy7IXE7dSRWaGakDBP6Sq xswA== 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 :dkim-signature; bh=sSpGxH+Rw6W+BJgQbKAT0McUO0L1gdUtv1WBx7RCMo8=; b=i2MuxOJOj0Pi/p4P/R2peIcoiqYUUJbJcdF6QWaAdwSR2apMGKR56VI/ayIJRYt+Kw rm6Cypy+36kLVzpen/x1wlzY9VYpkridLN7MkTQOfYNHvZNQj2s6+D/zS5We5O6PbGQG GHtYoFY9Ire0WUErepmeU2/f5rSx8yIDK0ElV1axgvADZt3HSuhqgmFwe87izxyMl5o2 Fsic7spNZlTTh5C8ghfDyFRUP68sK8EK/z3vemAFrT40fytA/XNDLDJnCA+9tKb7zuuN VyQizxnwR77ow19zFxJv5KBDXVOoTwx6O2XquBYyXcMHT3Lf0pn2R3zT4yIEwGGwWNUZ NPHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@irrelevant.dk header.s=fm1 header.b=FUZ14TAI; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=FWehnPjL; 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 qk38si29649226ejc.469.2021.11.10.01.21.44; Wed, 10 Nov 2021 01:22:07 -0800 (PST) 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=@irrelevant.dk header.s=fm1 header.b=FUZ14TAI; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=FWehnPjL; 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 S230459AbhKJJTw (ORCPT + 99 others); Wed, 10 Nov 2021 04:19:52 -0500 Received: from out2-smtp.messagingengine.com ([66.111.4.26]:45565 "EHLO out2-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230484AbhKJJTu (ORCPT ); Wed, 10 Nov 2021 04:19:50 -0500 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id EDCAC5C01E3; Wed, 10 Nov 2021 04:16:59 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Wed, 10 Nov 2021 04:16:59 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=irrelevant.dk; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=fm1; bh=sSpGxH+Rw6W+BJgQbKAT0McUO0L 1gdUtv1WBx7RCMo8=; b=FUZ14TAIIj5Ez9sbcMXVsRltIl9HdhGbzuUgkn4wIJL VTKC0rHZe0hX1HIHC7bwaOlwgaGCSJ+sOddA1UL1cEJWJyOT6KGRdzwDrF0LmOT7 X4MkCa4WPuwaPP690DJyHoJpKA4S8x9JK9ImsG9sFQ2kzAGweDmxiKQGTEfsAIZC EZ04QwqBK14PdriZqNccNY/bOd3EZnw9HvXIekdpQtnd5BQF7QBC6MvaY2j/g3HX KXuJoRa4j0dOVKvAvOJPmulWgAYc6hXro5qAfVH4DvcQtEDH5+MGH+ODhVPnx+BC AJsDJrBnA/7nxh65wnlQXMxE8Cu31Kj4GUpK3uoYOGA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=sSpGxH +Rw6W+BJgQbKAT0McUO0L1gdUtv1WBx7RCMo8=; b=FWehnPjLwaHvY2OtBPRfsM vCZHK4SNEY+/kEz49LEMvpCJa7Yz54EeeUPjVeVyA34lVRmwmqpB5rbJ0azF3Yry 9KXxuUnui86hrG5nuw+gYP9jfT2ZVFCjXh3gkhtM6vMEcG5CgGOXrZTFrxdnnPS3 mD97cAqwBn65K13s06dNns048Mj3u+dKzbB9KmT3VqQOHtfCEHOZ5hXZYnjHkrRj ae4tOSoei2lSpn3OMVPs7Csv4HeFjuuJLcSnC9fMZ1bABeDxXhFqFul912qeiIzO n7KcS036SvCsQw2zyXDJEU1k5dR9qdsmcMbFoQEInv5pYrcOmh9X/cqLxAbNfpZg == X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvuddrudejgddtudcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpeffhffvuffkfhggtggujgesghdtreertddtjeenucfhrhhomhepmfhlrghushcu lfgvnhhsvghnuceoihhtshesihhrrhgvlhgvvhgrnhhtrdgukheqnecuggftrfgrthhtvg hrnhepjeegudffueeiteekieelkedvueelteevjeduieeludfffeejgeffhfduvdduffek necuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepihhtsh esihhrrhgvlhgvvhgrnhhtrdgukh X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 10 Nov 2021 04:16:57 -0500 (EST) Date: Wed, 10 Nov 2021 10:16:55 +0100 From: Klaus Jensen To: Chaitanya Kulkarni Cc: Keith Busch , Christoph Hellwig , Jens Axboe , Sagi Grimberg , "linux-kernel@vger.kernel.org" , "linux-nvme@lists.infradead.org" , Klaus Jensen Subject: Re: [PATCH] nvme: fix write zeroes pi Message-ID: References: <20211104181618.864157-1-its@irrelevant.dk> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="Ye8ibXikhyU4UpIe" Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --Ye8ibXikhyU4UpIe Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Nov 10 06:10, Chaitanya Kulkarni wrote: > Klaus, >=20 > On 11/4/2021 11:16 AM, Klaus Jensen wrote: > > From: Klaus Jensen > >=20 > > Write Zeroes sets PRACT when block integrity is enabled (as it should), > > but neglects to also set the reftag which is expected by reads. This > > causes protection errors on reads. > >=20 > > Fix this by setting the reftag for type 1 and 2 (for type 3, reads will > > not check the reftag). > >=20 > > Signed-off-by: Klaus Jensen >=20 > Patch looks good to me but did you get a chance to test on > multiple non-QEMU controllers ? >=20 Hi Chaitanya, No, I should of course have mentioned that, my apologies. I hit this on QEMU, so just tested it with that. I didn't have a pi-capable device on hand. Feel free to leave this hanging until it can be tested with real hardware, I think I can dig something up :) However, the spec is pretty clear that the reftag must be set when using PRACT. It is, however, kinda strange that the spec also says that PRCHK must be cleared to zeroes - in my opinion, the device should check the reftag in type 1 and 2 if requested to do so. A reason this doesnt bug out on real hardware is probably that the blocks end up deallocated, which bypasses the pi check. However, currently, in QEMU, if PRACT is set, QEMU will not deallocate the block in write zeroes. Honestly, I'm not sure why it doesnt. I dont see any reason for it to not request the QEMU block layer to deallocate... Yours truly is the idiot that wrote it so I'll consider fixing that :) The commit that introduced PRACT for write zeroes (commit aaeb7bb061be5 "nvme: set the PRACT bit when using Write Zeroes with T10 PI") also mentions that without PRACT reads may have validation errors if the write zeroes didnt deallocate, and QEMU is one of those devices. --Ye8ibXikhyU4UpIe Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEUigzqnXi3OaiR2bATeGvMW1PDekFAmGLjgYACgkQTeGvMW1P DemRCAgAhY6rLFxCImjQJF4u0l7EQP2gO0+MNOkHKPjljy54QzBOMaOEErk9ycdp Bx/km3rIt9hMY7AlrdcTAkO6EivAjdke0muHlDqovvxKTEs3Fp7GGPzvGcaL+n/O H/fEtjYXv2I0VhhR29bi8h9hQFsU4QFCpvof2lT1Tftym3Xix4NPPOS5bO+JhWJb 2DBoW/0L2Nougm2QKaGhAhmHeGHJGAL486P1Bv9m/XmsVmuV/jcoAQd613+yK/NC 2/PgFXqTeWFDwpR1o8yd9Gq768cW76jz4ptgl4NCc3tvfzlKpHMH00frmSBZef/p Om0gu1ilaHyAaNj4UwhR9qbQI1Q01A== =EaqI -----END PGP SIGNATURE----- --Ye8ibXikhyU4UpIe--