Re: [PATCH v4 01/11] reset: allow registering handlers that aren't called by snapshot loading

2022-10-24 Thread Markus Armbruster
"Jason A. Donenfeld" writes: > Snapshot loading only expects to call deterministic handlers, not > non-deterministic ones. So introduce a way of registering handlers that > won't be called when reseting for snapshots. > > Signed-off-by: Jason A. Donenfeld [...] > diff --git a/qapi/run-state.js

Re: [PATCH] tcg/riscv: Fix base register for user-only qemu_ld/st

2022-10-24 Thread LIU Zhiwei
On 2022/10/24 7:33, Richard Henderson wrote: When guest_base != 0, we were not coordinating the usage of TCG_REG_TMP0 as base properly, leading to a previous zero-extend of the input address being discarded. Shuffle the alignment check to the front, because that does not depend on the zero-ext

Re: [PATCH 2/4] vhost: toggle device callbacks using used event idx

2022-10-24 Thread Michael S. Tsirkin
On Tue, Oct 25, 2022 at 01:46:43PM +0800, Jason Wang wrote: > On Tue, Oct 25, 2022 at 1:36 PM Michael S. Tsirkin wrote: > > > > On Tue, Oct 25, 2022 at 10:26:35AM +0800, Jason Wang wrote: > > > On Mon, Oct 24, 2022 at 10:05 PM Michael S. Tsirkin > > > wrote: > > > > > > > > On Mon, Oct 24, 2022

Re: [PATCH 2/4] vhost: toggle device callbacks using used event idx

2022-10-24 Thread Jason Wang
On Tue, Oct 25, 2022 at 1:36 PM Michael S. Tsirkin wrote: > > On Tue, Oct 25, 2022 at 10:26:35AM +0800, Jason Wang wrote: > > On Mon, Oct 24, 2022 at 10:05 PM Michael S. Tsirkin wrote: > > > > > > On Mon, Oct 24, 2022 at 04:00:37PM +0200, Eugenio Perez Martin wrote: > > > > > > It's generally a w

Re: [PATCH 2/4] vhost: toggle device callbacks using used event idx

2022-10-24 Thread Michael S. Tsirkin
On Tue, Oct 25, 2022 at 10:26:35AM +0800, Jason Wang wrote: > On Mon, Oct 24, 2022 at 10:05 PM Michael S. Tsirkin wrote: > > > > On Mon, Oct 24, 2022 at 04:00:37PM +0200, Eugenio Perez Martin wrote: > > > > > It's generally a waste that we don't use endian-ness annotations > > > > > the way linux

Re: [PATCH v3] linux-user: Add guest memory layout to exception dump

2022-10-24 Thread Richard Henderson
On 10/25/22 15:24, Richard Henderson wrote: It would also fix a bug in that the host page permissions do not exactly match guest page permissions, and you're reporting host page permissions. Gah, not true, we've already probed page_flags. Reviewed-by: Richard Henderson r~

Re: [PATCH v5] linux-user: Add close_range() syscall

2022-10-24 Thread Richard Henderson
On 10/25/22 12:34, Helge Deller wrote: Signed-off-by: Helge Deller --- Changes: v5: Simplify check of arg2 against target_fd_max even more v4: Fix check of arg2 v3: fd_trans_unregister() only called if close_range() doesn't fail v2: consider CLOSE_RANGE_CLOEXEC flag Reviewed-by: Richard Henders

Re: [PATCH v3] linux-user: Add guest memory layout to exception dump

2022-10-24 Thread Richard Henderson
On 10/25/22 12:51, Helge Deller wrote: On 10/25/22 04:25, Richard Henderson wrote: On 10/25/22 11:57, Helge Deller wrote: On 10/25/22 00:35, Richard Henderson wrote: On 10/25/22 06:18, Helge Deller wrote: When the emulation stops with a hard exception it's very useful for debugging purposes t

[RFC PATCH 0/4] MultiFD zero-copy improvements

2022-10-24 Thread Leonardo Bras
RFC for an improvement suggested by Juan during the KVM Forum and a few optimizations I found in the way. Patch #1 is just moving code to a helper, should have no impact. Patch #2 is my implementation of Juan's suggestion. I implemented the simplest way I thought on the array size: a fixed define

[RFC PATCH 1/4] migration/multifd/zero-copy: Create helper function for flushing

2022-10-24 Thread Leonardo Bras
Move flushing code from multifd_send_sync_main() to a new helper, and call it in multifd_send_sync_main(). Signed-off-by: Leonardo Bras --- migration/multifd.c | 30 +++--- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/migration/multifd.c b/migration/mul

[RFC PATCH 4/4] migration/multifd/zero-copy: Flush only the LRU half of the header array

2022-10-24 Thread Leonardo Bras
Zero-copy multifd migration sends both the header and the memory pages in a single syscall. Since it's necessary to flush before reusing the header, a header array was implemented, so each write call uses a different array, and flushing only take place after all headers have been used, meaning 1 fl

[RFC PATCH 3/4] QIOChannel: Add max_pending parameter to qio_channel_flush()

2022-10-24 Thread Leonardo Bras
Zero-copy write in Linux is an asynchronous type of write, meaning the send process is not finished by the time the function returns. Since it's also zero-copy, it means that incorrect data may be sent if the write buffer gets modified after write returns. To check if a zero-copy write is finished

[RFC PATCH 2/4] migration/multifd/zero-copy: Merge header & pages send in a single write

