Re: [RFC PATCH v3 06/36] i386/tdx: Get tdx_capabilities via KVM_TDX_CAPABILITIES

2022-03-20 Thread Xiaoyao Li
On 3/18/2022 10:08 AM, Isaku Yamahata wrote: On Thu, Mar 17, 2022 at 09:58:43PM +0800, Xiaoyao Li wrote: diff --git a/target/i386/kvm/tdx.c b/target/i386/kvm/tdx.c index e3b94373b316..bed337e5ba18 100644 --- a/target/i386/kvm/tdx.c +++ b/target/i386/kvm/tdx.c @@ -14,10 +14,77 @@ #include "qe

[PULL 0/3] ppc queue

2022-03-20 Thread Cédric Le Goater
The following changes since commit 2058fdbe81e2985c226a026851dd26b146d3395c: Merge tag 'fixes-20220318-pull-request' of git://git.kraxel.org/qemu into staging (2022-03-19 11:28:54 +) are available in the Git repository at: https://github.com/legoater/qemu/ tags/pull-ppc-20220321 for yo

[RFC PATCH v2 0/1] Replace 'qemu_irq_split' with 'TYPE_SPLIT_IRQ'

2022-03-20 Thread Zongyuan Li
This is a WIP patch set trying to resolve https://gitlab.com/qemu-project/qemu/-/issues/811 which will totally replace 'qemu_irq_split' with use QOM object 'TYPE_SPLIT_IRQ' device. I just want to make sure I'm on the right way, so only 'realview' module is modified. Changes since v1: 1. Remov

[PULL 3/3] target/ppc: Replicate Double->Single-Precision result

2022-03-20 Thread Cédric Le Goater
From: Lucas Coutinho Power ISA v3.1 formalizes the previously undefined result in words 1 and 3 to be a copy of the result in words 0 and 2. This affects: xvcvsxdsp, xvcvuxdsp, xvcvdpsp. And the previously undefined result in word 1 to be a copy of the result in word 0. This affects: xscvdpsp.

[PULL 1/3] ppc64: Avoid pt_regs struct definition

2022-03-20 Thread Cédric Le Goater
From: Khem Raj Remove pt_regs indirection and instead reference gp_regs directly, this makes it portable across musl/glibc Use PT_* constants defined in asm/ptrace.h Move the file to ppc64 subdir and leave ppc empty Fixes ../qemu-6.2.0/linux-user/host/ppc64/../ppc/host-signal.h:16:32: error:

[RFC PATCH v2 1/1] hw/arm/realview: replace 'qemu_split_irq' with 'TYPE_SPLIT_IRQ'

2022-03-20 Thread Zongyuan Li
Signed-off-by: Zongyuan Li --- hw/arm/realview.c | 41 - 1 file changed, 32 insertions(+), 9 deletions(-) diff --git a/hw/arm/realview.c b/hw/arm/realview.c index 7b424e94a5..97ace560bf 100644 --- a/hw/arm/realview.c +++ b/hw/arm/realview.c @@ -13,9 +13,11

Re: [RFC PATCH v3 18/36] i386/tdvf: Introduce function to parse TDVF metadata

