qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: Kevin Wolf <kwolf@redhat.com>
Cc: qemu-block@nongnu.org,  hreitz@redhat.com,  eblake@redhat.com,
	qemu-devel@nongnu.org
Subject: Re: [PATCH 1/2] block: Expose block limits for images in QMP
Date: Wed, 24 Sep 2025 12:43:39 +0200	[thread overview]
Message-ID: <87a52k2kro.fsf@pond.sub.org> (raw)
In-Reply-To: <aNO0SZalsYn-AYCW@redhat.com> (Kevin Wolf's message of "Wed, 24 Sep 2025 11:05:13 +0200")

Kevin Wolf <kwolf@redhat.com> writes:

> Am 24.09.2025 um 08:10 hat Markus Armbruster geschrieben:
>> Kevin Wolf <kwolf@redhat.com> writes:
>> 
>> > This information can be useful both for debugging and for management
>> > tools trying to configure guest devices with the optimal limits
>> > (possibly across multiple hosts). There is no reason not to make it
>> > available, so just add it to BlockNodeInfo.
>> >
>> > Signed-off-by: Kevin Wolf <kwolf@redhat.com>
>> > ---
>> >  qapi/block-core.json             | 59 ++++++++++++++++++++++++++++++++
>> >  block/qapi.c                     | 34 ++++++++++++++++--
>> >  tests/qemu-iotests/184           |  3 +-
>> >  tests/qemu-iotests/184.out       |  8 -----
>> >  tests/qemu-iotests/common.filter |  3 +-
>> >  5 files changed, 94 insertions(+), 13 deletions(-)
>> >
>> > diff --git a/qapi/block-core.json b/qapi/block-core.json
>> > index dc6eb4ae23..eda041ac1c 100644
>> > --- a/qapi/block-core.json
>> > +++ b/qapi/block-core.json
>> > @@ -275,6 +275,62 @@
>> >        'file': 'ImageInfoSpecificFileWrapper'
>> >    } }
>> >  
>> > +##
>> > +# @BlockLimitsInfo:
>> > +#
>> > +# @request-alignment: Alignment requirement, in bytes, for offset/length of I/O
>> > +#     requests.
>> > +#
>> > +# @max-discard: Maximum number of bytes that can be discarded at once. If not
>> > +#     present, there is no specific maximum.
>> > +#
>> > +# @discard-alignment: Optimal alignment for discard requests in bytes. A power
>> > +#     of 2 is best, but not mandatory. If not present, discards don't have a
>> > +#     alignment requirement different from @request-alignment.
>> 
>> What does the second sentence try to convey?  As far as I can tell, QMP
>> has BlockLimitsInfo is only in the result of query-block and
>> query-named-block-nodes, i.e. it's not something the user picks.
>
> I copied these descriptions from the comments in struct BlockLimits,
> just leaving out things that are clearly internal. Their nature is the
> same there, we never configure block limits, we only detect them.
>
> What I think this sentence wants to tell us is that while you may
> intuitively expect power-of-two limits, you shouldn't be surprised to
> occasionally find other numbers here, too.

Well, I would be surprised, so having the doc mention it makes sense.

> Maybe "Note that this doesn't have to be a power of two" instead? Both
> in QAPI and the struct definition.

Works for me.

>> > +#
>> > +# @max-write-zeroes: Maximum number of bytes that can be zeroed out at once. If
>> > +#     not present, there is no specific maximum.
>> > +#
>> > +# @write-zeroes-alignment: Optimal alignment for write_zeroes requests in
>> > +#     bytes. A power of 2 is best, but not mandatory. If not present,
>> > +#     write_zeroes doesn't have a alignment requirement different from
>> > +#     @request-alignment.
>> 
>> Likewise.
>> 
>> > +#
>> > +# @opt-transfer: Optimal transfer length in bytes. If not present, there is no
>> > +#     preferred size.
>> > +#
>> > +# @max-transfer: Maximal transfer length in bytes. If not present, there is no
>> > +#     specific maximum.
>> > +#
>> > +# @max-hw-transfer: Maximal hardware transfer length in bytes.  Applies
>> > +#     whenever transfers to the device bypass the kernel I/O scheduler, for
>> > +#     example with SG_IO. If not present, there is no specific maximum.
>> > +#
>> > +# @max-iov: Maximum number of scatter/gather elements
>> > +#
>> > +# @max-hw-iov: Maximal number of scatter/gather elements allowed by the hardware.
>> 
>> Maximum number
>> 
>> > +#     Applies whenever transfers to the device bypass the kernel I/O scheduler,
>> > +#     for example with SG_IO. If not present, the hardware limits is unknown
>> > +#     and @max-iov is always used.
>> > +#
>> > +# @min-mem-alignment: memory alignment in bytes so that no bounce buffer is needed
>> > +#
>> > +# @opt-mem-alignment: memory alignment in bytes that is used for bounce buffers
>> 
>> Why is this "opt"?  I guess it means "optimal".
>
> Yes, I think so. How about this:
>
> @min-mem-alignment: Minimal required memory alignment in bytes for
> zero-copy I/O to succeed. For unaligned requrests, a bounce buffer will

requests

> be used.
>
> @opt-mem-alignment: Optimal memory alignment in bytes. This is the
> alignment used for any buffer allocations QEMU performs internally.

Good!

[...]



  reply	other threads:[~2025-09-24 10:45 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-23 16:37 [PATCH 0/2] block: Expose block limits in monitor and qemu-img info Kevin Wolf
2025-09-23 16:37 ` [PATCH 1/2] block: Expose block limits for images in QMP Kevin Wolf
2025-09-23 18:03   ` Eric Blake
2025-09-24  6:10   ` Markus Armbruster
2025-09-24  9:05     ` Kevin Wolf
2025-09-24 10:43       ` Markus Armbruster [this message]
2025-09-23 16:37 ` [PATCH 2/2] qemu-img info: Optionally show block limits Kevin Wolf
2025-09-23 18:09   ` Eric Blake
2025-09-24  8:28     ` Kevin Wolf
2025-09-29 14:02 ` [PATCH 0/2] block: Expose block limits in monitor and qemu-img info Hanna Czenczek

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=87a52k2kro.fsf@pond.sub.org \
    --to=armbru@redhat.com \
    --cc=eblake@redhat.com \
    --cc=hreitz@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).