[PATCH 0/2] Increase amount of data for monitor to read

Andrey Shinkevich via posted 2 patches 3 years, 5 months ago
Test checkpatch passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/1604666522-545580-1-git-send-email-andrey.shinkevich@virtuozzo.com
Maintainers: Max Reitz <mreitz@redhat.com>, Markus Armbruster <armbru@redhat.com>, "Marc-André Lureau" <marcandre.lureau@redhat.com>, Kevin Wolf <kwolf@redhat.com>, "Dr. David Alan Gilbert" <dgilbert@redhat.com>, Paolo Bonzini <pbonzini@redhat.com>
There is a newer version of this series
chardev/char-fd.c          | 64 +++++++++++++++++++++++++++++++++++++++++++++-
chardev/char-socket.c      | 54 +++++++++++++++++++++++++++-----------
chardev/char.c             | 40 +++++++++++++++++++++++++++++
include/chardev/char.h     | 15 +++++++++++
monitor/monitor.c          |  2 +-
tests/qemu-iotests/247     |  2 ++
tests/qemu-iotests/247.out |  1 +
7 files changed, 161 insertions(+), 17 deletions(-)
[PATCH 0/2] Increase amount of data for monitor to read
Posted by Andrey Shinkevich via 3 years, 5 months ago
The subject was discussed here:
https://lists.gnu.org/archive/html/qemu-devel/2017-05/msg00206.html

This series is a solution for the issue with QMP monitor buffered input.
A little parser is introduced to throttle JSON commands read from the
buffer so that QMP requests do not overwhelm the monitor input queue.
A side effect raised in the test #247 was managed in the first patch.
It may be considered as a workaround. Any sane fix suggested will be
appreciated.

Note:
This series goes after the Vladimir's one:
'[PATCH v3 00/25] backup performance: block_status + async"'
To make the test #129 passed, the following patch should be applied first:
'[PATCH v3 01/25] iotests: 129 don't check backup "busy"'.

Andrey Shinkevich (2):
  iotests: add another bash sleep command to 247
  monitor: increase amount of data for monitor to read

 chardev/char-fd.c          | 64 +++++++++++++++++++++++++++++++++++++++++++++-
 chardev/char-socket.c      | 54 +++++++++++++++++++++++++++-----------
 chardev/char.c             | 40 +++++++++++++++++++++++++++++
 include/chardev/char.h     | 15 +++++++++++
 monitor/monitor.c          |  2 +-
 tests/qemu-iotests/247     |  2 ++
 tests/qemu-iotests/247.out |  1 +
 7 files changed, 161 insertions(+), 17 deletions(-)

-- 
1.8.3.1


Re: [PATCH 0/2] Increase amount of data for monitor to read
Posted by Andrey Shinkevich 3 years, 5 months ago
Please exclude this address when reply:

jcody@redhat.com

Andrey

Re: [PATCH 0/2] Increase amount of data for monitor to read
Posted by Vladimir Sementsov-Ogievskiy 3 years, 5 months ago
06.11.2020 15:42, Andrey Shinkevich wrote:
> The subject was discussed here:
> https://lists.gnu.org/archive/html/qemu-devel/2017-05/msg00206.html
> 
> This series is a solution for the issue with QMP monitor buffered input.
> A little parser is introduced to throttle JSON commands read from the
> buffer so that QMP requests do not overwhelm the monitor input queue.
> A side effect raised in the test #247 was managed in the first patch.
> It may be considered as a workaround. Any sane fix suggested will be
> appreciated.
> 
> Note:
> This series goes after the Vladimir's one:
> '[PATCH v3 00/25] backup performance: block_status + async"'
> To make the test #129 passed, the following patch should be applied first:
> '[PATCH v3 01/25] iotests: 129 don't check backup "busy"'.
> 

Hi!

I tried the following test:

start qemu:

   ./qemu-system-x86_64 -qmp stdio

type the following in one line:

   { 'execute': 'qmp_capabilities' }{ 'execute': 'quit' }

press Enter.

Without your patches, the qemu quits immediately, printing double "{"return": {}}".
With your patches applied qemu prints "{"return": {}}" only once and doesn't quit, until I press Enter the second time.


> Andrey Shinkevich (2):
>    iotests: add another bash sleep command to 247
>    monitor: increase amount of data for monitor to read
> 
>   chardev/char-fd.c          | 64 +++++++++++++++++++++++++++++++++++++++++++++-
>   chardev/char-socket.c      | 54 +++++++++++++++++++++++++++-----------
>   chardev/char.c             | 40 +++++++++++++++++++++++++++++
>   include/chardev/char.h     | 15 +++++++++++
>   monitor/monitor.c          |  2 +-
>   tests/qemu-iotests/247     |  2 ++
>   tests/qemu-iotests/247.out |  1 +
>   7 files changed, 161 insertions(+), 17 deletions(-)
> 


