From: "Alex Bennée" <alex.bennee@linaro.org>
To: Roman Penyaev <r.peniaev@gmail.com>
Cc: "Marc-André Lureau" <marcandre.lureau@redhat.com>, qemu-devel@nongnu.org
Subject: Re: [PATCH v7 2/4] chardev/char-hub: implement backend chardev aggregator
Date: Wed, 22 Jan 2025 14:44:14 +0000 [thread overview]
Message-ID: <871pwuoqm9.fsf@draig.linaro.org> (raw)
In-Reply-To: <20250118164056.830721-3-r.peniaev@gmail.com> (Roman Penyaev's message of "Sat, 18 Jan 2025 17:40:50 +0100")
Roman Penyaev <r.peniaev@gmail.com> writes:
> This patch implements a new chardev backend `hub` device, which
> aggregates input from multiple backend devices and forwards it to a
> single frontend device. Additionally, `hub` device takes the output
> from the frontend device and sends it back to all the connected
> backend devices. This allows for seamless interaction between
> different backend devices and a single frontend interface.
>
> 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.
>
> The following is QEMU command line example:
>
> -chardev pty,path=/tmp/pty,id=pty0 \
> -chardev vc,id=vc0 \
> -chardev hub,id=hub0,chardevs.0=pty0,chardevs.1=vc0 \
> -device virtconsole,chardev=hub0 \
> -vnc 0.0.0.0:0
>
> Which creates 2 backend devices: text virtual console (`vc0`) and a
> pseudo TTY (`pty0`) connected to the single virtio hvc console with
> the backend aggregator (`hub0`) help. `vc0` renders text to an image,
> which can be shared over the VNC protocol. `pty0` is a pseudo TTY
> backend which provides biderectional communication to the virtio hvc
> console.
>
<snip>
> +static void qemu_chr_open_hub(Chardev *chr,
> + ChardevBackend *backend,
> + bool *be_opened,
> + Error **errp)
> +{
> + ChardevHub *hub = backend->u.hub.data;
> + HubChardev *d = HUB_CHARDEV(chr);
> + strList *list = hub->chardevs;
> +
> + d->be_eagain_ind = -1;
> +
> + if (list == NULL) {
> + error_setg(errp, "hub: 'chardevs' list is not defined");
> + return;
> + }
> +
> + while (list) {
> + Chardev *s;
> +
> + s = qemu_chr_find(list->value);
> + if (s == NULL) {
> + error_setg(errp, "hub: chardev can't be found by id '%s'",
> + list->value);
> + return;
> + }
> + if (CHARDEV_IS_HUB(s) || CHARDEV_IS_MUX(s)) {
> + error_setg(errp, "hub: multiplexers and hub devices can't be "
> + "stacked, check chardev '%s', chardev should not "
> + "be a hub device or have 'mux=on' enabled",
> + list->value);
> + return;
So I was looking at this to see if I could implement what I wanted which
was a tee-like copy of a serial port output while maintaining the C-a
support of the mux.
Normally I just use the shortcut -serial mon:stdio
However that form is a special case so I tried the following and ran
into the above:
-chardev stdio,mux=on,id=char0 \
-chardev file,path=console.log,id=clog \
-mon chardev=char0,mode=readline \
-chardev hub,id=hub0,chardevs.0=char0,chardevs.1=clog
Giving:
qemu-system-aarch64: -chardev -hub,id=hub0,chardevs.0=char0,chardevs.1=clog: hub: -multiplexers and hub devices can't be stacked, check chardev
-'char0', chardev should not be a hub device or have 'mux=on' -enabled
So what stops this sort of chain?
--
Alex Bennée
Virtualisation Tech Lead @ Linaro
next prev parent reply other threads:[~2025-01-22 14:45 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-18 16:40 [PATCH v7 0/4] chardev: implement backend chardev multiplexing Roman Penyaev
2025-01-18 16:40 ` [PATCH v7 1/4] chardev/char-pty: send CHR_EVENT_CLOSED on disconnect Roman Penyaev
2025-01-21 15:14 ` Alex Bennée
2025-01-18 16:40 ` [PATCH v7 2/4] chardev/char-hub: implement backend chardev aggregator Roman Penyaev
[not found] ` <CAMxuvaxUDzGN1H-zUccQrEz0KvG+a_9t1iKVz4YJQrsdwr=WKA@mail.gmail.com>
2025-01-21 10:56 ` Roman Penyaev
2025-01-22 14:44 ` Alex Bennée [this message]
2025-01-22 15:17 ` Roman Penyaev
2025-01-18 16:40 ` [PATCH v7 3/4] tests/unit/test-char: add unit tests for hub chardev backend Roman Penyaev
2025-01-18 16:40 ` [PATCH v7 4/4] qemu-options.hx: describe hub chardev and aggregation of several backends Roman Penyaev
2025-01-21 15:02 ` Alex Bennée
2025-01-21 15:23 ` Roman Penyaev
2025-01-21 15:49 ` Roman Penyaev
2025-01-21 16:02 ` Alex Bennée
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=871pwuoqm9.fsf@draig.linaro.org \
--to=alex.bennee@linaro.org \
--cc=marcandre.lureau@redhat.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.