Re: first bad commit: [5795eb443060148796beeba106e4366d7f1458a6] scsi: sd_zbc: emulate ZONE_APPEND commands

2020-09-12 Thread Borislav Petkov
On Sat, Sep 12, 2020 at 12:18:52PM +, Damien Le Moal wrote:
> But it was Thunderbird, getting real plain text emails with outlook is
> impossible.

Yeap.

> Corruption I think came from the copy-paste from the Mac bash
> terminal... Tabs get replaced by spacers.

Yeah, never copy-paste hunks. I go "git diff > /tmp/diff" and then load
it into the editor which has the mail opened ":r /tmp/diff" (vim).

> Host-managed is still a thing, getting bigger. But host-aware never really
> gained a lot of traction due to, I think, the potentially very weird 
> performance
> profile they can get into (Hmmm... similar to recent drive-managed noise...)

Yeah, I had the suspicion that it would be some raisins like that.

> No worries, we will fix the mess (sorry we hit you again !).

Yeah, thanks and no probs.

> The patch was space corrupted, but could you still try it ? Did it solve your
> problem ? I can recend it (minus space corruption) if needed.

Yeah, I see

[3.263400] ata4: SATA max UDMA/133 abar m131072@0xfe38 port 0xfe380280 
irq 45
[4.943083] ata4: SATA link up 6.0 Gbps (SStatus 133 SControl 300)
[4.951590] ata4.00: NCQ Send/Recv Log not supported
[4.961868] ata4.00: ATA-10: ST8000AS0022-1WL17Z, SN01, max UDMA/133
[4.977167] ata4.00: 15628053168 sectors, multi 16: LBA48 NCQ (depth 32), AA
[4.987217] ata4.00: NCQ Send/Recv Log not supported
[5.004230] ata4.00: configured for UDMA/133

but no "sdc" device or a partition or so. So I can't even do fdisk -l on it.

I see your other version - I'll test that later because real life awaits
and it is weekend and so on...

Thx.

-- 
Regards/Gruss,
Boris.

https://people.kernel.org/tglx/notes-about-netiquette


Re: first bad commit: [5795eb443060148796beeba106e4366d7f1458a6] scsi: sd_zbc: emulate ZONE_APPEND commands

2020-09-12 Thread Damien Le Moal
On 2020/09/12 18:09, Johannes Thumshirn wrote:
> On 12/09/2020 04:31, Damien Le Moal wrote:
>> On 2020/09/12 8:07, Borislav Petkov wrote:
>>> On Sat, Sep 12, 2020 at 12:17:59AM +0200, Borislav Petkov wrote:
 Enabling it, fixes the issue.
