[PATCH 14/14] migration/multifd: Forbid spurious wakeups

2024-01-31 Thread peterx
From: Peter Xu Now multifd's logic is designed to have no spurious wakeup. I still remember a talk to Juan and he seems to agree we should drop it now, and if my memory was right it was there because multifd used to hit that when still debugging. Let's drop it and see what can explode; as long

[PATCH 12/14] migration/multifd: multifd_send_prepare_header()

2024-01-31 Thread peterx
From: Peter Xu Introduce a helper multifd_send_prepare_header() to setup the header packet for multifd sender. It's fine to setup the IOV[0] _before_ send_prepare() because the packet buffer is already ready, even if the content is to be filled in. With this helper, we can already slightly

[PATCH 08/14] migration/multifd: Drop pages->num check in sender thread

2024-01-31 Thread peterx
From: Peter Xu Now with a split SYNC handler, we always have pages->num set for pending_job==true. Assert it instead. Signed-off-by: Peter Xu --- migration/multifd.c | 13 +++-- 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/migration/multifd.c b/migration/multifd.c

[PATCH 01/14] migration/multifd: Drop stale comment for multifd zero copy

2024-01-31 Thread peterx
From: Peter Xu We've already done that with multifd_flush_after_each_section, for multifd in general. Drop the stale "TODO-like" comment. Reviewed-by: Fabiano Rosas Signed-off-by: Peter Xu --- migration/multifd.c | 11 --- 1 file changed, 11 deletions(-) diff --git

[PATCH 03/14] migration/multifd: Drop MultiFDSendParams.quit, cleanup error paths

2024-01-31 Thread peterx
From: Peter Xu Multifd send side has two fields to indicate error quits: - MultiFDSendParams.quit - _send_state->exiting Merge them into the global one. The replacement is done by changing all p->quit checks into the global var check. The global check doesn't need any lock. A few more

[PATCH 00/14] migration/multifd: Refactor ->send_prepare() and cleanups

2024-01-31 Thread peterx
From: Peter Xu This patchset contains quite a few refactorings to current multifd: - It picked up some patches from an old series of mine [0] (the last patches were dropped, though; I did the cleanup slightly differently): I still managed to include one patch to split pending_job,

Re: [PATCH v8 00/21] Introduce smp.modules for x86 in QEMU

2024-01-31 Thread Daniel P . Berrangé
On Wed, Jan 31, 2024 at 06:13:29PM +0800, Zhao Liu wrote: > From: Zhao Liu > > Hi list, > > This is the our v8 patch series, rebased on the master branch at the > commit 11be70677c70 ("Merge tag 'pull-vfio-20240129' of > https://github.com/legoater/qemu into staging"). > > Compared with v7

why various devices are loading x86 roms on non-x86 architectures?

2024-01-31 Thread Michael Tokarev
Hi! qemu-system-aarch64 -device virtio-vga this one loads vgabios-virtio.bin. Why? Does this bios work on aarch64 (or any other non-x86 arch)? Should there may be some conditional in this and similar places? The same is true for x86 pxe roms and other x86-only roms. Thanks, /mjt

Re: Re: [libvirt PATCH V2 0/4] add loongarch support for libvirt

2024-01-31 Thread Andrea Bolognani
On Wed, Jan 31, 2024 at 11:20:41AM +0800, lixianglai wrote: > > > In the qemu code, loongarch virt machine does only create a pflash, > > > > > > which is used for nvram, and uefi code is loaded by rom. > > > > > > In summary, loongarch virt machine can use nvram with the following > > > command:

Re: [PULL 11/33] scsi: only access SCSIDevice->requests from one thread