2022-03-20 Thread Xiaoyao Li
On 3/19/2022 1:19 AM, Isaku Yamahata wrote: On Thu, Mar 17, 2022 at 09:58:55PM +0800, Xiaoyao Li wrote: diff --git a/hw/i386/tdvf.c b/hw/i386/tdvf.c new file mode 100644 index ..02da1d2c12dd --- /dev/null +++ b/hw/i386/tdvf.c @@ -0,0 +1,196 @@ +/* + * SPDX-License-Identifier: GPL-2

Re: [RFC PATCH v3 33/36] i386/tdx: Only configure MSR_IA32_UCODE_REV in kvm_init_msrs() for TDs

2022-03-20 Thread Xiaoyao Li
On 3/19/2022 1:31 AM, Isaku Yamahata wrote: On Thu, Mar 17, 2022 at 09:59:10PM +0800, Xiaoyao Li wrote: For TDs, only MSR_IA32_UCODE_REV in kvm_init_msrs() can be configured by VMM, while the features enumerated/controlled by other MSRs except MSR_IA32_UCODE_REV in kvm_init_msrs() are not unde

Re: [PATCH v9 10/14] target/riscv: rvk: add support for sha512 related instructions for RV64 in zknh extension

2022-03-20 Thread Alistair Francis
On Fri, Mar 18, 2022 at 2:26 PM Weiwei Li wrote: > > - add sha512sum0, sha512sig0, sha512sum1 and sha512sig1 instructions > > Co-authored-by: Zewen Ye > Signed-off-by: Weiwei Li > Signed-off-by: Junqiang Wang > Reviewed-by: Richard Henderson Reviewed-by: Alistair Francis Alistair > --- >

[PATCH V2 1/4] intel-iommu: don't warn guest errors when getting rid2pasid entry

2022-03-20 Thread Jason Wang
We use to warn on wrong rid2pasid entry. But this error could be triggered by the guest and could happens during initialization. So let's don't warn in this case. Signed-off-by: Jason Wang --- hw/i386/intel_iommu.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/hw/i386

[PATCH V2 0/4] PASID support for Intel IOMMU

2022-03-20 Thread Jason Wang
Hi All: This series tries to introduce PASID support for Intel IOMMU. The work is based on the previous scalabe mode support by implement the ECAP_PASID. A new "x-pasid-mode" is introduced to enable this mode. All internal vIOMMU codes were extended to support PASID instead of the current RID2PASI

[PATCH V2 2/4] intel-iommu: drop VTDBus

2022-03-20 Thread Jason Wang
We introduce VTDBus structure as an intermediate step for searching the address space. This works well with SID based matching/lookup. But when we want to support SID plus PASID based address space lookup, this intermediate steps turns out to be a burden. So the patch simply drops the VTDBus struct

[PATCH V2 4/4] intel-iommu: PASID support

2022-03-20 Thread Jason Wang
This patch introduce ECAP_PASID via "x-pasid-mode". Based on the existing support for scalable mode, we need to implement the following missing parts: 1) tag VTDAddressSpace with PASID and support IOMMU/DMA translation with PASID 2) tag IOTLB with PASID 3) PASID cache and its flush 4) Fault rec

[PATCH V2 3/4] intel-iommu: convert VTD_PE_GET_FPD_ERR() to be a function

2022-03-20 Thread Jason Wang
We used to have a macro for VTD_PE_GET_FPD_ERR() but it has an internal goto which prevents it from being reused. This patch convert that macro to a dedicated function and let the caller to decide what to do (e.g using goto or not). This makes sure it can be re-used for other function that requires

Re: [EXT] Re: QEMU+KVM on RISC-V + Hypervisor Extension

2022-03-20 Thread Alistair Francis
On Thu, Mar 17, 2022 at 7:46 PM Peter Maydell wrote: > > On Wed, 16 Mar 2022 at 22:23, Alistair Francis wrote: > > Hmm... This seems like a bug. We shouldn't allow the user to specify a > > `-bios` option if using KVM. Would you mind preparing a patch to catch > > this? > > You don't want to allo

Re: [RFC PATCH v3 08/36] i386/tdx: Adjust get_supported_cpuid() for TDX VM

2022-03-20 Thread Xiaoyao Li
On 3/19/2022 12:55 AM, Isaku Yamahata wrote: On Thu, Mar 17, 2022 at 09:58:45PM +0800, Xiaoyao Li wrote: ... +void tdx_get_supported_cpuid(uint32_t function, uint32_t index, int reg, + uint32_t *ret) +{ +switch (function) { +case 1: +if (reg == R_ECX

Re: [RFC PATCH v3 05/36] i386/tdx: Implement tdx_kvm_init() to initialize TDX VM context

2022-03-20 Thread Xiaoyao Li
On 3/18/2022 10:07 AM, Isaku Yamahata wrote: On Thu, Mar 17, 2022 at 09:58:42PM +0800, Xiaoyao Li wrote: Introduce tdx_kvm_init() and invoke it in kvm_confidential_guest_init() if it's a TDX VM. More initialization will be added later. Signed-off-by: Xiaoyao Li --- target/i386/kvm/kvm.c

[PATCH 2/5] kvm: Dynamically adjust the rate of dirty ring reaper thread

2022-03-20 Thread Chongyun Wu
Dynamically adjust the dirty ring collection thread to reduce the occurrence of ring full, thereby reducing the impact on customers, improving the efficiency of dirty page collection, and thus improving the migration efficiency. Implementation: 1) Define different collection speeds for the reap t

[PATCH 4/5] kvm: Introduce a dirty rate calculation method based on dirty ring

2022-03-20 Thread Chongyun Wu
A new structure KVMDirtyRingDirtyCounter is introduced in KVMDirtyRingReaper to record the number of dirty pages within a period of time. When kvm_dirty_ring_mark_page collects dirty pages, if it finds that the current dirty pages are not duplicates, it increases the dirty_pages_period count. Di

[PATCH 3/5] kvm: Dirty ring autoconverge optmization for kvm_cpu_synchronize_kick_all

2022-03-20 Thread Chongyun Wu
Dirty ring feature need call kvm_cpu_synchronize_kick_all to flush hardware buffers into KVMslots, but when aucoverge run kvm_cpu_synchronize_kick_all calling will become more and more time consuming. This will significantly reduce the efficiency of dirty page queries, especially when memory press

[PATCH 1/5] kvm, memory: Optimize dirty page collection for dirty ring

2022-03-20 Thread Chongyun Wu
When log_sync_global of dirty ring is called, it will collect dirty pages on all cpus, including all dirty pages on memslot, so when memory_region_sync_dirty_bitmap collects dirty pages from KVM, this interface needs to be called once, instead of traversing every dirty page. Each memslot is called

[PATCH 0/5] KVM: Dirty ring and auto converge optimization

2022-03-20 Thread Chongyun Wu
Overview This series of patches is to optimize the performance of online migration using dirty ring and autoconverge. Mainly through the following aspects to do optimization: 1. When using the dirty ring mode to traverse each memslot to obtain dirty pages, only call log_sync_global o

[PATCH 5/5] migration: Calculate the appropriate throttle for autoconverge

2022-03-20 Thread Chongyun Wu
The current autoconverge algorithm does not obtain the threshold that currently requires the CPU to limit the speed through calculation, but limits the speed of the CPU through continuous attempts. Start from an initial value to limit the speed. If the migration can not be completed for two consec

[PATCH v3 1/2] ui/cocoa: Move create_initial_menus

2022-03-20 Thread Akihiko Odaki
The following change would make it use add_console_menu_entries and addRemovableDevicesMenuItems so it should come after them. Signed-off-by: Akihiko Odaki --- ui/cocoa.m | 178 ++--- 1 file changed, 89 insertions(+), 89 deletions(-) diff --git a/

[PATCH v3 2/2] ui/cocoa: Create menus in iothread

2022-03-20 Thread Akihiko Odaki
Commit 0439c5a4623d674efa0c72abd62ca6e98bb7cf87 introduced an assertion that blk_all_next is called in the main thread. The function is called in the following chain: - blk_all_next - qmp_query_block - addRemovableDevicesMenuItems - main This change moves the menu creation to the iothread. This al

[PATCH v3 0/2] Create menus in iothread

2022-03-20 Thread Akihiko Odaki
Commit 0439c5a4623d674efa0c72abd62ca6e98bb7cf87 introduced an assertion that blk_all_next is called in the main thread. The function is called in the following chain: - blk_all_next - qmp_query_block - addRemovableDevicesMenuItems - main This change moves the menu creation to the iothread. This al

Re: [PATCH for-7.1 0/9] spapr: add drc->index, remove spapr_drc_index()

2022-03-20 Thread David Gibson
On Fri, Mar 18, 2022 at 02:33:11PM -0300, Daniel Henrique Barboza wrote: > Hi, > > I decided to make this change after realizing that (1) spapr_drc_index() > always return the same index value for the DRC regardless of machine or > device state and (2) we call spapr_drc_index() a lot throughout th

Re: [PATCH 4/4] net/colo.c: fix segmentation fault when packet is not parsed correctly

2022-03-20 Thread lizhij...@fujitsu.com
On 09/03/2022 16:38, Zhang Chen wrote: > When COLO use only one vnet_hdr_support parameter between > filter-redirector and filter-mirror(or colo-compare), COLO will crash > with segmentation fault. Back track as follow: > > Thread 1 "qemu-system-x86" received signal SIGSEGV, Segmentation fault. >

Re: [PATCH 3/4] net/colo.c: No need to track conn_list for filter-rewriter

2022-03-20 Thread lizhij...@fujitsu.com
On 09/03/2022 16:38, Zhang Chen wrote: > Filter-rewriter no need to track connection in conn_list. > This patch fix the glib g_queue_is_empty assertion when COLO guest > keep a lot of network connection. > > Signed-off-by: Zhang Chen LGTM. Reviewed-by: Li Zhijian > --- > net/colo.c | 2 +-

Re:Re:Re:Re: qemu not support serial crtscts

2022-03-20 Thread 付小明
Hi , all Do we Slove it? Dear Darryl Dixon, I see you find a bug like it in 2004 .This ii the link https://lists.nongnu.org/archive/html/qemu-devel/2004-08/msg00272.html Do you know make qemu support hardware flow control? 在 2022-03-17 14:13:45,"付小明" 写道: Could you provide

Re: [PATCH 2/4] net/colo: Fix a "double free" crash to clear the conn_list

2022-03-20 Thread lizhij...@fujitsu.com
On 09/03/2022 16:38, Zhang Chen wrote: > We notice the QEMU may crash when the guest has too many > incoming network connections with the following log: > > 15197@1593578622.668573:colo_proxy_main : colo proxy connection hashtable > full, clear it > free(): invalid pointer > [1]15195 abort (

Re: [PATCH] i386/cpu: Remove the deprecated cpu model 'Icelake-Client'

2022-03-20 Thread Robert Hoo
Hi Igor, Ping... Thanks. On Mon, 2022-03-14 at 16:50 +0800, Robert Hoo wrote: > Icelake, is the codename for Intel 3rd generation Xeon Scalable > server > processors. There isn't ever client variants. This "Icelake-Client" > CPU > model was added wrongly and imaginarily. > > It has been deprecat

Re: [PATCH v22 0/7] Add vmnet.framework based network backend

2022-03-20 Thread Jason Wang
On Fri, Mar 18, 2022 at 5:30 PM Akihiko Odaki wrote: > > Reviewed-by: Akihiko Odaki > Tested-by: Akihiko Odaki > > Thank you for this great work! We miss 7.0 so I will queue this for 7.1 Thanks everyone! > > On 2022/03/18 2:28, Vladislav Yaroshchuk wrote: > > macOS provides networking API for

Re: [PATCH v2 1/3] hw/arm/virt: Fix CPU's default NUMA node ID

2022-03-20 Thread wangyanan (Y)
On 2022/3/18 21:27, Igor Mammedov wrote: On Fri, 18 Mar 2022 21:00:35 +0800 "wangyanan (Y)" wrote: On 2022/3/18 17:56, Igor Mammedov wrote: On Fri, 18 Mar 2022 14:23:34 +0800 "wangyanan (Y)" wrote: Hi Gavin, On 2022/3/3 11:11, Gavin Shan wrote: The default CPU-to-NUMA association is gi

Re: [PATCH qemu] target/riscv: rvv: Add missing early exit condition for whole register load/store

2022-03-20 Thread Alistair Francis
On Sat, Mar 19, 2022 at 6:59 AM ~eopxd wrote: > > From: Yueh-Ting (eop) Chen > > According to v-spec (section 7.9): > The instructions operate with an effective vector length, > evl=NFIELDS*VLEN/EEW, > regardless of current settings in vtype and vl. The usual property that no > elements are writ

Re: [PATCH qemu] target/riscv: rvv: Add missing early exit condition for whole register load/store

2022-03-20 Thread Alistair Francis
On Sat, Mar 19, 2022 at 6:59 AM ~eopxd wrote: > > From: Yueh-Ting (eop) Chen > > According to v-spec (section 7.9): > The instructions operate with an effective vector length, > evl=NFIELDS*VLEN/EEW, > regardless of current settings in vtype and vl. The usual property that no > elements are writ

Re: propagating vmgenid outward and upward

2022-03-20 Thread Michael S. Tsirkin
On Thu, Mar 10, 2022 at 12:18:04PM +0100, Alexander Graf wrote: > I agree on the slightly racy compromise Thought hard about this, I think I agree, and I guess as a minimum we can start with at least the ACPI+RNG patch, right? That will already address wireguard ... -- MST

Re: [PATCH for-7.0] linux-user: Fix syscall parameter handling for MIPS n32

2022-03-20 Thread Laurent Vivier
Le 20/03/2022 à 06:22, WANG Xuerui a écrit : The MIPS n32 ABI is basically n64 with the address space (i.e. pointer width) shrinked to 32 bits. Meanwhile the current code treats it as o32-like based on TARGET_ABI_BITS, which causes problems with n32 syscalls utilizing 64-bit offsets, like pread64

Re: [PATCH for-7.0] linux-user: Fix syscall parameter handling for MIPS n32

2022-03-20 Thread Philippe Mathieu-Daudé
On 20/3/22 06:22, WANG Xuerui wrote: The MIPS n32 ABI is basically n64 with the address space (i.e. pointer width) shrinked to 32 bits. Meanwhile the current code treats it as o32-like based on TARGET_ABI_BITS, which causes problems with n32 syscalls utilizing 64-bit offsets, like pread64, affect

Account creation on QEMU Wiki

2022-03-20 Thread Ben Westover
Hello, I'd like to create an account on the QEMU Wiki, but as it says on the main page, account creation is currently disabled to reduce spam. It says to ask someone with an existing account to create one for me, but I don't know anyone who has one, so I'm asking here. Thanks, -- Ben Westover

Re: [PULL for-7.1 30/36] util/log: Rename qemu_logfile to global_file

2022-03-20 Thread Philippe Mathieu-Daudé
On 20/3/22 18:11, Richard Henderson wrote: Rename to emphasize this is the file-scope global variable. Signed-off-by: Richard Henderson --- util/log.c | 16 1 file changed, 8 insertions(+), 8 deletions(-) Reviewed-by: Philippe Mathieu-Daudé

Re: [PULL for-7.1 29/36] util/log: Rename logfilename to global_filename

2022-03-20 Thread Philippe Mathieu-Daudé
On 20/3/22 18:11, Richard Henderson wrote: Rename to emphasize this is the file-scope global variable. Signed-off-by: Richard Henderson --- util/log.c | 13 ++--- 1 file changed, 6 insertions(+), 7 deletions(-) Reviewed-by: Philippe Mathieu-Daudé

Re: [PULL for-7.1 32/36] util/log: Hoist the eval of is_daemonized in qemu_set_log_internal

2022-03-20 Thread Philippe Mathieu-Daudé
On 20/3/22 18:11, Richard Henderson wrote: Only call is_daemonized once. We require the result on all paths after this point. Signed-off-by: Richard Henderson --- util/log.c | 8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) Reviewed-by: Philippe Mathieu-Daudé

Re: [PULL for-7.1 34/36] util/log: Rename QemuLogFile to RCUCloseFILE

2022-03-20 Thread Philippe Mathieu-Daudé
On 20/3/22 18:11, Richard Henderson wrote: s/QemuLogFile/RCUCloseFILE/ s/qemu_logfile_free/rcu_close_file/ Emphasize that this is only a carrier for passing a pointer to call_rcu for closing, and not the real logfile. Signed-off-by: Richard Henderson --- util/log.c | 28 +

[PATCH] io: Limit readv/writev to IOV_MAX

2022-03-20 Thread Andrew Deason
The unit tests 'test-io-channel-file' and 'test-io-channel-socket' currently fail on Solaris, because we try to perform vectored I/O with a batch of 250 (CHUNK_COUNT) iovs. This exceeds MAX_IOV on Solaris (only 16, much lower than Linux's 1024), and so results in an EINVAL for file operations, and

Re: [PULL for-7.1 16/36] util/log: Remove qemu_log_flush

2022-03-20 Thread Philippe Mathieu-Daudé
On 20/3/22 18:11, Richard Henderson wrote: All uses flush output immediately before or after qemu_log_unlock. Instead of a separate call, move the flush into qemu_log_unlock. Signed-off-by: Richard Henderson --- include/qemu/log.h| 2 -- accel/tcg/translate-all.c | 1 - cpu.c

Re: [PULL for-7.1 14/36] target/nios2: Remove log_cpu_state from reset

2022-03-20 Thread Philippe Mathieu-Daudé
On 20/3/22 18:11, Richard Henderson wrote: This is redundant with the logging done in cpu_common_reset. Signed-off-by: Richard Henderson --- target/nios2/cpu.c | 5 - 1 file changed, 5 deletions(-) Reviewed-by: Philippe Mathieu-Daudé

Re: [PULL for-7.1 04/36] os-posix: Use qemu_log_enabled

2022-03-20 Thread Philippe Mathieu-Daudé
On 20/3/22 18:11, Richard Henderson wrote: Do not reference qemu_logfile directly; use the predicate provided by qemu/log.h. Signed-off-by: Richard Henderson --- os-posix.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Reviewed-by: Philippe Mathieu-Daudé

Re: [PULL for-7.1 05/36] util/log: Move qemu_log_lock, qemu_log_unlock out of line

2022-03-20 Thread Philippe Mathieu-Daudé
On 20/3/22 18:11, Richard Henderson wrote: Signed-off-by: Richard Henderson --- include/qemu/log.h | 28 +++- util/log.c | 23 +++ 2 files changed, 26 insertions(+), 25 deletions(-) Reviewed-by: Philippe Mathieu-Daudé

Re: [PULL for-7.1 03/36] util/log: Pass Error pointer to qemu_set_log

2022-03-20 Thread Philippe Mathieu-Daudé
On 20/3/22 18:11, Richard Henderson wrote: Do not force exit within qemu_set_log. Pass an Error value back up the stack as per usual. "Pass an Error value back up the stack [and return a boolean value] as per usual.", see: https://lore.kernel.org/qemu-devel/87bky6ugmx@pond.sub.org/ Sign

Re: [PATCH v2 0/2] Create menus in iothread

2022-03-20 Thread Philippe Mathieu-Daudé
On 7/3/22 14:49, Akihiko Odaki wrote: ui/cocoa: Create menus in iothread Commit 0439c5a4623d674efa0c72abd62ca6e98bb7cf87 introduced an assertion that blk_all_next is called in the main thread. The function is called in the following chain: - blk_all_next - qmp_query_block - addRemovableDevicesMe

[PATCH 2/3] qga/commands-posix: Fix iface hw address detection

2022-03-20 Thread Andrew Deason
Since its introduction in commit 3424fc9f16a1 ("qemu-ga: add guest-network-get-interfaces command"), guest-network-get-interfaces seems to check if a given interface has a hardware address by checking 'ifa->ifa_flags & SIOCGIFHWADDR'. But ifa_flags is a field for IFF_* flags (IFF_UP, IFF_LOOPBACK,

[PATCH 1/3] qga/commands-posix: Use getifaddrs when available

2022-03-20 Thread Andrew Deason
Currently, commands-posix.c assumes that getifaddrs() is only available on Linux, and so the related guest agent command guest-network-get-interfaces is only implemented for #ifdef __linux__. This function does exist on other platforms, though, such as Solaris. So, add a meson check for getifaddrs(

[PATCH 0/3] qga: Implement guest-network-get-interfaces for Solaris

2022-03-20 Thread Andrew Deason
This implements the guest agent guest-network-get-interfaces command on Solaris. Solaris provides a getifaddrs() that's very similar to the Linux one, so the implementation is mostly the same. Andrew Deason (3): qga/commands-posix: Use getifaddrs when available qga/commands-posix: Fix iface hw

[PATCH 3/3] qga/commands-posix: Fix listing ifaces for Solaris

2022-03-20 Thread Andrew Deason
The code for guest-network-get-interfaces needs a couple of small adjustments for Solaris: - The results from SIOCGIFHWADDR are documented as being in ifr_addr, not ifr_hwaddr (ifr_hwaddr doesn't exist on Solaris). - The implementation of guest_get_network_stats is Linux-specific, so hide it

[PATCH v2] target/i386: kvm: do not access uninitialized variable on older kernels

2022-03-20 Thread Paolo Bonzini
KVM support for AMX includes a new system attribute, KVM_X86_XCOMP_GUEST_SUPP. Commit 19db68ca68 ("x86: Grant AMX permission for guest", 2022-03-15) however did not fully consider the behavior on older kernels. First, it warns too aggressively. Second, it invokes the KVM_GET_DEVICE_ATTR ioctl unc

Re: [PATCH] linux-user: Clean up arg_start/arg_end confusion

2022-03-20 Thread Richard Henderson
On 3/18/22 04:41, Peter Maydell wrote: On Tue, 15 Mar 2022 at 22:47, Richard Henderson wrote: We had two sets of variables: arg_start/arg_end, and arg_strings/env_strings. In linuxload.c, we set the first pair to the bounds of the argv strings, but in elfload.c, we set the first pair to the b

Re: [PATCH 2/2] fix lock cmpxchg instruction

2022-03-20 Thread Richard Henderson
On 3/19/22 09:06, Wei Li wrote: For lock cmpxchg, the situation is more complex. After the instruction is completed by tcg_gen_atomic_cmpxchg_tl, it needs a branch to judge if oldv == cmpv or not. The instruction only touches accumulator when oldv != cmpv. Signed-off-by: Wei Li --- target/i38

Re: [PATCH 1/2] fix cmpxchg instruction

2022-03-20 Thread Richard Henderson
On 3/19/22 09:06, Wei Li wrote: We need a branch to determine when the instruction can touch the accumulator. But there is a branch provided by movcond. There is no branch in movcond -- this expands to cmov. -/* store value = (old == cmp ? new : old); */ -tcg_

