Skip to contentSkip to conversation

Add Support for GET LBA STATUS 16 command in scsi emulation

PATCH Superseded Lin Ma 3 participants 12 messages Jun 2, 2020 – Jun 3, 2020

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Lin Ma

author
#0 lore raw

cover Add Support for GET LBA STATUS 16 command in scsi emulation

In this current design, The GET LBA STATUS parameter data only contains an eight-byte header + one LBA status descriptor.

How to test:
host:~ # qemu-system-x86_64 \
...
-drive file=/vm0/disk0.raw,format=raw,if=none,id=drive0,discard=unmap \
-device scsi-hd,id=scsi0,drive=drive0 \
...

guest:~ # dd if=/dev/zero of=/dev/sda bs=512 seek=1024 count=256

guest:~ # sg_unmap -l 1024 -n 32 /dev/sda

guest:~ # sg_get_lba_status /dev/sda -l 1024
No indication of the completion condition
RTP=0
descriptor LBA: 0x0000000000000400 blocks: 32 deallocated

Lin Ma (4):
block: Add bdrv_co_get_lba_status
block: Add GET LBA STATUS support
block: Add block accounting code for GET LBA STATUS
scsi-disk: Add support for the GET LBA STATUS 16 command

 block/block-backend.c          | 38 ++++++++++++++
 block/io.c                     | 43 ++++++++++++++++
 hw/scsi/scsi-disk.c            | 92 ++++++++++++++++++++++++++++++++++
 include/block/accounting.h     |  1 +
 include/scsi/constants.h       |  1 +
 include/sysemu/block-backend.h |  2 +
 6 files changed, 177 insertions(+)
Signature · 1 line
2.24.0
author
#1 lore raw

PATCH 1/4 block: Add bdrv_co_get_lba_status

The get lba status wrapper based on the bdrv_block_status. The following patches will add GET LBA STATUS 16 support for scsi emulation layer.

---
 block/io.c | 43 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 43 insertions(+)
block/io.c +43 -0
index 121ce17a49..dacc3c2471 100644
@@ -2186,6 +2186,49 @@ int coroutine_fn bdrv_co_pwrite_zeroes(BdrvChild *child, int64_t offset,
                            BDRV_REQ_ZERO_WRITE | flags);
 }
 
+int coroutine_fn
+bdrv_co_get_lba_status(BdrvChild *child, int64_t offset, int64_t bytes,
+                       uint32_t *num_blocks, uint32_t *is_deallocated)
+{
+    BlockDriverState *bs = child->bs;
+    int ret;
+    int64_t target_size, count = 0;
+    bool first = true;
+    uint8_t wanted_bit1 = 0;
+
+    target_size = bdrv_getlength(bs);
+    if (target_size < 0) {
+        return -EIO;
+    }
+
+    if (offset < 0 || bytes < 0) {
+        return -EIO;
+    }
+
+    for ( ; offset <= target_size - bytes; offset += count) {
+        ret = bdrv_block_status(bs, offset, bytes, &count, NULL, NULL);
+        if (ret < 0) {
+            goto out;
+        }
+        if (first) {
+            if (ret & BDRV_BLOCK_ZERO) {
+                wanted_bit1 = BDRV_BLOCK_ZERO >> 1;;
+                *is_deallocated = 1;
+            } else {
+                wanted_bit1 = 0;
+            }
+            first = false;
+        }
+        if ((ret & BDRV_BLOCK_ZERO) >> 1 == wanted_bit1) {
+            (*num_blocks)++;
+        } else {
+            break;
+        }
+    }
+out:
+    return ret;
+}
+
 /*
  * Flush ALL BDSes regardless of if they are reachable via a BlkBackend or not.
  */
Signature · 1 line
2.24.0
#2 lore raw

Re: [PATCH 1/4] block: Add bdrv_co_get_lba_status

Hi Lin,

just a couple of things, leaving the core aspects to more knowledgeable people in this area to address.

In general, you want all patches in the series to build correctly.

Applying only PATCH 1/4 breaks the build for me with:

/home/claudio/git/qemu/block/io.c:2190:1: error: no previous prototype for ‘bdrv_co_get_lba_status’ [-Werror=missing-prototypes]
bdrv_co_get_lba_status(BdrvChild *child, int64_t offset, int64_t bytes,
^~~~~~~~~~~~~~~~~~~~~~
/home/claudio/git/qemu/block/io.c: In function ‘bdrv_co_get_lba_status’:
/home/claudio/git/qemu/block/io.c:2194:9: error: ‘ret’ may be used uninitialized in this function [-Werror=maybe-uninitialized]

     int ret;
         ^~~

cc1: all warnings being treated as errors

Quoted 33 lines · Lin Ma

The get lba status wrapper based on the bdrv_block_status. The following patches will add GET LBA STATUS 16 support for scsi emulation layer.

---
 block/io.c | 43 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 43 insertions(+)
block/io.c +17 -0
index 121ce17a49..dacc3c2471 100644
@@ -2186,6 +2186,49 @@ int coroutine_fn bdrv_co_pwrite_zeroes(BdrvChild *child, int64_t offset,
                            BDRV_REQ_ZERO_WRITE | flags);
 }
 