>>>
>>> Btw, I just hit the below warn with 5.8, while booting with the above
>>> config option enabled. Looks familiar and I didn't trigger it with
>>> 5.9-rc4+ so you guys either fixed it or something changed in-between:
>>>
>>> [5.124321] ata4.00: NCQ Send/Recv Log not supported
>>> [5.131484] ata4.00: configured for UDMA/133
>>> [5.135847] scsi 3:0:0:0: Direct-Access ATA  ST8000AS0022-1WL 
>>> SN01 PQ: 0 ANSI: 5
>>> [5.143972] sd 3:0:0:0: Attached scsi generic sg1 type 0
>>> [5.144033] sd 3:0:0:0: [sdb] Host-aware zoned block device
>>> [5.177105] sd 3:0:0:0: [sdb] 15628053168 512-byte logical blocks: (8.00 
>>> TB/7.28 TiB)
>>> [5.184880] sd 3:0:0:0: [sdb] 4096-byte physical blocks
>>> [5.190084] sd 3:0:0:0: [sdb] 29808 zones of 524288 logical blocks + 1 
>>> runt zone
>>> [5.197439] sd 3:0:0:0: [sdb] Write Protect is off
>>> [5.202220] sd 3:0:0:0: [sdb] Mode Sense: 00 3a 00 00
>>> [5.207260] sd 3:0:0:0: [sdb] Write cache: enabled, read cache: enabled, 
>>> doesn't support DPO or FUA
>>> [5.356631]  sdb: sdb1
>>> [5.359014] sdb: disabling host aware zoned block device support due to 
>>> partitions
>>> [5.389941] [ cut here ]
>>> [5.394557] WARNING: CPU: 8 PID: 164 at block/blk-settings.c:236 
>>> blk_queue_max_zone_append_sectors+0x12/0x40
>>> [5.404300] Modules linked in:
>>> [5.407365] CPU: 8 PID: 164 Comm: kworker/u32:6 Not tainted 5.8.0 #7
>>> [5.413682] Hardware name: Micro-Star International Co., Ltd. 
>>> MS-7B79/X470 GAMING PRO (MS-7B79), BIOS 1.70 01/23/2019
>>> [5.424191] Workqueue: events_unbound async_run_entry_fn
>>> [5.429482] RIP: 0010:blk_queue_max_zone_append_sectors+0x12/0x40
>>> [5.435543] Code: fe 0f 00 00 53 48 89 fb 0f 86 3d 07 00 00 48 89 b3 e0 
>>> 03 00 00 5b c3 90 0f 1f 44 00 00 8b 87 40 04 00 00 ff c8 83 f8 01 76 03 
>>> <0f> 0b c3 8b 87 f8 03 00 00 39 87 f0 03 00 00 0f 46 87 f0 03 00 00
>>> [5.454099] RSP: 0018:c9697c60 EFLAGS: 00010282
>>> [5.459306] RAX:  RBX: 8887fa0a9400 RCX: 
>>> 
>>> [5.466390] RDX: 8887faf0d400 RSI: 0540 RDI: 
>>> 8887f0dde6c8
>>> [5.473474] RBP: 7471 R08: 001d1c40 R09: 
>>> 8887fee29ad0
>>> [5.480559] R10: 0001434bac00 R11: 00358275 R12: 
>>> 0008
>>> [5.487643] R13: 8887f0dde6c8 R14: 8887fa0a9738 R15: 
>>> 
>>> [5.494726] FS:  () GS:8887fee0() 
>>> knlGS:
>>> [5.502757] CS:  0010 DS:  ES:  CR0: 80050033
>>> [5.508474] CR2:  CR3: 02209000 CR4: 
>>> 003406e0
>>> [5.515558] Call Trace:
>>> [5.518026]  sd_zbc_read_zones+0x323/0x480
>>> [5.522122]  sd_revalidate_disk+0x122b/0x2000
>>> [5.526472]  ? __device_add_disk+0x2f7/0x4e0
>>> [5.530738]  sd_probe+0x347/0x44b
>>> [5.534058]  really_probe+0x2c4/0x3f0
>>> [5.537720]  driver_probe_device+0xe1/0x150
>>> [5.541902]  ? driver_allows_async_probing+0x50/0x50
>>> [5.546852]  bus_for_each_drv+0x6a/0xa0
>>> [5.550683]  __device_attach_async_helper+0x8c/0xd0
>>> [5.47]  async_run_entry_fn+0x4a/0x180
>>> [5.559636]  process_one_work+0x1a5/0x3a0
>>> [5.563637]  worker_thread+0x50/0x3a0
>>> [5.567300]  ? process_one_work+0x3a0/0x3a0
>>> [5.571480]  kthread+0x117/0x160
>>> [5.574715]  ? kthread_park+0x90/0x90
>>> [5.578377]  ret_from_fork+0x22/0x30
>>> [5.581960] ---[ end trace 94141003236730cf ]---
>>> [5.586578] sd 3:0:0:0: [sdb] Attached SCSI disk
>>> [6.186783] ata5: failed to resume link (SControl 0)
>>> [6.191818] ata5: SATA link down (SStatus 0 SControl 0)
>>>
> 
> 
> This looks like we're trying to configure zone append max sectors 
> on a device that doesn't have the zoned flag set.

Yep. That's because sd_zbc_revalidate_zones() entry test uses sd_is_zoned() and
does not look at queue->limits.zoned which was changed to BLK_ZONE_NONE while
sd_is_zoned() still correctly says that the drive is host-aware. We need to
change the entry test to use blk_queue_is_zoned() instead of sd_is_zoned().