Re: [PATCH for-7.0] linux-user: Fix syscall parameter handling for MIPS n32

2022-03-20 Thread Richard Henderson
On 3/19/22 22:22, WANG Xuerui wrote: The MIPS n32 ABI is basically n64 with the address space (i.e. pointer width) shrinked to 32 bits. Meanwhile the current code treats it as o32-like based on TARGET_ABI_BITS, which causes problems with n32 syscalls utilizing 64-bit offsets, like pread64, affect

[PULL for-7.1 33/36] util/log: Combine two logfile closes

2022-03-20 Thread Richard Henderson
Merge the close from the changed_name block with the close from the !need_to_open_file block. Signed-off-by: Richard Henderson --- util/log.c | 11 +++ 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/util/log.c b/util/log.c index f1f6d09c90..596de0050f 100644 --- a/util/log

[PULL for-7.1 29/36] util/log: Rename logfilename to global_filename

2022-03-20 Thread Richard Henderson
Rename to emphasize this is the file-scope global variable. Signed-off-by: Richard Henderson --- util/log.c | 13 ++--- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/util/log.c b/util/log.c index 691d6d7930..e559d37369 100644 --- a/util/log.c +++ b/util/log.c @@ -34,7 +34

[PULL for-7.1 27/36] softmmu: Use qemu_set_log_filename_flags