+int coroutine_fn
+bdrv_co_get_lba_status(BdrvChild *child, int64_t offset, int64_t bytes,
+                       uint32_t *num_blocks, uint32_t *is_deallocated)
+{
+    BlockDriverState *bs = child->bs;
+    int ret;
+    int64_t target_size, count = 0;
+    bool first = true;
+    uint8_t wanted_bit1 = 0;
+
+    target_size = bdrv_getlength(bs);
+    if (target_size < 0) {
+        return -EIO;
+    }
+
+    if (offset < 0 || bytes < 0) {
+        return -EIO;

block/io.c int coroutine_fn bdrv_co_pwrite_zeroes(BdrvChild *child, int64_t offset, · line 2215

Quoted 10 lines
block/io.c +10 -0
+    }
+
+    for ( ; offset <= target_size - bytes; offset += count) {
+        ret = bdrv_block_status(bs, offset, bytes, &count, NULL, NULL);
+        if (ret < 0) {
+            goto out;
+        }
+        if (first) {
+            if (ret & BDRV_BLOCK_ZERO) {
+                wanted_bit1 = BDRV_BLOCK_ZERO >> 1;;

extra ; at the end of the line

Quoted 10 lines
block/io.c +9 -0
+                *is_deallocated = 1;
+            } else {
+                wanted_bit1 = 0;
+            }
+            first = false;
+        }
+        if ((ret & BDRV_BLOCK_ZERO) >> 1 == wanted_bit1) {
+            (*num_blocks)++;
+        } else {

block/io.c int coroutine_fn bdrv_co_pwrite_zeroes(BdrvChild *child, int64_t offset, · line 2234

Quoted 10 lines
block/io.c +7 -0
+            break;
+        }
+    }
+out:
+    return ret;
+}
+
 /*
  * Flush ALL BDSes regardless of if they are reachable via a BlkBackend or not.
  */

Ciao,

CLaudio

author
#3 lore raw

PATCH 2/4 block: Add GET LBA STATUS support

In reply to Lin Ma
---
 block/block-backend.c          | 38 ++++++++++++++++++++++++++++++++++
 include/sysemu/block-backend.h |  2 ++
 2 files changed, 40 insertions(+)
block/block-backend.c +38 -0
index 6936b25c83..feb1f38b98 100644
@@ -1650,6 +1650,44 @@ int blk_pdiscard(BlockBackend *blk, int64_t offset, int bytes)
     return blk_prw(blk, offset, NULL, bytes, blk_pdiscard_entry, 0);
 }
 
+static int coroutine_fn
+blk_do_get_lba_status(BlockBackend *blk, int64_t offset, int bytes,
+                      uint32_t *num_blocks, uint32_t *is_deallocated)
+{
+    int ret;
+
+    blk_wait_while_drained(blk);
+
+    ret = blk_check_byte_request(blk, offset, bytes);
+    if (ret < 0) {
+        return ret;
+    }
+
+    return bdrv_co_get_lba_status(blk->root, offset, bytes, num_blocks,
+                                  is_deallocated);
+}
+
+static void blk_aio_get_lba_status_entry(void *opaque)
+{
+    BlkAioEmAIOCB *acb = opaque;
+    BlkRwCo *rwco = &acb->rwco;
+
+    void *data = acb->common.opaque;
+    uint32_t *num_blocks = &data[0];
+    uint32_t *is_deallocated = &data[sizeof(uint32_t)];
+
+    rwco->ret = blk_do_get_lba_status(rwco->blk, rwco->offset, acb->bytes,
+                                      num_blocks, is_deallocated);
+    blk_aio_complete(acb);
+}
+
+BlockAIOCB *blk_aio_get_lba_status(BlockBackend *blk, int64_t offset, int bytes,
+                                   BlockCompletionFunc *cb, void *opaque)
+{
+    return blk_aio_prwv(blk, offset, bytes, NULL, blk_aio_get_lba_status_entry,
+                        0, cb, opaque);
+}
+
 /* To be called between exactly one pair of blk_inc/dec_in_flight() */
 static int coroutine_fn blk_do_flush(BlockBackend *blk)
 {
include/sysemu/block-backend.h +2 -0
index 8203d7f6f9..cd527ec0c9 100644
@@ -171,6 +171,8 @@ BlockAIOCB *blk_aio_flush(BlockBackend *blk,
                           BlockCompletionFunc *cb, void *opaque);
 BlockAIOCB *blk_aio_pdiscard(BlockBackend *blk, int64_t offset, int bytes,
                              BlockCompletionFunc *cb, void *opaque);
+BlockAIOCB *blk_aio_get_lba_status(BlockBackend *blk, int64_t offset, int bytes,
+                                   BlockCompletionFunc *cb, void *opaque);
 void blk_aio_cancel(BlockAIOCB *acb);
 void blk_aio_cancel_async(BlockAIOCB *acb);
 int blk_ioctl(BlockBackend *blk, unsigned long int req, void *buf);
Signature · 1 line
2.24.0
author
#4 lore raw

PATCH 3/4 block: Add block accounting code for GET LBA STATUS

In reply to Lin Ma
---
 include/block/accounting.h | 1 +
 1 file changed, 1 insertion(+)
include/block/accounting.h +1 -0
index 878b4c3581..645014fb0b 100644
@@ -38,6 +38,7 @@ enum BlockAcctType {
     BLOCK_ACCT_WRITE,
     BLOCK_ACCT_FLUSH,
     BLOCK_ACCT_UNMAP,
+    BLOCK_ACCT_GET_LBA_STATUS,
     BLOCK_MAX_IOTYPE,
 };
 
Signature · 1 line
2.24.0
#5 lore raw

Re: [PATCH 3/4] block: Add block accounting code for GET LBA STATUS

Quoted 11 lines · Lin Ma
---
 include/block/accounting.h | 1 +
 1 file changed, 1 insertion(+)
include/block/accounting.h +0 -0
index 878b4c3581..645014fb0b 100644

include/block/accounting.h enum BlockAcctType { · line 44

Quoted 7 lines
include/block/accounting.h +1 -0
@@ -38,6 +38,7 @@ enum BlockAcctType {
     BLOCK_ACCT_WRITE,
     BLOCK_ACCT_FLUSH,
     BLOCK_ACCT_UNMAP,
+    BLOCK_ACCT_GET_LBA_STATUS,
     BLOCK_MAX_IOTYPE,
 };
 

This should probably be combined with the change that makes use of BLOCK_ACCT_GET_LBA_STATUS to constitute a single, meaningful change.

Ciao,

Claudio

author
#6 lore raw

PATCH 4/4 scsi-disk: Add support for the GET LBA STATUS 16 command

In reply to Lin Ma
---
 hw/scsi/scsi-disk.c      | 92 ++++++++++++++++++++++++++++++++++++++++
 include/scsi/constants.h |  1 +
 2 files changed, 93 insertions(+)
hw/scsi/scsi-disk.c +92 -0
index 387503e11b..2d2c6b4b82 100644
@@ -1866,6 +1866,91 @@ static void scsi_disk_emulate_write_data(SCSIRequest *req)
     }
 }
 
+typedef struct GetLbaStatusCBData {
+    uint32_t num_blocks;
+    uint32_t is_deallocated;
+    SCSIDiskReq *r;
+} GetLbaStatusCBData;
+
+static void scsi_get_lba_status_complete(void *opaque, int ret);
+
+static void scsi_get_lba_status_complete_noio(GetLbaStatusCBData *data, int ret)
+{
+    SCSIDiskReq *r = data->r;
+    SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, r->req.dev);
+
+    assert(r->req.aiocb == NULL);
+
+    block_acct_start(blk_get_stats(s->qdev.conf.blk), &r->acct,
+                     s->qdev.blocksize, BLOCK_ACCT_GET_LBA_STATUS);
+
+    r->req.aiocb = blk_aio_get_lba_status(s->qdev.conf.blk,
+                                          r->req.cmd.lba * s->qdev.blocksize,
+                                          s->qdev.blocksize,
+                                          scsi_get_lba_status_complete, data);
+    return;
+}
+
+static void scsi_get_lba_status_complete(void *opaque, int ret)
+{
+    GetLbaStatusCBData *data = opaque;
+    SCSIDiskReq *r = data->r;
+    SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, r->req.dev);
+
+    assert(r->req.aiocb != NULL);
+    r->req.aiocb = NULL;
+
+    aio_context_acquire(blk_get_aio_context(s->qdev.conf.blk));
+    if (scsi_disk_req_check_error(r, ret, true)) {
+        g_free(data);
+        goto done;
+    }
+
+    block_acct_done(blk_get_stats(s->qdev.conf.blk), &r->acct);
+    scsi_req_unref(&r->req);
+    g_free(data);
+
+done:
+    aio_context_release(blk_get_aio_context(s->qdev.conf.blk));
+}
+
+static void scsi_disk_emulate_get_lba_status(SCSIRequest *req, uint8_t *outbuf)
+{
+    SCSIDiskReq *r = DO_UPCAST(SCSIDiskReq, req, req);
+    GetLbaStatusCBData *data;
+    uint32_t *num_blocks;
+    uint32_t *is_deallocated;
+
+    data = g_new0(GetLbaStatusCBData, 1);
+    data->r = r;
+    num_blocks = &(data->num_blocks);
+    is_deallocated = &(data->is_deallocated);
+
+    scsi_req_ref(&r->req);
+    scsi_get_lba_status_complete_noio(data, 0);
+
+    /* 8 + 16 is the length in bytes of response header and
+     * one LBA status descriptor
+     */
+    memset(outbuf, 0, 8 + 16);
+    outbuf[3] = 20;
+    outbuf[8] = (req->cmd.lba >> 56) & 0xff;
+    outbuf[9] = (req->cmd.lba >> 48) & 0xff;
+    outbuf[10] = (req->cmd.lba >> 40) & 0xff;
+    outbuf[11] = (req->cmd.lba >> 32) & 0xff;
+    outbuf[12] = (req->cmd.lba >> 24) & 0xff;
+    outbuf[13] = (req->cmd.lba >> 16) & 0xff;
+    outbuf[14] = (req->cmd.lba >> 8) & 0xff;
+    outbuf[15] = req->cmd.lba & 0xff;
+    outbuf[16] = (*num_blocks >> 24) & 0xff;
+    outbuf[17] = (*num_blocks >> 16) & 0xff;
+    outbuf[18] = (*num_blocks >> 8) & 0xff;
+    outbuf[19] = *num_blocks & 0xff;
+    outbuf[20] = *is_deallocated ? 1 : 0;
+
+    return;
+}
+
 static int32_t scsi_disk_emulate_command(SCSIRequest *req, uint8_t *buf)
 {
     SCSIDiskReq *r = DO_UPCAST(SCSIDiskReq, req, req);
@@ -2076,6 +2161,13 @@ static int32_t scsi_disk_emulate_command(SCSIRequest *req, uint8_t *buf)
 
             /* Protection, exponent and lowest lba field left blank. */
             break;
+        } else if ((req->cmd.buf[1] & 31) == SAI_GET_LBA_STATUS) {
+            if (req->cmd.lba > s->qdev.max_lba) {
+                goto illegal_lba;
+            }
+            scsi_disk_emulate_get_lba_status(req, outbuf);
+            r->iov.iov_len = req->cmd.xfer;
+            return r->iov.iov_len;
         }
         trace_scsi_disk_emulate_command_SAI_unsupported();
         goto illegal_request;
