[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v7 02/13] qtest: Reintroduce qtest_qmp_receive
From: |
Thomas Huth |
Subject: |
Re: [PATCH v7 02/13] qtest: Reintroduce qtest_qmp_receive |
Date: |
Mon, 12 Oct 2020 13:14:34 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.6.0 |
On 06/10/2020 14.38, Maxim Levitsky wrote:
> The new qtest_qmp_receive buffers all the received qmp events, allowing
> qtest_qmp_eventwait_ref to return them.
>
> This is intended to solve the race in regard to ordering of qmp events
> vs qmp responses, as soon as the callers start using the new interface.
>
> In addition to that, define qtest_qmp_event_ref a function which only scans
> the buffer that qtest_qmp_receive stores the events to.
>
> This is intended for callers that are only interested in events that were
> received during the last call to the qtest_qmp_receive.
>
> Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
> Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
> ---
> tests/qtest/libqos/libqtest.h | 23 ++++++++++++++++
> tests/qtest/libqtest.c | 49 ++++++++++++++++++++++++++++++++++-
> 2 files changed, 71 insertions(+), 1 deletion(-)
>
> diff --git a/tests/qtest/libqos/libqtest.h b/tests/qtest/libqos/libqtest.h
> index a41135fc92..19429a536d 100644
> --- a/tests/qtest/libqos/libqtest.h
> +++ b/tests/qtest/libqos/libqtest.h
> @@ -198,6 +198,16 @@ void qtest_qmp_vsend(QTestState *s, const char *fmt,
> va_list ap)
> */
> QDict *qtest_qmp_receive_dict(QTestState *s);
>
> +/**
> + * qtest_qmp_receive:
> + * @s: #QTestState instance to operate on.
> + *
> + * Reads a QMP message from QEMU and returns the response.
> + * Buffers all the events received meanwhile, until a
> + * call to qtest_qmp_eventwait
> + */
> +QDict *qtest_qmp_receive(QTestState *s);
Re-introducing qtest_qmp_receive() with different behavior than before will
likely make backports of other later patches a pain, and might also break
other patches that use this function but are not merged yet. Could you
please use a different name for this function instead? Maye
qtest_qmp_receive_buffered() or something like that?
Thomas
[PATCH v7 03/13] qtest: switch users back to qtest_qmp_receive, Maxim Levitsky, 2020/10/06
[PATCH v7 04/13] qdev: add "check if address free" callback for buses, Maxim Levitsky, 2020/10/06
[PATCH v7 05/13] scsi: switch to bus->check_address, Maxim Levitsky, 2020/10/06
[PATCH v7 06/13] scsi/scsi_bus: switch search direction in scsi_device_find, Maxim Levitsky, 2020/10/06
[PATCH v7 07/13] device_core: use drain_call_rcu in in qmp_device_add, Maxim Levitsky, 2020/10/06