All of lore.kernel.org
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: "Marc-André Lureau" <marcandre.lureau@gmail.com>
Cc: Roman Penyaev <r.peniaev@gmail.com>,
	 qemu-devel@nongnu.org,  Kevin Wolf <kwolf@redhat.com>
Subject: Re: [PATCH v4 6/8] chardev/char-mux: implement backend chardev multiplexing
Date: Wed, 11 Dec 2024 10:42:38 +0100	[thread overview]
Message-ID: <87frmuwo6p.fsf@pond.sub.org> (raw)
In-Reply-To: <CAJ+F1CLkn2WcmJEmNpJwNcc5VPriDTdSFWcv44QWaYtvHycKcQ@mail.gmail.com> ("Marc-André Lureau"'s message of "Wed, 16 Oct 2024 15:13:52 +0400")

I'm awfully, awfully late.  My apologies!
Marc-André Lureau <marcandre.lureau@gmail.com> writes:

> Hi
>
> On Wed, Oct 16, 2024 at 2:29 PM Roman Penyaev <r.peniaev@gmail.com> wrote:
>
>> This patch implements multiplexing capability of several backend
>> devices, which opens up an opportunity to use a single frontend
>> device on the guest, which can be manipulated from several
>> backend devices.
>>
>> The idea of the change is trivial: keep list of backend devices
>> (up to 4), init them on demand and forward data buffer back and
>> forth.
>>
>> Patch implements another multiplexer type `mux-be`. The following
>> is QEMU command line example:
>>
>>    -chardev mux-be,id=mux0 \
>>    -chardev socket,path=/tmp/sock,server=on,wait=off,id=sock0,mux-be-id=mux0 \
>>    -chardev vc,id=vc0,mux-be-id=mux0 \
>>
>
> I am not sure about adding "mux-be-id" to all chardev. It avoids the issue
> of expressing a list of ids in mux-be though (while it may have potential
> loop!)
>
> Markus, do you have a suggestion to take an array of chardev ids as a CLI
> option? It looks like we could require QAPIfy -chardev from Kevin here..

We've developed a number of ways of array-shaped configuration bits.
The most recent one relies on QAPI.  To not get bogged down in
compatibility considerations, let me show a new option first.

Create a QAPI type FooOptions for the option's argument, say

    { 'struct': 'FooOptions',
      'data': { 'ids': ['str'] } }

Create the new option -foo, and use qobject_input_visitor_new_str() and
visit_type_T() to parse its argument into a T.

The new option now supports both JSON and dotted keys syntax for its
argument.

JSON example:

    -foo '{"ids": ["eins", "zwei", "drei"]}'

Same in dotted keys:

    -foo ids.0=eins,ids.1=zwei,ids.2=drei

Note: dotted keys are slightly less expressive than JSON.  For instance,
they can't do empty arrays.  Users need to fall back to JSON then.
Peruse the big comment in util/keyval.c if you're curious.

Things can get messy when QAPIfying an existing option argument.  Dotted
keys are designed to be close to QemuOpts, but they're not identical.
If existing usage of the option argument relies on funky QemuOpts
features dotted keys don't replicate, we have a compatibility problem.
For complicated arguments, we may not know whether we have a
compatibility problem.

We can sacrifice dotted key syntax to avoid compatibility problems: if
the argument isn't JSON, fall back to the old option parsing code
instead.  Ugly, because we then have effectively two interfaces instead
of a single interface with a choice of syntax.

Hope this still helps at least some.



  parent reply	other threads:[~2024-12-11  9:43 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-16 10:25 [PATCH v4 0/8] chardev: implement backend chardev multiplexing Roman Penyaev
2024-10-16 10:25 ` [PATCH v4 1/8] chardev/char: rename `MuxChardev` struct to `MuxFeChardev` Roman Penyaev
2024-10-16 10:25 ` [PATCH v4 2/8] chardev/char: rename `char-mux.c` to `char-mux-fe.c` Roman Penyaev
2024-10-16 10:26 ` [PATCH v4 3/8] chardev/char: move away mux suspend/resume calls Roman Penyaev
2024-10-16 10:26 ` [PATCH v4 4/8] chardev/char: rename frontend mux calls Roman Penyaev
2024-10-16 10:26 ` [PATCH v4 5/8] chardev/char: introduce `mux-be-id=ID` option Roman Penyaev
2024-10-16 10:26 ` [PATCH v4 6/8] chardev/char-mux: implement backend chardev multiplexing Roman Penyaev
2024-10-16 11:13   ` Marc-André Lureau
2024-10-16 11:18     ` Marc-André Lureau
2024-10-16 14:19     ` Roman Penyaev
2024-11-20  8:00     ` Roman Penyaev
2024-12-11  9:42     ` Markus Armbruster [this message]
2024-12-17 10:32       ` Roman Penyaev
2024-12-19 13:45         ` Markus Armbruster
2025-01-16 11:27         ` Kevin Wolf
2025-01-17  8:03           ` Roman Penyaev
2025-01-17 13:20             ` Kevin Wolf
2024-10-16 10:26 ` [PATCH v4 7/8] tests/unit/test-char: add unit test for the `mux-be` multiplexer Roman Penyaev
2024-10-16 11:36   ` Marc-André Lureau
2024-10-17 13:48     ` Roman Penyaev
2024-10-16 10:26 ` [PATCH v4 8/8] qemu-options.hx: describe multiplexing of several backend devices Roman Penyaev
2024-10-16 11:27   ` Marc-André Lureau

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=87frmuwo6p.fsf@pond.sub.org \
    --to=armbru@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=marcandre.lureau@gmail.com \
    --cc=qemu-devel@nongnu.org \
    --cc=r.peniaev@gmail.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.