[PATCH v2 1/2] rcu: Introduce force_rcu notifier

2021-10-18 Thread Greg Kurz
The drain_rcu_call() function can be blocked as long as an RCU reader stays in a read-side critical section. This is typically what happens when a TCG vCPU is executing a busy loop. It can deadlock the QEMU monitor as reported in https://gitlab.com/qemu-project/qemu/-/issues/650 . This can be

[PATCH v2 2/2] accel/tcg: Register a force_rcu notifier

2021-10-18 Thread Greg Kurz
A TCG vCPU doing a busy loop systematicaly hangs the QEMU monitor if the user passes 'device_add' without argument. This is because drain_cpu_all() which is called from qmp_device_add() cannot return if readers don't exit read-side critical sections. That is typically what busy-looping TCG vCPUs

[PATCH v2 0/2] accel/tcg: Fix monitor deadlock

2021-10-18 Thread Greg Kurz
Commit 7bed89958bfb ("device_core: use drain_call_rcu in in qmp_device_add") introduced a regression in QEMU 6.0 : passing device_add without argument hangs the monitor. This was reported against qemu-system-mips64 with TGC, but I could consistently reproduce it with other targets (x86 and ppc64).

Re: [PATCH v4 2/2] monitor: refactor set/expire_password and allow VNC display id

2021-10-18 Thread Markus Armbruster
Stefan Reiter writes: > On 10/14/21 9:14 AM, Markus Armbruster wrote: >> Stefan Reiter writes: >> >>> On 10/12/21 11:24 AM, Markus Armbruster wrote: [...] I'd split this patch into three parts: item 1., 2.+3., 4.-6., because each part can stand on its own. >>> >>> The reason why I

Re: [PATCH 0/6] RfC: try improve native hotplug for pcie root ports

2021-10-18 Thread Michael S. Tsirkin
On Tue, Oct 19, 2021 at 07:21:44AM +0200, Gerd Hoffmann wrote: > On Mon, Oct 18, 2021 at 11:36:45AM -0400, Michael S. Tsirkin wrote: > > On Mon, Oct 11, 2021 at 02:04:58PM +0200, Gerd Hoffmann wrote: > > > > > > > > > Gerd Hoffmann (6): > > > pci: implement power state > > > pcie: implement

Re: [PATCH 0/6] RfC: try improve native hotplug for pcie root ports

2021-10-18 Thread Gerd Hoffmann
On Mon, Oct 18, 2021 at 11:36:45AM -0400, Michael S. Tsirkin wrote: > On Mon, Oct 11, 2021 at 02:04:58PM +0200, Gerd Hoffmann wrote: > > > > > > Gerd Hoffmann (6): > > pci: implement power state > > pcie: implement slow power control for pcie root ports > > pcie: add power indicator blink

Re: [PATCH] Hexagon (target/hexagon) put writes to USR into temp until commit

2021-10-18 Thread Philippe Mathieu-Daudé
On 10/12/21 11:31, Taylor Simpson wrote: > Change SET_USR_FIELD to write to hex_new_value[HEX_REG_USR] instead > of hex_gpr[HEX_REG_USR]. > > Then, we need code to mark the instructions that can set implicitly > set USR > - Macros added to hex_common.py > - A_FPOP added in translate.c > >

Re: [PATCH 1/2] Hexagon (target/hexagon) more tcg_constant_*

2021-10-18 Thread Philippe Mathieu-Daudé
On 10/12/21 11:31, Taylor Simpson wrote: > Change additional tcg_const_tl to tcg_constant_tl > > Note that gen_pred_cancal had slot_mask initialized with tcg_const_tl. > However, it is not constant throughout, so we initialize it with > tcg_temp_new and replace the first use with the constant

Re: [PATCH] block/file-posix: Fix return value translation for AIO discards.

2021-10-18 Thread Philippe Mathieu-Daudé
+Stefan On 10/18/21 20:07, Ari Sundholm wrote: > AIO discards regressed as a result of the following commit: > 0dfc7af2 block/file-posix: Optimize for macOS > > When trying to run blkdiscard within a Linux guest, the request would > fail, with some errors in dmesg: > > [ snip ]

Re: [PATCH] rebuild-expected-aml.sh: allow partial target list

2021-10-18 Thread Ani Sinha
On Mon, 18 Oct 2021, Michael S. Tsirkin wrote: > Only rebuild AML for configured targets. > > Signed-off-by: Michael S. Tsirkin Reviewed-by: Ani Sinha > --- > tests/data/acpi/rebuild-expected-aml.sh | 22 +- > 1 file changed, 21 insertions(+), 1 deletion(-) > > diff

Re: [PATCH] block/file-posix: Fix return value translation for AIO discards.

2021-10-18 Thread Akihiko Odaki
Reviewed-by: Akihiko Odaki On Tue, Oct 19, 2021 at 3:08 AM Ari Sundholm wrote: > > AIO discards regressed as a result of the following commit: > 0dfc7af2 block/file-posix: Optimize for macOS > > When trying to run blkdiscard within a Linux guest, the request would > fail, with some

Re: [PATCH v4 15/16] target/riscv: Use riscv_csrrw_debug for cpu_dump

2021-10-18 Thread Richard Henderson
On 10/18/21 5:01 PM, Richard Henderson wrote: +result = riscv_csrrw_debug(env, dump_csrs[i].csrno, , 0, 0); +assert(result == RISCV_EXCP_NONE); +qemu_fprintf(f, " %-8s " TARGET_FMT_lx "\n", + dump_csrs[i].name, val); Ho hum, this

