Misc patches (qtests, s390x, m68k, gitlab-ci)
Subsystems (3)
[PULL 16/17] tests/tcg/s390x: Test LOAD ADDRESS EXTENDED
In reply to Thomas HuthFrom: Ilya Leoshkevich <[email protected]>
Add a small test to prevent regressions. Userspace runs in primary mode, so LAE should always set the access register to 0.
Message-ID: <[email protected]>
--- tests/tcg/s390x/lae.c | 31 +++++++++++++++++++++++++++++++ tests/tcg/s390x/Makefile.target | 1 + 2 files changed, 32 insertions(+) create mode 100644 tests/tcg/s390x/lae.c
tests/tcg/s390x/lae.c new file +31 -0
@@ -0,0 +1,31 @@ +/* +* Test the LOAD ADDRESS EXTENDED instruction. +* +* SPDX-License-Identifier: GPL-2.0-or-later +*/ +#include <assert.h> +#include <stdlib.h> + +int main (void ) +{ +unsigned long long ar =-1 , b2 =100000 , r, x2 =500 ; +/* +* Hardcode the register number, since clang does not allow using %rN in +* place of %aN. +*/ + registerunsigned long long r2 __asm__("2" ); +int tmp; + + asm("ear %[tmp],%%a2\n" +"lae %%r2,42(%[x2],%[b2])\n" +"ear %[ar],%%a2\n" +"sar %%a2,%[tmp]" + : [tmp]"=&r" (tmp),"=&r" (r2), [ar]"+r" (ar) + : [b2]"r" (b2), [x2]"r" (x2) + :"memory" ); + r = r2; +assert (ar ==0xffffffff00000000ULL ); +assert (r ==100542 ); + +return EXIT_SUCCESS ; +}
tests/tcg/s390x/Makefile.target +1 -0
@@ -44,6 +44,7 @@ TESTS+=clgebr TESTS+=clc TESTS+=laalg TESTS+=add-logical-with-carry +TESTS+=lae cdsg: CFLAGS+=-pthread cdsg: LDFLAGS+=-pthread
Signature · 1 line
2.43.0
[PULL 06/17] net: add explicit info about connecting/listening state
In reply to Thomas HuthFrom: Daniel P. Berrangé <[email protected]>
When running 'info network', if the stream backend is still in the process of connecting, or waiting for an incoming connection, no information is displayed.
There is also no way to distinguish whether the server is still in the process of setting up the listener socket, or whether it is ready to accept incoming client connections.
This leads to a race condition in the netdev-socket qtest which launches a server process followed by a client process. Under high load conditions it is possible for the client to attempt to connect before the server is accepting clients. For the scenarios which do not set the 'reconnect' option, this opens up a race which can lead to the test scenario failing to reach the expected state.
Now that 'info network' can distinguish between initialization phase and the listening phase, the netdev-socket qtest will correctly synchronize, such that the client QEMU is not spawned until the server is ready.
This should solve the non-deterministic failures seen with the netdev-socket qtest.
Message-ID: <[email protected]>
--- net/stream.c | 5 ++++- tests/qtest/netdev-socket.c | 10 +++++----- 2 files changed, 9 insertions(+), 6 deletions(-)
net/stream.c +4 -1
@@ -173,7 +173,7 @@ static gboolean net_stream_send(QIOChannel *ioc,net_socket_rs_init (&s->rs, net_stream_rs_finalize, false); s->nc.link_down = true; -qemu_set_info_str (&s->nc,"%s" ,"" ); +qemu_set_info_str (&s->nc,"listening" );qapi_event_send_netdev_stream_disconnected (s->nc.name);net_stream_arm_reconnect (s);
@@ -292,6 +292,7 @@ static void net_stream_server_listening(QIOTask *task, gpointer opaque) s->nc.link_down = true; s->listener =qio_net_listener_new (); +qemu_set_info_str (&s->nc,"listening" );net_socket_rs_init (&s->rs, net_stream_rs_finalize, false);qio_net_listener_set_client_func (s->listener, net_stream_listen, s,NULL );qio_net_listener_add (s->listener, listen_sioc);
@@ -309,6 +310,7 @@ static int net_stream_server_init(NetClientState *peer, nc =qemu_new_net_client (&net_stream_info, peer, model, name); s =DO_UPCAST (NetStreamState, nc, nc); +qemu_set_info_str (&s->nc,"initializing" ); s->listen_ioc =QIO_CHANNEL (listen_sioc); qio_channel_socket_listen_async(listen_sioc, addr, 0,
@@ -400,6 +402,7 @@ static int net_stream_client_init(NetClientState *peer, nc =qemu_new_net_client (&net_stream_info, peer, model, name); s =DO_UPCAST (NetStreamState, nc, nc); +qemu_set_info_str (&s->nc,"connecting" ); s->ioc =QIO_CHANNEL (sioc); s->nc.link_down = true;
tests/qtest/netdev-socket.c +5 -5
@@ -127,7 +127,7 @@ static void test_stream_inet_ipv4(void)"addr.ipv4=on,addr.ipv6=off," "addr.host=127.0.0.1,addr.port=%d", port); -EXPECT_STATE (qts0,"st0: index=0,type=stream,\r\n" ,0 ); +EXPECT_STATE (qts0,"st0: index=0,type=stream,listening\r\n" ,0 ); qts1 =qtest_initf ("-nodefaults -M none " "-netdev stream,server=false,id=st0,addr.type=inet,"
@@ -200,7 +200,7 @@ static void test_stream_unix_reconnect(void)"-netdev stream,id=st0,server=true,addr.type=unix," "addr.path=%s", path); -EXPECT_STATE (qts0,"st0: index=0,type=stream,\r\n" ,0 ); +EXPECT_STATE (qts0,"st0: index=0,type=stream,listening\r\n" ,0 ); qts1 =qtest_initf ("-nodefaults -M none " "-netdev stream,server=false,id=st0,addr.type=unix,"
@@ -250,7 +250,7 @@ static void test_stream_inet_ipv6(void)"addr.ipv4=off,addr.ipv6=on," "addr.host=::1,addr.port=%d", port); -EXPECT_STATE (qts0,"st0: index=0,type=stream,\r\n" ,0 ); +EXPECT_STATE (qts0,"st0: index=0,type=stream,listening\r\n" ,0 ); qts1 =qtest_initf ("-nodefaults -M none " "-netdev stream,server=false,id=st0,addr.type=inet,"
@@ -282,7 +282,7 @@ static void test_stream_unix(void)"addr.type=unix,addr.path=%s," , path); -EXPECT_STATE (qts0,"st0: index=0,type=stream,\r\n" ,0 ); +EXPECT_STATE (qts0,"st0: index=0,type=stream,listening\r\n" ,0 ); qts1 =qtest_initf ("-nodefaults -M none " "-netdev stream,id=st0,server=false,"
@@ -314,7 +314,7 @@ static void test_stream_unix_abstract(void)"addr.abstract=on" , path); -EXPECT_STATE (qts0,"st0: index=0,type=stream,\r\n" ,0 ); +EXPECT_STATE (qts0,"st0: index=0,type=stream,listening\r\n" ,0 ); qts1 =qtest_initf ("-nodefaults -M none " "-netdev stream,id=st0,server=false,"
Signature · 1 line
2.43.0
Hi Peter!
The following changes since commit 34eac35f893664eb8545b98142e23d9954722766:
Merge tag 'pull-riscv-to-apply-20240110' of https://github.com/alistair23/qemu into staging (2024-01-10 11:41:56 +0000)
are available in the Git repository at:
https://gitlab.com/thuth/qemu.git tags/pull-request-2024-01-11
for you to fetch changes up to 52a21689cd829c1cc931b59b5ee5bdb10dd578c1:
.gitlab-ci.d/buildtest.yml: Work around htags bug when environment is large (2024-01-11 17:49:21 +0100)
----------------------------------------------------------------
* Fix non-deterministic failures of the 'netdev-socket' qtest
* Fix device presence checking in the virtio-ccw qtest
* Support codespell checking in checkpatch.pl
* Fix emulation of LAE s390x instruction
* Work around htags bug when environment is large
* Some other small clean-ups here and there
----------------------------------------------------------------
Daniel P. Berrangé (7):
qtest: use correct boolean type for failover property
Revert "netdev: set timeout depending on loadavg"
Revert "osdep: add getloadavg"
Revert "tests/qtest/netdev-socket: Raise connection timeout to 120 seconds"
net: add explicit info about connecting/listening state
net: handle QIOTask completion to report useful error message
qtest: ensure netdev-socket tests have non-overlapping names
Ilya Leoshkevich (2):
target/s390x: Fix LAE setting a wrong access register
tests/tcg/s390x: Test LOAD ADDRESS EXTENDEDMark Cave-Ayland (1):
q800: move dp8393x_prom memory region to Q800MachineState
Nicholas Piggin (1):
gitlab: fix s390x tag for avocado-system-centos
Peter Maydell (1):
.gitlab-ci.d/buildtest.yml: Work around htags bug when environment is large
Samuel Tardieu (1):
tests/qtest/virtio-ccw: Fix device presence checking
Thomas Huth (1):
target/s390x/kvm/pv: Provide some more useful information if decryption fails
Zhao Liu (3):
hw/s390x/ccw: Replace basename() with g_path_get_basename()
hw/s390x/ccw: Replace dirname() with g_path_get_dirname()
scripts/checkpatch: Support codespell checkingmeson.build | 1 - hw/s390x/ipl.h | 2 +- include/hw/m68k/q800.h | 1 + include/qemu/osdep.h | 10 --- target/s390x/kvm/pv.h | 5 +- hw/m68k/q800.c | 7 +-- hw/s390x/ipl.c | 5 +- hw/s390x/s390-ccw.c | 7 ++- hw/s390x/s390-virtio-ccw.c | 5 +- net/stream.c | 18 ++++-- target/s390x/kvm/pv.c | 25 ++++++-- target/s390x/tcg/translate.c | 3 +- tests/qtest/netdev-socket.c | 42 +++---------- tests/qtest/virtio-ccw-test.c | 2 +- tests/qtest/virtio-net-failover.c | 36 +++++------ tests/tcg/s390x/lae.c | 31 ++++++++++ .gitlab-ci.d/buildtest.yml | 7 ++- scripts/checkpatch.pl | 125 ++++++++++++++++++++++++++++++++------ tests/tcg/s390x/Makefile.target | 1 + 19 files changed, 223 insertions(+), 110 deletions(-) create mode 100644 tests/tcg/s390x/lae.c
[PULL 15/17] target/s390x: Fix LAE setting a wrong access register
From: Ilya Leoshkevich <[email protected]>
LAE should set the access register corresponding to the first operand, instead, it always modifies access register 1.
Message-ID: <[email protected]>
--- target/s390x/tcg/translate.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
target/s390x/tcg/translate.c +2 -1
@@ -3221,6 +3221,7 @@ static DisasJumpType op_mov2e(DisasContext *s, DisasOps *o) {int b2 =get_field (s, b2);TCGv ar1 =tcg_temp_new_i64 (); +int r1 =get_field (s, r1); o->out = o->in2; o->in2 =NULL ;
@@ -3244,7 +3245,7 @@ static DisasJumpType op_mov2e(DisasContext *s, DisasOps *o)break ; } - tcg_gen_st32_i64(ar1, tcg_env, offsetof(CPUS390XState, aregs[1])); + tcg_gen_st32_i64(ar1, tcg_env, offsetof(CPUS390XState, aregs[r1]));return DISAS_NEXT ; }
Signature · 1 line
2.43.0
[PULL 08/17] qtest: ensure netdev-socket tests have non-overlapping names
In reply to Thomas HuthFrom: Daniel P. Berrangé <[email protected]>
When naming glib tests if the name of one test is a substring of the name of another test, it is not possible to use the '-p /the/name' option to run a single test.
Message-ID: <[email protected]>
--- tests/qtest/netdev-socket.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tests/qtest/netdev-socket.c +1 -1
@@ -526,7 +526,7 @@ int main(int argc, char **argv)#ifndef _WIN32qtest_add_func ("/netdev/dgram/unix" , test_dgram_unix);#endif -qtest_add_func ("/netdev/stream/unix" , test_stream_unix); +qtest_add_func ("/netdev/stream/unix/oneshot" , test_stream_unix);qtest_add_func ("/netdev/stream/unix/reconnect" , test_stream_unix_reconnect);#ifdef CONFIG_LINUX
Signature · 1 line
2.43.0
[PULL 02/17] qtest: use correct boolean type for failover property
In reply to Thomas HuthFrom: Daniel P. Berrangé <[email protected]>
QMP device_add does not historically validate the parameter types. At some point it will likely change to enforce correct types, to match behaviour of -device. The failover property is expected to be a boolean in JSON.
Message-ID: <[email protected]>
--- tests/qtest/virtio-net-failover.c | 36 +++++++++++++++---------------- 1 file changed, 18 insertions(+), 18 deletions(-)
tests/qtest/virtio-net-failover.c +18 -18
@@ -486,7 +486,7 @@ static void test_hotplug_1_reverse(void)qtest_qmp_device_add (qts,"virtio-net" ,"standby0" ,"{'bus': 'root0'," -"'failover': 'on'," +"'failover': true," "'netdev': 'hs0'," "'mac': '" MAC_STANDBY0 "'}" );
@@ -517,7 +517,7 @@ static void test_hotplug_2(void)qtest_qmp_device_add (qts,"virtio-net" ,"standby0" ,"{'bus': 'root0'," -"'failover': 'on'," +"'failover': true," "'netdev': 'hs0'," "'mac': '" MAC_STANDBY0 "'}" );
@@ -566,7 +566,7 @@ static void test_hotplug_2_reverse(void)qtest_qmp_device_add (qts,"virtio-net" ,"standby0" ,"{'bus': 'root0'," -"'failover': 'on'," +"'failover': true," "'netdev': 'hs0'," "'rombar': 0," "'romfile': '',"
@@ -639,7 +639,7 @@ static void test_migrate_out(gconstpointer opaque)qtest_qmp_device_add (qts,"virtio-net" ,"standby0" ,"{'bus': 'root0'," -"'failover': 'on'," +"'failover': true," "'netdev': 'hs0'," "'mac': '" MAC_STANDBY0 "'}" );
@@ -754,7 +754,7 @@ static void test_migrate_in(gconstpointer opaque)qtest_qmp_device_add (qts,"virtio-net" ,"standby0" ,"{'bus': 'root0'," -"'failover': 'on'," +"'failover': true," "'netdev': 'hs0'," "'mac': '" MAC_STANDBY0 "'}" );
@@ -808,7 +808,7 @@ static void test_off_migrate_out(gconstpointer opaque)qtest_qmp_device_add (qts,"virtio-net" ,"standby0" ,"{'bus': 'root0'," -"'failover': 'off'," +"'failover': false," "'netdev': 'hs0'," "'mac': '" MAC_STANDBY0 "'}" );
@@ -876,7 +876,7 @@ static void test_off_migrate_in(gconstpointer opaque)qtest_qmp_device_add (qts,"virtio-net" ,"standby0" ,"{'bus': 'root0'," -"'failover': 'off'," +"'failover': false," "'netdev': 'hs0'," "'mac': '" MAC_STANDBY0 "'}" );
@@ -927,7 +927,7 @@ static void test_guest_off_migrate_out(gconstpointer opaque)qtest_qmp_device_add (qts,"virtio-net" ,"standby0" ,"{'bus': 'root0'," -"'failover': 'on'," +"'failover': true," "'netdev': 'hs0'," "'mac': '" MAC_STANDBY0 "'}" );
@@ -1003,7 +1003,7 @@ static void test_guest_off_migrate_in(gconstpointer opaque)qtest_qmp_device_add (qts,"virtio-net" ,"standby0" ,"{'bus': 'root0'," -"'failover': 'on'," +"'failover': true," "'netdev': 'hs0'," "'mac': '" MAC_STANDBY0 "'}" );
@@ -1054,7 +1054,7 @@ static void test_migrate_guest_off_abort(gconstpointer opaque)qtest_qmp_device_add (qts,"virtio-net" ,"standby0" ,"{'bus': 'root0'," -"'failover': 'on'," +"'failover': true," "'netdev': 'hs0'," "'mac': '" MAC_STANDBY0 "'}" );
@@ -1154,7 +1154,7 @@ static void test_migrate_abort_wait_unplug(gconstpointer opaque)qtest_qmp_device_add (qts,"virtio-net" ,"standby0" ,"{'bus': 'root0'," -"'failover': 'on'," +"'failover': true," "'netdev': 'hs0'," "'mac': '" MAC_STANDBY0 "'}" );
@@ -1243,7 +1243,7 @@ static void test_migrate_abort_active(gconstpointer opaque)qtest_qmp_device_add (qts,"virtio-net" ,"standby0" ,"{'bus': 'root0'," -"'failover': 'on'," +"'failover': true," "'netdev': 'hs0'," "'mac': '" MAC_STANDBY0 "'}" );
@@ -1342,7 +1342,7 @@ static void test_migrate_off_abort(gconstpointer opaque)qtest_qmp_device_add (qts,"virtio-net" ,"standby0" ,"{'bus': 'root0'," -"'failover': 'off'," +"'failover': false," "'netdev': 'hs0'," "'mac': '" MAC_STANDBY0 "'}" );
@@ -1434,7 +1434,7 @@ static void test_migrate_abort_timeout(gconstpointer opaque)qtest_qmp_device_add (qts,"virtio-net" ,"standby0" ,"{'bus': 'root0'," -"'failover': 'on'," +"'failover': true," "'netdev': 'hs0'," "'mac': '" MAC_STANDBY0 "'}" );
@@ -1530,7 +1530,7 @@ static void test_multi_out(gconstpointer opaque)qtest_qmp_device_add (qts,"virtio-net" ,"standby0" ,"{'bus': 'root0'," -"'failover': 'on'," +"'failover': true," "'netdev': 'hs0'," "'mac': '" MAC_STANDBY0 "'}" );
@@ -1561,7 +1561,7 @@ static void test_multi_out(gconstpointer opaque)qtest_qmp_device_add (qts,"virtio-net" ,"standby1" ,"{'bus': 'root2'," -"'failover': 'on'," +"'failover': true," "'netdev': 'hs2'," "'mac': '" MAC_STANDBY1 "'}" );
@@ -1700,7 +1700,7 @@ static void test_multi_in(gconstpointer opaque)qtest_qmp_device_add (qts,"virtio-net" ,"standby0" ,"{'bus': 'root0'," -"'failover': 'on'," +"'failover': true," "'netdev': 'hs0'," "'mac': '" MAC_STANDBY0 "'}" );
@@ -1724,7 +1724,7 @@ static void test_multi_in(gconstpointer opaque)qtest_qmp_device_add (qts,"virtio-net" ,"standby1" ,"{'bus': 'root2'," -"'failover': 'on'," +"'failover': true," "'netdev': 'hs2'," "'mac': '" MAC_STANDBY1 "'}" );
Signature · 1 line
2.43.0
[PULL 07/17] net: handle QIOTask completion to report useful error message
In reply to Thomas HuthFrom: Daniel P. Berrangé <[email protected]>
The network stream backend uses the async QIO socket APIs for listening and connecting sockets. It does not check the task object completion status, however, instead just looking at whether the socket FD is -1 or not.
By checking the task completion, we can set a useful error message for users instead of the non-actionable "connection error" string.
eg so users will see:
(qemu) info network
net: index=0,type=stream,error: Failed to connect to '/foo.unix': No such file or directory
Message-ID: <[email protected]>
--- net/stream.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-)
net/stream.c +10 -5
@@ -165,6 +165,7 @@ static gboolean net_stream_send(QIOChannel *ioc, s->ioc_write_tag =0 ; }if (s->listener) { +qemu_set_info_str (&s->nc,"listening" );qio_net_listener_set_client_func (s->listener, net_stream_listen, s,NULL ); }
@@ -173,7 +174,6 @@ static gboolean net_stream_send(QIOChannel *ioc,net_socket_rs_init (&s->rs, net_stream_rs_finalize, false); s->nc.link_down = true; -qemu_set_info_str (&s->nc,"listening" );qapi_event_send_netdev_stream_disconnected (s->nc.name);net_stream_arm_reconnect (s);
@@ -272,9 +272,11 @@ static void net_stream_server_listening(QIOTask *task, gpointer opaque)QIOChannelSocket *listen_sioc =QIO_CHANNEL_SOCKET (s->listen_ioc);SocketAddress *addr;int ret; +Error *err =NULL ; -if (listen_sioc->fd <0 ) { -qemu_set_info_str (&s->nc,"connection error" ); +if (qio_task_propagate_error (task, &err)) { +qemu_set_info_str (&s->nc,"error: %s" ,error_get_pretty (err)); +error_free (err);return ; }
@@ -327,9 +329,11 @@ static void net_stream_client_connected(QIOTask *task, gpointer opaque)SocketAddress *addr;gchar *uri;int ret; +Error *err =NULL ; -if (sioc->fd <0 ) { -qemu_set_info_str (&s->nc,"connection error" ); +if (qio_task_propagate_error (task, &err)) { +qemu_set_info_str (&s->nc,"error: %s" ,error_get_pretty (err)); +error_free (err); goto error; }
@@ -384,6 +388,7 @@ static gboolean net_stream_reconnect(gpointer data)static void net_stream_arm_reconnect (NetStreamState *s) {if (s->reconnect && s->timer_tag ==0 ) { +qemu_set_info_str (&s->nc,"connecting" ); s->timer_tag =g_timeout_add_seconds (s->reconnect, net_stream_reconnect, s); }
Signature · 1 line
2.43.0
[PULL 01/17] q800: move dp8393x_prom memory region to Q800MachineState
In reply to Thomas HuthFrom: Mark Cave-Ayland <[email protected]>
There is no need to dynamically allocate the memory region from the heap.
Message-ID: <[email protected]>
--- include/hw/m68k/q800.h | 1 + hw/m68k/q800.c | 7 +++---- 2 files changed, 4 insertions(+), 4 deletions(-)
include/hw/m68k/q800.h +1 -0
@@ -55,6 +55,7 @@ struct Q800MachineState {MOS6522Q800VIA1State via1;MOS6522Q800VIA2State via2;dp8393xState dp8393x; +MemoryRegion dp8393x_prom;ESCCState escc;OrIRQState escc_orgate;SysBusESPState esp;
hw/m68k/q800.c +3 -4
@@ -253,7 +253,6 @@ static void q800_machine_init(MachineState *machine)int bios_size;ram_addr_t initrd_base;int32_t initrd_size; -MemoryRegion *dp8393x_prom =g_new (MemoryRegion,1 );uint8_t *prom;int i, checksum;MacFbMode *macfb_mode;
@@ -406,13 +405,13 @@ static void q800_machine_init(MachineState *machine)sysbus_connect_irq (sysbus,0 ,qdev_get_gpio_in (DEVICE (&m->glue),GLUE_IRQ_IN_SONIC )); -memory_region_init_rom (dp8393x_prom,NULL ,"dp8393x-q800.prom" , +memory_region_init_rom (&m->dp8393x_prom,NULL ,"dp8393x-q800.prom" ,SONIC_PROM_SIZE , &error_fatal);memory_region_add_subregion (get_system_memory (),SONIC_PROM_BASE , - dp8393x_prom); + &m->dp8393x_prom);/* Add MAC address with valid checksum to PROM */ - prom =memory_region_get_ram_ptr (dp8393x_prom); + prom =memory_region_get_ram_ptr (&m->dp8393x_prom); checksum =0 ;for (i =0 ; i <6 ; i++) { prom[i] =revbit8 (nd_table[0 ].macaddr.a[i]);
Signature · 1 line
2.43.0
[PULL 03/17] Revert "netdev: set timeout depending on loadavg"
In reply to Thomas HuthFrom: Daniel P. Berrangé <[email protected]>
This reverts commit cadfc7293977ecadc2d6c48d7cffc553ed2f85f1.
The test was not timing out because of slow execution. It was timing out due to a race condition leading to the client QEMU attempting (and fatally failing) to connect before the server QEMU was listening.
Message-ID: <[email protected]>
--- tests/qtest/netdev-socket.c | 28 +--------------------------- 1 file changed, 1 insertion(+), 27 deletions(-)
tests/qtest/netdev-socket.c +1 -27
@@ -18,32 +18,6 @@#define CONNECTION_TIMEOUT 120 -static double connection_timeout (void ) -{ -double load; -int ret =getloadavg (&load,1 ); - -/* -* If we can't get load data, or load is low because we just started -* running, assume load of 1 (we are alone in this system). -*/ -if (ret <1 || load <1.0 ) { - load =1.0 ; - } -/* -* No one wants to wait more than 10 minutes for this test. Higher load? -* Too bad. -*/ -if (load >10.0 ) { -fprintf (stderr,"Warning: load %f higher than 10 - test might timeout\n" , - load); - load =10.0 ; - } - -/* if load is high increase timeout as we might not get a chance to run */ -return load *CONNECTION_TIMEOUT ; -} -#define EXPECT_STATE (q, e, t) \ do { \ char *resp = NULL; \
@@ -57,7 +31,7 @@ do { \if (g_str_equal (resp, e)) { \break ; \ } \ - }while (g_test_timer_elapsed () <connection_timeout ()); \ + }while (g_test_timer_elapsed () <CONNECTION_TIMEOUT ); \ g_assert_cmpstr(resp, ==, e); \g_free (resp); \ }while (0 )
Signature · 1 line
2.43.0
[PULL 11/17] target/s390x/kvm/pv: Provide some more useful information if decryption fails
In reply to Thomas HuthIt's a common scenario to copy guest images from one host to another to run the guest on the other machine. This (of course) does not work with "secure execution" guests since they are encrypted with one certain host key. However, if you still (accidentally) do it, you only get a very user-unfriendly error message that looks like this:
qemu-system-s390x: KVM PV command 2 (KVM_PV_SET_SEC_PARMS) failed:
header rc 108 rrc 5 IOCTL rc: -22
Let's provide at least a somewhat nicer hint to the users so that they are able to figure out what might have gone wrong.
Message-ID: <[email protected]>
--- hw/s390x/ipl.h | 2 +- target/s390x/kvm/pv.h | 5 +++-- hw/s390x/ipl.c | 5 ++--- hw/s390x/s390-virtio-ccw.c | 5 ++++- target/s390x/kvm/pv.c | 25 ++++++++++++++++++++----- 5 files changed, 30 insertions(+), 12 deletions(-)
hw/s390x/ipl.h +1 -1
@@ -107,7 +107,7 @@ typedef union IplParameterBlock IplParameterBlock;int s390_ipl_set_loadparm (uint8_t *loadparm);void s390_ipl_update_diag308 (IplParameterBlock *iplb); -int s390_ipl_prepare_pv_header (void ); +int s390_ipl_prepare_pv_header (Error **errp);int s390_ipl_pv_unpack (void );void s390_ipl_prepare_cpu (S390CPU *cpu);IplParameterBlock *s390_ipl_get_iplb (void );
target/s390x/kvm/pv.h +3 -2
@@ -42,7 +42,7 @@ int s390_pv_query_info(void);int s390_pv_vm_enable (void );void s390_pv_vm_disable (void );bool s390_pv_vm_try_disable_async (S390CcwMachineState *ms); -int s390_pv_set_sec_parms (uint64_t origin,uint64_t length); +int s390_pv_set_sec_parms (uint64_t origin,uint64_t length,Error **errp);int s390_pv_unpack (uint64_t addr,uint64_t size,uint64_t tweak);void s390_pv_prep_reset (void );int s390_pv_verify (void );
@@ -62,7 +62,8 @@ static inline int s390_pv_query_info(void) { return 0; }static inline int s390_pv_vm_enable (void ) {return 0 ; }static inline void s390_pv_vm_disable (void ) {}static inline bool s390_pv_vm_try_disable_async (S390CcwMachineState *ms) {return false; } -static inline int s390_pv_set_sec_parms (uint64_t origin,uint64_t length) {return 0 ; } +static inline int s390_pv_set_sec_parms (uint64_t origin,uint64_t length, +Error **errp) {return 0 ; }static inline int s390_pv_unpack (uint64_t addr,uint64_t size,uint64_t tweak) {return 0 ; }static inline void s390_pv_prep_reset (void ) {}static inline int s390_pv_verify (void ) {return 0 ; }
hw/s390x/ipl.c +2 -3
@@ -702,7 +702,7 @@ static void s390_ipl_prepare_qipl(S390CPU *cpu)cpu_physical_memory_unmap (addr, len,1 , len); } -int s390_ipl_prepare_pv_header (void ) +int s390_ipl_prepare_pv_header (Error **errp) {IplParameterBlock *ipib =s390_ipl_get_iplb_pv ();IPLBlockPV *ipib_pv = &ipib->pv;
@@ -711,8 +711,7 @@ int s390_ipl_prepare_pv_header(void)cpu_physical_memory_read (ipib_pv->pv_header_addr, hdr, ipib_pv->pv_header_len); - rc =s390_pv_set_sec_parms ((uintptr_t )hdr, - ipib_pv->pv_header_len); + rc =s390_pv_set_sec_parms ((uintptr_t )hdr, ipib_pv->pv_header_len, errp);g_free (hdr);return rc; }
hw/s390x/s390-virtio-ccw.c +4 -1
@@ -391,7 +391,7 @@ static int s390_machine_protect(S390CcwMachineState *ms) }/* Set SE header and unpack */ - rc =s390_ipl_prepare_pv_header (); + rc =s390_ipl_prepare_pv_header (&local_err);if (rc) { goto out_err; }
@@ -410,6 +410,9 @@ static int s390_machine_protect(S390CcwMachineState *ms)return rc; out_err: +if (local_err) { +error_report_err (local_err); + }s390_machine_unprotect (ms);return rc; }
target/s390x/kvm/pv.c +20 -5
@@ -29,7 +29,8 @@ static bool info_valid;static struct kvm_s390_pv_info_vm info_vm;static struct kvm_s390_pv_info_dump info_dump; -static int __s390_pv_cmd (uint32_t cmd,const char *cmdname,void *data) +static int __s390_pv_cmd (uint32_t cmd,const char *cmdname,void *data, +int *pvrc) {struct kvm_pv_cmd pv_cmd = { .cmd = cmd,
@@ -46,6 +47,9 @@ static int __s390_pv_cmd(uint32_t cmd, const char *cmdname, void *data)"IOCTL rc: %d" , cmd, cmdname, pv_cmd.rc, pv_cmd.rrc, rc); } +if (pvrc) { + *pvrc = pv_cmd.rc; + }return rc; }
@@ -53,12 +57,13 @@ static int __s390_pv_cmd(uint32_t cmd, const char *cmdname, void *data)* This macro lets us pass the command as a string to the function so * we can print it on an error. */ -#define s390_pv_cmd (cmd, data) __s390_pv_cmd(cmd, #cmd, data) +#define s390_pv_cmd (cmd, data) __s390_pv_cmd(cmd, #cmd, data, NULL) +#define s390_pv_cmd_pvrc (cmd, data, pvrc) __s390_pv_cmd(cmd, #cmd, data, pvrc)#define s390_pv_cmd_exit (cmd, data) \ { \ int rc; \ \ - rc = __s390_pv_cmd(cmd, #cmd, data);\ + rc = __s390_pv_cmd(cmd, #cmd, data, NULL); \ if (rc) { \ exit(1); \ } \
@@ -142,14 +147,24 @@ bool s390_pv_vm_try_disable_async(S390CcwMachineState *ms)return true; } -int s390_pv_set_sec_parms (uint64_t origin,uint64_t length) +int s390_pv_set_sec_parms (uint64_t origin,uint64_t length,Error **errp) { +int ret, pvrc;struct kvm_s390_pv_sec_parm args = { .origin = origin, .length = length, }; -return s390_pv_cmd (KVM_PV_SET_SEC_PARMS , &args); + ret =s390_pv_cmd_pvrc (KVM_PV_SET_SEC_PARMS , &args, &pvrc); +if (ret) { +error_setg (errp,"Failed to set secure execution parameters" ); +if (pvrc ==0x108 ) { +error_append_hint (errp,"Please check whether the image is " +"correctly encrypted for this host\n" ); + } + } + +return ret; }/*
Signature · 1 line
2.43.0
[PULL 05/17] Revert "tests/qtest/netdev-socket: Raise connection timeout to 120 seconds"
In reply to Thomas HuthFrom: Daniel P. Berrangé <[email protected]>
This reverts commit 0daaf2761f6d268ffaa2d01d450e202e127452b1.
The test was not timing out because of slow execution. It was timing out due to a race condition leading to the client QEMU attempting (and fatally failing) to connect before the server QEMU was listening.
Message-ID: <[email protected]>
--- tests/qtest/netdev-socket.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tests/qtest/netdev-socket.c +1 -1
@@ -16,7 +16,7 @@#include "qapi/qobject-input-visitor.h" #include "qapi/qapi-visit-sockets.h" -#define CONNECTION_TIMEOUT 120 +#define CONNECTION_TIMEOUT 60#define EXPECT_STATE (q, e, t) \ do { \
Signature · 1 line
2.43.0
[PULL 04/17] Revert "osdep: add getloadavg"
In reply to Thomas HuthFrom: Daniel P. Berrangé <[email protected]>
This reverts commit dc864d3a3777424187280e50c9bfb84dced54f12.
This functionality is not required after the previous revert
Message-ID: <[email protected]>
--- meson.build | 1 - include/qemu/osdep.h | 10 ---------- 2 files changed, 11 deletions(-)
meson.build +0 -1
@@ -2341,7 +2341,6 @@ config_host_data.set('HAVE_GLIB_WITH_SLICE_ALLOCATOR', glib_has_gslice) config_host_data.set('HAVE_OPENPTY', cc.has_function('openpty', dependencies: util)) config_host_data.set('HAVE_STRCHRNUL', cc.has_function('strchrnul')) config_host_data.set('HAVE_SYSTEM_FUNCTION', cc.has_function('system', prefix: '#include <stdlib.h>')) -config_host_data.set('HAVE_GETLOADAVG_FUNCTION', cc.has_function('getloadavg', prefix: '#include <stdlib.h>')) if rbd.found() config_host_data.set('HAVE_RBD_NAMESPACE_EXISTS', cc.has_function('rbd_namespace_exists',
include/qemu/osdep.h +0 -10
@@ -781,16 +781,6 @@ static inline int platform_does_not_support_system(const char *command) }#endif /* !HAVE_SYSTEM_FUNCTION */ -/** -* If the load average was unobtainable, -1 is returned -*/ -#ifndef HAVE_GETLOADAVG_FUNCTION -static inline int getloadavg (double loadavg[],int nelem) -{ -return -1 ; -} -#endif /* !HAVE_GETLOADAVG_FUNCTION */ -#ifdef __cplusplus }#endif
Signature · 1 line
2.43.0
[PULL 13/17] hw/s390x/ccw: Replace dirname() with g_path_get_dirname()
In reply to Thomas HuthFrom: Zhao Liu <[email protected]>
As commit 3e015d815b3f ("use g_path_get_basename instead of basename") said, g_path_get_dirname() should be preferred over dirname() since the former is a portable utility function that has the advantage of not modifying the string argument.
Replace dirname() with g_path_get_dirname().
Message-ID: <[email protected]>
--- hw/s390x/s390-ccw.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
hw/s390x/s390-ccw.c +3 -1
@@ -77,6 +77,7 @@ static void s390_ccw_get_dev_info(S390CCWDevice *cdev, {unsigned int cssid, ssid, devid;char dev_path[PATH_MAX ] = {0 }; + g_autofree char *tmp_dir = NULL; g_autofree char *tmp = NULL;if (!sysfsdev) {
@@ -93,7 +94,8 @@ static void s390_ccw_get_dev_info(S390CCWDevice *cdev, cdev->mdevid =g_path_get_basename (dev_path); - tmp =g_path_get_basename (dirname (dev_path)); + tmp_dir =g_path_get_dirname (dev_path); + tmp =g_path_get_basename (tmp_dir);if (sscanf (tmp,"%2x.%1x.%4x" , &cssid, &ssid, &devid) !=3 ) {error_setg_errno (errp, errno,"Failed to read %s" , tmp);return ;
Signature · 1 line
2.43.0
[PULL 14/17] scripts/checkpatch: Support codespell checking
In reply to Thomas HuthFrom: Zhao Liu <[email protected]>
Add two spelling check options (--codespell and --codespellfile) to enhance spelling check through dictionary, which copied the Linux kernel's implementation in checkpatch.pl.
This check uses the dictionary at "/usr/share/codespell/dictionary.txt" by default, if there is no dictionary specified under this path, it will look for the dictionary of python3's codespell (This requires user to add python3's path in environment variable $PATH, and to install codespell by "pip install codespell").
Message-ID: <[email protected]>
--- scripts/checkpatch.pl | 125 +++++++++++++++++++++++++++++++++++------- 1 file changed, 105 insertions(+), 20 deletions(-)
scripts/checkpatch.pl +105 -20
@@ -35,6 +35,9 @@ my $summary_file = 0; my $root; my %debug; my $help = 0; +my $codespell = 0; +my $codespellfile = "/usr/share/codespell/dictionary.txt"; +my $user_codespellfile = ""; sub help { my ($exitcode) = @_;
@@ -66,6 +69,9 @@ Options: is all off) --test-only=WORD report only warnings/errors containing WORD literally + --codespell Use the codespell dictionary for spelling/typos + (default: $codespellfile) + --codespellfile Use this codespell dictionary --color[=WHEN] Use colors 'always', 'never', or only when output is a terminal ('auto'). Default is 'auto'. -h, --help, --version display this help and exit
@@ -85,28 +91,50 @@ foreach (@ARGV) { } GetOptions( - 'q|quiet+' => \$quiet, - 'tree!' => \$tree, - 'signoff!' => \$chk_signoff, - 'patch!' => \$chk_patch, - 'branch!' => \$chk_branch, - 'emacs!' => \$emacs, - 'terse!' => \$terse, - 'f|file!' => \$file, - 'strict!' => \$no_warnings, - 'root=s' => \$root, - 'summary!' => \$summary, - 'mailback!' => \$mailback, - 'summary-file!' => \$summary_file, - - 'debug=s' => \%debug, - 'test-only=s' => \$tst_only, - 'color=s' => \$color, - 'no-color' => sub { $color = 'never'; }, - 'h|help' => \$help, - 'version' => \$help + 'q|quiet+' => \$quiet, + 'tree!' => \$tree, + 'signoff!' => \$chk_signoff, + 'patch!' => \$chk_patch, + 'branch!' => \$chk_branch, + 'emacs!' => \$emacs, + 'terse!' => \$terse, + 'f|file!' => \$file, + 'strict!' => \$no_warnings, + 'root=s' => \$root, + 'summary!' => \$summary, + 'mailback!' => \$mailback, + 'summary-file!' => \$summary_file, + 'debug=s' => \%debug, + 'test-only=s' => \$tst_only, + 'codespell!' => \$codespell, + 'codespellfile=s' => \$user_codespellfile, + 'color=s' => \$color, + 'no-color' => sub { $color = 'never'; }, + 'h|help' => \$help, + 'version' => \$help ) or help(1); +if ($user_codespellfile) { + # Use the user provided codespell file unconditionally + $codespellfile = $user_codespellfile; +} elsif (!(-f $codespellfile)) { + # If /usr/share/codespell/dictionary.txt is not present, try to find it + # under codespell's install directory: <codespell_root>/data/dictionary.txt + if (($codespell || $help) && which("python3") ne "") { + my $python_codespell_dict = << "EOF"; + +import os.path as op +import codespell_lib +codespell_dir = op.dirname(codespell_lib.__file__) +codespell_file = op.join(codespell_dir, 'data', 'dictionary.txt') +print(codespell_file, end='') +EOF + + my $codespell_dict = `python3 -c "$python_codespell_dict" 2> /dev/null`; + $codespellfile = $codespell_dict if (-f $codespell_dict); + } +} + help(0) if ($help); my $exit = 0;
@@ -337,6 +365,36 @@ our @typeList = ( qr{guintptr}, ); +# Load common spelling mistakes and build regular expression list. +my $misspellings; +my %spelling_fix; + +if ($codespell) { + if (open(my $spelling, '<', $codespellfile)) { + while (<$spelling>) { + my $line = $_; + + $line =~ s/\s*\n?$//g; + $line =~ s/^\s*//g; + + next if ($line =~ m/^\s*#/); + next if ($line =~ m/^\s*$/); + next if ($line =~ m/, disabled/i); + + $line =~ s/,.*$//; + + my ($suspect, $fix) = split(/->/, $line); + + $spelling_fix{$suspect} = $fix; + } + close($spelling); + } else { + warn "No codespell typos will be found - file '$codespellfile': $!\n"; + } +} + +$misspellings = join("|", sort keys %spelling_fix) if keys %spelling_fix; + # This can be modified by sub possible. Since it can be empty, be careful # about regexes that always match, because they can cause infinite loops. our @modifierList = (
@@ -477,6 +535,18 @@ sub top_of_kernel_tree { return 1; } +sub which { + my ($bin) = @_; + + foreach my $path (split(/:/, $ENV{PATH})) { + if (-e "$path/$bin") { + return "$path/$bin"; + } + } + + return ""; +} + sub expand_tabs { my ($str) = @_;
@@ -1585,6 +1655,21 @@ sub process { WARN("8-bit UTF-8 used in possible commit log\n" . $herecurr); } +# Check for various typo / spelling mistakes + if (defined($misspellings) && + ($in_commit_log || $line =~ /^(?:\+|Subject:)/i)) { + while ($rawline =~ /(?:^|[^\w\-'`])($misspellings)(?:[^\w\-'`]|$)/gi) { + my $typo = $1; + my $blank = copy_spacing($rawline); + my $ptr = substr($blank, 0, $-[1]) . "^" x length($typo); + my $hereptr = "$hereline$ptr\n"; + my $typo_fix = $spelling_fix{lc($typo)}; + $typo_fix = ucfirst($typo_fix) if ($typo =~ /^[A-Z]/); + $typo_fix = uc($typo_fix) if ($typo =~ /^[A-Z]+$/); + WARN("'$typo' may be misspelled - perhaps '$typo_fix'?\n" . $hereptr); + } + } + # ignore non-hunk lines and lines being removed next if (!$hunk_line || $line =~ /^-/);
Signature · 1 line
2.43.0
[PULL 10/17] gitlab: fix s390x tag for avocado-system-centos
In reply to Thomas HuthFrom: Nicholas Piggin <[email protected]>
The 390x tag should be s390x.
Message-ID: <[email protected]>
--- .gitlab-ci.d/buildtest.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
.gitlab-ci.d/buildtest.yml +1 -1
@@ -184,7 +184,7 @@ avocado-system-centos: variables: IMAGE: centos8 MAKE_CHECK_ARGS: check-avocado - AVOCADO_TAGS: arch:ppc64 arch:or1k arch:390x arch:x86_64 arch:rx + AVOCADO_TAGS: arch:ppc64 arch:or1k arch:s390x arch:x86_64 arch:rx arch:sh4 arch:nios2 build-system-opensuse:
Signature · 1 line
2.43.0
[PULL 12/17] hw/s390x/ccw: Replace basename() with g_path_get_basename()
In reply to Thomas HuthFrom: Zhao Liu <[email protected]>
g_path_get_basename() is a portable utility function that has the advantage of not modifying the string argument, so it should be preferred over basename().
And also to avoid potential compile breakage with the Musl C library similar to [1], replace basename() with g_path_get_basename().
[1]: https://lore.kernel.org/all/[email protected]/
Message-ID: <[email protected]>
--- hw/s390x/s390-ccw.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
hw/s390x/s390-ccw.c +3 -2
@@ -76,7 +76,8 @@ static void s390_ccw_get_dev_info(S390CCWDevice *cdev, Error **errp) {unsigned int cssid, ssid, devid; -char dev_path[PATH_MAX ] = {0 }, *tmp; +char dev_path[PATH_MAX ] = {0 }; + g_autofree char *tmp = NULL;if (!sysfsdev) {error_setg (errp,"No host device provided" );
@@ -92,7 +93,7 @@ static void s390_ccw_get_dev_info(S390CCWDevice *cdev, cdev->mdevid =g_path_get_basename (dev_path); - tmp =basename (dirname (dev_path)); + tmp =g_path_get_basename (dirname (dev_path));if (sscanf (tmp,"%2x.%1x.%4x" , &cssid, &ssid, &devid) !=3 ) {error_setg_errno (errp, errno,"Failed to read %s" , tmp);return ;
Signature · 1 line
2.43.0
[PULL 17/17] .gitlab-ci.d/buildtest.yml: Work around htags bug when environment is large
In reply to Thomas HuthFrom: Peter Maydell <[email protected]>
Sometimes the CI "pages" job fails with a message like this from htags:
$ htags -anT --tree-view=filetree -m qemu_init -t "Welcome to the QEMU sourcecode" htags: Negative exec line limit = -371
This is due to a bug in hflags where if the environment is too large it falls over:
https://lists.gnu.org/archive/html/bug-global/2024-01/msg00000.html
This happens to us because GitLab CI puts the commit message of the commit under test into the CI_COMMIT_MESSAGE and/or CI_COMMIT_TAG_MESSAGE environment variables, so the job will fail if the commit happens to have a verbose commit message.
Work around the htags bug by unsetting these variables while running htags.
Cc: [email protected]
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2080
Message-ID: <[email protected]>
--- .gitlab-ci.d/buildtest.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
.gitlab-ci.d/buildtest.yml +4 -1
@@ -647,7 +647,10 @@ pages: - mkdir -p public # HTML-ised source tree - make gtags - - htags -anT --tree-view=filetree -m qemu_init + # We unset variables to work around a bug in some htags versions + # which causes it to fail when the environment is large + - CI_COMMIT_MESSAGE= CI_COMMIT_TAG_MESSAGE= htags + -anT --tree-view=filetree -m qemu_init -t "Welcome to the QEMU sourcecode" - mv HTML public/src # Project documentation
Signature · 1 line
2.43.0
[PULL 09/17] tests/qtest/virtio-ccw: Fix device presence checking
In reply to Thomas HuthFrom: Samuel Tardieu <[email protected]>
An apparent copy-paste error tests for the presence of the virtio-rng-ccw device in order to perform tests on the virtio-scsi-ccw device.
Message-ID: <[email protected]>
--- tests/qtest/virtio-ccw-test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tests/qtest/virtio-ccw-test.c +1 -1
@@ -85,7 +85,7 @@ int main(int argc, char **argv)if (qtest_has_device ("virtio-rng-ccw" )) {qtest_add_func ("/virtio/rng/nop" , virtio_rng_nop); } -if (qtest_has_device ("virtio-rng-ccw" )) { +if (qtest_has_device ("virtio-scsi-ccw" )) {qtest_add_func ("/virtio/scsi/nop" , virtio_scsi_nop);qtest_add_func ("/virtio/scsi/hotplug" , virtio_scsi_hotplug); }
Signature · 1 line
2.43.0
Peter Maydell
AppliedQuoted 15 lines · Thomas Huth
Hi Peter!
The following changes since commit
34eac35f893664eb8545b98142e23d9954722766:Merge tag 'pull-riscv-to-apply-20240110' of https://github.com/alistair23/qemu into staging (2024-01-10 11:41:56 +0000)
are available in the Git repository at:
https://gitlab.com/thuth/qemu.git tags/pull-request-2024-01-11
for you to fetch changes up to
52a21689cd829c1cc931b59b5ee5bdb10dd578c1:
.gitlab-ci.d/buildtest.yml: Work around htags bug when environment is large (2024-01-11 17:49:21 +0100)
Quoted 8 lines
----------------------------------------------------------------
* Fix non-deterministic failures of the 'netdev-socket' qtest
* Fix device presence checking in the virtio-ccw qtest
* Support codespell checking in checkpatch.pl
* Fix emulation of LAE s390x instruction
* Work around htags bug when environment is large
* Some other small clean-ups here and there
Applied, thanks.
Please update the changelog at https://wiki.qemu.org/ChangeLog/9.0
for any user-visible changes.
-- PMM