eea7cd3f | 15-Mar-2023 |
Paolo Bonzini <pbonzini@redhat.com> |
monitor: do not use mb_read/mb_set
Instead of relying on magic memory barriers, document the pattern that is being used. It is the one based on Dekker's algorithm, and in this case it is embodied a
monitor: do not use mb_read/mb_set
Instead of relying on magic memory barriers, document the pattern that is being used. It is the one based on Dekker's algorithm, and in this case it is embodied as follows:
enqueue request; sleeping = true; smp_mb(); smp_mb(); if (sleeping) kick(); if (!have a request) yield();
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
show more ...
|
0ff25537 | 03-Mar-2023 |
Paolo Bonzini <pbonzini@redhat.com> |
monitor: cleanup fetching of QMP requests
Use a continue statement so that "after going to sleep" is treated the same way as "after processing a request". Pull the monitor_lock critical section out
monitor: cleanup fetching of QMP requests
Use a continue statement so that "after going to sleep" is treated the same way as "after processing a request". Pull the monitor_lock critical section out of monitor_qmp_requests_pop_any_with_lock() and protect qmp_dispatcher_co_shutdown with the monitor_lock.
The two changes are complex to separate because monitor_qmp_dispatcher_co() previously had a complicated logic to check for shutdown both before and after going to sleep.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
show more ...
|
3e6bed61 | 03-Mar-2023 |
Paolo Bonzini <pbonzini@redhat.com> |
monitor: cleanup detection of qmp_dispatcher_co shutting down
Instead of overloading qmp_dispatcher_co_busy, make the coroutine pointer NULL. This will make things break spectacularly if somebody t
monitor: cleanup detection of qmp_dispatcher_co shutting down
Instead of overloading qmp_dispatcher_co_busy, make the coroutine pointer NULL. This will make things break spectacularly if somebody tries to start a request after monitor_cleanup().
AIO_WAIT_WHILE_UNLOCKED() does not need qatomic_mb_read(), because the macro contains all the necessary memory barriers.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
show more ...
|
6ee7c82d | 03-Mar-2023 |
Paolo Bonzini <pbonzini@redhat.com> |
monitor: do not use mb_read/mb_set for suspend_cnt
Clean up monitor_event to just use monitor_suspend/monitor_resume, using mon->mux_out to protect against incorrect nesting (especially on startup).
monitor: do not use mb_read/mb_set for suspend_cnt
Clean up monitor_event to just use monitor_suspend/monitor_resume, using mon->mux_out to protect against incorrect nesting (especially on startup).
The only remaining case of reading suspend_cnt is in the can_read callback, which is just advisory and can use qatomic_read.
As an extra benefit, mux_out is now simply protected by mon_lock. Also, moving the prompt to the beginning of the main loop removes it from the output in some error cases where QEMU does not actually start successfully. It is not a full fix and it would be nice to also remove the monitor heading, but this is already a small (though unintentional) improvement.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
show more ...
|
4cb96b97 | 17-May-2023 |
Paolo Bonzini <pbonzini@redhat.com> |
monitor: add more *_locked() functions
Allow flushing and printing to the monitor while mon->mon_lock is held. This will help cleaning up the locking of mon->mux_out and mon->suspend_cnt.
Reviewed
monitor: add more *_locked() functions
Allow flushing and printing to the monitor while mon->mon_lock is held. This will help cleaning up the locking of mon->mux_out and mon->suspend_cnt.
Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
show more ...
|
c5d0c55f | 17-May-2023 |
Paolo Bonzini <pbonzini@redhat.com> |
monitor: allow calling monitor_resume under mon_lock
Move monitor_resume()'s call to readline_show_prompt() outside the potentially locked section. Reuse the existing monitor_accept_input() bottom
monitor: allow calling monitor_resume under mon_lock
Move monitor_resume()'s call to readline_show_prompt() outside the potentially locked section. Reuse the existing monitor_accept_input() bottom half for this purpose.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
show more ...
|
9612aa40 | 09-Mar-2023 |
Stefan Hajnoczi <stefanha@redhat.com> |
monitor: convert monitor_cleanup() to AIO_WAIT_WHILE_UNLOCKED()
monitor_cleanup() is called from the main loop thread. Calling AIO_WAIT_WHILE(qemu_get_aio_context(), ...) from the main loop thread i
monitor: convert monitor_cleanup() to AIO_WAIT_WHILE_UNLOCKED()
monitor_cleanup() is called from the main loop thread. Calling AIO_WAIT_WHILE(qemu_get_aio_context(), ...) from the main loop thread is equivalent to AIO_WAIT_WHILE_UNLOCKED(NULL, ...) because neither unlocks the AioContext and the latter's assertion that we're in the main loop succeeds.
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Message-Id: <20230309190855.414275-7-stefanha@redhat.com> Reviewed-by: Wilfred Mallawa <wilfred.mallawa@wdc.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
show more ...
|
4bf21c7f | 02-Mar-2023 |
Marc-André Lureau <marcandre.lureau@redhat.com> |
monitor: restrict command getfd to POSIX hosts
Currently, the function will simply fail if ancillary fds are not provided, for ex on unsupported platforms.
This changes the failure from:
{"err
monitor: restrict command getfd to POSIX hosts
Currently, the function will simply fail if ancillary fds are not provided, for ex on unsupported platforms.
This changes the failure from:
{"error": {"class": "GenericError", "desc": "No file descriptor supplied via SCM_RIGHTS"}}
to:
{"error": {"class": "CommandNotFound", "desc": "The command getfd has not been found"}}
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com>
show more ...
|
4cda177c | 06-Mar-2023 |
Marc-André Lureau <marcandre.lureau@redhat.com> |
qmp: add 'get-win32-socket'
A process with enough capabilities can duplicate a socket to QEMU. Add a QMP command to import it and add it to the monitor fd list, so it can be later used by other comm
qmp: add 'get-win32-socket'
A process with enough capabilities can duplicate a socket to QEMU. Add a QMP command to import it and add it to the monitor fd list, so it can be later used by other commands.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Acked-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20230306122751.2355515-9-marcandre.lureau@redhat.com>
show more ...
|