2024-01-31 Thread Kevin Wolf
Am 29.01.2024 um 17:30 hat Hanna Czenczek geschrieben: > I don’t like using drain as a form of lock specifically against AioContext > changes, but maybe Stefan is right, and we should use it in this specific > case to get just the single problem fixed.  (Though it’s not quite trivial > either. 

Re: [PATCH 1/6] vdpa: check for iova tree initialized at net_client_start

2024-01-31 Thread Si-Wei Liu
Hi Eugenio, Maybe there's some patch missing, but I saw this core dump when x-svq=on is specified while waiting for the incoming migration on destination host: (gdb) bt #0  0x5643b24cc13c in vhost_iova_tree_map_alloc (tree=0x0, map=map@entry=0x7ffd58c54830) at

Re: Re: [PATCH] linux-user: Make TARGET_NR_setgroups affect only the current thread

2024-01-31 Thread Ilya Leoshkevich
On Wed, Jan 31, 2024 at 08:53:49AM +0100, Helge Deller wrote: > On 1/31/24 01:18, Ilya Leoshkevich wrote: > > Like TARGET_NR_setuid, TARGET_NR_setgroups should affect only the > > calling thread, and not the entire process. Therefore, implement it > > using a syscall, and not a libc call. > > > >

[PATCH v8 19/21] i386: Add cache topology info in CPUCacheInfo

2024-01-31 Thread Zhao Liu
From: Zhao Liu Currently, by default, the cache topology is encoded as: 1. i/d cache is shared in one core. 2. L2 cache is shared in one core. 3. L3 cache is shared in one die. This default general setting has caused a misunderstanding, that is, the cache topology is completely equated with a

[PATCH v8 14/21] i386: Expose module level in CPUID[0x1F]

2024-01-31 Thread Zhao Liu
From: Zhao Liu Linux kernel (from v6.4, with commit edc0a2b595765 ("x86/topology: Fix erroneous smp_num_siblings on Intel Hybrid platforms") is able to handle platforms with Module level enumerated via CPUID.1F. Expose the module level in CPUID[0x1F] if the machine has more than 1 modules.

[PATCH v8 21/21] i386/cpu: Use CPUCacheInfo.share_level to encode CPUID[0x8000001D].EAX[bits 25:14]

2024-01-31 Thread Zhao Liu
From: Zhao Liu CPUID[0x801D].EAX[bits 25:14] NumSharingCache: number of logical processors sharing cache. The number of logical processors sharing this cache is NumSharingCache + 1. After cache models have topology information, we can use CPUCacheInfo.share_level to decide which topology

[PATCH v8 16/21] i386/cpu: Introduce module-id to X86CPU

2024-01-31 Thread Zhao Liu
From: Zhao Liu Introduce module-id to be consistent with the module-id field in CpuInstanceProperties. Following the legacy smp check rules, also add the module_id validity into x86_cpu_pre_plug(). Tested-by: Yongwei Ma Co-developed-by: Zhuocheng Ding Signed-off-by: Zhuocheng Ding

[PATCH v8 17/21] tests: Add test case of APIC ID for module level parsing

2024-01-31 Thread Zhao Liu
From: Zhuocheng Ding After i386 supports module level, it's time to add the test for module level's parsing. Signed-off-by: Zhuocheng Ding Co-developed-by: Zhao Liu Signed-off-by: Zhao Liu Reviewed-by: Yanan Wang Tested-by: Babu Moger Tested-by: Yongwei Ma Acked-by: Michael S. Tsirkin

[PATCH v8 05/21] i386/cpu: Fix i/d-cache topology to core level for Intel CPU

2024-01-31 Thread Zhao Liu
From: Zhao Liu For i-cache and d-cache, current QEMU hardcodes the maximum IDs for CPUs sharing cache (CPUID.04H.00H:EAX[bits 25:14] and CPUID.04H.01H:EAX[bits 25:14]) to 0, and this means i-cache and d-cache are shared in the SMT level. This is correct if there's single thread per core, but is

[PATCH v8 07/21] i386/cpu: Use APIC ID info get NumSharingCache for CPUID[0x8000001D].EAX[bits 25:14]

2024-01-31 Thread Zhao Liu
From: Zhao Liu The commit 8f4202fb1080 ("i386: Populate AMD Processor Cache Information for cpuid 0x801D") adds the cache topology for AMD CPU by encoding the number of sharing threads directly. >From AMD's APM, NumSharingCache (CPUID[0x801D].EAX[bits 25:14]) means [1]: The number of

[PATCH v8 06/21] i386/cpu: Use APIC ID info to encode cache topo in CPUID[4]

2024-01-31 Thread Zhao Liu
From: Zhao Liu Refer to the fixes of cache_info_passthrough ([1], [2]) and SDM, the CPUID.04H:EAX[bits 25:14] and CPUID.04H:EAX[bits 31:26] should use the nearest power-of-2 integer. The nearest power-of-2 integer can be calculated by pow2ceil() or by using APIC ID offset/width (like L3

[PATCH v8 02/21] hw/core/machine: Support modules in -smp

2024-01-31 Thread Zhao Liu
From: Zhao Liu Add "modules" parameter parsing support in -smp. Suggested-by: Xiaoyao Li Tested-by: Yongwei Ma Signed-off-by: Zhao Liu --- Changes since v7: * New commit to introduce module level in -smp. --- hw/core/machine-smp.c | 39 +--

[PATCH v8 13/21] i386: Support modules_per_die in X86CPUTopoInfo

2024-01-31 Thread Zhao Liu
From: Zhao Liu Support module level in i386 cpu topology structure "X86CPUTopoInfo". Since x86 does not yet support the "modules" parameter in "-smp", X86CPUTopoInfo.modules_per_die is currently always 1. Therefore, the module level width in APIC ID, which can be calculated by

[PATCH v8 20/21] i386/cpu: Use CPUCacheInfo.share_level to encode CPUID[4]

2024-01-31 Thread Zhao Liu
From: Zhao Liu CPUID[4].EAX[bits 25:14] is used to represent the cache topology for Intel CPUs. After cache models have topology information, we can use CPUCacheInfo.share_level to decide which topology level to be encoded into CPUID[4].EAX[bits 25:14]. And since with the helper

[PATCH v8 15/21] i386: Support module_id in X86CPUTopoIDs

2024-01-31 Thread Zhao Liu
From: Zhao Liu Add module_id member in X86CPUTopoIDs. module_id can be parsed from APIC ID, so also update APIC ID parsing rule to support module level. With this support, the conversions with module level between X86CPUTopoIDs, X86CPUTopoInfo and APIC ID are completed. module_id can be also

[PATCH v8 11/21] i386/cpu: Decouple CPUID[0x1F] subleaf with specific topology level

2024-01-31 Thread Zhao Liu
From: Zhao Liu At present, the subleaf 0x02 of CPUID[0x1F] is bound to the "die" level. In fact, the specific topology level exposed in 0x1F depends on the platform's support for extension levels (module, tile and die). To help expose "module" level in 0x1F, decouple CPUID[0x1F] subleaf with

[PATCH v8 12/21] i386: Introduce module level cpu topology to CPUX86State

2024-01-31 Thread Zhao Liu
From: Zhao Liu Intel CPUs implement module level on hybrid client products (e.g., ADL-N, MTL, etc) and E-core server products. A module contains a set of cores that share certain resources (in current products, the resource usually includes L2 cache, as well as module scoped features and MSRs).

[PATCH v8 18/21] hw/i386/pc: Support smp.modules for x86 PC machine

2024-01-31 Thread Zhao Liu
From: Zhao Liu As module-level topology support is added to X86CPU, now we can enable the support for the modules parameter on PC machines. With this support, we can define a 5-level x86 CPU topology with "-smp": -smp cpus=*,maxcpus=*,sockets=*,dies=*,modules=*,cores=*,threads=*. Additionally,

[PATCH v8 09/21] i386/cpu: Introduce bitmap to cache available CPU topology levels

2024-01-31 Thread Zhao Liu
From: Zhao Liu Currently, QEMU checks the specify number of topology domains to detect if there's extended topology levels (e.g., checking nr_dies). With this bitmap, the extended CPU topology (the levels other than SMT, core and package) could be easier to detect without touching the topology

[PATCH v8 08/21] i386/cpu: Consolidate the use of topo_info in cpu_x86_cpuid()

2024-01-31 Thread Zhao Liu
From: Zhao Liu In cpu_x86_cpuid(), there are many variables in representing the cpu topology, e.g., topo_info, cs->nr_cores and cs->nr_threads. Since the names of cs->nr_cores/cs->nr_threads does not accurately represent its meaning, the use of cs->nr_cores/cs->nr_threads is prone to confusion

[PATCH v8 03/21] hw/core: Introduce module-id as the topology subindex

2024-01-31 Thread Zhao Liu
From: Zhao Liu Add module-id in CpuInstanceProperties, to locate the CPU with module level. Suggested-by: Xiaoyao Li Tested-by: Yongwei Ma Signed-off-by: Zhao Liu --- Changes since v7: * New commit to introduce module_id to locate the CPU with module level. ---

[PATCH v8 00/21] Introduce smp.modules for x86 in QEMU

2024-01-31 Thread Zhao Liu
From: Zhao Liu Hi list, This is the our v8 patch series, rebased on the master branch at the commit 11be70677c70 ("Merge tag 'pull-vfio-20240129' of https://github.com/legoater/qemu into staging"). Compared with v7 [1], v8 mainly has the following changes: * Introduced smp.modules for x86

[PATCH v8 10/21] i386: Split topology types of CPUID[0x1F] from the definitions of CPUID[0xB]

2024-01-31 Thread Zhao Liu
From: Zhao Liu CPUID[0xB] defines SMT, Core and Invalid types, and this leaf is shared by Intel and AMD CPUs. But for extended topology levels, Intel CPU (in CPUID[0x1F]) and AMD CPU (in CPUID[0x8026]) have the different definitions with different enumeration values. Though

[PATCH v8 04/21] hw/core: Support module-id in numa configuration

2024-01-31 Thread Zhao Liu
From: Zhao Liu Module is a level above the core, thereby supporting numa configuration on the module level can bring user more numa flexibility. This is the natural further support for module level. Add module level support in numa configuration. Tested-by: Yongwei Ma Signed-off-by: Zhao Liu

[PATCH v8 01/21] hw/core/machine: Introduce the module as a CPU topology level

2024-01-31 Thread Zhao Liu
From: Zhao Liu In x86, module is the topology level above core, which contains a set of cores that share certain resources (in current products, the resource usually includes L2 cache, as well as module scoped features and MSRs). To build the module level topology for x86 CPUs, introduce module

Re: [PATCH] hw/pci: migration: Skip config space check for vendor specific capability during restore/load

2024-01-31 Thread Vinayak Kale
On 31/01/24 12:28 am, Alex Williamson wrote: On Tue, 30 Jan 2024 23:32:26 +0530 Vinayak Kale wrote: Missed adding Michael, Marcel, Alex and Avihai earlier, apologies. Regards, Vinayak On 30/01/24 3:26 pm, Vinayak Kale wrote: In case of migration, during restore operation, qemu checks

Re: [PATCH 0/5] migration/multifd: Prerequisite cleanups for ongoing work

2024-01-31 Thread Peter Xu
On Mon, Jan 29, 2024 at 09:51:06AM -0300, Fabiano Rosas wrote: > Peter Xu writes: > > > On Mon, Jan 29, 2024 at 01:41:01AM +, Liu, Yuan1 wrote: > >> Because this change has an impact on the previous live migration > >> With IAA Patch, does the submission of the next version needs > >> to

Re: [PATCH v2] pc: q35: Bump max_cpus to 1856 vcpus

2024-01-31 Thread Daniel P . Berrangé
On Wed, Jan 31, 2024 at 02:54:19PM +0800, Zhao Liu wrote: > On Wed, Jan 31, 2024 at 10:47:29AM +0530, Ani Sinha wrote: > > Date: Wed, 31 Jan 2024 10:47:29 +0530 > > From: Ani Sinha > > Subject: Re: [PATCH v2] pc: q35: Bump max_cpus to 1856 vcpus > > > > On Wed, Jan 31, 2024 at 9:27 AM Zhao Liu

[PATCH v3 2/9] intc/grlib_irqmp: add ncpus property

2024-01-31 Thread Clément Chigot
This adds a "ncpus" property to the "grlib-irqmp" device to be used later, this required a little refactoring of how we initialize the device (ie: use realize instead of init). Co-developed-by: Frederic Konrad Signed-off-by: Clément Chigot Reviewed-by: Philippe Mathieu-Daudé ---

[PATCH v3 6/9] leon3: remove SP initialization

2024-01-31 Thread Clément Chigot
According to the doc (see §4.2.15 in [1]), the reset operation should not impact %SP. [1] https://gaisler.com/doc/gr712rc-usermanual.pdf Signed-off-by: Clément Chigot --- hw/sparc/leon3.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/hw/sparc/leon3.c b/hw/sparc/leon3.c index

Re: [PATCH v4 35/47] hw/mips/mipssim: use qemu_create_nic_device()

2024-01-31 Thread Thomas Huth
On 26/01/2024 18.25, David Woodhouse wrote: From: David Woodhouse The MIPS SIM platform instantiates its NIC only if a corresponding configuration exists for it. Use qemu_create_nic_device() function for that. Signed-off-by: David Woodhouse --- hw/mips/mipssim.c | 13 +++-- 1 file

[PATCH v3 4/9] intc/grlib_irqmp: implements multicore irq

2024-01-31 Thread Clément Chigot
Now there is an ncpus property, use it in order to deliver the IRQ to multiple CPU. Co-developed-by: Frederic Konrad Signed-off-by: Clément Chigot Reviewed-by: Philippe Mathieu-Daudé --- hw/intc/grlib_irqmp.c | 41 +-- hw/sparc/leon3.c | 3

[PATCH v3 7/9] leon3: implement multiprocessor

2024-01-31 Thread Clément Chigot
This allows to register more than one CPU on the leon3_generic machine. Co-developed-by: Frederic Konrad Signed-off-by: Clément Chigot --- hw/sparc/leon3.c | 98 ++-- 1 file changed, 70 insertions(+), 28 deletions(-) diff --git a/hw/sparc/leon3.c

[PATCH v3 0/9] sparc/leon3: Add support for -smp

2024-01-31 Thread Clément Chigot
V3 modifications - Patch 3: Fix indentation - Patch 4: Fix types and improves variable declarations - Patch 6 (NEW): Remove SP initialization in leon3 - Patch 7: Add assert in leon3_start_cpu - Patch 8: Improve comment --- V2 modifications - Patch1: Add SPDX copyright tags. - Patch3: Add

[PATCH v3 5/9] target/sparc: implement asr17 feature for smp

2024-01-31 Thread Clément Chigot
This allows the guest program to know its cpu id. Co-developed-by: Frederic Konrad Signed-off-by: Clément Chigot Reviewed-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé --- target/sparc/helper.c| 16 target/sparc/helper.h| 1 + target/sparc/translate.c |

[PATCH v3 3/9] intc/grlib_irqmp: implements the multiprocessor status register

2024-01-31 Thread Clément Chigot
This implements the multiprocessor status register in grlib-irqmp and bind it to a start signal, which will be later wired in leon3-generic to start a cpu. The EIRQ and BA bits are not implemented. Based on https://gaisler.com/doc/gr712rc-usermanual.pdf, §8.3.5. Co-developed-by: Frederic Konrad

[PATCH v3 8/9] leon3: check cpu_id in the tiny bootloader

2024-01-31 Thread Clément Chigot
Now that SMP is possible, the asr17 must be checked in the little boot code or the secondary CPU will reinitialize the Timer and the Uart. Co-developed-by: Frederic Konrad Signed-off-by: Clément Chigot Reviewed-by: Philippe Mathieu-Daudé --- hw/sparc/leon3.c | 22 -- 1

[PATCH v3 9/9] MAINTAINERS: replace Fabien by myself as Leon3 maintainer

2024-01-31 Thread Clément Chigot
CC: Fabien Chouteau Signed-off-by: Clément Chigot Reviewed-by: Fabien Chouteau --- MAINTAINERS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MAINTAINERS b/MAINTAINERS index dfaca8323e..f076c97fcb 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1708,7 +1708,7 @@ F:

[PATCH v3 1/9] sparc/grlib: split out the headers for each peripherals

2024-01-31 Thread Clément Chigot
... and move them in their right hardware directory. Update Copyright and add SPDX-License-Identifier at the same time. Co-developed-by: Frederic Konrad Signed-off-by: Clément Chigot Reviewed-by: Philippe Mathieu-Daudé --- hw/char/grlib_apbuart.c | 6 ++--

Re: [PATCH v4 30/47] hw/arm: use qemu_configure_nic_device()

2024-01-31 Thread Thomas Huth
On 26/01/2024 18.25, David Woodhouse wrote: From: David Woodhouse Signed-off-by: David Woodhouse --- hw/arm/mps2-tz.c | 8 ++-- hw/arm/msf2-soc.c| 6 +- hw/arm/musicpal.c| 3 +-- hw/arm/xilinx_zynq.c | 11 --- hw/arm/xlnx-versal.c | 7 +--

<    1   2   3