Re: [Qemu-devel] [RFC] virtio-blk: simple multithreaded MQ implementation for bdrv_raw

2016-05-30 Thread Roman Penyaev
On Sat, May 28, 2016 at 12:27 AM, Stefan Hajnoczi wrote: > On Fri, May 27, 2016 at 01:55:04PM +0200, Roman Pen wrote: >> Hello, all. >> >> This is RFC because mostly this patch is a quick attempt to get true >> multithreaded multiqueue support for a block device with native AIO. >> The goal is to

Re: [Qemu-devel] [RFC] virtio-blk: simple multithreaded MQ implementation for bdrv_raw

2016-05-30 Thread Roman Penyaev
On Mon, May 30, 2016 at 8:40 AM, Alexandre DERUMIER wrote: > Hi, > >>>To avoid any locks in qemu backend and not to introduce thread safety >>>into qemu block-layer I open same backend device several times, one >>>device per one MQ. e.g. the following is the stack for a virtio-blk >>>with num-que

Re: [Qemu-devel] [PATCH v2 0/8] virtio-blk: multiqueue support

2016-06-04 Thread Roman Penyaev
Hi, On Sat, Jun 4, 2016 at 12:26 AM, Stefan Hajnoczi wrote: > On Thu, Jun 02, 2016 at 05:19:41PM -0700, Stefan Hajnoczi wrote: >> On Mon, May 30, 2016 at 06:25:58PM -0700, Stefan Hajnoczi wrote: >> > v2: >> > * Simplify s->rq live migration [Paolo] >> > * Use more efficient bitmap ops for batch

Re: [Qemu-devel] [PATCH v3 0/7] virtio-blk: multiqueue support

2016-06-20 Thread Roman Penyaev
Hi, Stefan. On Mon, Jun 20, 2016 at 12:36 PM, Stefan Hajnoczi wrote: > On Tue, Jun 07, 2016 at 05:28:24PM +0100, Stefan Hajnoczi wrote: >> v3: >> * Drop Patch 1 to batch guest notify for non-dataplane >> >>The Linux AIO completion BH and the virtio-blk batch notify BH changed >> order >>

[PATCH 2/2] qemu-options.hx: describe multiplexing of several backend devices

2024-09-13 Thread Roman Penyaev
This adds a few lines describing multiplexer configuration for multiplexing several backend devices with a single frontend device. Signed-off-by: Roman Penyaev Cc: "Marc-André Lureau" Cc: Paolo Bonzini Cc: qemu-devel@nongnu.org --- qemu-optio

[PATCH 1/2] chardev: implement backend chardev multiplexing

2024-09-13 Thread Roman Penyaev
hvc console. Signed-off-by: Roman Penyaev Cc: "Marc-André Lureau" Cc: Paolo Bonzini Cc: qemu-devel@nongnu.org --- chardev/char-fe.c | 14 +++-- chardev/char-mux.c | 120 + chardev/char.c | 2 +- chardev/chardev-intern

[PATCH 0/2] chardev: implement backend chardev multiplexing

2024-09-13 Thread Roman Penyaev
nput and output due the buffer multiplexing: # VNC client vncviewer :0 # TTY emulator socat unix:connect:/tmp/sock pty,link=/tmp/pty tio /tmp/pty [1] https://www.qemu.org/docs/master/system/qemu-manpage.html#hxtool-6 Roman Penyaev (2): chardev: implement backend chardev multiplexi

Re: [PATCH 1/2] chardev: implement backend chardev multiplexing

2024-09-17 Thread Roman Penyaev
Hi Marc-André, On Tue, Sep 17, 2024 at 2:31 PM Marc-André Lureau wrote: > > Hi Roman > > On Fri, Sep 13, 2024 at 8:37 PM Roman Penyaev wrote: > > > > This patch implements multiplexing capability of several backend > > devices, which opens up an opportunity to us

Re: [Qemu-devel] [PATCH] linux-aio: keep processing events if MAX_EVENTS reached