Re: [PATCH v4 14/16] target/riscv: Align gprs and fprs in cpu_dump

2021-10-18 Thread LIU Zhiwei
On 2021/10/19 上午8:01, Richard Henderson wrote: Allocate 8 columns per register name. Signed-off-by: Richard Henderson Reviewed-by: LIU Zhiwei Zhiwei --- target/riscv/cpu.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c

Re: [PATCH v4 09/16] target/riscv: Replace DisasContext.w with DisasContext.ol

2021-10-18 Thread Richard Henderson
On 10/18/21 7:24 PM, LIU Zhiwei wrote: @@ -223,10 +238,15 @@ static TCGv dest_gpr(DisasContext *ctx, int reg_num)   static void gen_set_gpr(DisasContext *ctx, int reg_num, TCGv t)   {   if (reg_num != 0) { -    if (ctx->w) { +    switch (get_ol(ctx)) { +    case MXL_RV32:

Re: [PATCH v1 2/2] target/riscv: Organise the CPU properties

2021-10-18 Thread Bin Meng
On Mon, Oct 18, 2021 at 12:32 PM Alistair Francis wrote: > > From: Alistair Francis Possible commit description: Organise the CPU properties so that standard extensions come first then followed by experimental extensions. > > Signed-off-by: Alistair Francis > --- > target/riscv/cpu.c | 17

Re: [PATCH v1 1/2] target/riscv: Remove some unused macros

2021-10-18 Thread Bin Meng
On Mon, Oct 18, 2021 at 5:30 PM Philippe Mathieu-Daudé wrote: > > On 10/18/21 06:32, Alistair Francis wrote: > > From: Alistair Francis > > Possible commit description: > > Since commit 1a9540d1f1a ("target/riscv: Drop support for ISA > spec version 1.09.1") these definitions are unused,

Re: [PATCH v4 09/16] target/riscv: Replace DisasContext.w with DisasContext.ol

2021-10-18 Thread LIU Zhiwei
On 2021/10/19 上午8:01, Richard Henderson wrote: In preparation for RV128, consider more than just "w" for operand size modification. This will be used for the "d" insns from RV128 as well. Rename oper_len to get_olen to better match get_xlen. Reviewed-by: Alistair Francis Signed-off-by:

Re: [PATCH v1 1/2] target/riscv: Remove some unused macros

2021-10-18 Thread Alistair Francis
On Mon, Oct 18, 2021 at 7:30 PM Philippe Mathieu-Daudé wrote: > > On 10/18/21 06:32, Alistair Francis wrote: > > From: Alistair Francis > > Possible commit description: > > Since commit 1a9540d1f1a ("target/riscv: Drop support for ISA > spec version 1.09.1") these definitions are unused,

[PATCH v4 16/16] target/riscv: Compute mstatus.sd on demand

2021-10-18 Thread Richard Henderson
The position of this read-only field is dependent on the current cpu width. Rather than having to compute that difference in many places, compute it only on read. Signed-off-by: Richard Henderson --- target/riscv/cpu_helper.c | 3 +-- target/riscv/csr.c| 37

[PATCH v4 15/16] target/riscv: Use riscv_csrrw_debug for cpu_dump

2021-10-18 Thread Richard Henderson
Use the official debug read interface to the csrs, rather than referencing the env slots directly. Put the list of csrs to dump into a table. Signed-off-by: Richard Henderson --- target/riscv/cpu.c | 99 +- 1 file changed, 55 insertions(+), 44

[PATCH v4 12/16] target/riscv: Use gen_unary_per_ol for RVB

2021-10-18 Thread Richard Henderson
The count zeros instructions require a separate implementation for RV32 when TARGET_LONG_BITS == 64. Reviewed-by: LIU Zhiwei Reviewed-by: Alistair Francis Signed-off-by: Richard Henderson --- target/riscv/translate.c| 16 target/riscv/insn_trans/trans_rvb.c.inc |

[PATCH v4 14/16] target/riscv: Align gprs and fprs in cpu_dump

2021-10-18 Thread Richard Henderson
Allocate 8 columns per register name. Signed-off-by: Richard Henderson --- target/riscv/cpu.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index 4e1920d5f0..f352c2b74c 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c

[PATCH v4 09/16] target/riscv: Replace DisasContext.w with DisasContext.ol

2021-10-18 Thread Richard Henderson
In preparation for RV128, consider more than just "w" for operand size modification. This will be used for the "d" insns from RV128 as well. Rename oper_len to get_olen to better match get_xlen. Reviewed-by: Alistair Francis Signed-off-by: Richard Henderson --- target/riscv/translate.c

[PATCH v4 13/16] target/riscv: Use gen_shift*_per_ol for RVB, RVI

2021-10-18 Thread Richard Henderson
Most shift instructions require a separate implementation for RV32 when TARGET_LONG_BITS == 64. Reviewed-by: LIU Zhiwei Reviewed-by: Alistair Francis Signed-off-by: Richard Henderson --- target/riscv/translate.c| 31 + target/riscv/insn_trans/trans_rvb.c.inc | 92

[PATCH v4 06/16] target/riscv: Use REQUIRE_64BIT in amo_check64

2021-10-18 Thread Richard Henderson
Use the same REQUIRE_64BIT check that we use elsewhere, rather than open-coding the use of is_32bit. Reviewed-by: LIU Zhiwei Reviewed-by: Alistair Francis Signed-off-by: Richard Henderson --- target/riscv/insn_trans/trans_rvv.c.inc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff

[PATCH v4 08/16] target/riscv: Replace is_32bit with get_xl/get_xlen

2021-10-18 Thread Richard Henderson
In preparation for RV128, replace a simple predicate with a more versatile test. Reviewed-by: LIU Zhiwei Reviewed-by: Alistair Francis Signed-off-by: Richard Henderson --- target/riscv/translate.c | 33 ++--- 1 file changed, 18 insertions(+), 15 deletions(-) diff

[PATCH v4 11/16] target/riscv: Adjust trans_rev8_32 for riscv64

2021-10-18 Thread Richard Henderson
When target_long is 64-bit, we still want a 32-bit bswap for rev8. Since this opcode is specific to RV32, we need not conditionalize. Acked-by: Alistair Francis Reviewed-by: LIU Zhiwei Signed-off-by: Richard Henderson --- target/riscv/insn_trans/trans_rvb.c.inc | 7 ++- 1 file changed, 6

[PATCH v4 05/16] target/riscv: Add MXL/SXL/UXL to TB_FLAGS

2021-10-18 Thread Richard Henderson
Begin adding support for switching XLEN at runtime. Extract the effective XLEN from MISA and MSTATUS and store for use during translation. Reviewed-by: LIU Zhiwei Reviewed-by: Alistair Francis Signed-off-by: Richard Henderson --- target/riscv/cpu.h| 2 ++ target/riscv/cpu.c|

[PATCH v4 04/16] target/riscv: Replace riscv_cpu_is_32bit with riscv_cpu_mxl

2021-10-18 Thread Richard Henderson
Shortly, the set of supported XL will not be just 32 and 64, and representing that properly using the enumeration will be imperative. Two places, booting and gdb, intentionally use misa_mxl_max to emphasize the use of the reset value of misa.mxl, and not the current cpu state. Reviewed-by: LIU

[PATCH v4 10/16] target/riscv: Use gen_arith_per_ol for RVM

2021-10-18 Thread Richard Henderson
The multiply high-part instructions require a separate implementation for RV32 when TARGET_LONG_BITS == 64. Reviewed-by: LIU Zhiwei Reviewed-by: Alistair Francis Signed-off-by: Richard Henderson --- target/riscv/translate.c| 16 +++

[PATCH v4 01/16] target/riscv: Move cpu_get_tb_cpu_state out of line

2021-10-18 Thread Richard Henderson
Move the function to cpu_helper.c, as it is large and growing. Reviewed-by: LIU Zhiwei Reviewed-by: Alistair Francis Signed-off-by: Richard Henderson --- target/riscv/cpu.h| 47 ++- target/riscv/cpu_helper.c | 46

[PATCH v4 03/16] target/riscv: Split misa.mxl and misa.ext

2021-10-18 Thread Richard Henderson
The hw representation of misa.mxl is at the high bits of the misa csr. Representing this in the same way inside QEMU results in overly complex code trying to check that field. Reviewed-by: LIU Zhiwei Reviewed-by: Alistair Francis Signed-off-by: Richard Henderson --- target/riscv/cpu.h

[PATCH v4 07/16] target/riscv: Properly check SEW in amo_op

2021-10-18 Thread Richard Henderson
We're currently assuming SEW <= 3, and the "else" from the SEW == 3 must be less. Use a switch and explicitly bound both SEW and SEQ for all cases. Reviewed-by: LIU Zhiwei Reviewed-by: Alistair Francis Signed-off-by: Richard Henderson --- target/riscv/insn_trans/trans_rvv.c.inc | 26

[PATCH v4 02/16] target/riscv: Create RISCVMXL enumeration

2021-10-18 Thread Richard Henderson
Move the MXL_RV* defines to enumerators. Reviewed-by: LIU Zhiwei Reviewed-by: Alistair Francis Signed-off-by: Richard Henderson --- target/riscv/cpu_bits.h | 8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/target/riscv/cpu_bits.h b/target/riscv/cpu_bits.h index

[PATCH v4 00/16] target/riscv: Rationalize XLEN and operand length

2021-10-18 Thread Richard Henderson
This is a partial patch set attempting to set things in the right direction for both the UXL and RV128 patch sets. r~ Changes for v4: * Use riscv_csrrw_debug for cpu_dump. This fixes the issue that Alistair pointed out wrt the MSTATUS.SD bit not being correct in the dump; note that

Re: [PATCH v2 04/22] target/riscv: Improve fidelity of guest external interrupts

2021-10-18 Thread Alistair Francis
On Mon, Oct 18, 2021 at 10:55 PM Anup Patel wrote: > > On Fri, Oct 15, 2021 at 11:54 AM Alistair Francis > wrote: > > > > On Thu, Sep 16, 2021 at 11:42 PM Anup Patel wrote: > > > > > > On Wed, Sep 15, 2021 at 6:19 AM Alistair Francis > > > wrote: > > > > > > > > On Tue, Sep 14, 2021 at 2:33

Re: [PATCH v6] Work around vhost-user-blk-test hang

2021-10-18 Thread Raphael Norwitz
On Mon, Oct 18, 2021 at 05:50:41PM -0400, Michael S. Tsirkin wrote: > On Thu, Oct 14, 2021 at 04:32:23AM +, Raphael Norwitz wrote: > > The vhost-user-blk-test qtest has been hanging intermittently for a > > while. The root cause is not yet fully understood, but the hang is > > impacting enough

Re: TCP/IP connections sometimes stop retransmitting packets (in nested virtualization case)

2021-10-18 Thread Maxim Levitsky
On Mon, 2021-10-18 at 16:49 -0400, Michael S. Tsirkin wrote: > On Mon, Oct 18, 2021 at 11:05:23AM -0700, Eric Dumazet wrote: > > > > On 10/17/21 3:50 AM, Maxim Levitsky wrote: > > > Hi! > > > > > > This is a follow up mail to my mail about NFS client deadlock I was > > > trying to debug last

Re: [PATCH v6] Work around vhost-user-blk-test hang

2021-10-18 Thread Michael S. Tsirkin
On Thu, Oct 14, 2021 at 04:32:23AM +, Raphael Norwitz wrote: > The vhost-user-blk-test qtest has been hanging intermittently for a > while. The root cause is not yet fully understood, but the hang is > impacting enough users that it is important to merge a workaround for > it. > > The race

Re: [PATCH v2 04/15] tests: acpi: q35: test for x2APIC entries in SRAT

2021-10-18 Thread Michael S. Tsirkin
On Thu, Sep 02, 2021 at 07:35:40AM -0400, Igor Mammedov wrote: > Set -smp 1,maxcpus=288 to test for ACPI code that > deal with CPUs with large APIC ID (>255). > > PS: > Test requires KVM and in-kernel irqchip support, > so skip test if KVM is not available. > > Signed-off-by: Igor Mammedov >

[PATCH] rebuild-expected-aml.sh: allow partial target list

2021-10-18 Thread Michael S. Tsirkin
Only rebuild AML for configured targets. Signed-off-by: Michael S. Tsirkin --- tests/data/acpi/rebuild-expected-aml.sh | 22 +- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/tests/data/acpi/rebuild-expected-aml.sh b/tests/data/acpi/rebuild-expected-aml.sh

Re: [PULL v2 00/23] Pull bsd user 20211018 patches

2021-10-18 Thread Richard Henderson
...@gitlab.com:bsdimp/qemu.git tags/pull-bsd-user-20211018-pull-request for you to fetch changes up to 5abfac277d25feb5f12332422c03ea1cb21c6aa1: bsd-user/signal: Create a dummy signal queueing function (2021-10-18 12:51:39 -0600) Applied, thanks. r~

Re: [PATCH 2/2] Hexagon (target/hexagon) put writes to USR into temp until commit

2021-10-18 Thread Richard Henderson
On 10/12/21 2:31 AM, Taylor Simpson wrote: Change SET_USR_FIELD to write to hex_new_value[HEX_REG_USR] instead of hex_gpr[HEX_REG_USR]. Then, we need code to mark the instructions that can set implicitly set USR - Macros added to hex_common.py - A_FPOP added in translate.c Test case added in

Re: [PATCH 1/2] Hexagon (target/hexagon) more tcg_constant_*

2021-10-18 Thread Richard Henderson
On 10/12/21 2:31 AM, Taylor Simpson wrote: Change additional tcg_const_tl to tcg_constant_tl Note that gen_pred_cancal had slot_mask initialized with tcg_const_tl. However, it is not constant throughout, so we initialize it with tcg_temp_new and replace the first use with the constant value.

Re: [PATCH v4 3/3] bios-tables-test: Generate reference table for virt/DBG2

2021-10-18 Thread Richard Henderson
On 10/7/21 12:29 AM, Eric Auger wrote: diff --git a/tests/data/acpi/virt/DBG2 b/tests/data/acpi/virt/DBG2 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..86e6314f7b0235ef8ed3e0221e09f996c41f5e98 100644 GIT binary patch literal 87 zcmZ>9ayJTR0D|*Q{>~o33QiFL&-l2owUbL9`AKgJ=eA21Zr}H4uw|p@A7lh%qQJ

Re: [PATCH v2] hw/elf_ops.h: switch to ssize_t for elf loader return type

2021-10-18 Thread Richard Henderson
On 10/14/21 12:43 PM, Luc Michel wrote: Until now, int was used as the return type for all the ELF loader related functions. The returned value is the sum of all loaded program headers "MemSize" fields. Because of the overflow check in elf_ops.h, trying to load an ELF bigger than INT_MAX will

[PATCH] tests/vm/openbsd: Update to release 7.0

2021-10-18 Thread Richard Henderson
There are two minor changes required in the script for the network configuration of the newer release. Signed-off-by: Richard Henderson --- tests/vm/openbsd | 7 +++ 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tests/vm/openbsd b/tests/vm/openbsd index

Re: TCP/IP connections sometimes stop retransmitting packets (in nested virtualization case)

2021-10-18 Thread Michael S. Tsirkin
On Mon, Oct 18, 2021 at 11:05:23AM -0700, Eric Dumazet wrote: > > > On 10/17/21 3:50 AM, Maxim Levitsky wrote: > > Hi! > > > > This is a follow up mail to my mail about NFS client deadlock I was trying > > to debug last week: > >

Re: [PATCH v2 05/15] tests: acpi: update expected tables blobs

2021-10-18 Thread Michael S. Tsirkin
On Thu, Sep 02, 2021 at 07:35:41AM -0400, Igor Mammedov wrote: > Update adds CPU entries to MADT/SRAT/FACP and DSDT to cover 288 CPUs. > Notable changes are that CPUs with APIC ID 255 and higher > use 'Processor Local x2APIC Affinity' structure in SRAT and > "Device" element in DSDT. > > FACP: >

Re: [PATCH] hw/arm/sbsa-ref: Fixed cpu type error message typo.

2021-10-18 Thread Richard Henderson
On 10/7/21 11:36 PM, Shuuichirou Ishii wrote: Signed-off-by: Shuuichirou Ishii --- hw/arm/sbsa-ref.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/arm/sbsa-ref.c b/hw/arm/sbsa-ref.c index 509c5f09b4..358714bd3e 100644 --- a/hw/arm/sbsa-ref.c +++ b/hw/arm/sbsa-ref.c

Re: [PATCH v4 07/12] virtiofsd: Let lo_inode_open() return a TempFd

2021-10-18 Thread Vivek Goyal
On Thu, Sep 16, 2021 at 10:40:40AM +0200, Hanna Reitz wrote: > Strictly speaking, this is not necessary, because lo_inode_open() will > always return a new FD owned by the caller, so TempFd.owned will always > be true. > > The auto-cleanup is nice, though. Also, we get a more unified interface >

[PULL v2 18/23] bsd-user/target_os_elf: If ELF_HWCAP2 is defined, publish it

2021-10-18 Thread Warner Losh
Some architectures publish AT_HWCAP2 as well as AT_HWCAP. Those architectures will define ELF_HWCAP2 in their target_arch_elf.h files for the value for this process. If it is defined, then publish it. Signed-off-by: Warner Losh Reviewed-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé

[PULL v2 20/23] bsd-user: Add stop_all_tasks

2021-10-18 Thread Warner Losh
Similar to the same function in linux-user: this stops all the current tasks. Signed-off-by: Stacey Son Signed-off-by: Warner Losh Reviewed-by: Richard Henderson Reviewed-by: Kyle Evans --- bsd-user/main.c | 9 + bsd-user/qemu.h | 1 + 2 files changed, 10 insertions(+) diff --git

[PULL v2 23/23] bsd-user/signal: Create a dummy signal queueing function

2021-10-18 Thread Warner Losh
Create dummy signal queueing function so we can start to integrate other architectures (at the cost of signals remaining broken) to tame the dependency graph a bit and to bring in signals in a more controlled fashion. Log unimplemented events to it in the mean time. Signed-off-by: Warner Losh

[PULL v2 19/23] bsd-user: Remove used from TaskState

2021-10-18 Thread Warner Losh
The 'used' field in TaskState is write only. Remove it from TaskState. Signed-off-by: Warner Losh Reviewed-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Kyle Evans --- bsd-user/main.c | 1 - bsd-user/qemu.h | 1 - 2 files changed, 2 deletions(-) diff --git

[PULL v2 22/23] bsd-user: Rename sigqueue to qemu_sigqueue

2021-10-18 Thread Warner Losh
To avoid a name clash with FreeBSD's sigqueue data structure in signalvar.h, rename sigqueue to qemu_sigqueue. This structure is currently defined, but unused. Signed-off-by: Warner Losh Reviewed-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Kyle Evans ---

[PULL v2 17/23] bsd-user/target_os_elf.h: Remove fallback ELF_HWCAP and reorder

2021-10-18 Thread Warner Losh
All architectures have a ELF_HWCAP, so remove the fallback ifdef. Place ELF_HWCAP in the same order as on native FreeBSD. Signed-off-by: Warner Losh Reviewed-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Kyle Evans --- bsd-user/freebsd/target_os_elf.h | 8 ++-- 1

[PULL v2 13/23] bsd-user: TARGET_RESET define is unused, remove it

2021-10-18 Thread Warner Losh
Signed-off-by: Warner Losh Reviewed-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Kyle Evans --- bsd-user/i386/target_arch_cpu.h | 2 -- bsd-user/x86_64/target_arch_cpu.h | 2 -- 2 files changed, 4 deletions(-) diff --git a/bsd-user/i386/target_arch_cpu.h

[PULL v2 16/23] bsd-user: move TARGET_MC_GET_CLEAR_RET to target_os_signal.h

2021-10-18 Thread Warner Losh
Move TARGET_MC_GET_CLEAR_RET to freebsd/target_os_signal.h since it's architecture agnostic on FreeBSD. Signed-off-by: Warner Losh Reviewed-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Kyle Evans --- bsd-user/freebsd/target_os_signal.h | 3 +++

[PULL v2 21/23] bsd-user/sysarch: Move to using do_freebsd_arch_sysarch interface

2021-10-18 Thread Warner Losh
do_freebsd_arch_sysarch() exists in $ARCH/target_arch_sysarch.h for x86. Call it from do_freebsd_sysarch() and remove the mostly duplicate version in syscall.c. Future changes will move it to os-sys.c and support other architectures. Signed-off-by: Warner Losh Reviewed-by: Richard Henderson

[PULL v2 12/23] bsd-user/strace.list: Remove support for FreeBSD versions older than 12.0

2021-10-18 Thread Warner Losh
Signed-off-by: Warner Losh Reviewed-by: Richard Henderson Reviewed-by: Kyle Evans --- bsd-user/freebsd/strace.list | 11 --- 1 file changed, 11 deletions(-) diff --git a/bsd-user/freebsd/strace.list b/bsd-user/freebsd/strace.list index b01b5f36e8..275d2dbe27 100644 ---

[PULL v2 14/23] bsd-user: export get_errno and is_error from syscall.c

2021-10-18 Thread Warner Losh
Make get_errno and is_error global so files other than syscall.c can use them. Signed-off-by: Warner Losh Reviewed-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Kyle Evans --- bsd-user/qemu.h| 4 bsd-user/syscall.c | 10 +- 2 files changed, 9

[PULL v2 15/23] bsd-user/errno_defs.h: Add internal error numbers

2021-10-18 Thread Warner Losh
From: Stacey Son To emulate signals and interrupted system calls, we need to have the same mechanisms we have in the kernel, including these errno values. Signed-off-by: Stacey Son Signed-off-by: Warner Losh Reviewed-by: Richard Henderson Reviewed-by: Kyle Evans --- bsd-user/errno_defs.h |

[PULL v2 10/23] meson: *-user: only descend into *-user when configured

2021-10-18 Thread Warner Losh
To increase flexibility, only descend into *-user when that is configured. This allows *-user to selectively include directories based on the host OS which may not exist on all hosts. Adopt Paolo's suggestion of checking the configuration in the directories that know about the configuration.

[PULL v2 09/23] bsd-user/mmap.c: assert that target_mprotect cannot fail

2021-10-18 Thread Warner Losh
Similar to the equivalent linux-user change 86abac06c14. All error conditions that target_mprotect checks are also checked by target_mmap. EACCESS cannot happen because we are just removing PROT_WRITE. ENOMEM should not happen because we are modifying a whole VMA (and we have bigger problems

[PULL v2 06/23] bsd-user/mmap.c: Convert to qemu_log logging for mmap debugging

2021-10-18 Thread Warner Losh
Convert DEBUG_MMAP to qemu_log CPU_LOG_PAGE. Signed-off-by: Warner Losh Reviewed-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Kyle Evans --- bsd-user/mmap.c | 53 + 1 file changed, 23 insertions(+), 30 deletions(-)

[PULL v2 07/23] bsd-user/mmap.c: Don't mmap fd == -1 independently from MAP_ANON flag

2021-10-18 Thread Warner Losh
Switch checks for !(flags & MAP_ANONYMOUS) with checks for fd != -1. MAP_STACK and MAP_GUARD both require fd == -1 and don't require mapping the fd either. Add analysis from Guy Yur detailing the different cases for MAP_GUARD and MAP_STACK. Signed-off-by: Guy Yur [ partially merged before,

[PULL v2 11/23] bsd-user/target_os-user.h: Remove support for FreeBSD older than 12.0

2021-10-18 Thread Warner Losh
Signed-off-by: Warner Losh Reviewed-by: Richard Henderson Reviewed-by: Kyle Evans --- bsd-user/freebsd/target_os_user.h | 100 +- 1 file changed, 1 insertion(+), 99 deletions(-) diff --git a/bsd-user/freebsd/target_os_user.h b/bsd-user/freebsd/target_os_user.h

[PULL v2 05/23] bsd-user/mmap.c: mmap prefer MAP_ANON for BSD

2021-10-18 Thread Warner Losh
MAP_ANON and MAP_ANONYMOUS are identical. Prefer MAP_ANON for BSD since the file is now a confusing mix of the two. Signed-off-by: Warner Losh Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Reviewed-by: Kyle Evans --- bsd-user/mmap.c | 11 +-- 1 file changed, 5

[PULL v2 02/23] bsd-user/mmap.c: check pread's return value to fix warnings with _FORTIFY_SOURCE

2021-10-18 Thread Warner Losh
From: Mikaël Urankar Simmilar to the equivalent linux-user: commit fb7e378cf9c, which added checking to pread's return value. Update to current qemu standards with {} around the if statement. Signed-off-by: Mikaël Urankar Signed-off-by: Warner Losh Reviewed-by: Richard Henderson Reviewed-by:

[PULL v2 08/23] bsd-user/mmap.c: Implement MAP_EXCL, required by jemalloc in head

2021-10-18 Thread Warner Losh
From: Kyle Evans jemalloc requires a working MAP_EXCL. Ensure that no page is double mapped when specified. In addition, use guest_range_valid_untagged to test for valid ranges of pages rather than an incomplete inlined version of the test that might be wrong. Signed-off-by: Kyle Evans

[PULL v2 01/23] bsd-user/mmap.c: Always zero MAP_ANONYMOUS memory in mmap_frag()

2021-10-18 Thread Warner Losh
From: Mikaël Urankar Similar to the equivalent linux-user commit e6deac9cf99 When mapping MAP_ANONYMOUS memory fragments, still need notice about to set it zero, or it will cause issues. Signed-off-by: Mikaël Urankar Signed-off-by: Warner Losh Reviewed-by: Richard Henderson Reviewed-by:

[PULL v2 00/23] Pull bsd user 20211018 patches

2021-10-18 Thread Warner Losh
The following changes since commit c148a0572130ff485cd2249fbdd1a3260d5e10a4: Merge remote-tracking branch 'remotes/rth/tags/pull-tcg-20211016' into staging (2021-10-16 11:16:28 -0700) are available in the Git repository at: g...@gitlab.com:bsdimp/qemu.git tags/pull-bsd-user-20211018-pull

[PULL v2 04/23] bsd-user/mmap.c: mmap return ENOMEM on overflow

2021-10-18 Thread Warner Losh
mmap should return ENOMEM on len overflow rather than EINVAL. Return EINVAL when len == 0 and ENOMEM when the rounded to a page length is 0. Found by make check-tcg. Signed-off-by: Warner Losh Reviewed-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Kyle Evans ---

[PULL v2 03/23] bsd-user/mmap.c: MAP_ symbols are defined, so no need for ifdefs

2021-10-18 Thread Warner Losh
All these MAP_ symbols are always defined on supported FreeBSD versions (12.2 and newer), so remove the #ifdefs since they aren't needed. Signed-off-by: Warner Losh Reviewed-by: Philippe Mathieu-Daudé Acked-by: Richard Henderson Reviewed-by: Kyle Evans --- bsd-user/mmap.c | 14 --

Re: [PATCH v7 16/21] target/loongarch: Add disassembler

2021-10-18 Thread Philippe Mathieu-Daudé
On 10/18/21 20:33, Richard Henderson wrote: > On 10/18/21 11:18 AM, WANG Xuerui wrote: >> On 10/19/21 01:29, Richard Henderson wrote: >>> On 10/18/21 8:38 AM, WANG Xuerui wrote: For now any implementation would suffice, and I already saw one or two bugs in the output during my TCG

Re: [PATCH v2 0/2] roms/edk2: Avoid cloning unused cmocka submodule

2021-10-18 Thread Richard Henderson
On 10/18/21 11:53 AM, Philippe Mathieu-Daudé wrote: If you don't have anything in your queue I can send a pullreq tomorrow, otherwise thanks for taking care of it. I do have a few other patches already in the queue. I'll take care of it. r~

Re: [PATCH v2 0/2] roms/edk2: Avoid cloning unused cmocka submodule

2021-10-18 Thread Philippe Mathieu-Daudé
On 10/18/21 20:10, Richard Henderson wrote: > On 10/18/21 3:58 AM, Philippe Mathieu-Daudé wrote: >> cmocka website SSL certificate expired, making CI pipelines >> fail [*]. However EDK2 images built to test QEMU don't need >> cmocka, nor oniguruma. Avoid cloning them. >> >> Note:

Re: [PULL 07/23] bsd-user/mmap.c: Don't mmap fd == -1 independently from MAP_ANON flag

2021-10-18 Thread Richard Henderson
On 10/18/21 11:47 AM, Warner Losh wrote: On Mon, Oct 18, 2021 at 12:45 PM Richard Henderson > wrote: On 10/18/21 9:04 AM, Warner Losh wrote: > diff --git a/roms/seabios-hppa b/roms/seabios-hppa > index b12acac4be..73b740f771 16 >

Re: [PULL 07/23] bsd-user/mmap.c: Don't mmap fd == -1 independently from MAP_ANON flag

2021-10-18 Thread Warner Losh
On Mon, Oct 18, 2021 at 12:45 PM Richard Henderson < richard.hender...@linaro.org> wrote: > On 10/18/21 9:04 AM, Warner Losh wrote: > > diff --git a/roms/seabios-hppa b/roms/seabios-hppa > > index b12acac4be..73b740f771 16 > > --- a/roms/seabios-hppa > > +++ b/roms/seabios-hppa > > @@ -1 +1

Re: [PULL 07/23] bsd-user/mmap.c: Don't mmap fd == -1 independently from MAP_ANON flag

2021-10-18 Thread Richard Henderson
On 10/18/21 9:04 AM, Warner Losh wrote: diff --git a/roms/seabios-hppa b/roms/seabios-hppa index b12acac4be..73b740f771 16 --- a/roms/seabios-hppa +++ b/roms/seabios-hppa @@ -1 +1 @@ -Subproject commit b12acac4be27b6d5d9fbe48c4be1286dcc245fbb +Subproject commit

Re: [PULL 00/17] MIPS patches for 2021-10-18

2021-10-18 Thread Richard Henderson
://github.com/philmd/qemu.git tags/mips-20211018 for you to fetch changes up to 2792cf20ca7eed0e354a0ed731422411faca4908: via-ide: Avoid using isa_get_irq() (2021-10-18 00:41:36 +0200) MIPS patches queue Hardware emulation: - Generate

Re: [PATCH v7 16/21] target/loongarch: Add disassembler

2021-10-18 Thread Richard Henderson
On 10/18/21 11:18 AM, WANG Xuerui wrote: On 10/19/21 01:29, Richard Henderson wrote: On 10/18/21 8:38 AM, WANG Xuerui wrote: For now any implementation would suffice, and I already saw one or two bugs in the output during my TCG host work, but it surely would be nice to switch to generated

Re: [PATCH v7 16/21] target/loongarch: Add disassembler

2021-10-18 Thread WANG Xuerui
On 10/19/21 01:29, Richard Henderson wrote: On 10/18/21 8:38 AM, WANG Xuerui wrote: For now any implementation would suffice, and I already saw one or two bugs in the output during my TCG host work, but it surely would be nice to switch to generated decoder in the future. The

Re: [PATCH v2 0/2] roms/edk2: Avoid cloning unused cmocka submodule

2021-10-18 Thread Richard Henderson
On 10/18/21 3:58 AM, Philippe Mathieu-Daudé wrote: cmocka website SSL certificate expired, making CI pipelines fail [*]. However EDK2 images built to test QEMU don't need cmocka, nor oniguruma. Avoid cloning them. Note: scripts/make-release is neither covered in MAINTAINERS nor in our

Re: [PATCH v4 00/12] virtiofsd: Allow using file handles instead of O_PATH FDs

2021-10-18 Thread Vivek Goyal
On Thu, Sep 16, 2021 at 10:40:33AM +0200, Hanna Reitz wrote: [..] > Second, I’ve renamed the TempFd objects to reflect what kind of FDs they > contain; i.e. they’re no longer called “inode_fd” or “dir_fd”, but > “path_fd”, “rw_fd”, or “dir_path_fd” instead. This change is really helpful. Makes

[PATCH] block/file-posix: Fix return value translation for AIO discards.

2021-10-18 Thread Ari Sundholm
AIO discards regressed as a result of the following commit: 0dfc7af2 block/file-posix: Optimize for macOS When trying to run blkdiscard within a Linux guest, the request would fail, with some errors in dmesg: [ snip ] [4.010070] sd 2:0:0:0: [sda] tag#0 FAILED Result:

Re: [PATCH v4 1/2] sev/i386: Introduce sev_add_kernel_loader_hashes for measured linux boot

2021-10-18 Thread Tom Lendacky
On 9/30/21 12:49 AM, Dov Murik wrote: ... +/* + * Add the hashes of the linux kernel/initrd/cmdline to an encrypted guest page + * which is included in SEV's initial memory measurement. + */ +bool sev_add_kernel_loader_hashes(SevKernelLoaderContext *ctx, Error **errp) +{ +uint8_t *data; +

Re: TCP/IP connections sometimes stop retransmitting packets (in nested virtualization case)

2021-10-18 Thread Eric Dumazet
On 10/17/21 3:50 AM, Maxim Levitsky wrote: > Hi! > > This is a follow up mail to my mail about NFS client deadlock I was trying to > debug last week: > https://lore.kernel.org/all/e10b46b04fe4427fa50901dda71fb5f5a26af33e.ca...@redhat.com/T/#u > > I strongly believe now that this is not

Re: [RFC PATCH 0/4] Replace custom test harness with "meson test"

2021-10-18 Thread Paolo Bonzini
On 18/10/21 11:51, Thomas Huth wrote: * CTRL+C will only interrupt the longest running test.  Pressing    CTRL+C repeatedly three times (which you would likely do anyway,    that's how things work) interrupts the whole run I tried this, and while hitting CTRL-C multiple times brought me back

Re: [PATCH v7 02/21] target/loongarch: Add core definition

2021-10-18 Thread Philippe Mathieu-Daudé
On 10/18/21 18:06, WANG Xuerui wrote: > Hi Song, > > On 10/18/21 20:47, Song Gao wrote: >> This patch add target state header, target definitions >> and initialization routines. > "adds"; fix in other patches too. >> >> Signed-off-by: Song Gao >> Signed-off-by: Xiaojuan Yang >> Reviewed-by:

Re: [RFC PATCH] chardev: don't exit() straight away on C-a x

2021-10-18 Thread Philippe Mathieu-Daudé
On 10/18/21 18:14, Alex Bennée wrote: > Philippe Mathieu-Daudé writes: >> On 10/18/21 16:02, Alex Bennée wrote: >>> While there are a number of uses in the code-base of the exit(0) >>> pattern it gets in the way of clean exit which can do all of it's >>> house-keeping. In particular it was

Re: [PATCH v7 16/21] target/loongarch: Add disassembler

2021-10-18 Thread Richard Henderson
On 10/18/21 8:38 AM, WANG Xuerui wrote: For now any implementation would suffice, and I already saw one or two bugs in the output during my TCG host work, but it surely would be nice to switch to generated decoder in the future. The loongarch-opcodes tables could be extended to support

Re: [RFC PATCH] chardev: don't exit() straight away on C-a x

2021-10-18 Thread Alex Bennée
Paolo Bonzini writes: > On 18/10/21 16:53, Alex Bennée wrote: >> Paolo Bonzini writes: >> >>> On 18/10/21 16:02, Alex Bennée wrote: While there are a number of uses in the code-base of the exit(0) pattern it gets in the way of clean exit which can do all of it's house-keeping.

Re: [PATCH v4 02/12] virtiofsd: Limit setxattr()'s creds-dropped region

2021-10-18 Thread Vivek Goyal
On Thu, Sep 16, 2021 at 10:40:35AM +0200, Hanna Reitz wrote: > We only need to drop/switch our credentials for the (f)setxattr() call > alone, not for the openat() or fchdir() around it. > > (Right now, this may not be that big of a problem, but with inodes being > identified by file handles

Re: a quetion about sysbus_realize_and_unref function

2021-10-18 Thread Markus Armbruster
Philippe Mathieu-Daudé writes: > Hi, > > On 10/18/21 14:01, Chan Kim wrote: >> Hi, list members, >> >> I see for example in hw/arm/virt.c, when it creates a device to attach >> to a system bus, it calls “sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), >> _fatal);” function >> >> . >> >> static

Re: [PATCH v4 01/12] virtiofsd: Keep /proc/self/mountinfo open

2021-10-18 Thread Vivek Goyal
On Thu, Sep 16, 2021 at 10:40:34AM +0200, Hanna Reitz wrote: > File handles are specific to mounts, and so name_to_handle_at() returns > the respective mount ID. However, open_by_handle_at() is not content > with an ID, it wants a file descriptor for some inode on the mount, > which we have to

Re: [PATCH v7 02/21] target/loongarch: Add core definition

2021-10-18 Thread WANG Xuerui
Hi Song, On 10/18/21 20:47, Song Gao wrote: This patch add target state header, target definitions and initialization routines. "adds"; fix in other patches too. Signed-off-by: Song Gao Signed-off-by: Xiaojuan Yang Reviewed-by: Richard Henderson --- target/loongarch/cpu-param.h | 19

Re: [RFC PATCH] chardev: don't exit() straight away on C-a x

2021-10-18 Thread Alex Bennée
Philippe Mathieu-Daudé writes: > On 10/18/21 16:02, Alex Bennée wrote: >> While there are a number of uses in the code-base of the exit(0) >> pattern it gets in the way of clean exit which can do all of it's >> house-keeping. In particular it was reported that you can crash >> plugins this way

[PULL 17/23] bsd-user/target_os_elf.h: Remove fallback ELF_HWCAP and reorder

2021-10-18 Thread Warner Losh
All architectures have a ELF_HWCAP, so remove the fallback ifdef. Place ELF_HWCAP in the same order as on native FreeBSD. Signed-off-by: Warner Losh Reviewed-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Kyle Evans --- bsd-user/freebsd/target_os_elf.h | 8 ++-- 1

  1   2   3   >