Re: [PATCH] gdbstub: Fix client Ctrl-C handling

2023-07-31 Thread Joel Stanley
On Sun, 30 Jul 2023 at 09:43, Nicholas Piggin wrote: > > On Wed Jul 26, 2023 at 4:35 PM AEST, Joel Stanley wrote: > > On Wed, 12 Jul 2023 at 02:12, Nicholas Piggin wrote: > > > > > > On Tue Jul 11, 2023 at 9:03 PM AEST, Matheus Tavares Bernardino wrote: > > > > > Nicholas Piggin wrote: > > > > >

[PATCH 0/3] Accompany -nostdlib with -fno-stack-protector

2023-07-31 Thread Akihiko Odaki
A build of GCC 13.2 will have stack protector enabled by default if it was configured with --enable-default-ssp option. For such a compiler, it is necessary to explicitly disable stack protector when linking without standard libraries. This is a tree-wide change to add -fno-stack-protector where -

[PATCH 1/3] pc-bios/optionrom: Add -fno-stack-protector

2023-07-31 Thread Akihiko Odaki
A build of GCC 13.2 will have stack protector enabled by default if it was configured with --enable-default-ssp option. For such a compiler, it is necessary to explicitly disable stack protector when linking without standard libraries. Signed-off-by: Akihiko Odaki --- pc-bios/optionrom/Makefile

[PATCH 2/3] tests/migration: Add -fno-stack-protector

2023-07-31 Thread Akihiko Odaki
A build of GCC 13.2 will have stack protector enabled by default if it was configured with --enable-default-ssp option. For such a compiler, it is necessary to explicitly disable stack protector when linking without standard libraries. Signed-off-by: Akihiko Odaki --- tests/migration/s390x/Makef

[PATCH 3/3] tests/tcg: Add -fno-stack-protector

2023-07-31 Thread Akihiko Odaki
A build of GCC 13.2 will have stack protector enabled by default if it was configured with --enable-default-ssp option. For such a compiler, it is necessary to explicitly disable stack protector when linking without standard libraries. Signed-off-by: Akihiko Odaki --- tests/tcg/mips/hello-mips.c

Re: [PATCH for-8.2 1/6] vfio/migration: Move from STOP_COPY to STOP in vfio_save_cleanup()

2023-07-31 Thread Cédric Le Goater
On 7/31/23 08:32, Avihai Horon wrote: On 30/07/2023 19:25, Cédric Le Goater wrote: External email: Use caution opening links or attachments On 7/16/23 10:15, Avihai Horon wrote: Changing the device state from STOP_COPY to STOP can take time as the device may need to free resources and do oth

Re: [PATCH 2/3] tests/migration: Add -fno-stack-protector

2023-07-31 Thread Juan Quintela
Akihiko Odaki wrote: > A build of GCC 13.2 will have stack protector enabled by default if it > was configured with --enable-default-ssp option. For such a compiler, > it is necessary to explicitly disable stack protector when linking > without standard libraries. > > Signed-off-by: Akihiko Odaki

Re: [PATCH for-8.2 2/2] arm/kvm: convert to kvm_get_one_reg

2023-07-31 Thread Gavin Shan
On 7/18/23 21:14, Cornelia Huck wrote: We can neaten the code by switching the callers that work on a CPUstate to the kvm_get_one_reg function. Signed-off-by: Cornelia Huck --- target/arm/kvm.c | 15 +++- target/arm/kvm64.c | 57 -- 2

Re: [PATCH] kvm: Fix crash by initializing kvm_state early

2023-07-31 Thread David Hildenbrand
On 31.07.23 01:48, Gavin Shan wrote: Runs into core dump on arm64 and the backtrace extracted from the core dump is shown as below. It's caused by accessing @kvm_state which isn't initialized at that point due to commit 176d073029 ("hw/arm/virt: Use machine_memory_devices_init()"), where the mach

RE: [PATCH RFC v1 2/3] vfio/pci: enable vector on dynamic MSI-X allocation

2023-07-31 Thread Liu, Jing2
Hi Alex, > On July 28, 2023 1:25 AM, Alex Williamson wrote: > > On Thu, 27 Jul 2023 03:24:09 -0400 > Jing Liu wrote: > > > The vector_use callback is used to enable vector that is unmasked in > > guest. The kernel used to only support static MSI-X allocation. When > > allocating a new interru

Re: [PATCH RFC v1 1/3] vfio/pci: detect the support of dynamic MSI-X allocation

2023-07-31 Thread Cédric Le Goater
On 7/31/23 05:57, Liu, Jing2 wrote: Hi C. On July 28, 2023 4:44 PM, Cédric Le Goater wrote: [ ... ] Sorry I didn't quite understand "info.flags be tested against VFIO_IRQ_INFO_NORESIZE". I saw kernel < 6.4 simply added NORESIZE to info.flags and latest kernel adds if has_dyn_msix. Would

Re: [RFC] migration/block-dirty-bitmap: make loading bitmap for device with iothread future-proof

2023-07-31 Thread Juan Quintela
Fiona Ebner wrote: > The bdrv_create_dirty_bitmap() function (which is also called by > bdrv_dirty_bitmap_create_successor()) uses bdrv_getlength(bs). This is > a wrapper around a coroutine, and when not called in coroutine context > would use bdrv_poll_co(). Such a call would trigger an assert()

Re: [PATCH 2/3] tests/migration: Add -fno-stack-protector

