mbox series

[V3,0/3] null_blk: add tracepoints for zoned mode

Message ID 20200325021629.15103-1-chaitanya.kulkarni@wdc.com (mailing list archive)
Headers show
Series null_blk: add tracepoints for zoned mode | expand

Message

Chaitanya Kulkarni March 25, 2020, 2:16 a.m. UTC
Hi Jens,

Recently we've added several new operations for zoned block devices
blk-zone.c (ZBD). These operations have a direct effect on the
zone-state machine present in the null_blk_zoned.c. 

This will allow us to add new testcases in blktests in order to verify
the correct operations on the driver side.

This is a small patch series which adds tracepoints for the null_blk
block driver when configured in a zoned mode (with command line
parameter zoned=1).

The first patch is a prep patch that adds a helper to stringify zone
conditions which we use in the trace, the second patch adds new
tracepoint definitions and the third patch allows null_blk_zoned to
trace operations.

Please have a look at the end for sample test output which has tests
for CONFIG_BLK_DEV_ZONED and !CONFIG_BLK_DEV_ZONED.

Regards,
Chaitanya              

Changes from V2 : -

1. Only compile null_blk_trace.c file if tracing and blk_dev_zoned is
   enabled.
2. Add a test log with and without CONFIG_BLK_DEV_ZONED.
3. Move Change log to the cover-letter.
4. Declare blk_zone_cond_str() without any CONFIG_BLK_DEV_ZONED
   conditions. 
5. Add a comment to the ${KDIR_HOME}/drivers/block/Makefile about
   whay we need ccflags-y.
6. Fix cover-letter header.
7. Add a copyright banner in null_blk_trace.c.

Changes from V1 : -

1. Move blk_zone_cond_str() to blk-zoned.c.
2. Mark zone_cond_namd array static.
3. Remove BLK_ZONE_COND_LAST.
4. Get rid of inline prefix for blk_zone_cond_str().
5. Use CONFIG_BLK_DEV_ZONE for null_blk_trace.o. 

Chaitanya Kulkarni (3):
  block: add a zone condition debug helper
  null_blk: add tracepoint helpers for zoned mode
  null_blk: add trace in null_blk_zoned.c

 block/blk-zoned.c              | 32 ++++++++++++++
 drivers/block/Makefile         |  6 +++
 drivers/block/null_blk_trace.c | 21 +++++++++
 drivers/block/null_blk_trace.h | 79 ++++++++++++++++++++++++++++++++++
 drivers/block/null_blk_zoned.c | 12 +++++-
 include/linux/blkdev.h         |  3 ++
 6 files changed, 152 insertions(+), 1 deletion(-)
 create mode 100644 drivers/block/null_blk_trace.c
 create mode 100644 drivers/block/null_blk_trace.h

Test Results :-

1. With CONFIG_BLK_DEV_ZONED DISABLED :-
----------------------------------------

# zcat /proc/config.gz | grep BLK_DEV_ZONED 
# CONFIG_BLK_DEV_ZONED is not set
# makej M=drivers/block
  MODPOST 11 modules
  CC [M]  drivers/block/brd.mod.o
  CC [M]  drivers/block/floppy.mod.o
  CC [M]  drivers/block/loop.mod.o
  CC [M]  drivers/block/mtip32xx/mtip32xx.mod.o
  CC [M]  drivers/block/null_blk.mod.o    <---
  CC [M]  drivers/block/pktcdvd.mod.o
  CC [M]  drivers/block/rbd.mod.o
  CC [M]  drivers/block/sx8.mod.o
  CC [M]  drivers/block/virtio_blk.mod.o
  CC [M]  drivers/block/xen-blkfront.mod.o
  CC [M]  drivers/block/zram/zram.mod.o
  LD [M]  drivers/block/xen-blkfront.ko
  LD [M]  drivers/block/brd.ko
  LD [M]  drivers/block/rbd.ko
  LD [M]  drivers/block/virtio_blk.ko
  LD [M]  drivers/block/sx8.ko
  LD [M]  drivers/block/floppy.ko
  LD [M]  drivers/block/null_blk.ko       <---
  LD [M]  drivers/block/pktcdvd.ko
  LD [M]  drivers/block/loop.ko
  LD [M]  drivers/block/zram/zram.ko
  LD [M]  drivers/block/mtip32xx/mtip32xx.ko