include/scsi/constants.h +1 -0
index 874176019e..1b6417898a 100644
@@ -154,6 +154,7 @@
  * SERVICE ACTION IN subcodes
  */
 #define SAI_READ_CAPACITY_16  0x10
+#define SAI_GET_LBA_STATUS  0x12
 
 /*
  * READ POSITION service action codes
Signature · 1 line
2.24.0
#7 lore raw

Re: [PATCH 4/4] scsi-disk: Add support for the GET LBA STATUS 16 command

Quoted 27 lines · Lin Ma
---
 hw/scsi/scsi-disk.c      | 92 ++++++++++++++++++++++++++++++++++++++++
 include/scsi/constants.h |  1 +
 2 files changed, 93 insertions(+)
hw/scsi/scsi-disk.c +13 -0
index 387503e11b..2d2c6b4b82 100644
@@ -1866,6 +1866,91 @@ static void scsi_disk_emulate_write_data(SCSIRequest *req)
     }
 }
 
+typedef struct GetLbaStatusCBData {
+    uint32_t num_blocks;
+    uint32_t is_deallocated;
+    SCSIDiskReq *r;
+} GetLbaStatusCBData;
+
+static void scsi_get_lba_status_complete(void *opaque, int ret);
+
+static void scsi_get_lba_status_complete_noio(GetLbaStatusCBData *data, int ret)
+{
+    SCSIDiskReq *r = data->r;
+    SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, r->req.dev);
+

hw/scsi/scsi-disk.c static void scsi_disk_emulate_write_data(SCSIRequest *req) · line 1891

Quoted 10 lines
hw/scsi/scsi-disk.c +10 -0
+    assert(r->req.aiocb == NULL);
+
+    block_acct_start(blk_get_stats(s->qdev.conf.blk), &r->acct,
+                     s->qdev.blocksize, BLOCK_ACCT_GET_LBA_STATUS);
+
+    r->req.aiocb = blk_aio_get_lba_status(s->qdev.conf.blk,
+                                          r->req.cmd.lba * s->qdev.blocksize,
+                                          s->qdev.blocksize,
+                                          scsi_get_lba_status_complete, data);
+    return;

this return statement does not add anything of value, I think you can remove it.

Quoted 33 lines
hw/scsi/scsi-disk.c +33 -0
+}
+
+static void scsi_get_lba_status_complete(void *opaque, int ret)
+{
+    GetLbaStatusCBData *data = opaque;
+    SCSIDiskReq *r = data->r;
+    SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, r->req.dev);
+
+    assert(r->req.aiocb != NULL);
+    r->req.aiocb = NULL;
+
+    aio_context_acquire(blk_get_aio_context(s->qdev.conf.blk));
+    if (scsi_disk_req_check_error(r, ret, true)) {
+        g_free(data);
+        goto done;
+    }
+
+    block_acct_done(blk_get_stats(s->qdev.conf.blk), &r->acct);
+    scsi_req_unref(&r->req);
+    g_free(data);
+
+done:
+    aio_context_release(blk_get_aio_context(s->qdev.conf.blk));
+}
+
+static void scsi_disk_emulate_get_lba_status(SCSIRequest *req, uint8_t *outbuf)
+{
+    SCSIDiskReq *r = DO_UPCAST(SCSIDiskReq, req, req);
+    GetLbaStatusCBData *data;
+    uint32_t *num_blocks;
+    uint32_t *is_deallocated;
+
+    data = g_new0(GetLbaStatusCBData, 1);

hw/scsi/scsi-disk.c static void scsi_disk_emulate_write_data(SCSIRequest *req) · line 1934

Quoted 10 lines
hw/scsi/scsi-disk.c +10 -0
+    data->r = r;
+    num_blocks = &(data->num_blocks);
+    is_deallocated = &(data->is_deallocated);
+
+    scsi_req_ref(&r->req);
+    scsi_get_lba_status_complete_noio(data, 0);
+
+    /* 8 + 16 is the length in bytes of response header and
+     * one LBA status descriptor
+     */