2023-07-31 Thread Thomas Huth
On 31/07/2023 08.58, Akihiko Odaki wrote: A build of GCC 13.2 will have stack protector enabled by default if it was configured with --enable-default-ssp option. For such a compiler, it is necessary to explicitly disable stack protector when linking without standard libraries. Signed-off-by: Aki

Re: [PATCH 1/3] pc-bios/optionrom: Add -fno-stack-protector

2023-07-31 Thread Thomas Huth
On 31/07/2023 08.58, Akihiko Odaki wrote: A build of GCC 13.2 will have stack protector enabled by default if it was configured with --enable-default-ssp option. For such a compiler, it is necessary to explicitly disable stack protector when linking without standard libraries. Signed-off-by: Aki

Re: [PATCH 3/3] tests/tcg: Add -fno-stack-protector

2023-07-31 Thread Ilya Leoshkevich
On Mon, 2023-07-31 at 15:58 +0900, Akihiko Odaki wrote: > A build of GCC 13.2 will have stack protector enabled by default if > it > was configured with --enable-default-ssp option. For such a compiler, > it is necessary to explicitly disable stack protector when linking > without standard librarie

Re: [PATCH 3/3] tests/tcg: Add -fno-stack-protector

2023-07-31 Thread Thomas Huth
On 31/07/2023 08.58, Akihiko Odaki wrote: A build of GCC 13.2 will have stack protector enabled by default if it was configured with --enable-default-ssp option. For such a compiler, it is necessary to explicitly disable stack protector when linking without standard libraries. Signed-off-by: Aki

[PATCH 3/5] linux-user: Use MAP_FIXED_NOREPLACE for do_brk()

2023-07-31 Thread Akihiko Odaki
MAP_FIXED_NOREPLACE can ensure the mapped address is fixed without concerning that the new mapping overwrites something else. Signed-off-by: Akihiko Odaki --- linux-user/syscall.c | 17 +++-- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/linux-user/syscall.c b/linux-

[PATCH 0/5] linux-user: brk/mmap fixes

2023-07-31 Thread Akihiko Odaki
linux-user was failing on M2 MacBook Air. Digging into the details, I found several bugs in brk and mmap so here are fixes. Akihiko Odaki (5): linux-user: Unset MAP_FIXED_NOREPLACE for host linux-user: Do not call get_errno() in do_brk() linux-user: Use MAP_FIXED_NOREPLACE for do_brk() lin

[PATCH 4/5] linux-user: Do nothing if too small brk is specified

2023-07-31 Thread Akihiko Odaki
Linux 6.4.7 does nothing when a value smaller than the initial brk is specified. Fixes: 86f04735ac ("linux-user: Fix brk() to release pages") Signed-off-by: Akihiko Odaki --- linux-user/syscall.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/linux-user/syscall.c b/lin

[PATCH 5/5] linux-user: Do not align brk with host page size

2023-07-31 Thread Akihiko Odaki
do_brk() minimizes calls into target_mmap() by aligning the address with host page size, which is potentially larger than the target page size. However, the current implementation of this optimization has two bugs: - The start of brk is rounded up with the host page size while brk advertises an

[PATCH 2/5] linux-user: Do not call get_errno() in do_brk()

2023-07-31 Thread Akihiko Odaki
Later the returned value is compared with -1, and negated errno is not expected. Fixes: 00faf08c95 ("linux-user: Don't use MAP_FIXED in do_brk()") Signed-off-by: Akihiko Odaki --- linux-user/syscall.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/linux-user/syscall.c

[PATCH 1/5] linux-user: Unset MAP_FIXED_NOREPLACE for host

2023-07-31 Thread Akihiko Odaki
Passing MAP_FIXED_NOREPLACE to host will fail if the virtual address space is reserved with mmap. Replace it with MAP_FIXED. Signed-off-by: Akihiko Odaki --- linux-user/mmap.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/linux-user/mmap.c b/linux-user/mmap.c index a5dfb56545..2f26cbaf5d

Re: [PATCH] vdpa: set old virtio status at cvq isolation probing end

2023-07-31 Thread Eugenio Perez Martin
On Mon, Jul 31, 2023 at 8:36 AM Jason Wang wrote: > > On Wed, Jul 26, 2023 at 2:27 PM Eugenio Perez Martin > wrote: > > > > On Wed, Jul 26, 2023 at 4:07 AM Jason Wang wrote: > > > > > > On Wed, Jul 26, 2023 at 2:21 AM Eugenio Pérez wrote: > > > > > > > > The device already has a virtio status s

Re: [RFC PATCH 4/6] hw/i386/intel_iommu: Fix VTD_IR_TableEntry for ms_struct layout

2023-07-31 Thread Thomas Huth
On 28/07/2023 16.37, Daniel P. Berrangé wrote: On Fri, Jul 28, 2023 at 04:27:46PM +0200, Thomas Huth wrote: We might want to compile QEMU with Clang on Windows - but it does not support the __attribute__((gcc_struct)) yet. So we have to make sure that the structs will stay the same when the comp

Re: [PATCH] target/s390x: Move trans_exc_code update to do_program_interrupt

2023-07-31 Thread Ilya Leoshkevich
On Fri, 2023-07-28 at 13:02 -0700, Richard Henderson wrote: > On 7/28/23 12:55, Richard Henderson wrote: > > This solves a problem in which the store to LowCore during tlb_fill > > triggers a clean-page TB invalidation for page0 during translation, > > which results in an assertion failure for lock

Re: [PATCH v5 0/3] linux-user: Fix and optimize target memory layout