# insmod drivers/block/null_blk.ko 
# dmesg  -c
[ 1610.279303] null_blk: loading out-of-tree module taints kernel.
[ 1610.279390] null_blk: module verification failed: signature and/or required key missing - tainting kernel
[ 1610.290823] null_blk: module loaded
# rmmod  drivers/block/null_blk.ko 
# insmod drivers/block/null_blk.ko zoned=1
insmod: ERROR: could not insert module drivers/block/null_blk.ko: Invalid parameters
# dmesg  -c
[ 1627.347747] null_blk: CONFIG_BLK_DEV_ZONED not enabled
# ls /sys/kernel/debug/tracing/events/ | grep null
# echo $?
1

2. With CONFIG_BLK_DEV_ZONED ENABLED :-
---------------------------------------

# zcat /proc/config.gz | grep BLK_DEV_ZONED
CONFIG_BLK_DEV_ZONED=y
# makej M=drivers/block/
  AR      drivers/block//built-in.a
  CC [M]  drivers/block//floppy.o
  CC [M]  drivers/block//brd.o
  CC [M]  drivers/block//loop.o
  CC [M]  drivers/block//pktcdvd.o
  CC [M]  drivers/block//virtio_blk.o
  CC [M]  drivers/block//zram/zcomp.o
  CC [M]  drivers/block//mtip32xx/mtip32xx.o
  CC [M]  drivers/block//sx8.o
  CC [M]  drivers/block//zram/zram_drv.o
  CC [M]  drivers/block//rbd.o
  CC [M]  drivers/block//xen-blkfront.o
  CC [M]  drivers/block//null_blk_main.o  <---
  CC [M]  drivers/block//null_blk_trace.o <---
  CC [M]  drivers/block//null_blk_zoned.o <---
  LD [M]  drivers/block//zram/zram.o
  LD [M]  drivers/block//null_blk.o
  MODPOST 11 modules
  CC [M]  drivers/block//brd.mod.o
  CC [M]  drivers/block//floppy.mod.o
  CC [M]  drivers/block//loop.mod.o
  CC [M]  drivers/block//mtip32xx/mtip32xx.mod.o
  CC [M]  drivers/block//null_blk.mod.o   <---
  CC [M]  drivers/block//pktcdvd.mod.o
  CC [M]  drivers/block//rbd.mod.o
  CC [M]  drivers/block//sx8.mod.o
  CC [M]  drivers/block//virtio_blk.mod.o
  CC [M]  drivers/block//xen-blkfront.mod.o
  CC [M]  drivers/block//zram/zram.mod.o
  LD [M]  drivers/block//pktcdvd.ko
  LD [M]  drivers/block//floppy.ko
  LD [M]  drivers/block//brd.ko
  LD [M]  drivers/block//mtip32xx/mtip32xx.ko
  LD [M]  drivers/block//loop.ko
  LD [M]  drivers/block//virtio_blk.ko
  LD [M]  drivers/block//null_blk.ko
  LD [M]  drivers/block//rbd.ko
  LD [M]  drivers/block//xen-blkfront.ko
  LD [M]  drivers/block//sx8.ko
  LD [M]  drivers/block//zram/zram.ko
# insmod drivers/block/null_blk.ko
# dmesg -c
[  543.576548] null_blk: module loaded
# lsblk | grep nullb0
nullb0          252:0    0   250G  0 disk 
# rmmod null_blk
# insmod drivers/block/null_blk.ko zoned=1 zone_size=128 gb=1
# dmesg -c
[  543.654579] null_blk: module loaded
# lsblk | grep nullb0
nullb0          252:0    0     1G  0 disk 
# blkzone report /dev/nullb0
  start: 0x000000000, len 0x040000, capacity: 0x040000, wptr 0x000000 reset:0 non-seq:0, zcond: 1(em) [type: 2(SEQ_WRITE_REQUIRED)]
  start: 0x000040000, len 0x040000, capacity: 0x040000, wptr 0x000000 reset:0 non-seq:0, zcond: 1(em) [type: 2(SEQ_WRITE_REQUIRED)]
  start: 0x000080000, len 0x040000, capacity: 0x040000, wptr 0x000000 reset:0 non-seq:0, zcond: 1(em) [type: 2(SEQ_WRITE_REQUIRED)]
  start: 0x0000c0000, len 0x040000, capacity: 0x040000, wptr 0x000000 reset:0 non-seq:0, zcond: 1(em) [type: 2(SEQ_WRITE_REQUIRED)]
  start: 0x000100000, len 0x040000, capacity: 0x040000, wptr 0x000000 reset:0 non-seq:0, zcond: 1(em) [type: 2(SEQ_WRITE_REQUIRED)]
  start: 0x000140000, len 0x040000, capacity: 0x040000, wptr 0x000000 reset:0 non-seq:0, zcond: 1(em) [type: 2(SEQ_WRITE_REQUIRED)]
  start: 0x000180000, len 0x040000, capacity: 0x040000, wptr 0x000000 reset:0 non-seq:0, zcond: 1(em) [type: 2(SEQ_WRITE_REQUIRED)]
  start: 0x0001c0000, len 0x040000, capacity: 0x040000, wptr 0x000000 reset:0 non-seq:0, zcond: 1(em) [type: 2(SEQ_WRITE_REQUIRED)]