2022-03-20 Thread Richard Henderson
Perform all logfile setup at startup in one step. Signed-off-by: Richard Henderson --- softmmu/vl.c | 21 + 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/softmmu/vl.c b/softmmu/vl.c index 73296015af..81c91ec7b0 100644 --- a/softmmu/vl.c +++ b/softmmu/vl.c @@

Re: [PULL for-7.1 00/36] Logging cleanup and per-thread logfiles

2022-03-20 Thread Richard Henderson
On 3/20/22 10:10, Richard Henderson wrote: Most of the changes here reduce the amount of locking involved in logging, due to repeated qemu_log calls, each of which takes and releases the rcu_read_lock. This makes more use of qemu_log_lock/unlock around code blocks, which both keeps the output to

[PULL for-7.1 22/36] include/qemu/log: Move entire implementation out-of-line

2022-03-20 Thread Richard Henderson
Move QemuLogFile, qemu_logfile, and all inline functions into qemu/log.c. No need to expose these implementation details in the api. Signed-off-by: Richard Henderson --- include/qemu/log.h| 38 -- tests/unit/test-logging.c | 1 + util/log.c

[PULL for-7.1 36/36] util/log: Support per-thread log files

2022-03-20 Thread Richard Henderson
Add a new log flag, tid, to turn this feature on. Require the log filename to be set, and to contain %d. Do not allow tid to be turned off once it is on, nor let the filename be change thereafter. This avoids the need for signalling each thread to re-open on a name change. Signed-off-by: Richard