this should probably look like:

/*
* 8 + 16 ...
* one LBA ...
*/

Quoted 7 lines
hw/scsi/scsi-disk.c +7 -0
+    memset(outbuf, 0, 8 + 16);
+    outbuf[3] = 20;
+    outbuf[8] = (req->cmd.lba >> 56) & 0xff;
+    outbuf[9] = (req->cmd.lba >> 48) & 0xff;
+    outbuf[10] = (req->cmd.lba >> 40) & 0xff;
+    outbuf[11] = (req->cmd.lba >> 32) & 0xff;
+    outbuf[12] = (req->cmd.lba >> 24) & 0xff;

hw/scsi/scsi-disk.c static void scsi_disk_emulate_write_data(SCSIRequest *req) · line 1951

Quoted 10 lines
hw/scsi/scsi-disk.c +10 -0
+    outbuf[13] = (req->cmd.lba >> 16) & 0xff;
+    outbuf[14] = (req->cmd.lba >> 8) & 0xff;
+    outbuf[15] = req->cmd.lba & 0xff;
+    outbuf[16] = (*num_blocks >> 24) & 0xff;
+    outbuf[17] = (*num_blocks >> 16) & 0xff;
+    outbuf[18] = (*num_blocks >> 8) & 0xff;
+    outbuf[19] = *num_blocks & 0xff;
+    outbuf[20] = *is_deallocated ? 1 : 0;
+
+    return;

