qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Kevin Wolf <kwolf@redhat.com>
To: Stefan Hajnoczi <stefanha@redhat.com>
Cc: pkrempa@redhat.com, Alberto Garcia <berto@igalia.com>,
	slp@redhat.com, qemu-block@nongnu.org, qemu-devel@nongnu.org,
	rjones@redhat.com, mreitz@redhat.com,
	Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>,
	Klaus Jensen <its@irrelevant.dk>,
	philmd@redhat.com, Markus Armbruster <armbru@redhat.com>,
	sgarzare@redhat.com
Subject: Re: [ANNOUNCE] libblkio v0.1.0 preview release
Date: Thu, 29 Apr 2021 17:51:16 +0200	[thread overview]
Message-ID: <YIrV9MqlqwUhJR+B@merkur.fritz.box> (raw)
In-Reply-To: <YIq9PpAd6nP9XTmz@stefanha-x1.localdomain>

[-- Attachment #1: Type: text/plain, Size: 2804 bytes --]

Am 29.04.2021 um 16:05 hat Stefan Hajnoczi geschrieben:
> Hi,
> A preview release of libblkio, a library for high-performance block I/O,
> is now available:
> 
>   https://gitlab.com/libblkio/libblkio/-/tree/v0.1.0
> 
> Applications are increasingly integrating high-performance I/O
> interfaces such as Linux io_uring, userspace device drivers, and
> vhost-user device support. The effort required to add each of these
> low-level interfaces into an application is relatively high. libblkio
> provides a single API for efficiently accessing block devices and
> eliminates the need to write custom code for each one.
> 
> The library is not yet ready to use and currently lacks many features.
> In fact, I hope this news doesn't spread too far yet because libblkio is
> at a very early stage, but feedback from the QEMU community is necessary
> at this time.

I'm a bit worried about the configuration interface. This looks an awful
lot like plain QOM properties, which have proven to result in both very
verbose (not to say messy) and rather error prone implementations.

You have to write setters/getters for every property, even if it usually
ends up doing the same thing, storing the value somewhere. Worse, these
getters and setters have to work in very different circumstances, namely
initialisation where you usually have to store the value away so that it
can be checked for consistency with other properties in .realize() or
.complete(), and property updates during runtime. Often enough, we
forget the latter and create bugs. If we don't create bugs, we usually
start with 'if (realized)' and have two completely different code paths.
Another common bug in QOM objects is forgetting to check if mandatory
properties were actually set.

Did you already consider these problems and decided to go this way
anyway, or is this more of an accidental design? And if the former, what
were the reasons that made it appealing?

Alternatives in QEMU are qdev properties (which are internally QOM
properties, but provide default implementations and are at least
automatically read-only after realize, avoiding that whole class of
bugs) and QAPI.
If this was QEMU code, I would of course go for QAPI, but a library is
something different and adding the code generator would probably be a
bit too much anyway. But the idea in the resulting code would be dealing
with native structs instead of a bunch of function calls. This would
probably be the least error prone way for the implementation, but of
course, it would make binary compatibility a bit harder when adding new
properties.

Thinking a bit further, we'll likely get the same problems as with QOM
in other places, too, e.g. how do you introspect which properties exist
in a given build?

Kevin

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  parent reply	other threads:[~2021-04-29 15:56 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-29 14:05 [ANNOUNCE] libblkio v0.1.0 preview release Stefan Hajnoczi
2021-04-29 14:22 ` Richard W.M. Jones
2021-04-29 14:41   ` Stefan Hajnoczi
2021-04-29 15:00     ` Richard W.M. Jones
2021-04-29 15:08       ` Daniel P. Berrangé
2021-04-29 15:31         ` Richard W.M. Jones
2021-04-29 15:35           ` Daniel P. Berrangé
2021-04-29 17:17         ` libnbd thread-local errors and dlclose (was: Re: [ANNOUNCE] libblkio v0.1.0 preview release) Richard W.M. Jones
2021-04-29 17:27           ` Daniel P. Berrangé
2021-04-30 16:20       ` [ANNOUNCE] libblkio v0.1.0 preview release Stefan Hajnoczi
2021-04-29 15:51 ` Kevin Wolf [this message]
2021-04-30 15:49   ` Stefan Hajnoczi
2021-05-04 13:44     ` Kevin Wolf
2021-05-05 16:19       ` Stefan Hajnoczi
2021-05-05 16:46         ` Kevin Wolf
2021-05-06  8:46           ` Stefan Hajnoczi
2021-05-06 10:33             ` Kevin Wolf
2021-05-06 13:53               ` Stefan Hajnoczi
2021-05-13  9:47               ` Stefan Hajnoczi
2021-05-14 15:55                 ` Kevin Wolf
2021-05-17 14:09                   ` Stefan Hajnoczi
2021-05-18  8:02                     ` Kevin Wolf

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=YIrV9MqlqwUhJR+B@merkur.fritz.box \
    --to=kwolf@redhat.com \
    --cc=armbru@redhat.com \
    --cc=berto@igalia.com \
    --cc=its@irrelevant.dk \
    --cc=mreitz@redhat.com \
    --cc=philmd@redhat.com \
    --cc=pkrempa@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=rjones@redhat.com \
    --cc=sgarzare@redhat.com \
    --cc=slp@redhat.com \
    --cc=stefanha@redhat.com \
    --cc=vsementsov@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 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).