[PULL for-7.1 34/36] util/log: Rename QemuLogFile to RCUCloseFILE

2022-03-20 Thread Richard Henderson
s/QemuLogFile/RCUCloseFILE/ s/qemu_logfile_free/rcu_close_file/ Emphasize that this is only a carrier for passing a pointer to call_rcu for closing, and not the real logfile. Signed-off-by: Richard Henderson --- util/log.c | 28 +--- 1 file changed, 13 insertions(+), 15

[PULL for-7.1 21/36] include/exec/log: Do not reference QemuLogFile directly

2022-03-20 Thread Richard Henderson
Use qemu_log_lock/unlock instead of the raw rcu_read. Signed-off-by: Richard Henderson --- include/exec/log.h | 13 - 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/include/exec/log.h b/include/exec/log.h index ad0a40cfeb..10d0e809d4 100644 --- a/include/exec/log.h +++

[PULL for-7.1 32/36] util/log: Hoist the eval of is_daemonized in qemu_set_log_internal

2022-03-20 Thread Richard Henderson
Only call is_daemonized once. We require the result on all paths after this point. Signed-off-by: Richard Henderson --- util/log.c | 8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/util/log.c b/util/log.c index 42b13e6bf1..f1f6d09c90 100644 --- a/util/log.c +++ b/util/l