2022-10-24 Thread Leonardo Bras
When zero-copy-send is enabled, each loop iteration of the multifd_send_thread will calls for qio_channel_write_*() twice: The first one for sending the header without zero-copy flag and the second one for sending the memory pages, with zero-copy flag enabled. This ends up calling two syscalls per

[PATCH v1 1/2] hw/riscv/opentitan: bump opentitan

2022-10-24 Thread Wilfred Mallawa
From: Wilfred Mallawa This patch updates the OpenTitan model to match the specified register layout as per [1]. Which is also the latest commit of OpenTitan supported by TockOS. Note: Pinmux and Padctrl has been merged into Pinmux [2][3], this patch removes any references to Padctrl. Note: OpenT

Re: [RFC PATCH] main-loop: introduce WITH_QEMU_IOTHREAD_LOCK

2022-10-24 Thread Akihiko Odaki
Hi, Thanks for your proposal. I always wanted to see the helper functions with block, which is really specific to Apple-related code are replaced with more QEMU-standard GLib infrastructure. What about returning IoThreadLocked with qemu_iothread_auto_lock() and assign it to g_auto(IoThreadLo

[PATCH v1 2/2] hw/riscv/opentitan: add aon_timer base unimpl

2022-10-24 Thread Wilfred Mallawa
From: Wilfred Mallawa Adds the updated `aon_timer` base as an unimplemented device. This is used by TockOS, patch ensures the guest doesn't hit load faults. Signed-off-by: Wilfred Mallawa Reviewed-by: Bin Meng Reviewed-by: Alistair Francis --- hw/riscv/opentitan.c | 3 +++ include/hw

[PATCH v1 0/2] hw/riscv/opentitan: bump opentitan version

2022-10-24 Thread Wilfred Mallawa
From: Wilfred Mallawa This patch provides updates to the OpenTitan model to bump to RTL version . A unique change here is the merger of hwip `padctrl` into `pinmux`, to reflect this change, any references to `padctrl` are removed. Additionally, an unimplemented device for `aon_timer` is added an

Re: [PATCH v0 2/2] hw/riscv/opentitan: add aon_timer base unimpl

2022-10-24 Thread Alistair Francis
On Tue, Oct 25, 2022 at 11:19 AM Wilfred Mallawa wrote: > > From: Wilfred Mallawa > > Adds the updated `aon_timer` base as an unimplemented device. This is > used by TockOS, patch ensures the guest doesn't hit load faults. > > Signed-off-by: Wilfred Mallawa Reviewed-by: Alistair Francis Alist

Re: [PATCH v0 1/2] hw/riscv/opentitan: bump opentitan

2022-10-24 Thread Alistair Francis
On Tue, Oct 25, 2022 at 11:18 AM Wilfred Mallawa wrote: > > From: Wilfred Mallawa > > This patch updates the OpenTitan model to match > the specified register layout as per [1]. Which is also the latest > commit of OpenTitan supported by TockOS. > > Note: Pinmux and Padctrl has been merged into P

Re: [RFC 6/8] target/riscv: delete redundant check for zcd instructions in decode_opc

2022-10-24 Thread Alistair Francis
On Fri, Sep 30, 2022 at 11:28 AM Weiwei Li wrote: > > All the check for Zcd instructions have been done in their trans function > > Signed-off-by: Weiwei Li > Signed-off-by: Junqiang Wang > --- > target/riscv/translate.c | 7 --- > 1 file changed, 7 deletions(-) > > diff --git a/target/risc

Re: [RFC 7/8] target/riscv: expose properties for Zc* extension

2022-10-24 Thread Alistair Francis
On Fri, Sep 30, 2022 at 11:29 AM Weiwei Li wrote: > > Expose zca,zcb,zcf,zcd,zcmp,zcmt properties > > Signed-off-by: Weiwei Li > Signed-off-by: Junqiang Wang Reviewed-by: Alistair Francis Alistair > --- > target/riscv/cpu.c | 13 + > 1 file changed, 13 insertions(+) > > diff --g

Re: [RFC 1/8] target/riscv: add cfg properties for Zc* extension

2022-10-24 Thread Alistair Francis
On Fri, Sep 30, 2022 at 11:28 AM Weiwei Li wrote: > > Add properties for Zca,Zcb,Zcf,Zcd,Zcmp,Zcmt extension > Add check for these properties > > Signed-off-by: Weiwei Li > Signed-off-by: Junqiang Wang Reviewed-by: Alistair Francis Alistair > --- > target/riscv/cpu.c | 24 ++

Re: [PATCH] tcg/riscv: Fix reg overlap case in tcg_out_addsub2

2022-10-24 Thread Alistair Francis
On Fri, Oct 21, 2022 at 9:47 AM Richard Henderson wrote: > > There was a typo using opc_addi instead of opc_add with the > two registers. While we're at it, simplify the gating test > to al == bl to improve dynamic scheduling even when the > output register does not overlap the inputs. > > Report

Re: [PATCH v2] kset: fix memory leak when kset_register() returns error

2022-10-24 Thread Luben Tuikov
On 2022-10-24 08:19, Yang Yingliang wrote: > Inject fault while loading module, kset_register() may fail. > If it fails, the name allocated by kobject_set_name() which > is called before kset_register() is leaked, because refcount > of kobject is hold in kset_init(). > > As a kset may be embedded

Re: [PATCH v3] linux-user: Add guest memory layout to exception dump

2022-10-24 Thread Helge Deller
On 10/25/22 04:25, Richard Henderson wrote: On 10/25/22 11:57, Helge Deller wrote: On 10/25/22 00:35, Richard Henderson wrote: On 10/25/22 06:18, Helge Deller wrote: When the emulation stops with a hard exception it's very useful for debugging purposes to dump the current guest memory layout (

Re: [RFC PATCH v2 2/8] vdpa: Save emulated features list in vhost_vdpa

2022-10-24 Thread Jason Wang
On Mon, Oct 24, 2022 at 5:26 PM Eugenio Perez Martin wrote: > > On Mon, Oct 24, 2022 at 4:14 AM Jason Wang wrote: > > > > On Fri, Oct 21, 2022 at 4:56 PM Eugenio Perez Martin > > wrote: > > > > > > On Fri, Oct 21, 2022 at 4:57 AM Jason Wang wrote: > > > > > > > > On Thu, Oct 20, 2022 at 2:34 PM

[PATCH v5] linux-user: Add close_range() syscall

2022-10-24 Thread Helge Deller
Signed-off-by: Helge Deller --- Changes: v5: Simplify check of arg2 against target_fd_max even more v4: Fix check of arg2 v3: fd_trans_unregister() only called if close_range() doesn't fail v2: consider CLOSE_RANGE_CLOEXEC flag diff --git a/linux-user/strace.list b/linux-user/strace.list index a8

Re: [PATCH 2/4] vhost: toggle device callbacks using used event idx

2022-10-24 Thread Jason Wang
On Mon, Oct 24, 2022 at 10:05 PM Michael S. Tsirkin wrote: > > On Mon, Oct 24, 2022 at 04:00:37PM +0200, Eugenio Perez Martin wrote: > > > > It's generally a waste that we don't use endian-ness annotations > > > > the way linux does. > > > > > > Yes, it's worth doing something similar sometime. >

Re: [PATCH v3] linux-user: Add guest memory layout to exception dump

2022-10-24 Thread Richard Henderson
On 10/25/22 11:57, Helge Deller wrote: On 10/25/22 00:35, Richard Henderson wrote: On 10/25/22 06:18, Helge Deller wrote: When the emulation stops with a hard exception it's very useful for debugging purposes to dump the current guest memory layout (for an example see /proc/self/maps) beside th

Re: [PATCH] target/riscv/pmp: fix non-translated page size address checks w/ MPU

2022-10-24 Thread Alistair Francis
On Thu, Oct 20, 2022 at 7:29 AM Leon Schuermann wrote: > > Alistair Francis writes: > >> @@ -310,10 +311,17 @@ bool pmp_hart_has_privs(CPURISCVState *env, > >> target_ulong addr, > >> } > >> > >> if (size == 0) { > >> -if (riscv_feature(env, RISCV_FEATURE_MMU)) { > >> +

Re: [PATCH v4] linux-user: Add close_range() syscall

2022-10-24 Thread Richard Henderson
On 10/25/22 11:39, Helge Deller wrote: On 10/25/22 00:39, Richard Henderson wrote: On 10/25/22 06:43, Helge Deller wrote: +    abi_long maxfd = arg2; + +    if ((sizeof(abi_long) == 4 && arg2 == (abi_long)0x7FFFUL) || +    (sizeof(abi_long) == 8 && arg2 == (abi_

Re: [PATCH] tcg/riscv: Fix reg overlap case in tcg_out_addsub2

2022-10-24 Thread Alistair Francis
On Fri, Oct 21, 2022 at 9:47 AM Richard Henderson wrote: > > There was a typo using opc_addi instead of opc_add with the > two registers. While we're at it, simplify the gating test > to al == bl to improve dynamic scheduling even when the > output register does not overlap the inputs. > > Report

Re: [PATCH v2] kset: fix memory leak when kset_register() returns error

2022-10-24 Thread Yang Yingliang via
Hi, On 2022/10/25 5:25, Luben Tuikov wrote: On 2022-10-24 17:06, Luben Tuikov wrote: On 2022-10-24 08:19, Yang Yingliang wrote: Inject fault while loading module, kset_register() may fail. If it fails, the name allocated by kobject_set_name() which is called before kset_register() is leaked, b

Re: [PATCH v4] linux-user: Add close_range() syscall

2022-10-24 Thread Helge Deller
On 10/25/22 03:39, Helge Deller wrote: On 10/25/22 00:39, Richard Henderson wrote: On 10/25/22 06:43, Helge Deller wrote: +    abi_long maxfd = arg2; + +    if ((sizeof(abi_long) == 4 && arg2 == (abi_long)0x7FFFUL) || +    (sizeof(abi_long) == 8 && arg2 == (abi_

Re: [PATCH v3] linux-user: Add guest memory layout to exception dump

2022-10-24 Thread Helge Deller
On 10/25/22 00:35, Richard Henderson wrote: On 10/25/22 06:18, Helge Deller wrote: When the emulation stops with a hard exception it's very useful for debugging purposes to dump the current guest memory layout (for an example see /proc/self/maps) beside the CPU registers. The open_self_maps() f

Re: [PATCH 4/4] include/qemu/atomic128: Avoid __sync_val_compare_and_swap_16

2022-10-24 Thread Richard Henderson
On 10/25/22 09:24, Richard Henderson wrote: Merge the CONFIG_ATOMIC128 and CONFIG_CMPXCHG128 cases with respect to atomic16_cmpxchg and use __atomic_compare_exchange_nomic (via qatomic_cmpxchg) instead of the "legacy" __sync_val_compare_and_swap_16. Update the meson has_cmpxchg128 test to match.

Re: [PATCH v0 1/2] hw/riscv/opentitan: bump opentitan

2022-10-24 Thread Bin Meng
On Tue, Oct 25, 2022 at 9:17 AM Wilfred Mallawa wrote: > > From: Wilfred Mallawa > > This patch updates the OpenTitan model to match > the specified register layout as per [1]. Which is also the latest > commit of OpenTitan supported by TockOS. > > Note: Pinmux and Padctrl has been merged into Pi

Re: [PATCH v0 2/2] hw/riscv/opentitan: add aon_timer base unimpl

2022-10-24 Thread Bin Meng
On Tue, Oct 25, 2022 at 9:19 AM Wilfred Mallawa wrote: > > From: Wilfred Mallawa > > Adds the updated `aon_timer` base as an unimplemented device. This is > used by TockOS, patch ensures the guest doesn't hit load faults. > > Signed-off-by: Wilfred Mallawa > --- > hw/riscv/opentitan.c |

Re: [PATCH v4] linux-user: Add close_range() syscall

2022-10-24 Thread Helge Deller
On 10/25/22 00:39, Richard Henderson wrote: On 10/25/22 06:43, Helge Deller wrote: +    abi_long maxfd = arg2; + +    if ((sizeof(abi_long) == 4 && arg2 == (abi_long)0x7FFFUL) || +    (sizeof(abi_long) == 8 && arg2 == (abi_long)0x7FFFULL)) { +

Re: [PATCH v4 02/11] device-tree: add re-randomization helper function

2022-10-24 Thread Alistair Francis
On Tue, Oct 25, 2022 at 10:51 AM Jason A. Donenfeld wrote: > > When the system reboots, the rng-seed that the FDT has should be > re-randomized, so that the new boot gets a new seed. Several > architectures require this functionality, so export a function for > injecting a new seed into the given

Re: [PATCH v4 05/11] riscv: re-randomize rng-seed on reboot

2022-10-24 Thread Alistair Francis
On Tue, Oct 25, 2022 at 10:47 AM Jason A. Donenfeld wrote: > > When the system reboots, the rng-seed that the FDT has should be > re-randomized, so that the new boot gets a new seed. Since the FDT is in > the ROM region at this point, we add a hook right after the ROM has been > added, so that we

Re: [PATCH] tcg/riscv: Fix range matched by TCG_CT_CONST_M12

2022-10-24 Thread Alistair Francis
On Sat, Oct 22, 2022 at 8:19 PM Richard Henderson wrote: > > We were matching a signed 13-bit range, not a 12-bit range. > Expand the commentary within the function and be explicit > about all of the ranges. > > Reported-by: LIU Zhiwei > Signed-off-by: Richard Henderson Thanks! Applied to risc

[PATCH v0 2/2] hw/riscv/opentitan: add aon_timer base unimpl

2022-10-24 Thread Wilfred Mallawa
From: Wilfred Mallawa Adds the updated `aon_timer` base as an unimplemented device. This is used by TockOS, patch ensures the guest doesn't hit load faults. Signed-off-by: Wilfred Mallawa --- hw/riscv/opentitan.c | 3 +++ include/hw/riscv/opentitan.h | 1 + 2 files changed, 4 insertion

[PATCH v0 1/2] hw/riscv/opentitan: bump opentitan

2022-10-24 Thread Wilfred Mallawa
From: Wilfred Mallawa This patch updates the OpenTitan model to match the specified register layout as per [1]. Which is also the latest commit of OpenTitan supported by TockOS. Note: Pinmux and Padctrl has been merged into Pinmux [2][3], this patch removes any references to Padctrl. Note: OpenT

[PATCH v0 0/2] hw/riscv/opentitan: bump opentitan version

2022-10-24 Thread Wilfred Mallawa
From: Wilfred Mallawa This patch provides updates to the OpenTitan model to bump to RTL version . A unique change here is the merger of hwip `padctrl` into `pinmux`, to reflect this change, any references to `padctrl` are removed. Additionally, an unimplemented device for `aon_timer` is added an

Re: [PATCH v3 1/8] reset: allow registering handlers that aren't called by snapshot loading

2022-10-24 Thread Jason A. Donenfeld
On Mon, Oct 24, 2022 at 7:40 PM Markus Armbruster wrote: > > Peter Maydell writes: > > > On Mon, 24 Oct 2022 at 14:20, Markus Armbruster wrote: > >> > >> Peter Maydell writes: > >> > >> > On Mon, 24 Oct 2022 at 13:28, Markus Armbruster > >> > wrote: > >> >> > >> >> Peter Maydell writes: > >>

[PATCH v4 10/11] openrisc: re-randomize rng-seed on reboot

2022-10-24 Thread Jason A. Donenfeld
When the system reboots, the rng-seed that the FDT has should be re-randomized, so that the new boot gets a new seed. Since the FDT is in the ROM region at this point, we add a hook right after the ROM has been added, so that we have a pointer to that copy of the FDT. Cc: Stafford Horne Signed-of

[PATCH v4 08/11] mips/boston: re-randomize rng-seed on reboot

2022-10-24 Thread Jason A. Donenfeld
When the system reboots, the rng-seed that the FDT has should be re-randomized, so that the new boot gets a new seed. Since the FDT is in the ROM region at this point, we add a hook right after the ROM has been added, so that we have a pointer to that copy of the FDT. Cc: Aleksandar Rikalo Cc: Pa

[PATCH v4 04/11] arm: re-randomize rng-seed on reboot

2022-10-24 Thread Jason A. Donenfeld
When the system reboots, the rng-seed that the FDT has should be re-randomized, so that the new boot gets a new seed. Since the FDT is in the ROM region at this point, we add a hook right after the ROM has been added, so that we have a pointer to that copy of the FDT. Cc: Peter Maydell Cc: qemu-.

[PATCH v4 11/11] rx: re-randomize rng-seed on reboot

2022-10-24 Thread Jason A. Donenfeld
When the system reboots, the rng-seed that the FDT has should be re-randomized, so that the new boot gets a new seed. Since the FDT is in the ROM region at this point, we add a hook right after the ROM has been added, so that we have a pointer to that copy of the FDT. Cc: Yoshinori Sato Signed-of

[PATCH v4 03/11] x86: do not re-randomize RNG seed on snapshot load

2022-10-24 Thread Jason A. Donenfeld
Snapshot loading is supposed to be deterministic, so we shouldn't re-randomize the various seeds used. Signed-off-by: Jason A. Donenfeld --- hw/i386/x86.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/i386/x86.c b/hw/i386/x86.c index 1148f70c03..bd50a064a3 100644 --- a/h

[PATCH v4 06/11] m68k/virt: do not re-randomize RNG seed on snapshot load

2022-10-24 Thread Jason A. Donenfeld
Snapshot loading is supposed to be deterministic, so we shouldn't re-randomize the various seeds used. Signed-off-by: Jason A. Donenfeld --- hw/m68k/virt.c | 20 +++- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/hw/m68k/virt.c b/hw/m68k/virt.c index 89c4108eb5..

[PATCH v4 02/11] device-tree: add re-randomization helper function

2022-10-24 Thread Jason A. Donenfeld
When the system reboots, the rng-seed that the FDT has should be re-randomized, so that the new boot gets a new seed. Several architectures require this functionality, so export a function for injecting a new seed into the given FDT. Cc: Alistair Francis Cc: David Gibson Signed-off-by: Jason A.

[PATCH v4 09/11] mips/malta: pass RNG seed via env var and re-randomize on reboot

2022-10-24 Thread Jason A. Donenfeld
As of the kernel commit linked below, Linux ingests an RNG seed passed as part of the environment block by the bootloader or firmware. This mechanism works across all different environment block types, generically, which pass some block via the second firmware argument. On malta, this has been test

[PATCH v4 01/11] reset: allow registering handlers that aren't called by snapshot loading

2022-10-24 Thread Jason A. Donenfeld
Snapshot loading only expects to call deterministic handlers, not non-deterministic ones. So introduce a way of registering handlers that won't be called when reseting for snapshots. Signed-off-by: Jason A. Donenfeld --- hw/arm/aspeed.c| 4 ++-- hw/arm/mps2-tz.c | 4 ++--

[PATCH v4 05/11] riscv: re-randomize rng-seed on reboot

2022-10-24 Thread Jason A. Donenfeld
When the system reboots, the rng-seed that the FDT has should be re-randomized, so that the new boot gets a new seed. Since the FDT is in the ROM region at this point, we add a hook right after the ROM has been added, so that we have a pointer to that copy of the FDT. Cc: Palmer Dabbelt Cc: Alist

qemu-devel@nongnu.org

2022-10-24 Thread Jason A. Donenfeld
When the system reboots, the rng seed that QEMU passes should be re-randomized, so that the new boot gets a new seed. This series wires that up for FDT. Then, since the record&replay subsystem makes use of reset as well, we add a new reset cause for record&replay, so that we can avoid re-randomizi

[PATCH v4 07/11] m68k/q800: do not re-randomize RNG seed on snapshot load

2022-10-24 Thread Jason A. Donenfeld
Snapshot loading is supposed to be deterministic, so we shouldn't re-randomize the various seeds used. Signed-off-by: Jason A. Donenfeld --- hw/m68k/q800.c | 33 + 1 file changed, 13 insertions(+), 20 deletions(-) diff --git a/hw/m68k/q800.c b/hw/m68k/q800.c inde

Re: [PATCH v2] hw/acpi/erst.c: Fix memory handling issues

2022-10-24 Thread Alexander Bulekov
On 221024 1224, Alexander Bulekov wrote: > On 221024 1742, Christian A. Ehrhardt wrote: > > - Fix memset argument order: The second argument is > > the value, the length goes last. > > - Fix an integer overflow reported by Alexander Bulekov. > > > > Both issues allow the guest to overrun the hos

Re: [PATCH] tcg/riscv: Fix range matched by TCG_CT_CONST_M12

2022-10-24 Thread Alistair Francis
On Sat, Oct 22, 2022 at 8:19 PM Richard Henderson wrote: > > We were matching a signed 13-bit range, not a 12-bit range. > Expand the commentary within the function and be explicit > about all of the ranges. > > Reported-by: LIU Zhiwei > Signed-off-by: Richard Henderson Reviewed-by: Alistair Fr

[PATCH v2 3/8] Hexagon (target/hexagon) Remove next_PC from runtime state

2022-10-24 Thread Taylor Simpson
The imported files don't properly mark all CONDEXEC instructions, so we add some logic to hex_common.py to add the attribute. Signed-off-by: Taylor Simpson --- target/hexagon/cpu.h| 1 - target/hexagon/gen_tcg.h| 6 ++ target/hexagon/macros.h | 2 +-

[PATCH v2 1/8] Hexagon (target/hexagon) Only use branch_taken when packet has multi cof

2022-10-24 Thread Taylor Simpson
When a packet has more than one change-of-flow instruction, only the first one to branch is considered. We use the branch_taken variable to keep track of this. However, when there is a single cof instruction, we don't need the same amount of bookkeeping. We add the pkt_has_multi_cof member to th

[PATCH v2 5/8] Hexagon (target/hexagon) Add overrides for compound compare and jump

2022-10-24 Thread Taylor Simpson
Signed-off-by: Taylor Simpson --- target/hexagon/gen_tcg.h | 177 +++ target/hexagon/genptr.c | 74 2 files changed, 251 insertions(+) diff --git a/target/hexagon/gen_tcg.h b/target/hexagon/gen_tcg.h index ad149adbe1..b56b216110 100644 --- a

[PATCH v2 2/8] Hexagon (target/hexagon) Remove PC from the runtime state

2022-10-24 Thread Taylor Simpson
Add pc field to Packet structure For helpers that need PC, pass an extra argument Remove slot arg from conditional jump helpers On a trap0, copy pkt->pc into hex_gpr[HEX_REG_PC] Signed-off-by: Taylor Simpson --- target/hexagon/gen_tcg.h| 7 +++ target/hexagon/insn.h

[PATCH v2 8/8] Hexagon (target/hexagon) Use direct block chaining for tight loops

2022-10-24 Thread Taylor Simpson
Direct block chaining is documented here https://qemu.readthedocs.io/en/latest/devel/tcg.html#direct-block-chaining Hexagon inner loops end with the endloop0 instruction To go back to the beginning of the loop, this instructions writes to PC from register SA0 (start address 0). To use direct bloc

[PATCH v2 6/8] Hexagon (target/hexagon) Add overrides for various forms of jump

2022-10-24 Thread Taylor Simpson
Signed-off-by: Taylor Simpson --- target/hexagon/gen_tcg.h | 189 +++ target/hexagon/genptr.c | 46 ++ 2 files changed, 235 insertions(+) diff --git a/target/hexagon/gen_tcg.h b/target/hexagon/gen_tcg.h index b56b216110..216862352c 100644 --- a/targe

[PATCH v2 0/8] Hexagon (target/hexagon) Improve change-of-flow

2022-10-24 Thread Taylor Simpson
This patch series improves change-of-flow handling. Currently, we set the PC to a new address before exiting a TB. The ultimate goal is to use direct block chaining. However, several steps are needed along the way. 1) When a packet has more than one change-of-flow (COF) instruction, only the fi

[PATCH v2 7/8] Hexagon (target/hexagon) Use direct block chaining for direct jump/branch

2022-10-24 Thread Taylor Simpson
Direct block chaining is documented here https://qemu.readthedocs.io/en/latest/devel/tcg.html#direct-block-chaining Recall that Hexagon allows packets with multiple jumps where only the first one with a true predicate will actually jump. So, we can only use direct block chaining when the packet c

[PATCH v2 4/8] Hexagon (target/hexagon) Add overrides for direct call instructions

2022-10-24 Thread Taylor Simpson
Add overrides for J2_call J2_callt J2_callf Signed-off-by: Taylor Simpson --- target/hexagon/gen_tcg.h | 8 ++ target/hexagon/genptr.c | 58 2 files changed, 66 insertions(+) diff --git a/target/hexagon/gen_tcg.h b/target/hexagon/gen_tc

[PATCH 4/4] include/qemu/atomic128: Avoid __sync_val_compare_and_swap_16

2022-10-24 Thread Richard Henderson
Merge the CONFIG_ATOMIC128 and CONFIG_CMPXCHG128 cases with respect to atomic16_cmpxchg and use __atomic_compare_exchange_nomic (via qatomic_cmpxchg) instead of the "legacy" __sync_val_compare_and_swap_16. Update the meson has_cmpxchg128 test to match. Signed-off-by: Richard Henderson --- inclu

[PATCH 0/4] atomic: Friendlier assertions, avoidance of __sync

2022-10-24 Thread Richard Henderson
The current use of _Static_assert, via QEMU_BUILD_BUG_ON, requires the user have #if conditionals to avoid the statement from appearing in the preprocessed file at all. Introduce a new primitive that allows normal C conditionals and dead-code elimination. Remove all use of __sync* builtins in fav

[PATCH 3/4] include/qemu/thread: Use qatomic_* functions

2022-10-24 Thread Richard Henderson
Use qatomic_*, which expands to __atomic_* in preference to the "legacy" __sync_* functions. Signed-off-by: Richard Henderson --- include/qemu/thread.h | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/include/qemu/thread.h b/include/qemu/thread.h index af19f2b3fc..976e

[PATCH 2/4] include/qemu/atomic: Use qemu_build_assert

2022-10-24 Thread Richard Henderson
Change from QEMU_BUILD_BUG_ON, which requires ifdefs to avoid problematic code, to qemu_build_assert, which can use C ifs. Signed-off-by: Richard Henderson --- include/qemu/atomic.h | 16 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/include/qemu/atomic.h b/inclu

[PATCH 1/4] include/qemu/osdep: Add qemu_build_assert

2022-10-24 Thread Richard Henderson
This differs from assert, in that with optimization enabled it triggers at build-time. It differs from QEMU_BUILD_BUG_ON, aka _Static_assert, in that it is sensitive to control flow and is subject to dead-code elimination. Signed-off-by: Richard Henderson --- include/qemu/osdep.h | 8

Re: [PATCH v2 07/11] hw/intc/xics: Avoid dynamic stack allocation

2022-10-24 Thread Richard Henderson
On 8/20/22 01:39, Peter Maydell wrote: From: Philippe Mathieu-Daudé Use autofree heap allocation instead of variable-length array on the stack. Signed-off-by: Philippe Mathieu-Daudé Acked-by: David Gibson Reviewed-by: Greg Kurz Signed-off-by: Peter Maydell --- hw/intc/xics.c | 2 +- 1 file c

Re: [PATCH v2 06/11] hw/ppc/pnv: Avoid dynamic stack allocation

2022-10-24 Thread Richard Henderson
On 8/20/22 01:39, Peter Maydell wrote: From: Philippe Mathieu-Daudé Use autofree heap allocation instead of variable-length array on the stack. Signed-off-by: Philippe Mathieu-Daudé Acked-by: David Gibson Signed-off-by: Peter Maydell Reviewed-by: Peter Maydell --- hw/ppc/pnv.c |

Re: [PATCH v2 04/11] io/channel-websock: Replace strlen(const_str) by sizeof(const_str) - 1

2022-10-24 Thread Richard Henderson
On 8/20/22 01:39, Peter Maydell wrote: From: Philippe Mathieu-Daudé The combined_key[... QIO_CHANNEL_WEBSOCK_GUID_LEN ...] array in qio_channel_websock_handshake_send_res_ok() expands to a call to strlen(QIO_CHANNEL_WEBSOCK_GUID), and the compiler doesn't realize the string is const, so consider

Re: [PATCH v2 02/11] chardev/baum: Use definitions to avoid dynamic stack allocation

2022-10-24 Thread Richard Henderson
On 8/20/22 01:39, Peter Maydell wrote: From: Philippe Mathieu-Daudé We know 'x * y' will be at most 'X_MAX * Y_MAX' (which is not a big value, it is actually 84). Instead of having the compiler use variable-length array, declare an array able to hold the maximum 'x * y'. Signed-off-by: Philippe

Re: [PATCH v2 03/11] chardev/baum: Avoid dynamic stack allocation

2022-10-24 Thread Richard Henderson
On 8/20/22 01:39, Peter Maydell wrote: From: Philippe Mathieu-Daudé Use autofree heap allocation instead of variable-length array on the stack. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Marc-André Lureau Reviewed-by: Samuel Thibault Signed-off-by: Peter Maydell --- chardev/baum.c | 3

Re: [PATCH v2 01/11] chardev/baum: Replace magic values by X_MAX / Y_MAX definitions

2022-10-24 Thread Richard Henderson
On 8/20/22 01:39, Peter Maydell wrote: From: Philippe Mathieu-Daudé Replace '84' magic value by the X_MAX definition, and '1' by Y_MAX. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Marc-André Lureau Reviewed-by: Samuel Thibault Signed-off-by: Peter Maydell --- chardev/baum.c | 11 ++

Re: [PATCH 00/26] target/s390x: pc-relative translation blocks

2022-10-24 Thread Richard Henderson
Ping. On 10/6/22 13:43, Richard Henderson wrote: This is the S390 specific changes required to reduce the amount of translation for address space randomization. Begin with some generic cleanups, then prepare by using displacements instead of addresses when possible, then add some tcg infrastruc

Re: [PATCH 00/24] accel/tcg: Rewrite user-only vma tracking

2022-10-24 Thread Richard Henderson
Ping. On 10/6/22 13:10, Richard Henderson wrote: The primary motivator here are the numerous bug reports (e.g. #290) about not being able to handle very large memory allocations. I presume all or most of these are due to guest use of the clang address sanitizer, which allocates a massive shadow

Re: [PATCH 0/3] tcg/sparc: Remove support for sparc32plus

2022-10-24 Thread Richard Henderson
Ping. On 10/17/22 16:24, Richard Henderson wrote: While working on other cleanup/new features wrt calling conventions, I noticed, again, that I am unable to test sparc32plus. The current debian installation in the gcc compile farm is for sparc64, and that is also what gentoo is currently buildi

Re: [RFC PATCH] main-loop: introduce WITH_QEMU_IOTHREAD_LOCK

2022-10-24 Thread Richard Henderson
On 10/25/22 03:19, Alex Bennée wrote: This helper intends to ape our other auto-unlocking helpers with WITH_QEMU_LOCK_GUARD. The principle difference is the iothread lock is often nested needs a little extra book keeping to ensure we don't double lock or unlock a lock taken higher up the call cha

Re: [PATCH 1/6] target/mips: Introduce register access helper functions

2022-10-24 Thread Richard Henderson
On 10/25/22 01:23, Jiaxun Yang wrote: Introduce register access functions with value extend capability to prepare for decodetree based translation implmentation. Signed-off-by: Jiaxun Yang --- target/mips/tcg/translate.c | 143 +++- target/mips/tcg/translate.h

Re: [PATCH v4] linux-user: Add close_range() syscall

2022-10-24 Thread Richard Henderson
On 10/25/22 06:43, Helge Deller wrote: +abi_long maxfd = arg2; + +if ((sizeof(abi_long) == 4 && arg2 == (abi_long)0x7FFFUL) || +(sizeof(abi_long) == 8 && arg2 == (abi_long)0x7FFFULL)) { +maxfd = target_fd_max; +}

Re: [PATCH v3] linux-user: Add guest memory layout to exception dump

2022-10-24 Thread Richard Henderson
On 10/25/22 06:18, Helge Deller wrote: When the emulation stops with a hard exception it's very useful for debugging purposes to dump the current guest memory layout (for an example see /proc/self/maps) beside the CPU registers. The open_self_maps() function provides such a memory dump, but sinc

Re: [PATCH 9/9] target/s390x: Use Int128 for passing float128

2022-10-24 Thread Richard Henderson
On 10/25/22 04:01, Philippe Mathieu-Daudé wrote: On 21/10/22 09:30, Richard Henderson wrote: Signed-off-by: Richard Henderson ---   target/s390x/helper.h  | 32 ++---   target/s390x/tcg/fpu_helper.c  | 88 ++   target/s390x/tcg/translate.c   | 76 ++

Re: [PATCH] tests/tcg/nios2: Tweak 10m50-ghrd.ld

2022-10-24 Thread Alex Bennée
Richard Henderson writes: > More closely follow the default linker script for nios2. > This magically fixes a problem resolving .got relocs from > the toolchain's libgcc.a. > > Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1258 > Signed-off-by: Richard Henderson Queued to testing/ne

[PATCH v4] linux-user: Add close_range() syscall

2022-10-24 Thread Helge Deller
Signed-off-by: Helge Deller --- Changes: v4: Fix check for arg2 v3: fd_trans_unregister() only called if close_range() doesn't fail v2: consider CLOSE_RANGE_CLOEXEC flag diff --git a/linux-user/strace.list b/linux-user/strace.list index 3df2184580..cd995e5d56 100644 --- a/linux-user/strace.list +

Re: [PATCH v2] kset: fix memory leak when kset_register() returns error

2022-10-24 Thread Luben Tuikov
On 2022-10-24 08:19, Yang Yingliang wrote: > Inject fault while loading module, kset_register() may fail. > If it fails, the name allocated by kobject_set_name() which > is called before kset_register() is leaked, because refcount > of kobject is hold in kset_init(). "is hold" --> "was set". Also

Re: [PATCH v2] kset: fix memory leak when kset_register() returns error

2022-10-24 Thread Luben Tuikov
On 2022-10-24 17:06, Luben Tuikov wrote: > On 2022-10-24 08:19, Yang Yingliang wrote: >> Inject fault while loading module, kset_register() may fail. >> If it fails, the name allocated by kobject_set_name() which >> is called before kset_register() is leaked, because refcount >> of kobject is hold

Re: [PATCH] tests/qtest/ac97-test: add up-/downsampling tests

2022-10-24 Thread Volker Rümelin
Am 24.10.22 um 10:13 schrieb Marc-André Lureau: Hi On Mon, Oct 24, 2022 at 9:28 AM Volker Rümelin wrote: Test if the audio subsystem can handle extreme up- and down- sampling ratios like 44100/1 and 1/44100. For some time these used to trigger QEMU aborts. The test was taken from

Re: [PATCH v2] hw/acpi/erst.c: Fix memory handling issues

2022-10-24 Thread Eric DeVolder
On 10/24/22 10:42, Christian A. Ehrhardt wrote: - Fix memset argument order: The second argument is the value, the length goes last. - Fix an integer overflow reported by Alexander Bulekov. Both issues allow the guest to overrun the host buffer allocated for the ERST memory device. Cc: Er

soc_name for supermicrox11-bmc machine: ast2400-a1 or ast2500-a1 ?

2022-10-24 Thread Guenter Roeck
Hi, I always wondered why I am having trouble running Linux on supermicrox11-bmc. Building the kernel with aspeed_g4_defconfig results in its clock running at ~20x the real clock speed, and kernels built with aspeed_g5_defconfig do not boot at all. I ended up spending some time on it last weeken

Re: [PATCH v2] hw/acpi/erst.c: Fix memory handling issues

2022-10-24 Thread Michael S. Tsirkin
On Mon, Oct 24, 2022 at 05:42:33PM +0200, Christian A. Ehrhardt wrote: > - Fix memset argument order: The second argument is > the value, the length goes last. > - Fix an integer overflow reported by Alexander Bulekov. > > Both issues allow the guest to overrun the host buffer > allocated for th

[PATCH] linux-user: Add strace output for timer_settime64() syscall

2022-10-24 Thread Helge Deller
Add missing timer_settime64() strace output and specify format for timer_settime(). Signed-off-by: Helge Deller diff --git a/linux-user/strace.list b/linux-user/strace.list index cd995e5d56..3a898e2532 100644 --- a/linux-user/strace.list +++ b/linux-user/strace.list @@ -1534,7 +1534,10 @@ { TAR

[PATCH v3] linux-user: Add guest memory layout to exception dump

2022-10-24 Thread Helge Deller
When the emulation stops with a hard exception it's very useful for debugging purposes to dump the current guest memory layout (for an example see /proc/self/maps) beside the CPU registers. The open_self_maps() function provides such a memory dump, but since it's located in the syscall.c file, var

Re: [PATCH v3] linux-user: Add guest memory layout to exception dump

2022-10-24 Thread Laurent Vivier
Le 24/10/2022 à 22:18, Helge Deller a écrit : When the emulation stops with a hard exception it's very useful for debugging purposes to dump the current guest memory layout (for an example see /proc/self/maps) beside the CPU registers. The open_self_maps() function provides such a memory dump, b

[PATCH 0/2] python: misc machine.py improvements

2022-10-24 Thread John Snow
Improve machine.py logging and fix a shutdown bug that we *probably* weren't actually hitting anywhere. Changes for console input logging are on the way, but separate because it will touch avocado. More comprehensive fixes for multiple socket polling are also on the way, but decidedly separate. T

  1   2   3   >