(see above)

Quoted 32 lines
hw/scsi/scsi-disk.c +9 -0
+}
+
 static int32_t scsi_disk_emulate_command(SCSIRequest *req, uint8_t *buf)
 {
     SCSIDiskReq *r = DO_UPCAST(SCSIDiskReq, req, req);
@@ -2076,6 +2161,13 @@ static int32_t scsi_disk_emulate_command(SCSIRequest *req, uint8_t *buf)
 
             /* Protection, exponent and lowest lba field left blank. */
             break;
+        } else if ((req->cmd.buf[1] & 31) == SAI_GET_LBA_STATUS) {
+            if (req->cmd.lba > s->qdev.max_lba) {
+                goto illegal_lba;
+            }
+            scsi_disk_emulate_get_lba_status(req, outbuf);
+            r->iov.iov_len = req->cmd.xfer;
+            return r->iov.iov_len;
         }
         trace_scsi_disk_emulate_command_SAI_unsupported();
         goto illegal_request;
include/scsi/constants.h +1 -0
index 874176019e..1b6417898a 100644
@@ -154,6 +154,7 @@
  * SERVICE ACTION IN subcodes
  */
 #define SAI_READ_CAPACITY_16  0x10
+#define SAI_GET_LBA_STATUS  0x12
 
 /*
  * READ POSITION service action codes
#8 lore raw
In reply to Lin Ma
Patchew URL: https://patchew.org/QEMU/[email protected]/

Patchew URL: https://patchew.org/QEMU/[email protected]/

Hi,

This series failed the docker-quick@centos7 build test. Please find the testing commands and their output below. If you have Docker installed, you can probably reproduce it locally.

=== TEST SCRIPT BEGIN ===
#!/bin/bash
make docker-image-centos7 V=1 NETWORK=1
time make docker-test-quick@centos7 SHOW_ENV=1 J=14 NETWORK=1 === TEST SCRIPT END ===

CC block/nvme.o
CC block/throttle-groups.o
/tmp/qemu-test/src/block/block-backend.c: In function 'blk_do_get_lba_status':
/tmp/qemu-test/src/block/block-backend.c:1666:5: error: implicit declaration of function 'bdrv_co_get_lba_status' [-Werror=implicit-function-declaration]

     return bdrv_co_get_lba_status(blk->root, offset, bytes, num_blocks,
     ^
/tmp/qemu-test/src/block/block-backend.c:1666:5: error: nested extern declaration of 'bdrv_co_get_lba_status' [-Werror=nested-externs]
/tmp/qemu-test/src/block/block-backend.c: In function 'blk_aio_get_lba_status_entry':
/tmp/qemu-test/src/block/block-backend.c:1676:33: error: dereferencing 'void *' pointer [-Werror]
     uint32_t *num_blocks = &data[0];
                                 ^
/tmp/qemu-test/src/block/block-backend.c:1677:37: error: dereferencing 'void *' pointer [-Werror]
     uint32_t *is_deallocated = &data[sizeof(uint32_t)];
                                     ^

cc1: all warnings being treated as errors
make: *** [block/block-backend.o] Error 1
make: *** Waiting for unfinished jobs....
/tmp/qemu-test/src/block/io.c:2190:1: error: no previous prototype for 'bdrv_co_get_lba_status' [-Werror=missing-prototypes]
bdrv_co_get_lba_status(BdrvChild *child, int64_t offset, int64_t bytes,
^
cc1: all warnings being treated as errors
make: *** [block/io.o] Error 1
Traceback (most recent call last):
File "./tests/docker/docker.py", line 665, in <module>

    sys.exit(main())

---
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['sudo', '-n', 'docker', 'run', '--label', 'com.qemu.instance.uuid=e0beb28f32564939b51782a3a5fc4b8e', '-u', '1001', '--security-opt', 'seccomp=unconfined', '--rm', '-e', 'TARGET_LIST=', '-e', 'EXTRA_CONFIGURE_OPTS=', '-e', 'V=', '-e', 'J=14', '-e', 'DEBUG=', '-e', 'SHOW_ENV=1', '-e', 'CCACHE_DIR=/var/tmp/ccache', '-v', '/home/patchew/.cache/qemu-docker-ccache:/var/tmp/ccache:z', '-v', '/var/tmp/patchew-tester-tmp-3acrwdcl/src/docker-src.2020-06-02-03.50.11.11734:/var/tmp/qemu:z,ro', 'qemu:centos7', '/var/tmp/qemu/run', 'test-quick']' returned non-zero exit status 2. filter=--filter=label=com.qemu.instance.uuid=e0beb28f32564939b51782a3a5fc4b8e
make[1]: *** [docker-run] Error 1
make[1]: Leaving directory `/var/tmp/patchew-tester-tmp-3acrwdcl/src'
make: *** [docker-run-test-quick@centos7] Error 2

real 2m17.058s
user 0m8.502s

The full log is available at
http://patchew.org/logs/[email protected]/testing.docker-quick@centos7/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to [email protected]

#9 lore raw
In reply to Lin Ma
Patchew URL: https://patchew.org/QEMU/[email protected]/

Patchew URL: https://patchew.org/QEMU/[email protected]/

Hi,

This series seems to have some coding style problems. See output below for more information:

Message-id: [email protected]
Subject: [PATCH 0/4] Add Support for GET LBA STATUS 16 command in scsi emulation
Type: series

=== TEST SCRIPT BEGIN ===
#!/bin/bash
git rev-parse base > /dev/null || exit 0
git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram
./scripts/checkpatch.pl --mailback base..
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384 Switched to a new branch 'test'
f21fd54 scsi-disk: Add support for the GET LBA STATUS 16 command 1cf515c block: Add block accounting code for GET LBA STATUS fb4af56 block: Add GET LBA STATUS support
3e12b00 block: Add bdrv_co_get_lba_status

=== OUTPUT BEGIN ===
1/4 Checking commit 3e12b00c0380 (block: Add bdrv_co_get_lba_status)
ERROR: superfluous trailing semicolon
#47: FILE: block/io.c:2215:
+ wanted_bit1 = BDRV_BLOCK_ZERO >> 1;;

total: 1 errors, 0 warnings, 49 lines checked

Patch 1/4 has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.

2/4 Checking commit fb4af5679e29 (block: Add GET LBA STATUS support)
3/4 Checking commit 1cf515c04a31 (block: Add block accounting code for GET LBA STATUS) 4/4 Checking commit f21fd540cc03 (scsi-disk: Add support for the GET LBA STATUS 16 command)
WARNING: Block comments use a leading /* on a separate line
#81: FILE: hw/scsi/scsi-disk.c:1932:
+ /* 8 + 16 is the length in bytes of response header and

total: 0 errors, 1 warnings, 111 lines checked

Patch 4/4 has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.
=== OUTPUT END ===

Test command exited with code: 1

The full log is available at
http://patchew.org/logs/[email protected]/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to [email protected]

#10 lore raw
In reply to Lin Ma
Patchew URL: https://patchew.org/QEMU/[email protected]/

Patchew URL: https://patchew.org/QEMU/[email protected]/

Hi,

This series failed the asan build test. Please find the testing commands and their output below. If you have Docker installed, you can probably reproduce it locally.

=== TEST SCRIPT BEGIN ===
#!/bin/bash
export ARCH=x86_64
make docker-image-fedora V=1 NETWORK=1
time make docker-test-debug@fedora TARGET_LIST=x86_64-softmmu J=14 NETWORK=1 === TEST SCRIPT END ===

  CC      block/nvme.o
  CC      block/nbd.o
  CC      block/sheepdog.o
/tmp/qemu-test/src/block/block-backend.c:1666:12: error: implicit declaration of function 'bdrv_co_get_lba_status' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
    return bdrv_co_get_lba_status(blk->root, offset, bytes, num_blocks,
           ^

/tmp/qemu-test/src/block/block-backend.c:1666:12: note: did you mean 'blk_do_get_lba_status'? /tmp/qemu-test/src/block/block-backend.c:1654:1: note: 'blk_do_get_lba_status' declared here blk_do_get_lba_status(BlockBackend *blk, int64_t offset, int bytes,
^
/tmp/qemu-test/src/block/block-backend.c:1666:12: error: this function declaration is not a prototype [-Werror,-Wstrict-prototypes]

    return bdrv_co_get_lba_status(blk->root, offset, bytes, num_blocks,
           ^

2 errors generated.
make: *** [/tmp/qemu-test/src/rules.mak:69: block/block-backend.o] Error 1
make: *** Waiting for unfinished jobs....
/tmp/qemu-test/src/block/io.c:2190:1: error: no previous prototype for function 'bdrv_co_get_lba_status' [-Werror,-Wmissing-prototypes] bdrv_co_get_lba_status(BdrvChild *child, int64_t offset, int64_t bytes,
^
1 error generated.
make: *** [/tmp/qemu-test/src/rules.mak:69: block/io.o] Error 1
Traceback (most recent call last):
File "./tests/docker/docker.py", line 665, in <module>

    sys.exit(main())

---
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['sudo', '-n', 'docker', 'run', '--label', 'com.qemu.instance.uuid=aaeff486206e49e6b5c30d0f96e9933a', '-u', '1003', '--security-opt', 'seccomp=unconfined', '--rm', '-e', 'TARGET_LIST=x86_64-softmmu', '-e', 'EXTRA_CONFIGURE_OPTS=', '-e', 'V=', '-e', 'J=14', '-e', 'DEBUG=', '-e', 'SHOW_ENV=', '-e', 'CCACHE_DIR=/var/tmp/ccache', '-v', '/home/patchew2/.cache/qemu-docker-ccache:/var/tmp/ccache:z', '-v', '/var/tmp/patchew-tester-tmp-sk0g3zzx/src/docker-src.2020-06-02-03.50.12.11895:/var/tmp/qemu:z,ro', 'qemu:fedora', '/var/tmp/qemu/run', 'test-debug']' returned non-zero exit status 2. filter=--filter=label=com.qemu.instance.uuid=aaeff486206e49e6b5c30d0f96e9933a
make[1]: *** [docker-run] Error 1
make[1]: Leaving directory `/var/tmp/patchew-tester-tmp-sk0g3zzx/src'
make: *** [docker-run-test-debug@fedora] Error 2

real 4m28.592s
user 0m8.333s

The full log is available at
http://patchew.org/logs/[email protected]/testing.asan/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to [email protected]

#11 lore raw
In reply to Lin Ma
Patchew URL: https://patchew.org/QEMU/[email protected]/

Patchew URL: https://patchew.org/QEMU/[email protected]/

Hi,

This series failed the docker-mingw@fedora build test. Please find the testing commands and their output below. If you have Docker installed, you can probably reproduce it locally.

=== TEST SCRIPT BEGIN ===
#! /bin/bash
export ARCH=x86_64
make docker-image-fedora V=1 NETWORK=1
time make docker-test-mingw@fedora J=14 NETWORK=1
=== TEST SCRIPT END ===

CC block/replication.o
CC block/throttle.o
/tmp/qemu-test/src/block/block-backend.c: In function 'blk_do_get_lba_status':
/tmp/qemu-test/src/block/block-backend.c:1666:12: error: implicit declaration of function 'bdrv_co_get_lba_status'; did you mean 'blk_do_get_lba_status'? [-Werror=implicit-function-declaration]

     return bdrv_co_get_lba_status(blk->root, offset, bytes, num_blocks,
            ^~~~~~~~~~~~~~~~~~~~~~
            blk_do_get_lba_status
/tmp/qemu-test/src/block/block-backend.c:1666:12: error: nested extern declaration of 'bdrv_co_get_lba_status' [-Werror=nested-externs]
/tmp/qemu-test/src/block/block-backend.c: In function 'blk_aio_get_lba_status_entry':
/tmp/qemu-test/src/block/block-backend.c:1676:33: error: dereferencing 'void *' pointer [-Werror]
     uint32_t *num_blocks = &data[0];
                                 ^
/tmp/qemu-test/src/block/block-backend.c:1677:37: error: dereferencing 'void *' pointer [-Werror]
     uint32_t *is_deallocated = &data[sizeof(uint32_t)];
                                     ^

cc1: all warnings being treated as errors
make: *** [/tmp/qemu-test/src/rules.mak:69: block/block-backend.o] Error 1
make: *** Waiting for unfinished jobs....
/tmp/qemu-test/src/block/io.c:2190:1: error: no previous prototype for 'bdrv_co_get_lba_status' [-Werror=missing-prototypes]
bdrv_co_get_lba_status(BdrvChild *child, int64_t offset, int64_t bytes,
^~~~~~~~~~~~~~~~~~~~~~
/tmp/qemu-test/src/block/io.c: In function 'bdrv_co_get_lba_status':
/tmp/qemu-test/src/block/io.c:2194:9: error: 'ret' may be used uninitialized in this function [-Werror=maybe-uninitialized]

     int ret;
         ^~~

cc1: all warnings being treated as errors
make: *** [/tmp/qemu-test/src/rules.mak:69: block/io.o] Error 1 Traceback (most recent call last):
File "./tests/docker/docker.py", line 665, in <module>

    sys.exit(main())

---
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['sudo', '-n', 'docker', 'run', '--label', 'com.qemu.instance.uuid=130ab752886a4d91808d25eef0fb2b19', '-u', '1001', '--security-opt', 'seccomp=unconfined', '--rm', '-e', 'TARGET_LIST=', '-e', 'EXTRA_CONFIGURE_OPTS=', '-e', 'V=', '-e', 'J=14', '-e', 'DEBUG=', '-e', 'SHOW_ENV=', '-e', 'CCACHE_DIR=/var/tmp/ccache', '-v', '/home/patchew/.cache/qemu-docker-ccache:/var/tmp/ccache:z', '-v', '/var/tmp/patchew-tester-tmp-g7c0p0bd/src/docker-src.2020-06-02-03.54.28.23905:/var/tmp/qemu:z,ro', 'qemu:fedora', '/var/tmp/qemu/run', 'test-mingw']' returned non-zero exit status 2. filter=--filter=label=com.qemu.instance.uuid=130ab752886a4d91808d25eef0fb2b19
make[1]: *** [docker-run] Error 1
make[1]: Leaving directory `/var/tmp/patchew-tester-tmp-g7c0p0bd/src'
make: *** [docker-run-test-mingw@fedora] Error 2

real 2m5.434s
user 0m8.029s

The full log is available at
http://patchew.org/logs/[email protected]/testing.docker-mingw@fedora/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to [email protected]