> 
>>
>> Can you try this:
>>
>> diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
>> index 95018e650f2d..620539162ef1 100644
>> --- a/drivers/scsi/sd.c
>> +++ b/drivers/scsi/sd.c
>> @@ -2968,8 +2968,13 @@ static void sd_read_block_characteristics(struct
>> scsi_disk *sdkp)
>> } else {
>> sdkp->zoned = (buffer[8] >> 4) & 3;
>> if (sdkp->zoned == 1 && !disk_has_partitions(sdkp->disk)) {
>> +#ifdef CONFIG_BLK_DEV_ZONED
>> /* Host-aware */
>> 

Re: first bad commit: [5795eb443060148796beeba106e4366d7f1458a6] scsi: sd_zbc: emulate ZONE_APPEND commands

2020-09-12 Thread Damien Le Moal
On 2020/09/12 17:37, Borislav Petkov wrote:
> Hi Damien,
> 
> On Sat, Sep 12, 2020 at 02:31:55AM +, Damien Le Moal wrote:
>> Can you try this:
> 
> sure, but it is white-space damaged:
> 
> checking file drivers/scsi/sd.c
> patch:  malformed patch at line 86: scsi_disk *sdkp)
> 
> Welcome to the world of outlook and how sending patches with it never
> works. You guys might need linux.wdc.com now :-)))

Working on it :)
But it was Thunderbird, getting real plain text emails with outlook is
impossible. Corruption I think came from the copy-paste from the Mac bash
terminal... Tabs get replaced by spacers.

>> That should fix the above as well as the hang on boot with 
>> CONFIG_BLK_DEV_ZONED
>> disabled (for that one I do not totally understand what is going on...).
>>
>> We do not have any host-aware disk for testing (as far as I know, nobody is
>> selling these anymore),
> 
> Yeah, so Johannes said. I love it how a (relatively) brand new
> technology gets immediately deprecated :-\

Host-managed is still a thing, getting bigger. But host-aware never really
gained a lot of traction due to, I think, the potentially very weird performance
profile they can get into (Hmmm... similar to recent drive-managed noise...)

>> so our test setup is a bit lame in this area. We'll rig something up
>> with tcmu-runner emulation to add tests for these devices to avoid
>> a repeat of such problem. And we'll make sure to add a test for
>> host-aware+partitions, since we at least know for sure there is one
>> user :)
> 
> Bah, I use it as a big data dump so if you say, I should make use of it
> as a proper zoned device (I've skimmed through http://zonedstorage.io/ a
> bit last night), I can try to find some time...

No worries, we will fix the mess (sorry we hit you again !).
Also, Naohiro just posted btrfs zone support v7 !! Luckily, we can get that into
5.11.

The patch was space corrupted, but could you still try it ? Did it solve your
problem ? I can recend it (minus space corruption) if needed.

Cheers.


-- 
Damien Le Moal
Western Digital Research


Re: first bad commit: [5795eb443060148796beeba106e4366d7f1458a6] scsi: sd_zbc: emulate ZONE_APPEND commands

