All Virtuozzo development lists (kernel + QEMU)
 help / color / mirror / Atom feed
From: Alexander Ivanov <alexander.ivanov@virtuozzo.com>
To: no-reply@sashiko.virtuozzo.com, andrey.zhadchenko@virtuozzo.com
Cc: andrey.drobyshev@virtuozzo.com, svt-core@virtuozzo.com
Subject: Re: [PATCH hci-8.2 v4 4/5] vhost-blk: pause the VM on a request failed with ENOSPC #VSTOR-152175
Date: Tue, 1 Dec 2026 10:41:49 +0100	[thread overview]
Message-ID: <8750c827-a658-4136-a3dd-f44cd8a0e999@virtuozzo.com> (raw)
In-Reply-To: <010701a230ec6ca1-1f6f7a3e-f1ab-4f71-9cf2-747f0a0f3535-000000@eu-central-1.amazonses.com>

>> +    while (done < s->nr_held) {
>> +        nr = s->nr_held - done;
>> +        reqs->nr = nr;
>> +        for (i = 0; i < nr; i++) {
>> +            reqs->reqs[i].vq = s->held[done + i].vq;
>> +            reqs->reqs[i].head = s->held[done + i].head;
>> +        }
>> +
>> +        if (!ioctl(s->vhostfd, VHOST_BLK_RESUBMIT, reqs)) {
>> +            break;
>> +        }
>> +        if (reqs->nr >= nr) {
>> +            error_report("vhost-blk: unable to resubmit held requests: %s",
>> +                         strerror(errno));
>> +            break;
>> +        }
>> +
>> +        done += reqs->nr;
>> +        if (errno == ENOMEM) {
>> +            continue;
>> +        }
> [Severity: Medium]
> Can this loop spin forever? If VHOST_BLK_RESUBMIT keeps failing with ENOMEM and reports reqs->nr == 0, then done does not advance and the identical ioctl is reissued. There is no retry limit, backoff or zero-progress check.
>
> vhost_blk_resubmit_held() runs from vhost_blk_start() with the BQL held, so the whole VM and QMP would hang under persistent host memory pressure. Should the ENOMEM retry give up, or back off, when reqs->nr is 0?
Already answered on the previous revision: -ENOMEM here is transient, 
and bounding the retries would drop the held requests and hang the guest 
I/O for good.
>> +    req = &reqs->reqs[reqs->nr - 1];
>> +    path = object_get_canonical_path(OBJECT(dev));
>> +
>> +    qemu_system_vmstop_request_prepare();
>> +    qapi_event_send_block_io_error(path, proxy->id ?: "", NULL,
>> +                                   req->type == VIRTIO_BLK_T_IN ?
>> +                                   IO_OPERATION_TYPE_READ :
>> +                                   IO_OPERATION_TYPE_WRITE,
>> +                                   BLOCK_ERROR_ACTION_STOP, true,
>> +                                   req->error == ENOSPC, strerror(req->error),
>> +                                   0, 0);
> [Severity: Low]
> Is the event content accurate here? Any held request whose type is not VIRTIO_BLK_T_IN, such as flush, discard or write-zeroes, is reported as a WRITE. The offset and bytes are always 0, 0. The commit message says the event is emitted "as the block layer does for other devices", but management software gets inaccurate operation, offset and bytes fields.
This is intended. virtio-blk reports flush, discard and write-zeroes
failures as "write" too, IoOperationType has nothing else. The kernel
does not pass the sector and the length of a held request, so offset
and bytes are 0; libvirt does not read them.
>> +    event_notifier_set_handler(&s->error_notifier, vhost_blk_error_event);
>> +    s->hold_supported = !ioctl(s->vhostfd, VHOST_BLK_SET_ERROR_POLICY,
>> +                               &policy);
>> +    if (!s->hold_supported && vhost_blk_error_policy(s)) {
>> +        warn_report("vhost-blk: the kernel cannot hold failed requests, "
>> +                    "werror and rerror have no effect");
>> +    }
> [Severity: Low]
> Will this warning fire for every device on an older kernel? Realize maps werror=AUTO to BLOCKDEV_ON_ERROR_ENOSPC, so vhost_blk_error_policy() is non-zero even when the user never set werror or rerror. The result is log noise on every vhost-blk device, while the commit message only says "warn and run as before".
Intended: werror=auto means enospc, which pauses the VM on every other
block device. On an older kernel it does not, and the user should know
even with the defaults. It is one line per device at realize.

  reply	other threads:[~2026-12-01  9:41 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-01  9:18 [PATCH hci-8.2 v4 0/5] vhost-blk: support the werror/rerror policies Alexander Ivanov
2026-12-01  9:18 ` [PATCH hci-8.2 v4 1/5] linux-headers: add the vhost-blk held request ioctls #VSTOR-152175 Alexander Ivanov
2026-12-01  9:21   ` no-reply
2026-12-01  9:18 ` [PATCH hci-8.2 v4 2/5] vhost-blk: add the werror and rerror properties #VSTOR-152175 Alexander Ivanov
2026-12-01  9:18 ` [PATCH hci-8.2 v4 3/5] vhost-blk: stop vhost on every VM stop #VSTOR-152175 Alexander Ivanov
2026-12-01  9:24   ` no-reply
2026-12-01  9:18 ` [PATCH hci-8.2 v4 4/5] vhost-blk: pause the VM on a request failed with ENOSPC #VSTOR-152175 Alexander Ivanov
2026-12-01  9:25   ` no-reply
2026-12-01  9:41     ` Alexander Ivanov [this message]
2026-12-01  9:18 ` [PATCH hci-8.2 v4 5/5] vhost-blk: migrate the held requests #VSTOR-152175 Alexander Ivanov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8750c827-a658-4136-a3dd-f44cd8a0e999@virtuozzo.com \
    --to=alexander.ivanov@virtuozzo.com \
    --cc=andrey.drobyshev@virtuozzo.com \
    --cc=andrey.zhadchenko@virtuozzo.com \
    --cc=no-reply@sashiko.virtuozzo.com \
    --cc=svt-core@virtuozzo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.