From: Klaus Jensen <its@irrelevant.dk>
To: Chaitanya Kulkarni <chaitanyak@nvidia.com>
Cc: Keith Busch <kbusch@kernel.org>, Christoph Hellwig <hch@lst.de>,
Jens Axboe <axboe@fb.com>, Sagi Grimberg <sagi@grimberg.me>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-nvme@lists.infradead.org" <linux-nvme@lists.infradead.org>,
Klaus Jensen <k.jensen@samsung.com>
Subject: Re: [PATCH] nvme: fix write zeroes pi
Date: Wed, 10 Nov 2021 10:16:55 +0100 [thread overview]
Message-ID: <YYuOB9VytsFiDox2@apples.localdomain> (raw)
In-Reply-To: <db739cda-2dd7-015a-5ad9-d2d6e44131c6@nvidia.com>
[-- Attachment #1: Type: text/plain, Size: 1876 bytes --]
On Nov 10 06:10, Chaitanya Kulkarni wrote:
> Klaus,
>
> On 11/4/2021 11:16 AM, Klaus Jensen wrote:
> > From: Klaus Jensen <k.jensen@samsung.com>
> >
> > 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.
> >
> > Fix this by setting the reftag for type 1 and 2 (for type 3, reads will
> > not check the reftag).
> >
> > Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
>
> Patch looks good to me but did you get a chance to test on
> multiple non-QEMU controllers ?
>
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.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2021-11-10 9:17 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-04 18:16 [PATCH] nvme: fix write zeroes pi Klaus Jensen
2021-11-05 3:23 ` Martin K. Petersen
2021-11-10 6:10 ` Chaitanya Kulkarni
2021-11-10 9:16 ` Klaus Jensen [this message]
2021-11-11 5:06 ` Chaitanya Kulkarni
2021-11-10 8:43 ` Klaus Jensen
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=YYuOB9VytsFiDox2@apples.localdomain \
--to=its@irrelevant.dk \
--cc=axboe@fb.com \
--cc=chaitanyak@nvidia.com \
--cc=hch@lst.de \
--cc=k.jensen@samsung.com \
--cc=kbusch@kernel.org \
--cc=linux-kernel@vger.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