2020-09-12 Thread Johannes Thumshirn
On 12/09/2020 04:31, Damien Le Moal wrote:
> On 2020/09/12 8:07, Borislav Petkov wrote:
>> On Sat, Sep 12, 2020 at 12:17:59AM +0200, Borislav Petkov wrote:
>>> Enabling it, fixes the issue.
>>
>> Btw, I just hit the below warn with 5.8, while booting with the above
>> config option enabled. Looks familiar and I didn't trigger it with
>> 5.9-rc4+ so you guys either fixed it or something changed in-between:
>>
>> [5.124321] ata4.00: NCQ Send/Recv Log not supported
>> [5.131484] ata4.00: configured for UDMA/133
>> [5.135847] scsi 3:0:0:0: Direct-Access ATA  ST8000AS0022-1WL 
>> SN01 PQ: 0 ANSI: 5
>> [5.143972] sd 3:0:0:0: Attached scsi generic sg1 type 0
>> [5.144033] sd 3:0:0:0: [sdb] Host-aware zoned block device
>> [5.177105] sd 3:0:0:0: [sdb] 15628053168 512-byte logical blocks: (8.00 
>> TB/7.28 TiB)
>> [5.184880] sd 3:0:0:0: [sdb] 4096-byte physical blocks
>> [5.190084] sd 3:0:0:0: [sdb] 29808 zones of 524288 logical blocks + 1 
>> runt zone
>> [5.197439] sd 3:0:0:0: [sdb] Write Protect is off
>> [5.202220] sd 3:0:0:0: [sdb] Mode Sense: 00 3a 00 00
>> [5.207260] sd 3:0:0:0: [sdb] Write cache: enabled, read cache: enabled, 
>> doesn't support DPO or FUA
>> [5.356631]  sdb: sdb1
>> [5.359014] sdb: disabling host aware zoned block device support due to 
>> partitions
>> [5.389941] [ cut here ]
>> [5.394557] WARNING: CPU: 8 PID: 164 at block/blk-settings.c:236 
>> blk_queue_max_zone_append_sectors+0x12/0x40
>> [5.404300] Modules linked in:
>> [5.407365] CPU: 8 PID: 164 Comm: kworker/u32:6 Not tainted 5.8.0 #7
>> [5.413682] Hardware name: Micro-Star International Co., Ltd. 
>> MS-7B79/X470 GAMING PRO (MS-7B79), BIOS 1.70 01/23/2019
>> [5.424191] Workqueue: events_unbound async_run_entry_fn
>> [5.429482] RIP: 0010:blk_queue_max_zone_append_sectors+0x12/0x40
>> [5.435543] Code: fe 0f 00 00 53 48 89 fb 0f 86 3d 07 00 00 48 89 b3 e0 
>> 03 00 00 5b c3 90 0f 1f 44 00 00 8b 87 40 04 00 00 ff c8 83 f8 01 76 03 <0f> 
>> 0b c3 8b 87 f8 03 00 00 39 87 f0 03 00 00 0f 46 87 f0 03 00 00
>> [5.454099] RSP: 0018:c9697c60 EFLAGS: 00010282
>> [5.459306] RAX:  RBX: 8887fa0a9400 RCX: 
>> 
>> [5.466390] RDX: 8887faf0d400 RSI: 0540 RDI: 
>> 8887f0dde6c8
>> [5.473474] RBP: 7471 R08: 001d1c40 R09: 
>> 8887fee29ad0
>> [5.480559] R10: 0001434bac00 R11: 00358275 R12: 
>> 0008
>> [5.487643] R13: 8887f0dde6c8 R14: 8887fa0a9738 R15: 
>> 
>> [5.494726] FS:  () GS:8887fee0() 
>> knlGS:
>> [5.502757] CS:  0010 DS:  ES:  CR0: 80050033
>> [5.508474] CR2:  CR3: 02209000 CR4: 
>> 003406e0
>> [5.515558] Call Trace:
>> [5.518026]  sd_zbc_read_zones+0x323/0x480
>> [5.522122]  sd_revalidate_disk+0x122b/0x2000
>> [5.526472]  ? __device_add_disk+0x2f7/0x4e0
>> [5.530738]  sd_probe+0x347/0x44b
>> [5.534058]  really_probe+0x2c4/0x3f0
>> [5.537720]  driver_probe_device+0xe1/0x150
>> [5.541902]  ? driver_allows_async_probing+0x50/0x50
>> [5.546852]  bus_for_each_drv+0x6a/0xa0
>> [5.550683]  __device_attach_async_helper+0x8c/0xd0
>> [5.47]  async_run_entry_fn+0x4a/0x180
>> [5.559636]  process_one_work+0x1a5/0x3a0
>> [5.563637]  worker_thread+0x50/0x3a0
>> [5.567300]  ? process_one_work+0x3a0/0x3a0
>> [5.571480]  kthread+0x117/0x160
>> [5.574715]  ? kthread_park+0x90/0x90
>> [5.578377]  ret_from_fork+0x22/0x30
>> [5.581960] ---[ end trace 94141003236730cf ]---
>> [5.586578] sd 3:0:0:0: [sdb] Attached SCSI disk
>> [6.186783] ata5: failed to resume link (SControl 0)
>> [6.191818] ata5: SATA link down (SStatus 0 SControl 0)
>>


This looks like we're trying to configure zone append max sectors 
on a device that doesn't have the zoned flag set.

