vdpa_sim_blk: use dev_dbg() to print errors

Use dev_dbg() instead of dev_err()/dev_warn() to avoid flooding the
host with prints, when the guest driver is misbehaving.
In this way, prints can be dynamically enabled when the vDPA block
simulator is used to validate a driver.

Suggested-by: Jason Wang <jasowang@redhat.com>
Acked-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
Message-Id: <20220630153221.83371-2-sgarzare@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
This commit is contained in:
Stefano Garzarella 2022-06-30 17:32:19 +02:00 committed by Michael S. Tsirkin
parent a335b33f4f
commit 42a84c09ef

View File

@ -76,13 +76,13 @@ static bool vdpasim_blk_handle_req(struct vdpasim *vdpasim,
return false; return false;
if (vq->out_iov.used < 1 || vq->in_iov.used < 1) { if (vq->out_iov.used < 1 || vq->in_iov.used < 1) {
dev_err(&vdpasim->vdpa.dev, "missing headers - out_iov: %u in_iov %u\n", dev_dbg(&vdpasim->vdpa.dev, "missing headers - out_iov: %u in_iov %u\n",
vq->out_iov.used, vq->in_iov.used); vq->out_iov.used, vq->in_iov.used);
return false; return false;
} }
if (vq->in_iov.iov[vq->in_iov.used - 1].iov_len < 1) { if (vq->in_iov.iov[vq->in_iov.used - 1].iov_len < 1) {
dev_err(&vdpasim->vdpa.dev, "request in header too short\n"); dev_dbg(&vdpasim->vdpa.dev, "request in header too short\n");
return false; return false;
} }
@ -96,7 +96,7 @@ static bool vdpasim_blk_handle_req(struct vdpasim *vdpasim,
bytes = vringh_iov_pull_iotlb(&vq->vring, &vq->out_iov, &hdr, bytes = vringh_iov_pull_iotlb(&vq->vring, &vq->out_iov, &hdr,
sizeof(hdr)); sizeof(hdr));
if (bytes != sizeof(hdr)) { if (bytes != sizeof(hdr)) {
dev_err(&vdpasim->vdpa.dev, "request out header too short\n"); dev_dbg(&vdpasim->vdpa.dev, "request out header too short\n");
return false; return false;
} }
@ -110,7 +110,7 @@ static bool vdpasim_blk_handle_req(struct vdpasim *vdpasim,
switch (type) { switch (type) {
case VIRTIO_BLK_T_IN: case VIRTIO_BLK_T_IN:
if (!vdpasim_blk_check_range(sector, to_push)) { if (!vdpasim_blk_check_range(sector, to_push)) {
dev_err(&vdpasim->vdpa.dev, dev_dbg(&vdpasim->vdpa.dev,
"reading over the capacity - offset: 0x%llx len: 0x%zx\n", "reading over the capacity - offset: 0x%llx len: 0x%zx\n",
offset, to_push); offset, to_push);
status = VIRTIO_BLK_S_IOERR; status = VIRTIO_BLK_S_IOERR;
@ -121,7 +121,7 @@ static bool vdpasim_blk_handle_req(struct vdpasim *vdpasim,
vdpasim->buffer + offset, vdpasim->buffer + offset,
to_push); to_push);
if (bytes < 0) { if (bytes < 0) {
dev_err(&vdpasim->vdpa.dev, dev_dbg(&vdpasim->vdpa.dev,
"vringh_iov_push_iotlb() error: %zd offset: 0x%llx len: 0x%zx\n", "vringh_iov_push_iotlb() error: %zd offset: 0x%llx len: 0x%zx\n",
bytes, offset, to_push); bytes, offset, to_push);
status = VIRTIO_BLK_S_IOERR; status = VIRTIO_BLK_S_IOERR;
@ -133,7 +133,7 @@ static bool vdpasim_blk_handle_req(struct vdpasim *vdpasim,
case VIRTIO_BLK_T_OUT: case VIRTIO_BLK_T_OUT:
if (!vdpasim_blk_check_range(sector, to_pull)) { if (!vdpasim_blk_check_range(sector, to_pull)) {
dev_err(&vdpasim->vdpa.dev, dev_dbg(&vdpasim->vdpa.dev,
"writing over the capacity - offset: 0x%llx len: 0x%zx\n", "writing over the capacity - offset: 0x%llx len: 0x%zx\n",
offset, to_pull); offset, to_pull);
status = VIRTIO_BLK_S_IOERR; status = VIRTIO_BLK_S_IOERR;
@ -144,7 +144,7 @@ static bool vdpasim_blk_handle_req(struct vdpasim *vdpasim,
vdpasim->buffer + offset, vdpasim->buffer + offset,
to_pull); to_pull);
if (bytes < 0) { if (bytes < 0) {
dev_err(&vdpasim->vdpa.dev, dev_dbg(&vdpasim->vdpa.dev,
"vringh_iov_pull_iotlb() error: %zd offset: 0x%llx len: 0x%zx\n", "vringh_iov_pull_iotlb() error: %zd offset: 0x%llx len: 0x%zx\n",
bytes, offset, to_pull); bytes, offset, to_pull);
status = VIRTIO_BLK_S_IOERR; status = VIRTIO_BLK_S_IOERR;
@ -157,7 +157,7 @@ static bool vdpasim_blk_handle_req(struct vdpasim *vdpasim,
vdpasim_blk_id, vdpasim_blk_id,
VIRTIO_BLK_ID_BYTES); VIRTIO_BLK_ID_BYTES);
if (bytes < 0) { if (bytes < 0) {
dev_err(&vdpasim->vdpa.dev, dev_dbg(&vdpasim->vdpa.dev,
"vringh_iov_push_iotlb() error: %zd\n", bytes); "vringh_iov_push_iotlb() error: %zd\n", bytes);
status = VIRTIO_BLK_S_IOERR; status = VIRTIO_BLK_S_IOERR;
break; break;
@ -167,8 +167,8 @@ static bool vdpasim_blk_handle_req(struct vdpasim *vdpasim,
break; break;
default: default:
dev_warn(&vdpasim->vdpa.dev, dev_dbg(&vdpasim->vdpa.dev,
"Unsupported request type %d\n", type); "Unsupported request type %d\n", type);
status = VIRTIO_BLK_S_IOERR; status = VIRTIO_BLK_S_IOERR;
break; break;
} }