# echo 1 > /sys/kernel/debug/tracing/events/nullb/enable 
# for i in open close finish reset; do blkzone $i /dev/nullb0 ; done
# cat /sys/kernel/debug/tracing/trace_pipe 
   nullb_zone_op: disk=nullb0,  req=ZONE_OPEN       zone_no=0 zone_cond=EXP_OPEN  
   nullb_zone_op: disk=nullb0,  req=ZONE_OPEN       zone_no=1 zone_cond=EXP_OPEN  
   nullb_zone_op: disk=nullb0,  req=ZONE_OPEN       zone_no=2 zone_cond=EXP_OPEN  
   nullb_zone_op: disk=nullb0,  req=ZONE_OPEN       zone_no=3 zone_cond=EXP_OPEN  
   nullb_zone_op: disk=nullb0,  req=ZONE_OPEN       zone_no=4 zone_cond=EXP_OPEN  
   nullb_zone_op: disk=nullb0,  req=ZONE_OPEN       zone_no=5 zone_cond=EXP_OPEN  
   nullb_zone_op: disk=nullb0,  req=ZONE_OPEN       zone_no=6 zone_cond=EXP_OPEN  
   nullb_zone_op: disk=nullb0,  req=ZONE_OPEN       zone_no=7 zone_cond=EXP_OPEN  
   nullb_zone_op: disk=nullb0,  req=ZONE_CLOSE      zone_no=0 zone_cond=EMPTY     
   nullb_zone_op: disk=nullb0,  req=ZONE_CLOSE      zone_no=1 zone_cond=EMPTY     
   nullb_zone_op: disk=nullb0,  req=ZONE_CLOSE      zone_no=2 zone_cond=EMPTY     
   nullb_zone_op: disk=nullb0,  req=ZONE_CLOSE      zone_no=3 zone_cond=EMPTY     
   nullb_zone_op: disk=nullb0,  req=ZONE_CLOSE      zone_no=4 zone_cond=EMPTY     
   nullb_zone_op: disk=nullb0,  req=ZONE_CLOSE      zone_no=5 zone_cond=EMPTY     
   nullb_zone_op: disk=nullb0,  req=ZONE_CLOSE      zone_no=6 zone_cond=EMPTY     
   nullb_zone_op: disk=nullb0,  req=ZONE_CLOSE      zone_no=7 zone_cond=EMPTY     
   nullb_zone_op: disk=nullb0,  req=ZONE_FINISH     zone_no=0 zone_cond=FULL      
   nullb_zone_op: disk=nullb0,  req=ZONE_FINISH     zone_no=1 zone_cond=FULL      
   nullb_zone_op: disk=nullb0,  req=ZONE_FINISH     zone_no=2 zone_cond=FULL      
   nullb_zone_op: disk=nullb0,  req=ZONE_FINISH     zone_no=3 zone_cond=FULL      
   nullb_zone_op: disk=nullb0,  req=ZONE_FINISH     zone_no=4 zone_cond=FULL      
   nullb_zone_op: disk=nullb0,  req=ZONE_FINISH     zone_no=5 zone_cond=FULL      
   nullb_zone_op: disk=nullb0,  req=ZONE_FINISH     zone_no=6 zone_cond=FULL      
   nullb_zone_op: disk=nullb0,  req=ZONE_FINISH     zone_no=7 zone_cond=FULL      
   nullb_zone_op: disk=nullb0,  req=ZONE_RESET_ALL  zone_no=0 zone_cond=EMPTY     
   nullb_zone_op: disk=nullb0,  req=WRITE           zone_no=0 zone_cond=IMP_OPEN  
   nullb_zone_op: disk=nullb0,  req=WRITE           zone_no=0 zone_cond=IMP_OPEN  
   nullb_zone_op: disk=nullb0,  req=WRITE           zone_no=0 zone_cond=IMP_OPEN  
   nullb_zone_op: disk=nullb0,  req=WRITE           zone_no=0 zone_cond=IMP_OPEN  
   nullb_zone_op: disk=nullb0,  req=WRITE           zone_no=0 zone_cond=IMP_OPEN

