[PATCH 0/4] python/machine: use socketpair() for console socket

John Snow posted 4 patches 9 months, 2 weeks ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20230720130448.921356-1-jsnow@redhat.com
Maintainers: John Snow <jsnow@redhat.com>, Cleber Rosa <crosa@redhat.com>, Beraldo Leal <bleal@redhat.com>, Kevin Wolf <kwolf@redhat.com>, Hanna Reitz <hreitz@redhat.com>
There is a newer version of this series
python/qemu/machine/console_socket.py      | 11 +++---
python/qemu/machine/machine.py             | 40 +++++++++-------------
python/qemu/machine/qtest.py               |  6 ++--
tests/qemu-iotests/tests/copy-before-write |  3 +-
4 files changed, 27 insertions(+), 33 deletions(-)
[PATCH 0/4] python/machine: use socketpair() for console socket
Posted by John Snow 9 months, 2 weeks ago
Like we did for the QMP socket, use socketpair() for the console socket
so that hopefully there isn't a race condition during early boot where
data might get dropped on the floor.

"lightly tested"; passes local tests and gitlab CI. Doesn't seem to make
anything worse.

John Snow (4):
  python/machine: move socket setup out of _base_args property
  python/console_socket: accept existing FD in initializer
  python/machine: use socketpair() for console connections
  python/machine: remove unused console socket configuration arguments

 python/qemu/machine/console_socket.py      | 11 +++---
 python/qemu/machine/machine.py             | 40 +++++++++-------------
 python/qemu/machine/qtest.py               |  6 ++--
 tests/qemu-iotests/tests/copy-before-write |  3 +-
 4 files changed, 27 insertions(+), 33 deletions(-)

-- 
2.41.0

Re: [PATCH 0/4] python/machine: use socketpair() for console socket
Posted by Peter Maydell 9 months, 2 weeks ago
On Thu, 20 Jul 2023 at 14:04, John Snow <jsnow@redhat.com> wrote:
>
> Like we did for the QMP socket, use socketpair() for the console socket
> so that hopefully there isn't a race condition during early boot where
> data might get dropped on the floor.
>
> "lightly tested"; passes local tests and gitlab CI. Doesn't seem to make
> anything worse.

I tried this on the s390 linux box and the test failed because
of a python exception:

__init__() got an unexpected keyword argument 'sock_dir'

  $ QEMU_TEST_FLAKY_TESTS=1 ./build/aarch64/tests/venv/bin/avocado run
./build/aarch64/tests/avocado/machine_aarch64_sbsaref.py:Aarch64SbsarefMachine.test_sbsaref_edk2_firmware
JOB ID     : 8392ba37b5a825ed75278f85f686364d181c01d3
JOB LOG    : /home/linux1/avocado/job-results/job-2023-07-20T13.41-8392ba3/job.log
 (1/1) ./build/aarch64/tests/avocado/machine_aarch64_sbsaref.py:Aarch64SbsarefMachine.test_sbsaref_edk2_firmware:
ERROR: __init__() got an unexpected keyword argument 'sock_dir' (3.64
s)
RESULTS    : PASS 0 | ERROR 1 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0
| CANCEL 0
JOB TIME   : 6.92 s

Backtrace etc from in the job.log:

2023-07-20 13:41:49,125 stacktrace       L0041 ERROR| Reproduced
traceback from:
/home/linux1/qemu/build/aarch64/tests/venv/lib/python3.8/site-package
s/avocado/core/test.py:770
2023-07-20 13:41:49,147 stacktrace       L0045 ERROR| Traceback (most
recent call last):
2023-07-20 13:41:49,147 stacktrace       L0045 ERROR|   File
"/home/linux1/qemu/build/aarch64/tests/venv/lib/python3.8/site-packages/avocado/core/decorators.py",
line 90, in wrapper
2023-07-20 13:41:49,147 stacktrace       L0045 ERROR|     return
function(obj, *args, **kwargs)
2023-07-20 13:41:49,147 stacktrace       L0045 ERROR|   File
"/home/linux1/qemu/build/aarch64/tests/avocado/machine_aarch64_sbsaref.py",
line 84, in test_sbsaref_edk2_firmware
2023-07-20 13:41:49,147 stacktrace       L0045 ERROR|     self.fetch_firmware()
2023-07-20 13:41:49,147 stacktrace       L0045 ERROR|   File
"/home/linux1/qemu/build/aarch64/tests/avocado/machine_aarch64_sbsaref.py",
line 66, in fetch_firmware
2023-07-20 13:41:49,147 stacktrace       L0045 ERROR|     self.vm.set_console()
2023-07-20 13:41:49,147 stacktrace       L0045 ERROR|   File
"/home/linux1/qemu/build/aarch64/tests/avocado/avocado_qemu/__init__.py",
line 348, in vm
2023-07-20 13:41:49,147 stacktrace       L0045 ERROR|     return
self.get_vm(name='default')
2023-07-20 13:41:49,147 stacktrace       L0045 ERROR|   File
"/home/linux1/qemu/build/aarch64/tests/avocado/avocado_qemu/__init__.py",
line 354, in get_vm
2023-07-20 13:41:49,147 stacktrace       L0045 ERROR|
self._vms[name] = self._new_vm(name, *args)
2023-07-20 13:41:49,147 stacktrace       L0045 ERROR|   File
"/home/linux1/qemu/build/aarch64/tests/avocado/avocado_qemu/__init__.py",
line 324, in _new_vm
2023-07-20 13:41:49,147 stacktrace       L0045 ERROR|     vm =
QEMUMachine(self.qemu_bin, base_temp_dir=self.workdir,
2023-07-20 13:41:49,147 stacktrace       L0045 ERROR| TypeError:
__init__() got an unexpected keyword argument 'sock_dir'
2023-07-20 13:41:49,147 stacktrace       L0046 ERROR|
2023-07-20 13:41:49,147 test             L0775 DEBUG| Local variables:
2023-07-20 13:41:49,160 test             L0778 DEBUG|  -> obj <class
'machine_aarch64_sbsaref.Aarch64SbsarefMachine'>:
1-./build/aarch64/tests/avocado/machine_aarch64_sbsaref.py:Aarch64SbsarefMachine.test_sbsaref_edk2_firmware
2023-07-20 13:41:49,160 test             L0778 DEBUG|  -> args <class
'tuple'>: ()
2023-07-20 13:41:49,160 test             L0778 DEBUG|  -> kwargs
<class 'dict'>: {}
2023-07-20 13:41:49,160 test             L0778 DEBUG|  -> condition
<class 'str'>: 1
2023-07-20 13:41:49,160 test             L0778 DEBUG|  -> function
<class 'function'>: <function
Aarch64SbsarefMachine.test_sbsaref_edk2_firmware at 0x3ff814d9700>
2023-07-20 13:41:49,160 test             L0778 DEBUG|  -> message
<class 'str'>: Test is not reliable
2023-07-20 13:41:49,160 test             L0778 DEBUG|  -> negate
<class 'bool'>: True

thanks
-- PMM