[PULL for-7.1 31/36] util/log: Rename qemu_logfile_mutex to global_mutex

2022-03-20 Thread Richard Henderson
Rename to emphasize this covers the file-scope global variables. Signed-off-by: Richard Henderson --- util/log.c | 10 ++ 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/util/log.c b/util/log.c index 0676ce5bd6..42b13e6bf1 100644 --- a/util/log.c +++ b/util/log.c @@ -34,9 +

[PULL for-7.1 30/36] util/log: Rename qemu_logfile to global_file

2022-03-20 Thread Richard Henderson
Rename to emphasize this is the file-scope global variable. Signed-off-by: Richard Henderson --- util/log.c | 16 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/util/log.c b/util/log.c index e559d37369..0676ce5bd6 100644 --- a/util/log.c +++ b/util/log.c @@ -36,7

[PULL for-7.1 25/36] bsd-user: Use qemu_set_log_filename_flags

2022-03-20 Thread Richard Henderson
Perform all logfile setup in one step. Signed-off-by: Richard Henderson --- bsd-user/main.c | 18 +- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/bsd-user/main.c b/bsd-user/main.c index d25d1c6015..2c8f8d1c19 100644 --- a/bsd-user/main.c +++ b/bsd-user/main.c @@

[PULL for-7.1 17/36] util/log: Drop call to setvbuf

2022-03-20 Thread Richard Henderson
Now that the log buffer is flushed after every qemu_log_unlock, which includes every call to qemu_log, we do not need to force line buffering (or unbuffering for windows). Block buffer the entire loggable unit. Signed-off-by: Richard Henderson --- util/log.c | 6 -- 1 file changed, 6 deleti

[PULL for-7.1 35/36] util/log: Limit RCUCloseFILE to file closing

2022-03-20 Thread Richard Henderson
Use FILE* for global_file. We can perform an rcu_read on that just as easily as RCUCloseFILE*. This simplifies a couple of places, where previously we required taking the rcu_read_lock simply to avoid racing to dereference RCUCloseFile->fd. Only allocate the RCUCloseFile prior to call_rcu. Sign