Comments

Chaitanya Kulkarni March 27, 2020, 3:12 a.m. UTC | #1
Hi Jens,

Can we get this in ?

On 03/24/2020 08:21 PM, Chaitanya Kulkarni wrote:
> Hi Jens,
>
> Recently we've added several new operations for zoned block devices
> blk-zone.c (ZBD). These operations have a direct effect on the
> zone-state machine present in the null_blk_zoned.c.
>
> This will allow us to add new testcases in blktests in order to verify
> the correct operations on the driver side.
>
> This is a small patch series which adds tracepoints for the null_blk
> block driver when configured in a zoned mode (with command line
> parameter zoned=1).
>
> The first patch is a prep patch that adds a helper to stringify zone
> conditions which we use in the trace, the second patch adds new
> tracepoint definitions and the third patch allows null_blk_zoned to
> trace operations.
>
> Please have a look at the end for sample test output which has tests
> for CONFIG_BLK_DEV_ZONED and !CONFIG_BLK_DEV_ZONED.
>
> Regards,
> Chaitanya
>
Jens Axboe March 27, 2020, 3:35 p.m. UTC | #2
On 3/26/20 9:12 PM, Chaitanya Kulkarni wrote:
> Hi Jens,
> 
> Can we get this in ?

There still seems to be the unresolved issue of the function
declaration. I agree that we should not have a declaration for
a function if CONFIG_BLK_DEV_ZONED isn't set, so move it under
the existing ifdef.
Damien Le Moal March 27, 2020, 4:05 p.m. UTC | #3
On 2020/03/28 0:35, Jens Axboe wrote:
> On 3/26/20 9:12 PM, Chaitanya Kulkarni wrote:
>> Hi Jens,
>>
>> Can we get this in ?
> 
> There still seems to be the unresolved issue of the function
> declaration. I agree that we should not have a declaration for
> a function if CONFIG_BLK_DEV_ZONED isn't set, so move it under
> the existing ifdef.

The latest v4 series that Chaitanya posted addressed this issue.
The subject of this email is indeed v3 though...
Jens Axboe March 27, 2020, 4:25 p.m. UTC | #4
On 3/27/20 10:05 AM, Damien Le Moal wrote:
> On 2020/03/28 0:35, Jens Axboe wrote:
>> On 3/26/20 9:12 PM, Chaitanya Kulkarni wrote:
>>> Hi Jens,
>>>
>>> Can we get this in ?
>>
>> There still seems to be the unresolved issue of the function
>> declaration. I agree that we should not have a declaration for
>> a function if CONFIG_BLK_DEV_ZONED isn't set, so move it under
>> the existing ifdef.
> 
> The latest v4 series that Chaitanya posted addressed this issue.
> The subject of this email is indeed v3 though...

What's the msgid of that posting, I don't see it here?
Chaitanya Kulkarni March 27, 2020, 7:35 p.m. UTC | #5
On 3/27/20 8:35 AM, Jens Axboe wrote:
> On 3/26/20 9:12 PM, Chaitanya Kulkarni wrote:
>> Hi Jens,
>>
>> Can we get this in ?
> There still seems to be the unresolved issue of the function
> declaration. I agree that we should not have a declaration for
> a function if CONFIG_BLK_DEV_ZONED isn't set, so move it under
> the existing ifdef.
>
Sorry for replying to previous series.

Here is link for V4 which has above fix and Damien's review :-

https://www.spinics.net/lists/linux-block/msg51305.html
Jens Axboe March 27, 2020, 7:39 p.m. UTC | #6
On 3/27/20 1:35 PM, Chaitanya Kulkarni wrote:
> On 3/27/20 8:35 AM, Jens Axboe wrote:
>> On 3/26/20 9:12 PM, Chaitanya Kulkarni wrote:
>>> Hi Jens,
>>>
>>> Can we get this in ?
>> There still seems to be the unresolved issue of the function
>> declaration. I agree that we should not have a declaration for
>> a function if CONFIG_BLK_DEV_ZONED isn't set, so move it under
>> the existing ifdef.
>>
> Sorry for replying to previous series.
> 
> Here is link for V4 which has above fix and Damien's review :-
> 
> https://www.spinics.net/lists/linux-block/msg51305.html

Applied, thanks.