2023-07-31 Thread Michael Tokarev
28.07.2023 20:31, Helge Deller wrote: NOTE: - this patch series is for qemu v8.1.0-rc ONLY. - do not apply on top of v8.0-stable series, which uses a different search algorithm for free mmap memory and thus will give incorrect memory layouts. Hm. I included a previous version of this pat

Re: [RFC PATCH] target/i386: Truncate ESP when exiting from long mode

2023-07-31 Thread Ard Biesheuvel
On Wed, 26 Jul 2023 at 17:01, Richard Henderson wrote: > > On 7/26/23 01:17, Ard Biesheuvel wrote: > > While working on some EFI boot changes for Linux/x86, I noticed that TCG > > deviates from > > bare metal when it comes to how it handles the value of the stack pointer > > register RSP > > whe

[PATCH v2] target/riscv: Use existing lookup tables for MixColumns

2023-07-31 Thread Ard Biesheuvel
The AES MixColumns and InvMixColumns operations are relatively expensive 4x4 matrix multiplications in GF(2^8), which is why C implementations usually rely on precomputed lookup tables rather than performing the calculations on demand. Given that we already carry those tables in QEMU, we can just

RE: [PATCH RFC v1 1/3] vfio/pci: detect the support of dynamic MSI-X allocation

2023-07-31 Thread Liu, Jing2
Hi C. > On July 31, 2023 3:26 PM, Cédric Le Goater wrote: > > On 7/31/23 05:57, Liu, Jing2 wrote: > > Hi C. > > > >> On July 28, 2023 4:44 PM, Cédric Le Goater wrote: > >> > >> [ ... ] > >> > >>> Sorry I didn't quite understand "info.flags be tested against > >> VFIO_IRQ_INFO_NORESIZE". > >>> I

Re: [PATCH] vdpa: set old virtio status at cvq isolation probing end

2023-07-31 Thread Jason Wang
On Mon, Jul 31, 2023 at 4:05 PM Eugenio Perez Martin wrote: > > On Mon, Jul 31, 2023 at 8:36 AM Jason Wang wrote: > > > > On Wed, Jul 26, 2023 at 2:27 PM Eugenio Perez Martin > > wrote: > > > > > > On Wed, Jul 26, 2023 at 4:07 AM Jason Wang wrote: > > > > > > > > On Wed, Jul 26, 2023 at 2:21 AM

[RFC PATCH 00/24] plugins: Allow to read registers

2023-07-31 Thread Akihiko Odaki
I and other people in the University of Tokyo, where I research processor design, found TCG plugins are very useful for processor design exploration. The feature we find missing is the capability to read registers from plugins. In this series, I propose to add such a capability by reusing gdbstub

[RFC PATCH 01/24] contrib/plugins: Use GRWLock in execlog

2023-07-31 Thread Akihiko Odaki
execlog had the following comment: > As we could have multiple threads trying to do this we need to > serialise the expansion under a lock. Threads accessing already > created entries can continue without issue even if the ptr array > gets reallocated during resize. However, when the ptr array get

[RFC PATCH 05/24] target/arm: Move the reference to arm-core.xml

2023-07-31 Thread Akihiko Odaki
Some subclasses overwrite gdb_core_xml_file member but others don't. Always initialize the member in the subclasses for consistency. This especially helps for AArch64; in a following change, the file specified by gdb_core_xml_file is always looked up even if it's going to be overwritten later. Loo

[RFC PATCH 10/24] gdbstub: Use GDBFeature for gdb_register_coprocessor

2023-07-31 Thread Akihiko Odaki
This is a tree-wide change to introduce GDBFeature parameter to gdb_register_coprocessor(). The new parameter just replaces num_regs and xml parameters for now. GDBFeature will be utilized to simplify XML lookup in a following change. Signed-off-by: Akihiko Odaki --- include/exec/gdbstub.h |

[RFC PATCH 03/24] gdbstub: Add num_regs member to GDBFeature

2023-07-31 Thread Akihiko Odaki
Currently the number of registers exposed to GDB is written as magic numbers in code. Derive the number of registers GDB actually see from XML files to replace the magic numbers in code later. Signed-off-by: Akihiko Odaki --- include/exec/gdbstub.h | 1 + scripts/feature_to_c.py | 46 +

[RFC PATCH 04/24] gdbstub: Introduce gdb_find_static_feature()

2023-07-31 Thread Akihiko Odaki
This function is useful to determine the number of registers exposed to GDB from the XML name. Signed-off-by: Akihiko Odaki --- include/exec/gdbstub.h | 2 ++ gdbstub/gdbstub.c | 13 + 2 files changed, 15 insertions(+) diff --git a/include/exec/gdbstub.h b/include/exec/gdbstub

[RFC PATCH 06/24] hw/core/cpu: Replace gdb_core_xml_file with gdb_core_feature

2023-07-31 Thread Akihiko Odaki
This is a tree-wide change to replace gdb_core_xml_file, the path to GDB XML file with gdb_core_feature, the pointer to GDBFeature. This also replaces the values assigned to gdb_num_core_regs with the num_regs member of GDBFeature where applicable to remove magic numbers. A following change will u

[RFC PATCH 08/24] target/ppc: Use GDBFeature for dynamic XML

2023-07-31 Thread Akihiko Odaki
In preparation for a change to use GDBFeature as a parameter of gdb_register_coprocessor(), convert the internal representation of dynamic feature from plain XML to GDBFeature. Signed-off-by: Akihiko Odaki --- target/ppc/cpu-qom.h | 3 +-- target/ppc/cpu.h | 2 +- target/ppc/cpu_init.c |