> 
> Can you try this:
> 
> diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
> index 95018e650f2d..620539162ef1 100644
> --- a/drivers/scsi/sd.c
> +++ b/drivers/scsi/sd.c
> @@ -2968,8 +2968,13 @@ static void sd_read_block_characteristics(struct
> scsi_disk *sdkp)
> } else {
> sdkp->zoned = (buffer[8] >> 4) & 3;
> if (sdkp->zoned == 1 && !disk_has_partitions(sdkp->disk)) {
> +#ifdef CONFIG_BLK_DEV_ZONED
> /* Host-aware */
> q->limits.zoned = BLK_ZONED_HA;
> +#else
> +   /* Host-aware drive is treated as a regular disk */
> +   q->limits.zoned = BLK_ZONED_NONE;
> +#endif
> } else {
> /*
>  * Treat drive-managed devices and host-aware devices
> @@ -3404,12 +3409,12 @@ static int sd_probe(struct device *dev)
> sdkp->first_scan = 1;
> 

Re: first bad commit: [5795eb443060148796beeba106e4366d7f1458a6] scsi: sd_zbc: emulate ZONE_APPEND commands

2020-09-12 Thread Borislav Petkov
Hi Damien,

On Sat, Sep 12, 2020 at 02:31:55AM +, Damien Le Moal wrote:
> Can you try this:

sure, but it is white-space damaged:

checking file drivers/scsi/sd.c
patch:  malformed patch at line 86: scsi_disk *sdkp)

Welcome to the world of outlook and how sending patches with it never
works. You guys might need linux.wdc.com now :-)))

> That should fix the above as well as the hang on boot with 
> CONFIG_BLK_DEV_ZONED
> disabled (for that one I do not totally understand what is going on...).
>
> We do not have any host-aware disk for testing (as far as I know, nobody is
> selling these anymore),

Yeah, so Johannes said. I love it how a (relatively) brand new
technology gets immediately deprecated :-\

> so our test setup is a bit lame in this area. We'll rig something up
> with tcmu-runner emulation to add tests for these devices to avoid
> a repeat of such problem. And we'll make sure to add a test for
> host-aware+partitions, since we at least know for sure there is one
> user :)

Bah, I use it as a big data dump so if you say, I should make use of it
as a proper zoned device (I've skimmed through http://zonedstorage.io/ a
bit last night), I can try to find some time...

Thx.

-- 
Regards/Gruss,
Boris.

https://people.kernel.org/tglx/notes-about-netiquette


Re: first bad commit: [5795eb443060148796beeba106e4366d7f1458a6] scsi: sd_zbc: emulate ZONE_APPEND commands

2020-09-11 Thread Damien Le Moal
On 2020/09/12 8:07, Borislav Petkov wrote:
> On Sat, Sep 12, 2020 at 12:17:59AM +0200, Borislav Petkov wrote:
>> Enabling it, fixes the issue.
> 
> Btw, I just hit the below warn with 5.8, while booting with the above
> config option enabled. Looks familiar and I didn't trigger it with
> 5.9-rc4+ so you guys either fixed it or something changed in-between:
> 
> [5.124321] ata4.00: NCQ Send/Recv Log not supported
> [5.131484] ata4.00: configured for UDMA/133
> [5.135847] scsi 3:0:0:0: Direct-Access ATA  ST8000AS0022-1WL SN01 
> PQ: 0 ANSI: 5
> [5.143972] sd 3:0:0:0: Attached scsi generic sg1 type 0
> [5.144033] sd 3:0:0:0: [sdb] Host-aware zoned block device
> [5.177105] sd 3:0:0:0: [sdb] 15628053168 512-byte logical blocks: (8.00 
> TB/7.28 TiB)
> [5.184880] sd 3:0:0:0: [sdb] 4096-byte physical blocks
> [5.190084] sd 3:0:0:0: [sdb] 29808 zones of 524288 logical blocks + 1 
> runt zone
> [5.197439] sd 3:0:0:0: [sdb] Write Protect is off
> [5.202220] sd 3:0:0:0: [sdb] Mode Sense: 00 3a 00 00
> [5.207260] sd 3:0:0:0: [sdb] Write cache: enabled, read cache: enabled, 
> doesn't support DPO or FUA
> [5.356631]  sdb: sdb1
> [5.359014] sdb: disabling host aware zoned block device support due to 
> partitions
> [5.389941] [ cut here ]
> [5.394557] WARNING: CPU: 8 PID: 164 at block/blk-settings.c:236 
> blk_queue_max_zone_append_sectors+0x12/0x40
> [5.404300] Modules linked in:
> [5.407365] CPU: 8 PID: 164 Comm: kworker/u32:6 Not tainted 5.8.0 #7
> [5.413682] Hardware name: Micro-Star International Co., Ltd. MS-7B79/X470 
> GAMING PRO (MS-7B79), BIOS 1.70 01/23/2019
> [5.424191] Workqueue: events_unbound async_run_entry_fn
> [5.429482] RIP: 0010:blk_queue_max_zone_append_sectors+0x12/0x40
> [5.435543] Code: fe 0f 00 00 53 48 89 fb 0f 86 3d 07 00 00 48 89 b3 e0 03 
> 00 00 5b c3 90 0f 1f 44 00 00 8b 87 40 04 00 00 ff c8 83 f8 01 76 03 <0f> 0b 
> c3 8b 87 f8 03 00 00 39 87 f0 03 00 00 0f 46 87 f0 03 00 00
> [5.454099] RSP: 0018:c9697c60 EFLAGS: 00010282
> [5.459306] RAX:  RBX: 8887fa0a9400 RCX: 
> 
> [5.466390] RDX: 8887faf0d400 RSI: 0540 RDI: 
> 8887f0dde6c8
> [5.473474] RBP: 7471 R08: 001d1c40 R09: 
> 8887fee29ad0
> [5.480559] R10: 0001434bac00 R11: 00358275 R12: 
> 0008
> [5.487643] R13: 8887f0dde6c8 R14: 8887fa0a9738 R15: 
> 
> [5.494726] FS:  () GS:8887fee0() 
> knlGS:
> [5.502757] CS:  0010 DS:  ES:  CR0: 80050033
> [5.508474] CR2:  CR3: 02209000 CR4: 
> 003406e0
> [5.515558] Call Trace:
> [5.518026]  sd_zbc_read_zones+0x323/0x480
> [5.522122]  sd_revalidate_disk+0x122b/0x2000
> [5.526472]  ? __device_add_disk+0x2f7/0x4e0
> [5.530738]  sd_probe+0x347/0x44b
> [5.534058]  really_probe+0x2c4/0x3f0
> [5.537720]  driver_probe_device+0xe1/0x150
> [5.541902]  ? driver_allows_async_probing+0x50/0x50
> [5.546852]  bus_for_each_drv+0x6a/0xa0
> [5.550683]  __device_attach_async_helper+0x8c/0xd0
> [5.47]  async_run_entry_fn+0x4a/0x180
> [5.559636]  process_one_work+0x1a5/0x3a0
> [5.563637]  worker_thread+0x50/0x3a0
> [5.567300]  ? process_one_work+0x3a0/0x3a0
> [5.571480]  kthread+0x117/0x160
> [5.574715]  ? kthread_park+0x90/0x90
> [5.578377]  ret_from_fork+0x22/0x30
> [5.581960] ---[ end trace 94141003236730cf ]---
> [5.586578] sd 3:0:0:0: [sdb] Attached SCSI disk
> [6.186783] ata5: failed to resume link (SControl 0)
> [6.191818] ata5: SATA link down (SStatus 0 SControl 0)
> 

Can you try this:

diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index 95018e650f2d..620539162ef1 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -2968,8 +2968,13 @@ static void sd_read_block_characteristics(struct
scsi_disk *sdkp)
} else {
sdkp->zoned = (buffer[8] >> 4) & 3;
if (sdkp->zoned == 1 && !disk_has_partitions(sdkp->disk)) {
+#ifdef CONFIG_BLK_DEV_ZONED
/* Host-aware */
q->limits.zoned = BLK_ZONED_HA;
+#else
+   /* Host-aware drive is treated as a regular disk */
+   q->limits.zoned = BLK_ZONED_NONE;
+#endif
} else {
/*
 * Treat drive-managed devices and host-aware devices
@@ -3404,12 +3409,12 @@ static int sd_probe(struct device *dev)
sdkp->first_scan = 1;
sdkp->max_medium_access_timeouts = SD_MAX_MEDIUM_TIMEOUTS;

+   sd_revalidate_disk(gd);
+
error = sd_zbc_init_disk(sdkp);
if (error)
goto out_free_index;

-   sd_revalidate_disk(gd);
-
gd->flags = GENHD_FL_EXT_DEVT;
if (sdp->removable) {

Re: first bad commit: [5795eb443060148796beeba106e4366d7f1458a6] scsi: sd_zbc: emulate ZONE_APPEND commands

2020-09-11 Thread Borislav Petkov
On Sat, Sep 12, 2020 at 12:17:59AM +0200, Borislav Petkov wrote:
> Enabling it, fixes the issue.

Btw, I just hit the below warn with 5.8, while booting with the above
config option enabled. Looks familiar and I didn't trigger it with
5.9-rc4+ so you guys either fixed it or something changed in-between:

[5.124321] ata4.00: NCQ Send/Recv Log not supported
[5.131484] ata4.00: configured for UDMA/133
[5.135847] scsi 3:0:0:0: Direct-Access ATA  ST8000AS0022-1WL SN01 
PQ: 0 ANSI: 5
[5.143972] sd 3:0:0:0: Attached scsi generic sg1 type 0
[5.144033] sd 3:0:0:0: [sdb] Host-aware zoned block device
[5.177105] sd 3:0:0:0: [sdb] 15628053168 512-byte logical blocks: (8.00 
TB/7.28 TiB)
[5.184880] sd 3:0:0:0: [sdb] 4096-byte physical blocks
[5.190084] sd 3:0:0:0: [sdb] 29808 zones of 524288 logical blocks + 1 runt 
zone
[5.197439] sd 3:0:0:0: [sdb] Write Protect is off
[5.202220] sd 3:0:0:0: [sdb] Mode Sense: 00 3a 00 00
[5.207260] sd 3:0:0:0: [sdb] Write cache: enabled, read cache: enabled, 
doesn't support DPO or FUA
[5.356631]  sdb: sdb1
[5.359014] sdb: disabling host aware zoned block device support due to 
partitions
[5.389941] [ cut here ]
[5.394557] WARNING: CPU: 8 PID: 164 at block/blk-settings.c:236 
blk_queue_max_zone_append_sectors+0x12/0x40
[5.404300] Modules linked in:
[5.407365] CPU: 8 PID: 164 Comm: kworker/u32:6 Not tainted 5.8.0 #7
[5.413682] Hardware name: Micro-Star International Co., Ltd. MS-7B79/X470 
GAMING PRO (MS-7B79), BIOS 1.70 01/23/2019
[5.424191] Workqueue: events_unbound async_run_entry_fn
[5.429482] RIP: 0010:blk_queue_max_zone_append_sectors+0x12/0x40
[5.435543] Code: fe 0f 00 00 53 48 89 fb 0f 86 3d 07 00 00 48 89 b3 e0 03 
00 00 5b c3 90 0f 1f 44 00 00 8b 87 40 04 00 00 ff c8 83 f8 01 76 03 <0f> 0b c3 
8b 87 f8 03 00 00 39 87 f0 03 00 00 0f 46 87 f0 03 00 00
[5.454099] RSP: 0018:c9697c60 EFLAGS: 00010282
[5.459306] RAX:  RBX: 8887fa0a9400 RCX: 
[5.466390] RDX: 8887faf0d400 RSI: 0540 RDI: 8887f0dde6c8
[5.473474] RBP: 7471 R08: 001d1c40 R09: 8887fee29ad0
[5.480559] R10: 0001434bac00 R11: 00358275 R12: 0008
[5.487643] R13: 8887f0dde6c8 R14: 8887fa0a9738 R15: 
[5.494726] FS:  () GS:8887fee0() 
knlGS:
[5.502757] CS:  0010 DS:  ES:  CR0: 80050033
[5.508474] CR2:  CR3: 02209000 CR4: 003406e0
[5.515558] Call Trace:
[5.518026]  sd_zbc_read_zones+0x323/0x480
[5.522122]  sd_revalidate_disk+0x122b/0x2000
[5.526472]  ? __device_add_disk+0x2f7/0x4e0
[5.530738]  sd_probe+0x347/0x44b
[5.534058]  really_probe+0x2c4/0x3f0
[5.537720]  driver_probe_device+0xe1/0x150
[5.541902]  ? driver_allows_async_probing+0x50/0x50
[5.546852]  bus_for_each_drv+0x6a/0xa0
[5.550683]  __device_attach_async_helper+0x8c/0xd0
[5.47]  async_run_entry_fn+0x4a/0x180
[5.559636]  process_one_work+0x1a5/0x3a0
[5.563637]  worker_thread+0x50/0x3a0
[5.567300]  ? process_one_work+0x3a0/0x3a0
[5.571480]  kthread+0x117/0x160
[5.574715]  ? kthread_park+0x90/0x90
[5.578377]  ret_from_fork+0x22/0x30
[5.581960] ---[ end trace 94141003236730cf ]---
[5.586578] sd 3:0:0:0: [sdb] Attached SCSI disk
[6.186783] ata5: failed to resume link (SControl 0)
[6.191818] ata5: SATA link down (SStatus 0 SControl 0)

-- 
Regards/Gruss,
Boris.

https://people.kernel.org/tglx/notes-about-netiquette


Re: first bad commit: [5795eb443060148796beeba106e4366d7f1458a6] scsi: sd_zbc: emulate ZONE_APPEND commands

2020-09-11 Thread Randy Dunlap
On 9/11/20 3:26 PM, Johannes Thumshirn wrote:
> On 12/09/2020 00:22, Randy Dunlap wrote:
>> On 9/11/20 3:17 PM, Borislav Petkov wrote:
>>> On Fri, Sep 11, 2020 at 09:53:12PM +0200, Borislav Petkov wrote:
 Now, looking at that patch:

   5795eb443060 ("scsi: sd_zbc: emulate ZONE_APPEND commands")

 yeah, that doesn't revert cleanly. But it talks about zoned-something
 devices and that rings a bell because you guys broke my zoned device
 once already:
>>>
>>> Ok, so Johannes and I poked a bit on IRC and here it is:
>>>
>>> # CONFIG_BLK_DEV_ZONED is not set.
>>>
>>> Enabling it, fixes the issue.
>>>
>>
>> Uh, you are not saying that enabling that CONFIG_ is the final fix, are you?
>>
>> If so, do I need to enable it, even if I don't have a zoned block device?
>>
> 
> No he does have a zoned block device and no this is not the final fix, I 
> think one of the stubbed out functions is broken, but it's midnight here
> so we're calling it a day and chime back in on Monday.

Sure, thanks for the answers.


> And this setup is a bit special, as Boris is using partitions on a host-aware
> zoned block device which is somewhat exotic (see add_partition()).
> 
> Byte,

?  :)


-- 
~Randy



Re: first bad commit: [5795eb443060148796beeba106e4366d7f1458a6] scsi: sd_zbc: emulate ZONE_APPEND commands

2020-09-11 Thread Johannes Thumshirn
On 12/09/2020 00:22, Randy Dunlap wrote:
> On 9/11/20 3:17 PM, Borislav Petkov wrote:
>> On Fri, Sep 11, 2020 at 09:53:12PM +0200, Borislav Petkov wrote:
>>> Now, looking at that patch:
>>>
>>>   5795eb443060 ("scsi: sd_zbc: emulate ZONE_APPEND commands")
>>>
>>> yeah, that doesn't revert cleanly. But it talks about zoned-something
>>> devices and that rings a bell because you guys broke my zoned device
>>> once already:
>>
>> Ok, so Johannes and I poked a bit on IRC and here it is:
>>
>> # CONFIG_BLK_DEV_ZONED is not set.
>>
>> Enabling it, fixes the issue.
>>
> 
> Uh, you are not saying that enabling that CONFIG_ is the final fix, are you?
> 
> If so, do I need to enable it, even if I don't have a zoned block device?
>

No he does have a zoned block device and no this is not the final fix, I 
think one of the stubbed out functions is broken, but it's midnight here
so we're calling it a day and chime back in on Monday.

And this setup is a bit special, as Boris is using partitions on a host-aware
zoned block device which is somewhat exotic (see add_partition()).

Byte,
Johannes



Re: first bad commit: [5795eb443060148796beeba106e4366d7f1458a6] scsi: sd_zbc: emulate ZONE_APPEND commands

2020-09-11 Thread Randy Dunlap
On 9/11/20 3:17 PM, Borislav Petkov wrote:
> On Fri, Sep 11, 2020 at 09:53:12PM +0200, Borislav Petkov wrote:
>> Now, looking at that patch:
>>
>>   5795eb443060 ("scsi: sd_zbc: emulate ZONE_APPEND commands")
>>
>> yeah, that doesn't revert cleanly. But it talks about zoned-something
>> devices and that rings a bell because you guys broke my zoned device
>> once already:
> 
> Ok, so Johannes and I poked a bit on IRC and here it is:
> 
> # CONFIG_BLK_DEV_ZONED is not set.
> 
> Enabling it, fixes the issue.
> 

Uh, you are not saying that enabling that CONFIG_ is the final fix, are you?

If so, do I need to enable it, even if I don't have a zoned block device?


-- 
~Randy



Re: first bad commit: [5795eb443060148796beeba106e4366d7f1458a6] scsi: sd_zbc: emulate ZONE_APPEND commands

2020-09-11 Thread Borislav Petkov
On Fri, Sep 11, 2020 at 09:53:12PM +0200, Borislav Petkov wrote:
> Now, looking at that patch:
> 
>   5795eb443060 ("scsi: sd_zbc: emulate ZONE_APPEND commands")
> 
> yeah, that doesn't revert cleanly. But it talks about zoned-something
> devices and that rings a bell because you guys broke my zoned device
> once already:

Ok, so Johannes and I poked a bit on IRC and here it is:

# CONFIG_BLK_DEV_ZONED is not set.

Enabling it, fixes the issue.

-- 
Regards/Gruss,
Boris.

https://people.kernel.org/tglx/notes-about-netiquette