-- 
Best regards,
Vladimir

Re: [PATCH 0/2] Increase amount of data for monitor to read
Posted by Vladimir Sementsov-Ogievskiy 3 years, 5 months ago
09.11.2020 11:50, Vladimir Sementsov-Ogievskiy wrote:
> 06.11.2020 15:42, Andrey Shinkevich wrote:
>> The subject was discussed here:
>> https://lists.gnu.org/archive/html/qemu-devel/2017-05/msg00206.html
>>
>> This series is a solution for the issue with QMP monitor buffered input.
>> A little parser is introduced to throttle JSON commands read from the
>> buffer so that QMP requests do not overwhelm the monitor input queue.
>> A side effect raised in the test #247 was managed in the first patch.
>> It may be considered as a workaround. Any sane fix suggested will be
>> appreciated.
>>
>> Note:
>> This series goes after the Vladimir's one:
>> '[PATCH v3 00/25] backup performance: block_status + async"'
>> To make the test #129 passed, the following patch should be applied first:
>> '[PATCH v3 01/25] iotests: 129 don't check backup "busy"'.
>>
> 
> Hi!
> 
> I tried the following test:
> 
> start qemu:
> 
>    ./qemu-system-x86_64 -qmp stdio
> 
> type the following in one line:
> 
>    { 'execute': 'qmp_capabilities' }{ 'execute': 'quit' }
> 
> press Enter.
> 
> Without your patches, the qemu quits immediately, printing double "{"return": {}}".
> With your patches applied qemu prints "{"return": {}}" only once and doesn't quit, until I press Enter the second time.


Positive thing: the patches do increase performance:

for me, the following command:

(echo "{ 'execute': 'qmp_capabilities' }"; for i in {1..10000}; do echo "{ 'execute': 'query-block-jobs' }"; done; echo "{ 'execute': 'quit' }" ) | time ./qemu-system-x86_64 -qmp stdio > /dev/null

shows 2.4s on master and 0.6s after patches


> 
> 
>> Andrey Shinkevich (2):
>>    iotests: add another bash sleep command to 247
>>    monitor: increase amount of data for monitor to read
>>
>>   chardev/char-fd.c          | 64 +++++++++++++++++++++++++++++++++++++++++++++-
>>   chardev/char-socket.c      | 54 +++++++++++++++++++++++++++-----------
>>   chardev/char.c             | 40 +++++++++++++++++++++++++++++
>>   include/chardev/char.h     | 15 +++++++++++
>>   monitor/monitor.c          |  2 +-
>>   tests/qemu-iotests/247     |  2 ++
>>   tests/qemu-iotests/247.out |  1 +
>>   7 files changed, 161 insertions(+), 17 deletions(-)
>>
> 
> 


-- 
Best regards,
Vladimir

Re: [PATCH 0/2] Increase amount of data for monitor to read
Posted by Andrey Shinkevich 3 years, 5 months ago
On 09.11.2020 13:04, Vladimir Sementsov-Ogievskiy wrote:
> 09.11.2020 11:50, Vladimir Sementsov-Ogievskiy wrote:
>> 06.11.2020 15:42, Andrey Shinkevich wrote:
>>> The subject was discussed here:
>>> https://lists.gnu.org/archive/html/qemu-devel/2017-05/msg00206.html
>>>
>>> This series is a solution for the issue with QMP monitor buffered input.
>>> A little parser is introduced to throttle JSON commands read from the
>>> buffer so that QMP requests do not overwhelm the monitor input queue.
>>> A side effect raised in the test #247 was managed in the first patch.
>>> It may be considered as a workaround. Any sane fix suggested will be
>>> appreciated.
>>>
>>> Note:
>>> This series goes after the Vladimir's one:
>>> '[PATCH v3 00/25] backup performance: block_status + async"'
>>> To make the test #129 passed, the following patch should be applied 
>>> first:
>>> '[PATCH v3 01/25] iotests: 129 don't check backup "busy"'.
>>>

[...]

> 
> 
> Positive thing: the patches do increase performance:
> 
> for me, the following command:
> 
> (echo "{ 'execute': 'qmp_capabilities' }"; for i in {1..10000}; do echo 
> "{ 'execute': 'query-block-jobs' }"; done; echo "{ 'execute': 'quit' }" 
> ) | time ./qemu-system-x86_64 -qmp stdio > /dev/null
> 
> shows 2.4s on master and 0.6s after patches
> 
> 

Thank you for testing it. I'd like to include the result to the patch 
description with "Tested-by: ..."

Andrey