[RFC PATCH 12/24] gdbstub: Simplify XML lookup

2023-07-31 Thread Akihiko Odaki
Now we know all instances of GDBFeature that is used in CPU so we can traverse them to find XML. This removes the need for a CPU-specific lookup function for dynamic XMLs. Signed-off-by: Akihiko Odaki --- gdbstub/gdbstub.c | 28 +--- 1 file changed, 9 insertions(+), 19 de

[RFC PATCH 02/24] gdbstub: Introduce GDBFeature structure

2023-07-31 Thread Akihiko Odaki
Before this change, the information from a XML file was stored in an array that is not descriptive. Introduce a dedicated structure type to make it easier to understand and to extend with more fields. Signed-off-by: Akihiko Odaki --- MAINTAINERS | 2 +- meson.build | 2

[RFC PATCH 15/24] target/arm: Fill new members of GDBFeature

2023-07-31 Thread Akihiko Odaki
These members will be used to help plugins to identify registers. Signed-off-by: Akihiko Odaki --- target/arm/gdbstub.c | 46 +++--- target/arm/gdbstub64.c | 42 +- 2 files changed, 58 insertions(+), 30 deletions(-) diff

[RFC PATCH 07/24] target/arm: Use GDBFeature for dynamic XML

2023-07-31 Thread Akihiko Odaki
In preparation for a change to use GDBFeature as a parameter of gdb_register_coprocessor(), convert the internal representation of dynamic feature from plain XML to GDBFeature. Signed-off-by: Akihiko Odaki --- target/arm/cpu.h | 20 +-- target/arm/internals.h | 2 +- target/arm/gd

[RFC PATCH 11/24] gdbstub: Use GDBFeature for GDBRegisterState

2023-07-31 Thread Akihiko Odaki
Simplify GDBRegisterState by replacing num_regs and xml members with one member that points to GDBFeature. Signed-off-by: Akihiko Odaki --- gdbstub/gdbstub.c | 14 ++ 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/gdbstub/gdbstub.c b/gdbstub/gdbstub.c index ab75f6686b.

[RFC PATCH 16/24] target/ppc: Fill new members of GDBFeature

2023-07-31 Thread Akihiko Odaki
These members will be used to help plugins to identify registers. Signed-off-by: Akihiko Odaki --- target/ppc/gdbstub.c | 10 ++ 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/target/ppc/gdbstub.c b/target/ppc/gdbstub.c index 19c4935260..ac4ed12371 100644 --- a/target/ppc/

[RFC PATCH 22/24] contrib/plugins: Allow to log registers

2023-07-31 Thread Akihiko Odaki
This demonstrates how a register can be read from a plugin. Signed-off-by: Akihiko Odaki --- docs/devel/tcg-plugins.rst | 10 ++- contrib/plugins/execlog.c | 130 - 2 files changed, 108 insertions(+), 32 deletions(-) diff --git a/docs/devel/tcg-plugins.rst

[RFC PATCH 24/24] contrib/plugins: Add cc plugin

2023-07-31 Thread Akihiko Odaki
This demonstrates how to write a plugin in C++. Signed-off-by: Akihiko Odaki --- docs/devel/tcg-plugins.rst | 8 configure | 15 --- contrib/plugins/Makefile | 5 + contrib/plugins/cc.cc | 15 +++ tests/tcg/Makefile.target | 3 +++

[RFC PATCH 14/24] gdbstub: Add members to identify registers to GDBFeature

2023-07-31 Thread Akihiko Odaki
These members will be used to help plugins to identify registers. The added members in instances of GDBFeature dynamically generated by CPUs will be filled in later changes. Signed-off-by: Akihiko Odaki --- include/exec/gdbstub.h | 2 ++ scripts/feature_to_c.py | 14 +- 2 files cha

[RFC PATCH 18/24] hw/core/cpu: Add a parameter to gdb_read_register/gdb_write_register

2023-07-31 Thread Akihiko Odaki
gdbstub has a static variable named gdb_has_xml that tells if workarounds for old GDB versions are required when manipulating registers for GDB. Now we are reusing the infrastructure to manipulate registers for plugins. Plugins will not need these workarounds even when an old GDB is attached. Conv

[RFC PATCH 21/24] plugins: Allow to read registers

2023-07-31 Thread Akihiko Odaki
It is based on GDB protocol to ensure interface stability. The timing of the vcpu init hook is also changed so that the hook will get called after GDB features are initialized. Signed-off-by: Akihiko Odaki --- include/qemu/qemu-plugin.h | 65 ++-- cpu.c

[RFC PATCH 13/24] hw/core/cpu: Remove gdb_get_dynamic_xml member

2023-07-31 Thread Akihiko Odaki
This function is no longer used. Signed-off-by: Akihiko Odaki --- include/hw/core/cpu.h | 4 target/arm/cpu.h | 6 -- target/ppc/cpu.h | 1 - target/arm/cpu.c | 1 - target/arm/gdbstub.c | 18 -- target/ppc/cpu_init.c | 3 --- target/ppc/gdbstub.c |

[RFC PATCH 20/24] gdbstub: Expose functions to read registers