2016-07-12 Thread Roman Penyaev
On Tue, Jun 28, 2016 at 11:42 AM, Stefan Hajnoczi wrote: > On Mon, Jun 27, 2016 at 08:36:19PM +0200, Roman Penyaev wrote: >> On Jun 27, 2016 6:37 PM, "Stefan Hajnoczi" wrote: >> > >> > Commit ccb9dc10129954d0bcd7814298ed445e684d5a2a ("linux-aio: Can

Re: [Qemu-devel] [PATCH] linux-aio: keep processing events if MAX_EVENTS reached

2016-07-12 Thread Roman Penyaev
On Tue, Jul 12, 2016 at 4:59 PM, Paolo Bonzini wrote: > > > On 12/07/2016 16:12, Roman Penyaev wrote: >> But what is the most important thing here is, that reverting >> "linux-aio: Cancel BH if not needed" brings these numbers: >> >>READ: io=56362MB,

Re: [Qemu-devel] [PATCH 1/1] linux-aio: prevent submitting more than MAX_EVENTS

2016-07-13 Thread Roman Penyaev
On Wed, Jul 13, 2016 at 9:43 AM, Paolo Bonzini wrote: > > > On 12/07/2016 19:51, Roman Pen wrote: >> +if (s->io_q.in_flight >= MAX_EVENTS) >> +break; >> QSIMPLEQ_FOREACH(aiocb, &s->io_q.pending, next) { >> iocbs[len++] = &aiocb->iocb; >> -if (l

Re: [Qemu-devel] [PATCH V2 1/1] linux-aio: prevent submitting more than MAX_EVENTS

2016-07-13 Thread Roman Penyaev
On Wed, Jul 13, 2016 at 12:31 PM, Paolo Bonzini wrote: > > > On 13/07/2016 09:57, Roman Pen wrote: >> v1..v2: >> >> o comment tweaks. >> o fix QEMU coding style. >> >> Invoking io_setup(MAX_EVENTS) we ask kernel to create ring buffer for us >> with specified number of events. But kernel ring

Re: [Qemu-devel] [PATCH V2 1/1] linux-aio: prevent submitting more than MAX_EVENTS

2016-07-13 Thread Roman Penyaev
On Wed, Jul 13, 2016 at 2:22 PM, Eric Blake wrote: > On 07/13/2016 01:57 AM, Roman Pen wrote: >> v1..v2: >> >> o comment tweaks. >> o fix QEMU coding style. > > The above comments should be delayed... > >> >> Invoking io_setup(MAX_EVENTS) we ask kernel to create ring buffer for us >> with spec

Re: [Qemu-devel] [PATCH V2 1/1] linux-aio: prevent submitting more than MAX_EVENTS

2016-07-13 Thread Roman Penyaev
On Wed, Jul 13, 2016 at 1:45 PM, Kevin Wolf wrote: > Am 13.07.2016 um 13:33 hat Roman Penyaev geschrieben: >> Just to be sure that we are on the same page: >> >> 1. We have this commit "linux-aio: Cancel BH if not needed" which >> >>a) introduces pe

Re: [Qemu-devel] [PATCH V2 1/1] linux-aio: prevent submitting more than MAX_EVENTS

2016-07-15 Thread Roman Penyaev
On Wed, Jul 13, 2016 at 1:45 PM, Kevin Wolf wrote: > Am 13.07.2016 um 13:33 hat Roman Penyaev geschrieben: >> Just to be sure that we are on the same page: >> >> 1. We have this commit "linux-aio: Cancel BH if not needed" which >> >>a) introduces pe

Re: [Qemu-devel] [PATCH V2 1/1] linux-aio: prevent submitting more than MAX_EVENTS

2016-07-15 Thread Roman Penyaev
On Fri, Jul 15, 2016 at 11:58 AM, Paolo Bonzini wrote: > > > On 15/07/2016 11:18, Roman Penyaev wrote: >> Those 3 red spikes and a blue hill is what we have to focus on. The >> blue hill at the right corner of the chart means that almost always the >> ring buffe

Re: [Qemu-devel] [PATCH V2 1/1] linux-aio: prevent submitting more than MAX_EVENTS

2016-07-15 Thread Roman Penyaev
On Fri, Jul 15, 2016 at 12:17 PM, Roman Penyaev wrote: > On Fri, Jul 15, 2016 at 11:58 AM, Paolo Bonzini wrote: >> >> >> On 15/07/2016 11:18, Roman Penyaev wrote: >>> Those 3 red spikes and a blue hill is what we have to focus on. The >>> blue hill at t

Re: [Qemu-devel] [PATCH] linux-aio: keep processing events if MAX_EVENTS reached

2016-07-15 Thread Roman Penyaev
On Fri, Jul 15, 2016 at 4:18 PM, Stefan Hajnoczi wrote: > On Tue, Jul 12, 2016 at 04:12:42PM +0200, Roman Penyaev wrote: >> On Tue, Jun 28, 2016 at 11:42 AM, Stefan Hajnoczi wrote: >> > On Mon, Jun 27, 2016 at 08:36:19PM +0200, Roman Penyaev wrote: >> >> On Jun 27,

Re: [Qemu-devel] [PATCH V2 1/1] linux-aio: prevent submitting more than MAX_EVENTS

2016-07-15 Thread Roman Penyaev
On Fri, Jul 15, 2016 at 11:18 AM, Roman Penyaev wrote: > On Wed, Jul 13, 2016 at 1:45 PM, Kevin Wolf wrote: >> Am 13.07.2016 um 13:33 hat Roman Penyaev geschrieben: >>> Just to be sure that we are on the same page: >>> >>> 1. We have this commit "

Re: [Qemu-devel] [PATCH 3/3] linux-aio: process completions from ioq_submit()

2016-07-19 Thread Roman Penyaev
On Tue, Jul 19, 2016 at 12:36 PM, Paolo Bonzini wrote: > > > On 19/07/2016 12:25, Roman Pen wrote: >> if (laiocb->co) { >> -qemu_coroutine_enter(laiocb->co, NULL); >> +if (laiocb->co == qemu_coroutine_self()) { >> +laiocb->self_completed = true; > > No need for thi

Re: [Qemu-devel] [PATCH 3/3] linux-aio: process completions from ioq_submit()

2016-07-19 Thread Roman Penyaev
On Tue, Jul 19, 2016 at 1:18 PM, Roman Penyaev wrote: > On Tue, Jul 19, 2016 at 12:36 PM, Paolo Bonzini wrote: >> >> >> On 19/07/2016 12:25, Roman Pen wrote: >>> if (laiocb->co) { >>> -qemu_coroutine_enter(laiocb->co, NULL); >&

Re: [Qemu-devel] [PATCH 3/3] linux-aio: process completions from ioq_submit()

2016-07-19 Thread Roman Penyaev
On Tue, Jul 19, 2016 at 1:47 PM, Paolo Bonzini wrote: > > > On 19/07/2016 13:44, Roman Penyaev wrote: >>>> >> >>>> >> Can this leave I/O stuck if in_queue > 0 && in_flight == 0 after the >>>> >> return from qemu_laio_p

Re: [Qemu-devel] [PATCH v2 1/1] coroutine-lock: do not touch coroutine after another one has been entered

2017-06-01 Thread Roman Penyaev
On Thu, Jun 1, 2017 at 3:15 PM, Stefan Hajnoczi wrote: > On Wed, May 31, 2017 at 03:23:25PM +0200, Roman Penyaev wrote: >> On Wed, May 31, 2017 at 3:06 PM, Stefan Hajnoczi wrote: >> > On Tue, May 30, 2017 at 12:07:36PM +0200, Roman Pen wrote: >> >> diff --git a/uti

Re: [Qemu-devel] [PATCH v3 1/1] coroutine-lock: do not touch coroutine after another one has been entered

2017-06-02 Thread Roman Penyaev
On Thu, Jun 1, 2017 at 6:08 PM, Roman Pen wrote: [cut] > Thread 12 (Thread 0x7f57f2ffd700 (LWP 56426)): > #0 raise () from /lib/x86_64-linux-gnu/libc.so.6 > #1 abort () from /lib/x86_64-linux-gnu/libc.so.6 > #2 qemu_coroutine_enter (co=0x7f5804009af0) at qemu-coroutine.c:113 > #3 qemu_c

Re: [Qemu-devel] [PATCH 1/1] scripts/qemugdb/coroutine.py: get pthread pointer from '(gdb) thread info $id' output

2017-03-14 Thread Roman Penyaev
On Tue, Mar 14, 2017 at 11:21 AM, Paolo Bonzini wrote: > > > On 14/03/2017 11:08, Roman Pen wrote: >> For sure under corefile debugging it is not possible to invoke >> any syscalls, like arch_prctl(), so avoid doing that. That will >> simplify the script. > > Is the issue that start_thread only w

Re: [Qemu-devel] [PATCH 1/1] coroutine-lock: do not touch coroutine after another one has been entered

2017-05-30 Thread Roman Penyaev
On Tue, May 30, 2017 at 11:35 AM, Paolo Bonzini wrote: > > > On 30/05/2017 10:53, Roman Pen wrote: >> The fix is obvious: use temporal queue and do not touch coroutine after >> first qemu_coroutine_enter() is invoked. >> >> The issue is quite rare and happens every ~12 hours on very high IO load >

Re: [Qemu-devel] [PATCH v2 1/1] coroutine-lock: do not touch coroutine after another one has been entered

2017-05-31 Thread Roman Penyaev
On Wed, May 31, 2017 at 3:22 PM, Paolo Bonzini wrote: > > > On 31/05/2017 15:06, Stefan Hajnoczi wrote: >>> + >>> +while ((next = QSIMPLEQ_FIRST(&tmp_queue_wakeup))) { >>> +QSIMPLEQ_REMOVE_HEAD(&tmp_queue_wakeup, co_queue_next); >>> qemu_coroutine_enter(next); >>> } >>>

Re: [Qemu-devel] [PATCH v2 1/1] coroutine-lock: do not touch coroutine after another one has been entered

2017-05-31 Thread Roman Penyaev
On Wed, May 31, 2017 at 3:06 PM, Stefan Hajnoczi wrote: > On Tue, May 30, 2017 at 12:07:36PM +0200, Roman Pen wrote: >> diff --git a/util/qemu-coroutine-lock.c b/util/qemu-coroutine-lock.c >> index 6328eed26bc6..d589d8c66d5e 100644 >> --- a/util/qemu-coroutine-lock.c >> +++ b/util/qemu-coroutine-l

Re: [Qemu-devel] [PATCH v2 1/1] coroutine-lock: do not touch coroutine after another one has been entered

2017-06-01 Thread Roman Penyaev
On Tue, May 30, 2017 at 1:35 PM, Fam Zheng wrote: [cut] > Reviewed-by: Fam Zheng Do I need to resend the patch with 'reviewed-by' line? Or it is already queued? -- Roman

Re: [Qemu-devel] [PATCH 3/3] linux-aio: fix re-entrant completion processing

2016-09-27 Thread Roman Penyaev
Hey Stefan, On Tue, Sep 27, 2016 at 4:06 PM, Stefan Hajnoczi wrote: > Commit 0ed93d84edabc7656f5c998ae1a346fe8b94ca54 ("linux-aio: process > completions from ioq_submit()") added an optimization that processes > completions each time ioq_submit() returns with requests in flight. > This commit int

Re: [Qemu-devel] [PATCH 3/3] linux-aio: fix re-entrant completion processing

2016-09-27 Thread Roman Penyaev
On Tue, Sep 27, 2016 at 5:25 PM, Stefan Hajnoczi wrote: > On Tue, Sep 27, 2016 at 04:29:55PM +0200, Roman Penyaev wrote: >> On Tue, Sep 27, 2016 at 4:06 PM, Stefan Hajnoczi wrote: >> > Commit 0ed93d84edabc7656f5c998ae1a346fe8b94ca54 ("linux-aio: process >> > compl

Re: [Qemu-devel] [PATCH 3/3] linux-aio: fix re-entrant completion processing

2016-09-28 Thread Roman Penyaev
On Wed, Sep 28, 2016 at 5:01 AM, Fam Zheng wrote: > On Tue, 09/27 19:55, Roman Penyaev wrote: >> > The bug is 100% deterministic. Just boot up a guest with -drive >> > format=qcow2,aio=native. >> >> It turns out to be that everything is broken. I started al

Re: [Qemu-devel] [PATCH 3/3] linux-aio: fix re-entrant completion processing

2016-09-28 Thread Roman Penyaev
On Wed, Sep 28, 2016 at 11:34 AM, Fam Zheng wrote: > On Wed, 09/28 11:14, Roman Penyaev wrote: >> On Wed, Sep 28, 2016 at 5:01 AM, Fam Zheng wrote: >> > On Tue, 09/27 19:55, Roman Penyaev wrote: >> >> > The bug is 100% deterministic. Just boot up a guest wit

Re: [Qemu-devel] [PATCH] linux-aio: keep processing events if MAX_EVENTS reached

2016-06-27 Thread Roman Penyaev
then it's > necessary to call it again. Failure to do so can lead to hung I/O > because the eventfd has already been cleared and the completion BH will > not run again. > > This patch fixes the hang by calling io_getevents(2) again if the events > array was totally full. > >

Re: [PATCH v2 8/8] tests/unit/test-char: implement a few mux remove test cases

2024-10-15 Thread Roman Penyaev
Hi, On Tue, Oct 15, 2024, 10:50 Marc-André Lureau wrote: [cut] > qemu_chr_fe_deinit(&chr_be1, false); > > -qemu_chr_fe_deinit(&chr_be2, true); > > + > > +error = NULL; > > Unnecessary assignment, > > > +qmp_chardev_remove("mux-label", &error); > > +g_assert_cmpstr(error_get

[PATCH 6/8] chardev/mux: switch mux frontends management to bitset

2024-10-14 Thread Roman Penyaev
in the `backend` array (yes, huge confusion with backend and frontends names). Signed-off-by: Roman Penyaev Cc: "Marc-André Lureau" Cc: qemu-devel@nongnu.org --- chardev/char-mux.c | 41 +- chardev/char.c | 2 +- chard

[PATCH 4/8] chardev/mux: convert size members to unsigned int

2024-10-14 Thread Roman Penyaev
There is no sense to keep `focus`, `mux_cnt`, `prod`, `cons` and `tag` variables as signed, those represent either size, either position in array, which both are unsigned. `focus` member of `MuxChardev` is kept signed, because initially set to -1. Signed-off-by: Roman Penyaev Cc: "Marc-

[PATCH 3/8] chardev/mux: use bool type for `linestart` and `term_got_escape`

2024-10-14 Thread Roman Penyaev
Those are boolean variables, not signed integers. Signed-off-by: Roman Penyaev Cc: "Marc-André Lureau" Cc: qemu-devel@nongnu.org --- chardev/char-mux.c | 10 +- chardev/chardev-internal.h | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/ch

Re: [PATCH 1/1] chardev/char: fix qemu_chr_is_busy() check

2024-10-14 Thread Roman Penyaev
Hi Marc-André, On Thu, Oct 10, 2024 at 12:20 PM Marc-André Lureau wrote: > > Hi Roman > > On Thu, Oct 10, 2024 at 1:28 PM Roman Penyaev wrote: >> >> `mux_cnt` struct member never goes negative or decrements, >> so mux chardev can be !busy only when there are no >

[PATCH 0/8] chardev/mux: implement frontend detach

2024-10-14 Thread Roman Penyaev
ntend devices in any order. Also first patches do some refactoring the purpose of which is to make integer unsigned where possible (such as sizes or lengths). Roman Penyaev (8): chardev/char: fix qemu_chr_is_busy() check chardev/chardev-internal: remove unused `max_size` struct member charde

[PATCH 1/8] chardev/char: fix qemu_chr_is_busy() check

2024-10-14 Thread Roman Penyaev
`mux_cnt` struct member never goes negative or decrements, so mux chardev can be !busy only when there are no frontends attached. This patch fixes the always-true check. Fixes: a4afa548fc6d ("char: move front end handlers in CharBackend") Signed-off-by: Roman Penyaev Cc: "Marc-An

[PATCH 8/8] tests/unit/test-char: implement a few mux remove test cases

2024-10-14 Thread Roman Penyaev
This patch tests: 1. feasibility of removing mux which does not have frontends attached or frontends were prior detached. 2. inability to remove mux which has frontends attached (mux is "busy") Signed-off-by: Roman Penyaev Cc: "Marc-André Lureau" Cc: qemu-devel@nongnu

[PATCH 2/8] chardev/chardev-internal: remove unused `max_size` struct member

2024-10-14 Thread Roman Penyaev
Clean up forgotten leftovers. Signed-off-by: Roman Penyaev Cc: "Marc-André Lureau" Cc: qemu-devel@nongnu.org --- chardev/chardev-internal.h | 1 - 1 file changed, 1 deletion(-) diff --git a/chardev/chardev-internal.h b/chardev/chardev-internal.h index 4e03af31476c..c3024b51fdda 10

[PATCH 5/8] chardev/mux: introduce `mux_chr_attach_frontend() call

2024-10-14 Thread Roman Penyaev
Move away logic which attaches frontend device to a mux from `char-fe.c` to actual `char-mux.c` implementation and make it a separate function. No logic changes are made. Signed-off-by: Roman Penyaev Cc: "Marc-André Lureau" Cc: qemu-devel@nongnu.org --- chardev/char-fe.c

[PATCH 7/8] chardev/mux: implement detach of frontends from mux

2024-10-14 Thread Roman Penyaev
With bitset management now it becomes feasible to implement the logic of detaching frontends from multiplexer. Signed-off-by: Roman Penyaev Cc: "Marc-André Lureau" Cc: qemu-devel@nongnu.org --- chardev/char-fe.c | 2 +- chardev/char-mux.c | 20 +--

[PATCH v2 3/5] chardev/char-mux: implement backend chardev multiplexing

2024-10-09 Thread Roman Penyaev
communication to the virtio hvc console. New type of multiplexer `mux-be` actually is an alias for the same `MuxChardev` struct, which uses same functions as for the original `mux` type, but supports multiplexing N backends with 1 frontend. Signed-off-by: Roman Penyaev Cc: "Marc-André Lureau

[PATCH v2 5/5] qemu-options.hx: describe multiplexing of several backend devices

2024-10-09 Thread Roman Penyaev
This adds a few lines describing `mux-be` multiplexer configuration for multiplexing several backend devices with a single frontend device. Signed-off-by: Roman Penyaev Cc: "Marc-André Lureau" Cc: qemu-devel@nongnu.org --- qemu-options.hx | 46 +++

[PATCH v2 2/5] chardev/char: rename `mux_cnt` to `fe_cnt` for the `MuxChardev`

2024-10-09 Thread Roman Penyaev
-off-by: Roman Penyaev Cc: "Marc-André Lureau" Cc: qemu-devel@nongnu.org --- chardev/char-fe.c | 7 +++ chardev/char-mux.c | 12 ++-- chardev/char.c | 2 +- chardev/chardev-internal.h | 2 +- 4 files changed, 11 insertions(+), 12 deletions(-) di

[PATCH v2 1/5] chardev/char: introduce `mux-be-id=ID` option and _MUX_BE type

2024-10-09 Thread Roman Penyaev
will follow. Signed-off-by: Roman Penyaev Cc: "Marc-André Lureau" Cc: qemu-devel@nongnu.org --- chardev/char.c | 3 +++ include/chardev/char.h | 1 + qapi/char.json | 9 - 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/chardev/char.c b/cha

[PATCH v2 4/5] tests/unit/test-char: add unit test for the `mux-be` multiplexer

2024-10-09 Thread Roman Penyaev
The test is trivial: several backends, 1 `mux-be`, 1 frontend do the buffer write and read. Pipe is used for EAGAIN verification. Signed-off-by: Roman Penyaev Cc: "Marc-André Lureau" Cc: qemu-devel@nongnu.org --- tests/unit/test-char.c | 217 +++

[PATCH v2 0/5] chardev: implement backend chardev multiplexing

2024-10-09 Thread Roman Penyaev
failed backend device * Proper json support of the `mux-be-id` option * Unit test for the `mux-be` multiplexer [1] https://www.qemu.org/docs/master/system/qemu-manpage.html#hxtool-6 [2] https://github.com/lf-edge/eve Roman Penyaev (5): chardev/char: introduce `mux-be-id=ID` option and _MUX_

[PATCH v4 7/8] tests/unit/test-char: add unit test for the `mux-be` multiplexer

2024-10-16 Thread Roman Penyaev
The test is trivial: several backends, 1 `mux-be`, 1 frontend do the buffer write and read. Pipe is used for EAGAIN verification. Signed-off-by: Roman Penyaev Cc: "Marc-André Lureau" Cc: qemu-devel@nongnu.org --- tests/unit/test-char.c | 306 +++

[PATCH v4 1/8] chardev/char: rename `MuxChardev` struct to `MuxFeChardev`

2024-10-16 Thread Roman Penyaev
/CHARDEV_IS_MUX_FE/g s/MUX_CHARDEV/MUX_FE_CHARDEV/g s/TYPE_CHARDEV_MUX/TYPE_CHARDEV_MUX_FE/g No json or string types are changed for the sake of compatibility. Signed-off-by: Roman Penyaev Cc: "Marc-André Lureau" Cc: qemu-devel@nongnu.org --- chardev/char-fe.c | 10 +- chardev/

[PATCH v4 0/8] chardev: implement backend chardev multiplexing

2024-10-16 Thread Roman Penyaev
mux-be` multiplexer [1] https://www.qemu.org/docs/master/system/qemu-manpage.html#hxtool-6 [2] https://github.com/lf-edge/eve Roman Penyaev (8): chardev/char: rename `MuxChardev` struct to `MuxFeChardev` chardev/char: rename `char-mux.c` to `char-mux-fe.c` chardev/char: move away mux suspend/resum

[PATCH v4 5/8] chardev/char: introduce `mux-be-id=ID` option

2024-10-16 Thread Roman Penyaev
Patch introduces `mux-be-id=ID` option for all chardev devices. This is necessary to attach chardev to `mux-be` for backend multiplexing. Actual implementation wimplementation will follow. Signed-off-by: Roman Penyaev Cc: "Marc-André Lureau" Cc: qemu-devel@nongnu.org --- chardev/

[PATCH v4 2/8] chardev/char: rename `char-mux.c` to `char-mux-fe.c`

2024-10-16 Thread Roman Penyaev
In the following patches backend multiplexer will be introduced and the implementation will be named as follows: `char-mux-be.c`. This patch renames the frontend multiplexer from `char-mux.c` to `char-mux-fe.c`. Signed-off-by: Roman Penyaev Cc: "Marc-André Lureau" Cc: qemu-devel@

[PATCH v4 6/8] chardev/char-mux: implement backend chardev multiplexing

2024-10-16 Thread Roman Penyaev
` is a socket backend which provides biderectional communication to the virtio hvc console. Signed-off-by: Roman Penyaev Cc: "Marc-André Lureau" Cc: qemu-devel@nongnu.org --- chardev/char-fe.c | 9 ++ chardev/char-mux-be.c | 290

[PATCH v4 8/8] qemu-options.hx: describe multiplexing of several backend devices

2024-10-16 Thread Roman Penyaev
This adds a few lines describing `mux-be` multiplexer configuration for multiplexing several backend devices with a single frontend device. Signed-off-by: Roman Penyaev Cc: "Marc-André Lureau" Cc: qemu-devel@nongnu.org --- qemu-optio

[PATCH v4 4/8] chardev/char: rename frontend mux calls

2024-10-16 Thread Roman Penyaev
This patch renames calls in the frontend mux implementation to reflect its frontend nature. Patch does the following: s/mux_chr/mux_fe_chr/g No functional changes are made. Signed-off-by: Roman Penyaev Cc: "Marc-André Lureau" Cc: qemu-devel@nongnu.org --- chardev/char-fe.c

[PATCH v4 3/8] chardev/char: move away mux suspend/resume calls

2024-10-16 Thread Roman Penyaev
/mux_suspend_open/g s/resume_mux_open/mux_resume_open/g No functional changes are made. Signed-off-by: Roman Penyaev Cc: "Marc-André Lureau" Cc: qemu-devel@nongnu.org --- chardev/char-mux-fe.c | 63 ++--- chardev/char.c

Re: [PATCH v4 6/8] chardev/char-mux: implement backend chardev multiplexing

2024-10-16 Thread Roman Penyaev
Hi, On Wed, Oct 16, 2024 at 1:14 PM Marc-André Lureau wrote: > > Hi > > On Wed, Oct 16, 2024 at 2:29 PM Roman Penyaev wrote: >> >> This patch implements multiplexing capability of several backend >> devices, which opens up an opportunity to use a single frontend

Re: [PATCH v4 7/8] tests/unit/test-char: add unit test for the `mux-be` multiplexer

2024-10-17 Thread Roman Penyaev
Hi Marc-André, On Wed, Oct 16, 2024 at 1:36 PM Marc-André Lureau wrote: > > Hi > > On Wed, Oct 16, 2024 at 2:28 PM Roman Penyaev wrote: > > > > The test is trivial: several backends, 1 `mux-be`, 1 frontend > > do the buffer write and read. Pipe is used for EAGAI

[PATCH v3 6/7] tests/unit/test-char: add unit test for the `mux-be` multiplexer

2024-10-10 Thread Roman Penyaev
The test is trivial: several backends, 1 `mux-be`, 1 frontend do the buffer write and read. Pipe is used for EAGAIN verification. Signed-off-by: Roman Penyaev Cc: "Marc-André Lureau" Cc: qemu-devel@nongnu.org --- tests/unit/test-char.c | 218 +++

[PATCH v3 7/7] qemu-options.hx: describe multiplexing of several backend devices

2024-10-10 Thread Roman Penyaev
This adds a few lines describing `mux-be` multiplexer configuration for multiplexing several backend devices with a single frontend device. Signed-off-by: Roman Penyaev Cc: "Marc-André Lureau" Cc: qemu-devel@nongnu.org --- qemu-optio

[PATCH v3 1/7] chardev/char: rename `char-mux.c` to `char-mux-fe.c`

2024-10-10 Thread Roman Penyaev
In the following patches backend multiplexer will be introduced and the implementation will be named as follows: `char-mux-be.c`. This patch renames the frontend multiplexer from `char-mux.c` to `char-mux-fe.c`. Signed-off-by: Roman Penyaev Cc: "Marc-André Lureau" Cc: qemu-devel@

[PATCH v3 4/7] chardev/char: introduce `mux-be-id=ID` option

2024-10-10 Thread Roman Penyaev
Patch introduces `mux-be-id=ID` option for all chardev devices. This is necessary to attach chardev to `mux-be` for backend multiplexing. Actual implementation wimplementation will follow. Signed-off-by: Roman Penyaev Cc: "Marc-André Lureau" Cc: qemu-devel@nongnu.org --- chardev/

[PATCH v3 2/7] chardev/char: move away mux suspend/resume calls

2024-10-10 Thread Roman Penyaev
/mux_suspend_open/g s/resume_mux_open/mux_resume_open/g No functional changes are made. Signed-off-by: Roman Penyaev Cc: "Marc-André Lureau" Cc: qemu-devel@nongnu.org --- chardev/char-mux-fe.c | 63 ++--- chardev/char.c

[PATCH v3 5/7] chardev/char-mux: implement backend chardev multiplexing

2024-10-10 Thread Roman Penyaev
` is a socket backend which provides biderectional communication to the virtio hvc console. Signed-off-by: Roman Penyaev Cc: "Marc-André Lureau" Cc: qemu-devel@nongnu.org --- chardev/char-fe.c | 14 ++ chardev/char-mux-be.c | 272

[PATCH v3 3/7] chardev/char: rename frontend mux calls

2024-10-10 Thread Roman Penyaev
This patch renames calls in the frontend mux implementation to reflect its frontend nature. Patch does the following: s/mux_chr/mux_fe_chr/g No functional changes are made. Signed-off-by: Roman Penyaev Cc: "Marc-André Lureau" Cc: qemu-devel@nongnu.org --- chardev/char-mux

[PATCH 1/1] chardev/char: fix qemu_chr_is_busy() check

2024-10-10 Thread Roman Penyaev
`mux_cnt` struct member never goes negative or decrements, so mux chardev can be !busy only when there are no frontends attached. This patch fixes the always-true check. Fixes: a4afa548fc6d ("char: move front end handlers in CharBackend") Signed-off-by: Roman Penyaev Cc: "Marc-An

Re: [PATCH 1/1] chardev/char: fix qemu_chr_is_busy() check

2024-10-10 Thread Roman Penyaev
On Thu, Oct 10, 2024, 12:20 Marc-André Lureau wrote: > Hi Roman > > On Thu, Oct 10, 2024 at 1:28 PM Roman Penyaev wrote: > >> `mux_cnt` struct member never goes negative or decrements, >> so mux chardev can be !busy only when there are no >> frontends attached. Th

Re: [PATCH v2 0/5] chardev: implement backend chardev multiplexing

2024-10-10 Thread Roman Penyaev
| 9 +- >> qemu-options.hx| 46 +++- >> tests/unit/test-char.c | 217 ++++- >> 8 files changed, 538 insertions(+), 51 deletions(-) >> >> Signed-off-by: Roman Penyaev >> Cc: "Marc-André Lureau" >> Cc: qemu-devel@nongnu.org >> >> -- >> 2.43.0 >> >> > > > -- > Marc-André Lureau

Re: [PATCH 6/8] chardev/mux: switch mux frontends management to bitset

2024-10-14 Thread Roman Penyaev
On Mon, Oct 14, 2024 at 3:20 PM Marc-André Lureau wrote: > > > > On Mon, Oct 14, 2024 at 3:45 PM Roman Penyaev wrote: >> >> Frontends can be attached and detached during run-time (although detach >> is not implemented, but will follow). Counter variable of mux

Re: [PATCH 7/8] chardev/mux: implement detach of frontends from mux

2024-10-14 Thread Roman Penyaev
On Mon, Oct 14, 2024 at 3:22 PM Marc-André Lureau wrote: [cut] >> >> +bool mux_chr_detach_frontend(MuxChardev *d, unsigned int tag) >> +{ >> +unsigned int bit; >> + >> +bit = find_next_bit(&d->mux_bitset, MAX_MUX, tag); >> +if (bit >= MAX_MUX) { > > > if (bit != tag) instead? Right,

Re: [PATCH v3 1/7] chardev/char: rename `char-mux.c` to `char-mux-fe.c`

2024-10-14 Thread Roman Penyaev
On Mon, Oct 14, 2024 at 3:57 PM Marc-André Lureau wrote: > > Hi Roman, > > On Thu, Oct 10, 2024 at 2:21 PM Roman Penyaev wrote: >> >> In the following patches backend multiplexer will be >> introduced and the implementation will be named as >> follows: `ch

[PATCH v2 3/8] chardev/mux: use bool type for `linestart` and `term_got_escape`

2024-10-14 Thread Roman Penyaev
Those are boolean variables, not signed integers. Signed-off-by: Roman Penyaev Cc: "Marc-André Lureau" Cc: qemu-devel@nongnu.org --- chardev/char-mux.c | 10 +- chardev/chardev-internal.h | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/ch

[PATCH v2 5/8] chardev/mux: introduce `mux_chr_attach_frontend() call

2024-10-14 Thread Roman Penyaev
Move away logic which attaches frontend device to a mux from `char-fe.c` to actual `char-mux.c` implementation and make it a separate function. No logic changes are made. Signed-off-by: Roman Penyaev Cc: "Marc-André Lureau" Cc: qemu-devel@nongnu.org --- chardev/char-fe.c

[PATCH v2 8/8] tests/unit/test-char: implement a few mux remove test cases

2024-10-14 Thread Roman Penyaev
This patch tests: 1. feasibility of removing mux which does not have frontends attached or frontends were prior detached. 2. inability to remove mux which has frontends attached (mux is "busy") Signed-off-by: Roman Penyaev Cc: "Marc-André Lureau" Cc: qemu-devel@nongnu

[PATCH v2 2/8] chardev/chardev-internal: remove unused `max_size` struct member

2024-10-14 Thread Roman Penyaev
Clean up forgotten leftovers. Signed-off-by: Roman Penyaev Cc: "Marc-André Lureau" Cc: qemu-devel@nongnu.org --- chardev/chardev-internal.h | 1 - 1 file changed, 1 deletion(-) diff --git a/chardev/chardev-internal.h b/chardev/chardev-internal.h index 4e03af31476c..c3024b51fdda 10

[PATCH v2 1/8] chardev/char: fix qemu_chr_is_busy() check

2024-10-14 Thread Roman Penyaev
`mux_cnt` struct member never goes negative or decrements, so mux chardev can be !busy only when there are no frontends attached. This patch fixes the always-true check. Fixes: a4afa548fc6d ("char: move front end handlers in CharBackend") Signed-off-by: Roman Penyaev Cc: "Marc-An

[PATCH v2 4/8] chardev/mux: convert size members to unsigned int

2024-10-14 Thread Roman Penyaev
There is no sense to keep `focus`, `mux_cnt`, `prod`, `cons` and `tag` variables as signed, those represent either size, either position in array, which both are unsigned. `focus` member of `MuxChardev` is kept signed, because initially set to -1. Signed-off-by: Roman Penyaev Cc: "Marc-

[PATCH v2 7/8] chardev/mux: implement detach of frontends from mux

2024-10-14 Thread Roman Penyaev
With bitset management now it becomes feasible to implement the logic of detaching frontends from multiplexer. Signed-off-by: Roman Penyaev Cc: "Marc-André Lureau" Cc: qemu-devel@nongnu.org --- chardev/char-fe.c | 2 +- chardev/char-mux.c | 21 ++--

[PATCH v2 6/8] chardev/mux: switch mux frontends management to bitset

2024-10-14 Thread Roman Penyaev
in the `backend` array (yes, huge confusion with backend and frontends names). Signed-off-by: Roman Penyaev Cc: "Marc-André Lureau" Cc: qemu-devel@nongnu.org --- chardev/char-mux.c | 42 +- chardev/char.c | 2 +- chard

[PATCH v2 0/8] chardev/mux: implement frontend detach

2024-10-14 Thread Roman Penyaev
ntend devices in any order. Also first patches do some refactoring the purpose of which is to make integer unsigned where possible (such as sizes or lengths). v1->v2: * improve if condition and assert for bit verification Roman Penyaev (8): chardev/char: fix qemu_chr_is_busy() check c

Re: [PATCH v5 0/8] chardev: implement backend chardev multiplexing

2024-10-31 Thread Roman Penyaev
Hi Marc-André, In this 5th version of the mux-be series it seems I addressed all the comments and concerns. Could you please take a look once again? -- Roman On Thu, Oct 17, 2024 at 4:45 PM Roman Penyaev wrote: > > Mux is a character backend (host side) device, which multiplexes >

Re: [PATCH v2 7/8] chardev/mux: implement detach of frontends from mux

2024-11-02 Thread Roman Penyaev
Hi, On Tue, Oct 22, 2024, 07:21 CLEMENT MATHIEU--DRIF < clement.mathieu--d...@eviden.com> wrote: > > > On 14/10/2024 17:24, Roman Penyaev wrote: > > Caution: External email. Do not open attachments or click links, unless > this email comes from a known sender and you

[PATCH 1/2] chardev/char-mux: shift unsigned long to avoid 32-bit overflow

2024-11-02 Thread Roman Penyaev
Allthough the size of MAX_MUX is equal to 4 and likely will never change, this patch changes type of constant to unsigned long to be on the safe side. Also add a static compile check that MAX_MUX never bigger than `sizeof(d->mux_bitset)`. Signed-off-by: Roman Penyaev Cc: "Marc-André Lur

Re: [PULL 7/8] chardev/mux: implement detach of frontends from mux

2024-11-02 Thread Roman Penyaev
Hi Peter, On Fri, Nov 1, 2024 at 4:25 PM Peter Maydell wrote: > > On Tue, 15 Oct 2024 at 09:52, wrote: > > > > From: Roman Penyaev > > > > With bitset management now it becomes feasible to implement > > the logic of detaching frontends from multiplexer.

[PATCH 0/2] chardev/char-mux: tweak mux bitset operations

2024-11-02 Thread Roman Penyaev
Patchset tweaks bitset operations by changing a constant to unsigned long, introduces a static compile check and simplifies bitset operations. Roman Penyaev (2): chardev/char-mux: shift unsigned long to avoid 32-bit overflow chardev/char-mux: make boolean bit check instead of find_next_bit

[PATCH 2/2] chardev/char-mux: make boolean bit check instead of find_next_bit()

2024-11-02 Thread Roman Penyaev
This patch simplifies (and makes less confusing) bit checks by replacing `find_next_bit()` calls with boolean AND operation. Resolves: Coverity CID 1563776 Signed-off-by: Roman Penyaev Cc: "Marc-André Lureau" Cc: Peter Maydell Cc: Clément Mathieu--Drif Cc: qemu-devel@nongnu.org --

Re: [PATCH v5 0/8] chardev: implement backend chardev multiplexing

2024-10-31 Thread Roman Penyaev
On Thu, Oct 31, 2024 at 12:34 PM Marc-André Lureau wrote: > > Hi Roman > > On Thu, Oct 31, 2024 at 3:12 PM Roman Penyaev wrote: >> >> Hi Marc-André, >> >> In this 5th version of the mux-be series it seems I addressed all the >> comments and concern

Re: [PATCH 1/2] chardev: implement backend chardev multiplexing

2024-09-18 Thread Roman Penyaev
Hi, Thanks for the review, I will try to come up with the next version of this series. On Wed, Sep 18, 2024 at 12:52 PM Marc-André Lureau wrote: [cut] > > > Indeed, this double commas stuff is weird, I don't know that "trick". Is it > used elsewhere and documented? I don't see a test in test-qe

[PATCH v5 1/8] chardev/char: rename `MuxChardev` struct to `MuxFeChardev`

2024-10-17 Thread Roman Penyaev
/CHARDEV_IS_MUX_FE/g s/MUX_CHARDEV/MUX_FE_CHARDEV/g s/TYPE_CHARDEV_MUX/TYPE_CHARDEV_MUX_FE/g No json or string types are changed for the sake of compatibility. Signed-off-by: Roman Penyaev Cc: "Marc-André Lureau" Cc: qemu-devel@nongnu.org --- chardev/char-fe.c | 10 +- chardev/

[PATCH v5 8/8] qemu-options.hx: describe multiplexing of several backend devices

2024-10-17 Thread Roman Penyaev
This adds a few lines describing `mux-be` multiplexer configuration for multiplexing several backend devices with a single frontend device. Signed-off-by: Roman Penyaev Cc: "Marc-André Lureau" Cc: qemu-devel@nongnu.org --- qemu-optio

[PATCH v5 4/8] chardev/char: rename frontend mux calls

2024-10-17 Thread Roman Penyaev
This patch renames calls in the frontend mux implementation to reflect its frontend nature. Patch does the following: s/mux_chr/mux_fe_chr/g No functional changes are made. Signed-off-by: Roman Penyaev Cc: "Marc-André Lureau" Cc: qemu-devel@nongnu.org --- chardev/char-fe.c

[PATCH v5 7/8] tests/unit/test-char: add unit test for the `mux-be` multiplexer

2024-10-17 Thread Roman Penyaev
The test is trivial: several backends, 1 `mux-be`, 1 frontend do the buffer write and read. Pipe is used for EAGAIN verification. Signed-off-by: Roman Penyaev Cc: "Marc-André Lureau" Cc: qemu-devel@nongnu.org --- tests/unit/test-char.c | 323 +++

[PATCH v5 5/8] chardev/char: introduce `mux-be-id=ID` option

2024-10-17 Thread Roman Penyaev
Patch introduces `mux-be-id=ID` option for all chardev devices. This is necessary to attach chardev to `mux-be` for backend multiplexing. Actual implementation wimplementation will follow. Signed-off-by: Roman Penyaev Cc: "Marc-André Lureau" Cc: qemu-devel@nongnu.org --- chardev/

[PATCH v5 2/8] chardev/char: rename `char-mux.c` to `char-mux-fe.c`

2024-10-17 Thread Roman Penyaev
In the following patches backend multiplexer will be introduced and the implementation will be named as follows: `char-mux-be.c`. This patch renames the frontend multiplexer from `char-mux.c` to `char-mux-fe.c`. Signed-off-by: Roman Penyaev Cc: "Marc-André Lureau" Cc: qemu-devel@

[PATCH v5 0/8] chardev: implement backend chardev multiplexing

2024-10-17 Thread Roman Penyaev
e * Proper json support of the `mux-be-id` option * Unit test for the `mux-be` multiplexer [1] https://www.qemu.org/docs/master/system/qemu-manpage.html#hxtool-6 [2] https://github.com/lf-edge/eve Signed-off-by: Roman Penyaev Cc: "Marc-André Lureau" Cc: qemu-devel@nongnu.org R

[PATCH v5 3/8] chardev/char: move away mux suspend/resume calls

2024-10-17 Thread Roman Penyaev
/mux_suspend_open/g s/resume_mux_open/mux_resume_open/g No functional changes are made. Signed-off-by: Roman Penyaev Cc: "Marc-André Lureau" Cc: qemu-devel@nongnu.org --- chardev/char-mux-fe.c | 63 ++--- chardev/char.c

  1   2   >