Closed birkelund closed 5 years ago
pblk falls over when I try to test this.
[ 15.000307] pblk pblk0: ppa: (seq: 1):ch:0,lun:1,chk:0,sec:309
[ 15.000855] pblk pblk0: corrupted read LBA (0/1221)
[ 15.001322] WARNING: CPU: 2 PID: 0 at drivers/lightnvm/pblk-read.c:125 pblk_end_io_read+0x19c/0x220
[ 15.002187] Modules linked in:
[ 15.002483] CPU: 2 PID: 0 Comm: swapper/2 Tainted: G W 4.18.0-rc4+ #1033
[ 15.003238] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.7.5-0-ge51488c-20140602_164612-nilsson.home.kraxel.org 04/01/2014
[ 15.004443] RIP: 0010:pblk_end_io_read+0x19c/0x220
[ 15.004915] Code: ca ff 58 5a 4c 8b 5d b0 4c 8b 55 b8 49 8b 46 08 4c 89 d1 4c 89 ea 48 c7 c7 40 f6 df 81 4c 89 5d b8 48 8d 70 0c e8 e7 63 ca ff <0f> 0b 4c 8b 5d b8 e9 e8 fe ff ff 0f b6 50 06 c0 ea 04 0f b6 d2 52
[ 15.006688] RSP: 0018:ffff88013fd03d70 EFLAGS: 00010082
[ 15.007181] RAX: 0000000000000027 RBX: 0000000000000001 RCX: 0000000000000006
[ 15.007853] RDX: 0000000000000000 RSI: 0000000000000086 RDI: ffff88013fd15090
[ 15.008522] RBP: ffff88013fd03dc0 R08: 0000000000000000 R09: 000000000000033b
[ 15.009191] R10: 00000000000004c5 R11: ffffffff8224f80d R12: ffff880139cc6018
[ 15.009859] R13: 0000000000000000 R14: ffff88013b2ae800 R15: 0000000000000004
[ 15.010531] FS: 0000000000000000(0000) GS:ffff88013fd00000(0000) knlGS:0000000000000000
[ 15.011293] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 15.011832] CR2: 00007fe6d26c11d8 CR3: 0000000002009005 CR4: 00000000003606a0
[ 15.012497] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[ 15.013161] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
[ 15.013824] Call Trace:
[ 15.014059]
Qemu device config
-device nvme,drive=mynvme,serial=deadbeef,lnum_pu=4,lstrict=1,meta=16,mc=2,lsecs_per_chk=4096,lws_min=4,lws_opt=8 \
Tested with for-4.20/core
Looks like error reporting always is activated. Is there some way to default this to disabled, and have an option to enable it using the qemu device string?
I actually have not tested with pblk, just nvme-cli and liblightnvm. But I'll look into it.
DULBE is off by default. It needs to be explicitly activated using e.g.
nvme set-feature /dev/nvme0 -n 1 -f 0x5 -v $(( 1 << 16 ))
You're right. I had these in mind:
nvme: accessing unmapped chunk: ch:0, lun:3, chk:63, cno: 207 nvme: accessing unmapped chunk: ch:0, lun:3, chk:63, cno: 207 nvme: accessing unmapped chunk: ch:0, lun:3, chk:63, cno: 207 nvme: accessing unmapped chunk: ch:0, lun:3, chk:63, cno: 207 nvme: accessing unmapped chunk: ch:0, lun:3, chk:63, cno: 207 nvme: accessing unmapped chunk: ch:0, lun:3, chk:63, cno: 207 nvme: accessing unmapped chunk: ch:0, lun:3, chk:63, cno: 207 nvme: accessing unmapped chunk: ch:0, lun:3, chk:63, cno: 207 nvme: accessing unmapped chunk: ch:0, lun:3, chk:63, cno: 207 nvme: accessing unmapped chunk: ch:0, lun:3, chk:63, cno: 207 nvme: accessing unmapped chunk: ch:0, lun:3, chk:63, cno: 207 nvme: accessing unmapped chunk: ch:0, lun:3, chk:63, cno: 207 nvme: accessing unmapped chunk: ch:0, lun:3, chk:63, cno: 207
Which was reported on partition scan.
Yeah, the hw will report that, but still return success and 0x00 to the host.
And yeah. I also seeing some corrupted reads for pblk. I'll look into it and report back.
OK, I can now successfully run a fio verify test on pblk.
The issue was in function lnvm_rw_check_chunk_read
, where I check for the read being valid with respect to MW_CUNITS
. According to the spec a read is only valid if READ < (WP LBA - MW_CUNITS)
, causing me to implement that check as:
if (state == LNVM_CHUNK_OPEN || state == LNVM_CHUNK_CLOSED) {
uint64_t wpp = wp < mw_cunits ? 0 : wp;
if (state == LNVM_CHUNK_OPEN && wpp) {
wpp = wp-mw_cunits;
}
if (end_sectr < wpp) {
return 0;
}
}
pblk assumes that it is allowed to read at the end_sectr, so the condition becomes end_sectr <= wpp
instead. This might be something that needs to go into an errata for the spec? It was a bit unclear to me.
Uh, so pblk thinks that it can read from the WP offset? It should only read up till the write pointer.
It has nothing to do with pblk. pblk reads WP - MW_CUNITS in the chunk as originally defined. The way it is worded in the spec creates confusion, and probably one of the formulas for the read access should be <=
Here is an example:
MW_CUNITS = 16 Chunk size = 64 (0...63)
Chunk State: Open WP = 32
In that case,
WP - MW_CUNITS = 16
Valid reads from 0-15. That equals to the bound checking for < 16, and not <= 16.
Maybe "Read between (WP - MW_CUNITS) LBA and WP LBA" could be reworded to make it explicit that it includes WP - MW_CUNITS.
That is my understanding too. It is true though that the spec is not clear about this point, as it can be interpreted 0-indexed.
We are double checking pblk, as Klaus' test look ok.
Hehe, it is not the first time the zero-based value has caused questions.
There is a corner case in which pblk does not respect mw_cunits. I just submitted a patch to fix this upstream.
I've tested @javigon's patches on my branch. pblk is happy now.
Closing in favor of other.
Hi Matias,
Please consider reviewing and pulling my branch which implements support for DLFEAT/DULBE for both the scalar and vector paths.
It also introduces checks that enforce the read/write access rules (MW_CUNITS, WS_MIN).