[PULL for-7.1 26/36] linux-user: Use qemu_set_log_filename_flags

2022-03-20 Thread Richard Henderson
Perform all logfile setup in one step. Signed-off-by: Richard Henderson --- linux-user/main.c | 11 +-- 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/linux-user/main.c b/linux-user/main.c index 2bdee78019..75d13eff97 100644 --- a/linux-user/main.c +++ b/linux-user/main.c

[PULL for-7.1 11/36] exec/translator: Pass the locked filepointer to disas_log hook

2022-03-20 Thread Richard Henderson
We have fetched and locked the logfile in translator_loop. Pass the filepointer down to the disas_log hook so that it need not be fetched and locked again. Signed-off-by: Richard Henderson --- include/exec/translator.h | 2 +- accel/tcg/translator.c| 2 +- target/alpha/translate.c

[PULL for-7.1 28/36] util/log: Remove qemu_log_close

2022-03-20 Thread Richard Henderson
The only real use is in cpu_abort, where we have just flushed the file via qemu_log_unlock, and are just about to force-crash the application via abort. We do not really need to close the FILE before the abort. The two uses in test-logging.c can be handled with qemu_set_log_filename_flags. Signe

[PULL for-7.1 23/36] sysemu/os-win32: Test for and use _lock_file/_unlock_file

2022-03-20 Thread Richard Henderson
The bug referenced in os-win32.h was fixed in mingw-w64 v6. According to repology, version 5 used by ubuntu 18, which is not yet out of support, so provide a meson link test for it. Signed-off-by: Richard Henderson --- meson.build | 12 include/sysemu/os-win32.h | 16

[PULL for-7.1 19/36] linux-user: Expand log_page_dump inline

2022-03-20 Thread Richard Henderson
We have extra stuff to log at the same time. Hoist the qemu_log_lock/unlock to the caller and use fprintf. Signed-off-by: Richard Henderson --- include/exec/log.h | 15 --- linux-user/main.c | 43 +-- linux-user/mmap.c | 7 ++- 3 files c

[PULL for-7.1 12/36] exec/log: Remove log_disas and log_target_disas

2022-03-20 Thread Richard Henderson
These functions are no longer used. Signed-off-by: Richard Henderson --- include/exec/log.h | 24 1 file changed, 24 deletions(-) diff --git a/include/exec/log.h b/include/exec/log.h index 6a53199d44..d131a3140d 100644 --- a/include/exec/log.h +++ b/include/exec/log.h @

[PULL for-7.1 24/36] util/log: Introduce qemu_set_log_filename_flags

2022-03-20 Thread Richard Henderson
Provide a function to set both filename and flags at the same time. This is the common case at startup. Signed-off-by: Richard Henderson --- include/qemu/log.h | 1 + util/log.c | 122 - 2 files changed, 77 insertions(+), 46 deletions(-) di

[PULL for-7.1 20/36] tests/unit: Do not reference QemuLogFile directly

2022-03-20 Thread Richard Henderson
Use qemu_log_lock/unlock instead of the raw rcu_read. Signed-off-by: Richard Henderson --- tests/unit/test-logging.c | 33 +++-- 1 file changed, 15 insertions(+), 18 deletions(-) diff --git a/tests/unit/test-logging.c b/tests/unit/test-logging.c index 93c6d666e8..fc2

[PULL for-7.1 08/36] *: Use fprintf between qemu_log_lock/unlock

2022-03-20 Thread Richard Henderson
Inside qemu_log, we perform qemu_log_lock/unlock, which need not be done if we have already performed the lock beforehand. Always check the result of qemu_log_lock -- only checking qemu_loglevel_mask races with the acquisition of the lock on the logfile. Signed-off-by: Richard Henderson --- inc

[PULL for-7.1 10/36] tcg: Pass the locked filepointer to tcg_dump_ops

2022-03-20 Thread Richard Henderson
We have already looked up and locked the filepointer. Use fprintf instead of qemu_log directly for output in and around tcg_dump_ops. Signed-off-by: Richard Henderson --- tcg/tcg.c | 109 ++ 1 file changed, 52 insertions(+), 57 deletions(-) di

[PULL for-7.1 14/36] target/nios2: Remove log_cpu_state from reset

2022-03-20 Thread Richard Henderson
This is redundant with the logging done in cpu_common_reset. Signed-off-by: Richard Henderson --- target/nios2/cpu.c | 5 - 1 file changed, 5 deletions(-) diff --git a/target/nios2/cpu.c b/target/nios2/cpu.c index 6975ae4bdb..b0877cb39e 100644 --- a/target/nios2/cpu.c +++ b/target/nios2/cpu

[PULL for-7.1 18/36] bsd-user: Expand log_page_dump inline

2022-03-20 Thread Richard Henderson
We have extra stuff to log at the same time. Hoist the qemu_log_lock/unlock to the caller and use fprintf. Signed-off-by: Richard Henderson --- bsd-user/main.c | 25 +++-- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/bsd-user/main.c b/bsd-user/main.c index

[PULL for-7.1 15/36] util/log: Use qemu_log_lock/unlock in qemu_log

2022-03-20 Thread Richard Henderson
Avoid using QemuLogFile and RCU directly. Signed-off-by: Richard Henderson --- util/log.c | 11 +-- 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/util/log.c b/util/log.c index b1651d8122..3ec6e90575 100644 --- a/util/log.c +++ b/util/log.c @@ -62,23 +62,22 @@ void qemu_lo