2023-07-31 Thread Akihiko Odaki
gdb_foreach_feature() enumerates features that are useful to identify registers. gdb_read_register() actually reads registers. Signed-off-by: Akihiko Odaki --- include/exec/gdbstub.h | 6 ++ gdbstub/gdbstub.c | 38 ++ 2 files changed, 36 insertions(+

[RFC PATCH 17/24] target/riscv: Fill new members of GDBFeature

2023-07-31 Thread Akihiko Odaki
These members will be used to help plugins to identify registers. Signed-off-by: Akihiko Odaki --- target/riscv/gdbstub.c | 21 ++--- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/target/riscv/gdbstub.c b/target/riscv/gdbstub.c index 224c69ea99..b3d4d4de3e 100644

[RFC PATCH 23/24] plugins: Support C++

2023-07-31 Thread Akihiko Odaki
Make qemu-plugin.h consumable for C++ platform. Signed-off-by: Akihiko Odaki --- include/qemu/qemu-plugin.h | 4 1 file changed, 4 insertions(+) diff --git a/include/qemu/qemu-plugin.h b/include/qemu/qemu-plugin.h index 214b12bfd6..8637e3d8cf 100644 --- a/include/qemu/qemu-plugin.h +++ b/i

[RFC PATCH 09/24] target/riscv: Use GDBFeature for dynamic XML

2023-07-31 Thread Akihiko Odaki
In preparation for a change to use GDBFeature as a parameter of gdb_register_coprocessor(), convert the internal representation of dynamic feature from plain XML to GDBFeature. Signed-off-by: Akihiko Odaki --- target/riscv/cpu.h | 4 ++-- target/riscv/cpu.c | 4 ++-- target/riscv/gdbst

[RFC PATCH 19/24] gdbstub: Hide gdb_has_xml

2023-07-31 Thread Akihiko Odaki
gdb_has_xml is no longer referenced by the other components. Signed-off-by: Akihiko Odaki --- gdbstub/internals.h| 8 include/exec/gdbstub.h | 8 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/gdbstub/internals.h b/gdbstub/internals.h index f2b46cce41..92f5c

[PATCH v2 0/2] Accompany -nostdlib with -fno-stack-protector

2023-07-31 Thread Akihiko Odaki
A build of GCC 13.2 will have stack protector enabled by default if it was configured with --enable-default-ssp option. For such a compiler, it is necessary to explicitly disable stack protector when linking without standard libraries. This is a tree-wide change to add -fno-stack-protector where -

Re: [RFC PATCH 5/6] include/qemu/compiler: Fix problem with gcc_struct and Clang

2023-07-31 Thread Thomas Huth
On 28/07/2023 17.13, Peter Maydell wrote: On Fri, 28 Jul 2023 at 15:28, Thomas Huth wrote: Clang on Windows does not seem to know the "gcc_struct" attribute and emits a warning when we try to use it. Add an additional check here with __has_attribute() to avoid this problem. Signed-off-by: Tho

[PATCH v2 1/2] tests/migration: Add -fno-stack-protector

2023-07-31 Thread Akihiko Odaki
A build of GCC 13.2 will have stack protector enabled by default if it was configured with --enable-default-ssp option. For such a compiler, it is necessary to explicitly disable stack protector when linking without standard libraries. Signed-off-by: Akihiko Odaki Reviewed-by: Juan Quintela Revi

[PATCH v2 2/2] tests/tcg: Add -fno-stack-protector

2023-07-31 Thread Akihiko Odaki
A build of GCC 13.2 will have stack protector enabled by default if it was configured with --enable-default-ssp option. For such a compiler, it is necessary to explicitly disable stack protector when linking without standard libraries. Signed-off-by: Akihiko Odaki --- tests/tcg/mips/hello-mips.c

Re: [PATCH] ui/dbus: fix clang compilation issue

2023-07-31 Thread Philippe Mathieu-Daudé
On 26/7/23 17:12, marcandre.lur...@redhat.com wrote: From: Marc-André Lureau ../ui/dbus-listener.c:236:9: error: expected expression Error *err = NULL; See: https://gitlab.com/qemu-project/qemu/-/issues/1782#note_1488517427 Signed-off-by: Marc-André Lureau --- ui/dbus-listener.c |

[PATCH] tests/avocado: fix waiting for vm shutdown in replay_linux This patch fixes the race condition in waiting for shutdown of the replay linux test.

2023-07-31 Thread pavel . dovgalyuk
From: Pavel Dovgalyuk Signed-off-by: Pavel Dovgalyuk Suggested-by: John Snow --- tests/avocado/replay_linux.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/avocado/replay_linux.py b/tests/avocado/replay_linux.py index a76dd507fc..270ccc1eae 100644 --- a/tests/avoca

Re: linux-user/armeb: Fix __kernel_cmpxchg() for armeb

2023-07-31 Thread Philippe Mathieu-Daudé
On 27/7/23 23:19, Helge Deller wrote: Words are stored in big endian in the guest memory for armeb. Commit 7f4f0d9ea870 ("linux-user/arm: Implement __kernel_cmpxchg with host atomics") switched to use qatomic_cmpxchg() to swap a word with the memory content, but missed to endianess-swap the oldv

Re: linux-user/armeb: Fix __kernel_cmpxchg() for armeb

2023-07-31 Thread Michael Tokarev
31.07.2023 12:26, Philippe Mathieu-Daudé wrote: On 27/7/23 23:19, Helge Deller wrote: Words are stored in big endian in the guest memory for armeb. .. Reviewed-by: Philippe Mathieu-Daudé There was a v3 of this patch already, fwiw. /mjt

Re: [PATCH 0/5] linux-user: brk/mmap fixes

2023-07-31 Thread Michael Tokarev
31.07.2023 11:03, Akihiko Odaki wrote: linux-user was failing on M2 MacBook Air. Digging into the details, I found several bugs in brk and mmap so here are fixes. There's another work in this area by Helge Deller, have you seen it? ("linux-user: Fix and optimize target memory layout", a v5 alre

Re: [RFC PATCH 5/6] include/qemu/compiler: Fix problem with gcc_struct and Clang

2023-07-31 Thread Daniel P . Berrangé
On Mon, Jul 31, 2023 at 11:10:58AM +0200, Thomas Huth wrote: > On 28/07/2023 17.13, Peter Maydell wrote: > > On Fri, 28 Jul 2023 at 15:28, Thomas Huth wrote: > > > > > > Clang on Windows does not seem to know the "gcc_struct" attribute > > > and emits a warning when we try to use it. Add an addit

Re: [PATCH] Fix some typos in documentation and comments

2023-07-31 Thread Peter Maydell
On Sun, 30 Jul 2023 at 19:55, Stefan Weil via wrote: > > Signed-off-by: Stefan Weil > --- Reviewed-by: Peter Maydell thanks -- PMM

[PATCH] target/riscv: Use accelerated helper for AES64KS1I

2023-07-31 Thread Ard Biesheuvel
Use the accelerated SubBytes/ShiftRows/AddRoundKey AES helper to implement the first half of the key schedule derivation. This does not actually involve shifting rows, so clone the same uint32_t 4 times into the AES vector to counter that. Cc: Richard Henderson Cc: Philippe Mathieu-Daudé Signed-

Re: [PATCH] vdpa: set old virtio status at cvq isolation probing end

2023-07-31 Thread Eugenio Perez Martin
On Mon, Jul 31, 2023 at 10:42 AM Jason Wang wrote: > > On Mon, Jul 31, 2023 at 4:05 PM Eugenio Perez Martin > wrote: > > > > On Mon, Jul 31, 2023 at 8:36 AM Jason Wang wrote: > > > > > > On Wed, Jul 26, 2023 at 2:27 PM Eugenio Perez Martin > > > wrote: > > > > > > > > On Wed, Jul 26, 2023 at 4:

Re: [PATCH v3] linux-user/armeb: Fix __kernel_cmpxchg() for armeb

2023-07-31 Thread Philippe Mathieu-Daudé
On 28/7/23 21:23, Helge Deller wrote: Commit 7f4f0d9ea870 ("linux-user/arm: Implement __kernel_cmpxchg with host atomics") switched to use qatomic_cmpxchg() to swap a word with the memory content, but missed to endianess-swap the oldval and newval values when emulating an armeb CPU, which expects

Re: [PATCH v3 1/3] qapi: Moved architecture agnostic data types to `machine`

2023-07-31 Thread Philippe Mathieu-Daudé
On 30/7/23 08:40, Dinah Baum wrote: Signed-off-by: Dinah Baum --- qapi/machine-target.json | 78 +--- qapi/machine.json| 77 +++ 2 files changed, 78 insertions(+), 77 deletions(-) Reviewed-by: Philippe Mathieu-

Re: [PATCH] target/hppa: Move iaoq registers and thus reduce generated code size

2023-07-31 Thread Philippe Mathieu-Daudé
On 30/7/23 18:30, Helge Deller wrote: On hppa the Instruction Address Offset Queue (IAOQ) registers specifies the next to-be-executed instructions addresses. Each generated TB writes those registers at least once, so those registers are used heavily in generated code. Looking at the generated as

Re: [PATCH] Fix some typos in documentation and comments

2023-07-31 Thread Philippe Mathieu-Daudé
On 30/7/23 20:03, Stefan Weil wrote: Signed-off-by: Stefan Weil --- This patch was triggered by a spelling check for the generated QEMU documentation using codespell. It does not try to fix all typos which still exist in the QEMU code, but has a focus on those required to fix the documentation.

Re: [RFC PATCH 5/6] include/qemu/compiler: Fix problem with gcc_struct and Clang

2023-07-31 Thread Peter Maydell
On Mon, 31 Jul 2023 at 10:11, Thomas Huth wrote: > Or do you see another possibility how we could fix that timeout problem in > the 64-bit MSYS2 job? Still switching to clang, but compiling with > --extra-cflags="-Wno-unknown-attributes" maybe? Is there any way we can separate out the "take 25 mi

Re: [PATCH v5 0/3] linux-user: Fix and optimize target memory layout

2023-07-31 Thread Joel Stanley
On Fri, 28 Jul 2023 at 18:58, Helge Deller wrote: > > While trying to fix a bug which prevents running a static > armhf binary with linux-user, I noticed a whole bunch of > memory layout issues on various platforms. Most noteably > the free heap space was very limited in the current setup. > A lar

Re: [PATCH 0/7] Enable vdpa net migration with features depending on CVQ

2023-07-31 Thread Eugenio Perez Martin
On Mon, Jul 31, 2023 at 8:41 AM Jason Wang wrote: > > On Sat, Jul 29, 2023 at 1:20 AM Eugenio Pérez wrote: > > > > At this moment the migration of net features that depends on CVQ is not > > possible, as there is no reliable way to restore the device state like mac > > address, number of enabled

Re: [PATCH 0/5] linux-user: brk/mmap fixes

2023-07-31 Thread Joel Stanley
On Mon, 31 Jul 2023 at 09:31, Michael Tokarev wrote: > > 31.07.2023 11:03, Akihiko Odaki wrote: > > linux-user was failing on M2 MacBook Air. Digging into the details, I found > > several bugs in brk and mmap so here are fixes. > > There's another work in this area by Helge Deller, have you seen i

Re: [PATCH] elf2dmp: Don't abandon when Prcb is set to 0

2023-07-31 Thread Peter Maydell
On Sun, 30 Jul 2023 at 20:52, Viktor Prutyanov wrote: > > > >> On 2023/06/12 12:42, Viktor Prutyanov wrote: > >> > Prcb may be set to 0 for some CPUs if the dump was taken before they > start. The dump may still contain valuable information for started CPUs > so don't abandon conver

Re: [PATCH 0/5] linux-user: brk/mmap fixes

2023-07-31 Thread Akihiko Odaki
On 2023/07/31 19:17, Joel Stanley wrote: On Mon, 31 Jul 2023 at 09:31, Michael Tokarev wrote: 31.07.2023 11:03, Akihiko Odaki wrote: linux-user was failing on M2 MacBook Air. Digging into the details, I found several bugs in brk and mmap so here are fixes. There's another work in this area

[PATCH for-8.2 v2 1/6] vfio/migration: Move from STOP_COPY to STOP in vfio_save_cleanup()

2023-07-31 Thread Avihai Horon
Changing the device state from STOP_COPY to STOP can take time as the device may need to free resources and do other operations as part of the transition. Currently, this is done in vfio_save_complete_precopy() and therefore it is counted in the migration downtime. To avoid this, change the device

Re: [PATCH v2 4/4] vhost-user-scsi: support reconnect to backend

2023-07-31 Thread Li Feng
> 2023年7月31日 06:14,Raphael Norwitz 写道: > > I don’t think we should be changing any vhost-scsi-common code here. I’d > rather implement wrappers around vhost_user_scsi_start/stop() around > vhost_user_scsi_common_start/stop() and check started_vu there. > > Otherwise I think this is looking g

[PATCH for-8.2 v2 5/6] vfio/migration: Add P2P support for VFIO migration

2023-07-31 Thread Avihai Horon
VFIO migration uAPI defines an optional intermediate P2P quiescent state. While in the P2P quiescent state, P2P DMA transactions cannot be initiated by the device, but the device can respond to incoming ones. Additionally, all outstanding P2P transactions are guaranteed to have been completed by th

[PATCH for-8.2 v2 3/6] qdev: Add qdev_add_vm_change_state_handler_full()

2023-07-31 Thread Avihai Horon
Add qdev_add_vm_change_state_handler_full() variant that allows setting a prepare callback in addition to the main callback. This will facilitate adding P2P support for VFIO migration in the following patches. Signed-off-by: Avihai Horon Signed-off-by: Joao Martins --- include/sysemu/runstate.

[PATCH for-8.2 v2 2/6] sysemu: Add prepare callback to struct VMChangeStateEntry

2023-07-31 Thread Avihai Horon
Add prepare callback to struct VMChangeStateEntry. The prepare callback is optional and can be set by the new function qemu_add_vm_change_state_handler_prio_full() that allows setting this callback in addition to the main callback. The prepare callbacks and main callbacks are called in two separa

[PATCH for-8.2 v2 0/6] vfio/migration: Add P2P support for VFIO migration

2023-07-31 Thread Avihai Horon
Hi all, The first patch in this series adds a small optimization to VFIO migration by moving the STOP_COPY->STOP transition to vfio_save_cleanup(). Testing with a ConnectX-7 VFIO device showed that this can reduce downtime by up to 6%. The rest of the series adds P2P support for VFIO migration.

[PATCH for-8.2 v2 4/6] vfio/migration: Refactor PRE_COPY and RUNNING state checks

2023-07-31 Thread Avihai Horon
From: Joao Martins Move the PRE_COPY and RUNNING state checks to helper functions. This is in preparation for adding P2P VFIO migration support, where these helpers will also test for PRE_COPY_P2P and RUNNING_P2P states. Signed-off-by: Joao Martins Signed-off-by: Avihai Horon Reviewed-by: Céd

[PATCH for-8.2 v2 6/6] vfio/migration: Allow migration of multiple P2P supporting devices

2023-07-31 Thread Avihai Horon
Now that P2P support has been added to VFIO migration, allow migration of multiple devices if all of them support P2P migration. Single device migration is allowed regardless of P2P migration support. Signed-off-by: Avihai Horon Signed-off-by: Joao Martins --- hw/vfio/common.c | 26 +++

Re: assert fails in s390x TCG

2023-07-31 Thread Claudio Fontana
On 7/21/23 11:08, Claudio Fontana wrote: > > Hello Cornelia, Richard, > > I had some strange behavior in an s390x TCG VM that I am debugging, > > and configured latest upstream QEMU with --enable-debug --enable-debug-tcg > > and I am running the qemu binary with -d unimp,guest_errors . > > I g

Re: [PATCH] vhost-user-scsi: support reconnect to backend

2023-07-31 Thread Li Feng
> 2023年7月31日 06:09,Raphael Norwitz 写道: > > > >> On Jul 28, 2023, at 3:48 AM, Li Feng wrote: >> >> Thanks for your reply. >> >>> 2023年7月28日 上午5:21,Raphael Norwitz 写道: >>> >>> >>> On Jul 25, 2023, at 6:19 AM, Li Feng wrote: Thanks for your comments. > 2023年7月25

Re: [PATCH 4/7] spapr: Fix record-replay machine reset consuming too many events

2023-07-31 Thread Pavel Dovgalyuk
Acked-by: Pavel Dovgalyuk On 26.07.2023 21:35, Nicholas Piggin wrote: spapr_machine_reset gets a random number to populate the device-tree rng seed with. When loading a snapshot for record-replay, the machine is reset again, and that tries to consume the random event record again, crashing due

Re: [PATCH v2 2/4] vhost-user-common: send get_inflight_fd once

2023-07-31 Thread Li Feng
> 2023年7月31日 06:13,Raphael Norwitz 写道: > >> >> On Jul 28, 2023, at 3:49 AM, Li Feng wrote: >> >> >> >>> 2023年7月28日 下午2:04,Michael S. Tsirkin 写道: >>> >>> On Tue, Jul 25, 2023 at 06:42:45PM +0800, Li Feng wrote: Get_inflight_fd is sent only once. When reconnecting to the backend,

Re: [PATCH 5/7] tests/avocado: boot ppc64 pseries replay-record test to Linux VFS mount

2023-07-31 Thread Pavel Dovgalyuk
Acked-by: Pavel Dovgalyuk On 26.07.2023 21:35, Nicholas Piggin wrote: This the ppc64 record-replay test is able to replay the full kernel boot so try enabling it. Cc: Pavel Dovgalyuk Signed-off-by: Nicholas Piggin --- tests/avocado/replay_kernel.py | 3 +-- 1 file changed, 1 insertion(+),

Re: [PATCH 3/5] linux-user: Use MAP_FIXED_NOREPLACE for do_brk()

2023-07-31 Thread Peter Maydell
On Mon, 31 Jul 2023 at 09:04, Akihiko Odaki wrote: > > MAP_FIXED_NOREPLACE can ensure the mapped address is fixed without > concerning that the new mapping overwrites something else. MAP_FIXED_NOREPLACE only came in with Linux 4.17. So I think we still need to handle the "mapped address is not th

Re: [RFC PATCH 5/6] include/qemu/compiler: Fix problem with gcc_struct and Clang

2023-07-31 Thread Thomas Huth
On 31/07/2023 11.32, Daniel P. Berrangé wrote: On Mon, Jul 31, 2023 at 11:10:58AM +0200, Thomas Huth wrote: ... Or do you see another possibility how we could fix that timeout problem in the 64-bit MSYS2 job? Still switching to clang, but compiling with --extra-cflags="-Wno-unknown-attributes"

Re: [RFC PATCH 5/6] include/qemu/compiler: Fix problem with gcc_struct and Clang

2023-07-31 Thread Thomas Huth
On 31/07/2023 12.05, Peter Maydell wrote: On Mon, 31 Jul 2023 at 10:11, Thomas Huth wrote: Or do you see another possibility how we could fix that timeout problem in the 64-bit MSYS2 job? Still switching to clang, but compiling with --extra-cflags="-Wno-unknown-attributes" maybe? Is there any

Re: [PATCH 6/7] tests/avocado: reverse-debugging cope with re-executing breakpoints

2023-07-31 Thread Pavel Dovgalyuk
Reviewed-by: Pavel Dovgalyuk On 26.07.2023 21:35, Nicholas Piggin wrote: The reverse-debugging test creates a trace, then replays it and: 1. Steps the first 10 instructions and records their addresses. 2. Steps backward and verifies their addresses match. 3. Runs to (near) the end of the trace

Re: [PATCH 7/7] tests/avocado: ppc64 reverse debugging tests for pseries and powernv

2023-07-31 Thread Pavel Dovgalyuk
Reviewed-by: Pavel Dovgalyuk On 26.07.2023 21:35, Nicholas Piggin wrote: These machines run reverse-debugging well enough to pass basic tests. Wire them up. Cc: Pavel Dovgalyuk Signed-off-by: Nicholas Piggin --- tests/avocado/reverse_debugging.py | 29 + 1 file

[PATCH v3 1/5] vhost: fix the fd leak

2023-07-31 Thread Li Feng
When the vhost-user reconnect to the backend, the notifer should be cleanup. Otherwise, the fd resource will be exhausted. Fixes: f9a09ca3ea ("vhost: add support for configure interrupt") Signed-off-by: Li Feng Reviewed-by: Raphael Norwitz --- hw/virtio/vhost.c | 2 ++ 1 file changed, 2 insert

[PATCH v3 5/5] vhost-user-scsi: start vhost when guest kicks

2023-07-31 Thread Li Feng
Let's keep the same behavior as vhost-user-blk. Some old guests kick virtqueue before setting VIRTIO_CONFIG_S_DRIVER_OK. Signed-off-by: Li Feng --- hw/scsi/vhost-user-scsi.c | 48 +++ 1 file changed, 44 insertions(+), 4 deletions(-) diff --git a/hw/scsi/vhos

[PATCH v3 0/5] Implement reconnect for vhost-user-scsi

2023-07-31 Thread Li Feng
This patchset adds reconnect support for vhost-user-scsi. At the same times, fix vhost fd leak and refactor some code. Changes for v3: - Split the vhost_user_scsi_handle_output to a separate patch; - Move the started_vu from vhost scsi common header to vhost-user-scsi header; - Fix a log print err

[PATCH v3 4/5] vhost-user-scsi: support reconnect to backend

2023-07-31 Thread Li Feng
If the backend crashes and restarts, the device is broken. This patch adds reconnect for vhost-user-scsi. Tested with spdk backend. Signed-off-by: Li Feng --- hw/scsi/vhost-user-scsi.c | 199 +--- include/hw/virtio/vhost-user-scsi.h | 4 + 2 files changed, 18

  1   2   3   >