[PULL for-7.1 06/36] util/log: Treat qemu_log_lock like trylock

2022-03-20 Thread Richard Henderson
Do not require qemu_log_unlock to be called when qemu_log_lock returns NULL. Signed-off-by: Richard Henderson --- util/log.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/util/log.c b/util/log.c index 248db6211e..b1651d8122 100644 --- a/util/log.c +++ b/util/log.c @@ -39

[PULL for-7.1 09/36] util/log: Remove qemu_log_vprintf

2022-03-20 Thread Richard Henderson
This function is no longer used. Signed-off-by: Richard Henderson --- include/qemu/log.h | 15 --- 1 file changed, 15 deletions(-) diff --git a/include/qemu/log.h b/include/qemu/log.h index 10e284291c..6e45b31253 100644 --- a/include/qemu/log.h +++ b/include/qemu/log.h @@ -72,21 +72

[PULL for-7.1 07/36] hw/xen: Split out xen_pv_output_msg

2022-03-20 Thread Richard Henderson
Do not replicate the individual logging statements. Use qemu_log_lock/unlock instead of qemu_log directly. Signed-off-by: Richard Henderson --- hw/xen/xen_pvdev.c | 44 1 file changed, 24 insertions(+), 20 deletions(-) diff --git a/hw/xen/xen_pvdev.c

[PULL for-7.1 05/36] util/log: Move qemu_log_lock, qemu_log_unlock out of line

2022-03-20 Thread Richard Henderson
Signed-off-by: Richard Henderson --- include/qemu/log.h | 28 +++- util/log.c | 23 +++ 2 files changed, 26 insertions(+), 25 deletions(-) diff --git a/include/qemu/log.h b/include/qemu/log.h index 64f28785ae..10e284291c 100644 --- a/include/qe

[PULL for-7.1 16/36] util/log: Remove qemu_log_flush

2022-03-20 Thread Richard Henderson
All uses flush output immediately before or after qemu_log_unlock. Instead of a separate call, move the flush into qemu_log_unlock. Signed-off-by: Richard Henderson --- include/qemu/log.h| 2 -- accel/tcg/translate-all.c | 1 - cpu.c | 1 - hw/net/can/can_sja1000.c

[PULL for-7.1 03/36] util/log: Pass Error pointer to qemu_set_log

2022-03-20 Thread Richard Henderson
Do not force exit within qemu_set_log. Pass an Error value back up the stack as per usual. Signed-off-by: Richard Henderson --- include/qemu/log.h | 2 +- bsd-user/main.c | 2 +- linux-user/main.c| 2 +- monitor/misc.c

[PULL for-7.1 04/36] os-posix: Use qemu_log_enabled

2022-03-20 Thread Richard Henderson
Do not reference qemu_logfile directly; use the predicate provided by qemu/log.h. Signed-off-by: Richard Henderson --- os-posix.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/os-posix.c b/os-posix.c index 24692c8593..20d31fc518 100644 --- a/os-posix.c +++ b/os-posix.c @@ -

[PULL for-7.1 13/36] accel/tcg: Use cpu_dump_state between qemu_log_lock/unlock

2022-03-20 Thread Richard Henderson
Inside log_cpu_state, we perform qemu_log_lock/unlock, which need not be done if we have already performed the lock beforehand. Signed-off-by: Richard Henderson --- accel/tcg/cpu-exec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.

[PULL for-7.1 01/36] util/log: Drop manual log buffering

2022-03-20 Thread Richard Henderson
This buffering was introduced during the Paleozoic: 9fa3e853531. There has never been an explanation as to why we may not allow glibc to allocate the file buffer itself. We certainly have many other uses of mmap and malloc during user-only startup, so presumably whatever the issue was, it has bee

[PULL for-7.1 02/36] target/hexagon: Remove qemu_set_log in hexagon_translate_init

2022-03-20 Thread Richard Henderson
This code appears to be trying to make sure there is a logfile. But that's already true -- the logfile will either be set by -D, or will be stderr. In either case, not appropriate here. Cc: Taylor Simpson Signed-off-by: Richard Henderson --- target/hexagon/translate.c | 6 -- 1 file change

[PULL for-7.1 00/36] Logging cleanup and per-thread logfiles

2022-03-20 Thread Richard Henderson
Most of the changes here reduce the amount of locking involved in logging, due to repeated qemu_log calls, each of which takes and releases the rcu_read_lock. This makes more use of qemu_log_lock/unlock around code blocks, which both keeps the output together in the face of threads and also plays

[PATCH 7/7] tests/tcg/nios2: Re-enable linux-user tests

2022-03-20 Thread Richard Henderson
Now that signal handling has been fixed, re-enable tests. Signed-off-by: Richard Henderson --- tests/tcg/nios2/Makefile.target | 11 --- 1 file changed, 11 deletions(-) delete mode 100644 tests/tcg/nios2/Makefile.target diff --git a/tests/tcg/nios2/Makefile.target b/tests/tcg/nios2/Mak

[PATCH 1/7] linux-user/nios2: Fix clone child return

2022-03-20 Thread Richard Henderson
The child side of clone needs to set the secondary syscall return value, r7, to indicate syscall success. Advance the pc before do_syscall, so that the new thread does not re-execute the clone syscall. Signed-off-by: Richard Henderson --- linux-user/nios2/target_cpu.h | 1 + linux-user/nios2/cp

  1   2   >