Re: [libvirt PATCH 00/11] Some additional cleanups to mdev support

2021-04-12 Thread Erik Skultety
On Fri, Apr 09, 2021 at 04:32:55PM -0500, Jonathon Jongsma wrote: > Erik recommended several changes to the mdev series that was just merged and > suggested to address them in a follow-up patch series. They're mostly related > to simplifying the testing, and shouldn't actually change any behavior (

[libvirt PATCH v2] hyperv: Handle long CPU models better.

2021-04-12 Thread Dawid Zamirski
The existing driver code strips down CPU model strings returned by Hyper-V hosts so they fit into the 32 character limit of the virNodeInfo.model field. However, this did not work well for my AMD CPU for which Hyper-V returns the string "AMD FX(tm)-8350 Eight-Core Processor". Therefore, this patch

[libvirt][PATCH v5 3/3] qemu: add parser and formatter for 'restrictive' mode in numatune

2021-04-12 Thread Luyao Zhong
Reviewed-by: Daniel Henrique Barboza Signed-off-by: Luyao Zhong --- include/libvirt/libvirt-domain.h | 1 + src/conf/numa_conf.c | 9 src/qemu/qemu_command.c | 6 ++- src/qemu/qemu_process.c | 27 ++

[libvirt][PATCH v5 1/3] docs: add docs for 'restrictive' option for mode in numatune

2021-04-12 Thread Luyao Zhong
When user would like use cgroups to restrict the allowed memory nodes, and require not setting any specific memory policy, then 'restrictive' mode is useful. Reviewed-by: Daniel Henrique Barboza Signed-off-by: Luyao Zhong --- docs/formatdomain.rst | 7 +-- 1 file changed, 5 insertions(+), 2

[libvirt][PATCH v5 0/3] introduce 'restrictive' mode in numatune

2021-04-12 Thread Luyao Zhong
Before this patch set, numatune only has three memory modes: static, interleave and prefered. These memory policies are ultimately set by mbind() system call. Memory policy could be 'hard coded' into the kernel, but none of above policies fit our requirment under this case. mbind() support default

[libvirt][PATCH v5 2/3] schema: add 'restrictive' config option for mode in numatune

2021-04-12 Thread Luyao Zhong
support 'restrictive' mode in memory element and memnode element in numatune: ... ... Reviewed-by: Daniel Henrique Barboza Signed-off-by: Luyao Zhong --- docs/schemas/domaincommon.rng | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/schemas

[libvirt PATCH 1/2] vircgroupv2: properly free BPF prog and map FDs

2021-04-12 Thread Pavel Hrdina
When nested cgroup was introduced it did not properly free file descriptors for BPF prog and map. With nested cgroups we create the BPF bits in the nested cgroup instead of the VM root cgroup. This would leak the FDs which would be the last reference to the prog and map so kernel would not remove

[libvirt PATCH 2/2] vircgroupv2devices: refactor virCgroupV2DevicesRemoveProg

2021-04-12 Thread Pavel Hrdina
When running on systemd host the cgroup itself is removed by machined so when we reach this code the directory no longer exist. If libvirtd was running the whole time between starting and destroying VM the detection is skipped because we still have both FD in memory. But if libvirtd was restarted a

[libvirt PATCH 0/2] fix cgroups BPF FDs leak

2021-04-12 Thread Pavel Hrdina
Pavel Hrdina (2): vircgroupv2: properly free BPF prog and map FDs vircgroupv2devices: refactor virCgroupV2DevicesRemoveProg src/libvirt_private.syms | 2 +- src/util/vircgroupv2.c| 3 ++- src/util/vircgroupv2devices.c | 14 -- src/util/vircgroupv2devices.h | 2 +-

Re: [libvirt PATCH] Remove references to deleted Makefile.am

2021-04-12 Thread Pavel Hrdina
On Fri, Apr 09, 2021 at 10:12:59AM +0200, Tim Wiederhake wrote: > Signed-off-by: Tim Wiederhake > --- > src/admin/libvirt_admin_private.syms | 2 +- > src/libvirt_private.syms | 2 +- > src/libvirt_remote.syms | 2 +- > src/vbox/vbox_tmpl.c | 4 > tes

Re: [PATCH 0/2] qemu: blockjob: Fix two issues with block pull job finishing

2021-04-12 Thread Pavel Hrdina
On Mon, Apr 12, 2021 at 05:57:44PM +0200, Peter Krempa wrote: > Peter Krempa (2): > qemuBlockJobProcessEventCompletedPull: Avoid dangling pointer after > blockpull > qemuBlockJobProcessEventCompletedPull: Add backingStore terminators if > base is NULL Reviewed-by: Pavel Hrdina signa

Re: [PATCH 2/2] qemuBlockJobProcessEventCompletedPull: Add backingStore terminators if base is NULL

2021-04-12 Thread Pavel Hrdina
On Mon, Apr 12, 2021 at 05:57:46PM +0200, Peter Krempa wrote: > When doing a blockpull with NULL base the full contents of the disk are > pulled into the topmost image which then becomes fullu self-contained. s/fullu/fully/ > qemuBlockJobProcessEventCompletedPull doesn't install the backing chain

Re: [PATCH 0/5] nodedev: Couple of fixes after last mdevctl patches

2021-04-12 Thread Pavel Hrdina
On Mon, Apr 12, 2021 at 06:22:19PM +0200, Michal Privoznik wrote: > Recently, the nodedev driver gained ability to define (some type of) > devices. However, it uncovered some dormant bugs we had (patches 2/5 and > 3/5) and also introduced some (patches 1/5 and 5/5). > > I've came across these prob

Re: [PATCH 5/5] nodedev: Only set up mdevctl monitors if mdevctl.d exist

2021-04-12 Thread Pavel Hrdina
On Mon, Apr 12, 2021 at 06:22:24PM +0200, Michal Privoznik wrote: > During its initialization, the nodedev driver tries to set up > monitors for /etc/mdevctl.d directory, so that it can register > mdevs as they come and go. However, if the file doesn't exist > there is nothing to monitor and theref

Re: [PATCH] bhyve: Fix declaration of 'params' in 'bhyveParsePCIFbuf'

2021-04-12 Thread Ján Tomko
On a Monday in 2021, Peter Krempa wrote: In commit ad80bba90a3 I've mistakenly didn't delete '**' from the d/'ve/ variable declaration when converting it to 'GStrv' Fixes: ad80bba90a3 Signed-off-by: Peter Krempa --- The patch will be pushed under the build-breaker and trivial rules once th

[PATCH 5/5] nodedev: Only set up mdevctl monitors if mdevctl.d exist

2021-04-12 Thread Michal Privoznik
During its initialization, the nodedev driver tries to set up monitors for /etc/mdevctl.d directory, so that it can register mdevs as they come and go. However, if the file doesn't exist there is nothing to monitor and therefore we can exit early. In fact, we have to otherwise monitorFileRecursivel

[PATCH 4/5] nodedev: Separate mdevctl monitor setup into a function

2021-04-12 Thread Michal Privoznik
Signed-off-by: Michal Privoznik --- src/node_device/node_device_udev.c | 37 +++--- 1 file changed, 24 insertions(+), 13 deletions(-) diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_device_udev.c index 3e9c7a8d80..18219175c5 100644 --- a/src/node_d

[PATCH] bhyve: Fix declaration of 'params' in 'bhyveParsePCIFbuf'

2021-04-12 Thread Peter Krempa
In commit ad80bba90a3 I've mistakenly didn't delete '**' from the variable declaration when converting it to 'GStrv' Fixes: ad80bba90a3 Signed-off-by: Peter Krempa --- The patch will be pushed under the build-breaker and trivial rules once the pipeline passes: https://gitlab.com/pipo.sk/libvirt

[PATCH 2/5] nodedev: Lock @priv sooner

2021-04-12 Thread Michal Privoznik
The nodedev driver private data object @priv is created by calling udevEventDataNew(). After that, driver->privateData pointer is set to the freshly allocated object and only a few lines after all of this the object is locked. Technically it is safe because there should not be any other thread at t

[PATCH 1/5] nodedev: Unlock @priv if initialization of mdevctlMonitors fails

2021-04-12 Thread Michal Privoznik
If initialization of priv->mdevctlMonitors fails, then the control jumps over to cleanup label where nodeStateCleanup() is called which tries to lock @priv. But since @priv was already locked before taking the jump a deadlock occurs. The solution is to jump onto @unlock label, just like the code ar

[PATCH 0/5] nodedev: Couple of fixes after last mdevctl patches

2021-04-12 Thread Michal Privoznik
Recently, the nodedev driver gained ability to define (some type of) devices. However, it uncovered some dormant bugs we had (patches 2/5 and 3/5) and also introduced some (patches 1/5 and 5/5). I've came across these problems because I don't have /etc/mdevctl.d on my machine. Michal Prívozník (5

[PATCH 3/5] nodedev: Don't join not spawned threads

2021-04-12 Thread Michal Privoznik
During the nodedev driver initialization two threads are created: one for listening on udev events (like device plug/unplug) and the other for enumerating devices (so that the main thread doing the driver init is not blocked). If something goes wrong at any point then nodeStateCleanup() is called w

[PATCH 0/2] qemu: blockjob: Fix two issues with block pull job finishing

2021-04-12 Thread Peter Krempa
Peter Krempa (2): qemuBlockJobProcessEventCompletedPull: Avoid dangling pointer after blockpull qemuBlockJobProcessEventCompletedPull: Add backingStore terminators if base is NULL src/qemu/qemu_blockjob.c | 20 +++- 1 file changed, 15 insertions(+), 5 deletions(-) --

[PATCH 1/2] qemuBlockJobProcessEventCompletedPull: Avoid dangling pointer after blockpull

2021-04-12 Thread Peter Krempa
When doing a full block pull job (base == NULL) and the config XML contains a compatible disk, the completer function would leave a dangling pointer in 'cfgdisk->src->backingStore' as cfgdisk->src would be set to the value of 'cfgbase' which was always set to 'cfgdisk->src->backingStore'. This is

[PATCH 2/2] qemuBlockJobProcessEventCompletedPull: Add backingStore terminators if base is NULL

2021-04-12 Thread Peter Krempa
When doing a blockpull with NULL base the full contents of the disk are pulled into the topmost image which then becomes fullu self-contained. qemuBlockJobProcessEventCompletedPull doesn't install the backing chain terminators though, although it's guaranteed that there will be no backing chain be

Re: [RFC PATCH 00/43] qemu: Remove support for qemu-1.5 - qemu-2.10 and clean up capabilities

2021-04-12 Thread Neal Gompa
On Fri, Apr 9, 2021 at 11:00 AM Peter Krempa wrote: > > May 7, 2021 is the 2nd anniversary of release of rhel-8, which means we > no longer have to support qemu-1.5. > > Remove the capabilities and test data for the versions we no longer care > about and clean up some capabilities related stuff: >

[PATCH resend] virfile: Replace AbsPath judgement method with g_path_is_absolute()

2021-04-12 Thread Luke Yue
The g_path_is_absolute() considers more situations than just a simply "path[0] == '/'". Related issue: https://gitlab.com/libvirt/libvirt/-/issues/12 Signed-off-by: Luke Yue --- src/util/virfile.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util/virfile.c b/src/util/

Re: [PATCH resend] lib: Drop internal virXXXPtr typedefs

2021-04-12 Thread Peter Krempa
On Mon, Apr 12, 2021 at 13:46:35 +0200, Michal Privoznik wrote: > Historically, we declared pointer type to our types: > > typedef struct _virXXX virXXX; > typedef virXXX *virXXXPtr; > > But usefulness of such declaration is questionable, at best. > Unfortunately, we can't drop every such dec

Re: [RFC PATCH 00/43] qemu: Remove support for qemu-1.5 - qemu-2.10 and clean up capabilities

2021-04-12 Thread Pavel Hrdina
On Fri, Apr 09, 2021 at 04:56:36PM +0200, Peter Krempa wrote: > May 7, 2021 is the 2nd anniversary of release of rhel-8, which means we > no longer have to support qemu-1.5. > > Remove the capabilities and test data for the versions we no longer care > about and clean up some capabilities related

Re: [RFC PATCH 31/43] qemu: capabilities: Move rest of always present caps to virQEMUCapsInitQMPArch

2021-04-12 Thread Pavel Hrdina
On Fri, Apr 09, 2021 at 04:57:07PM +0200, Peter Krempa wrote: > These conveniently don't have any test fallout. > > Signed-off-by: Peter Krempa > --- > src/qemu/qemu_capabilities.c | 16 +++- > 1 file changed, 7 insertions(+), 9 deletions(-) > > diff --git a/src/qemu/qemu_capabiliti

Re: [RFC PATCH 19/43] qemuxml2xmltest: Always include basic set of capabilities

2021-04-12 Thread Pavel Hrdina
On Fri, Apr 09, 2021 at 04:56:55PM +0200, Peter Krempa wrote: > Use virQEMUCapsInitQMPBasicArch to add the basic set of capabilities > which all qemu versions will get. > > Signed-off-by: Peter Krempa > --- > tests/qemuxml2xmltest.c | 22 ++ > 1 file changed, 22 insertions(+)

Re: [RFC PATCH 17/43] qemuxml2argvtest: Rewrite parsing of XMLs to provide earlier parsing

2021-04-12 Thread Pavel Hrdina
On Fri, Apr 09, 2021 at 04:56:53PM +0200, Peter Krempa wrote: > In upcoming patches we'll need to parse a certain bit of XML before > calling the full XML parser. This effectively open-codes what > virDomainDefParseFile to reach virDomainDefParseNode. > > Signed-off-by: Peter Krempa > --- > test

Re: [RFC PATCH 18/43] qemuxml2argvtest: Parse 'arch' from XML early

2021-04-12 Thread Pavel Hrdina
On Fri, Apr 09, 2021 at 04:56:54PM +0200, Peter Krempa wrote: > If we want to provide correct (fake) caps already for the XML parser we > need to be able to parse the arch early so that we can properly > initialize the caps cache prior to calling the XML parser. > > This patch adds code which pars

Re: [libvirt PATCH v6 27/30] nodedev: fix hang when destroying an mdev in use

2021-04-12 Thread John Ferlan
On 3/26/21 12:48 PM, Jonathon Jongsma wrote: Calling `mdevctl stop` for a mediated device that is in use by an active domain will block until that vm exits (or the vm closes the device). Since the nodedev driver cannot query the hypervisor driver to see whether any active domains are using the

[PATCH resend] lib: Drop internal virXXXPtr typedefs

2021-04-12 Thread Michal Privoznik
Historically, we declared pointer type to our types: typedef struct _virXXX virXXX; typedef virXXX *virXXXPtr; But usefulness of such declaration is questionable, at best. Unfortunately, we can't drop every such declaration - we have to carry some over, because they are part of public API (e.

Re: Removal of fake-capabilities test from qemuxml2argvtest

2021-04-12 Thread Peter Krempa
On Fri, Apr 09, 2021 at 17:52:59 +0100, Daniel P. Berrangé wrote: > On Fri, Apr 09, 2021 at 05:14:41PM +0200, Peter Krempa wrote: > > Hi, > > > > recently I've got very annoyed that we still have a very large amount of > > tests in qemuxml2argvtest which use DO_TEST or some other fake-caps > > tes

Re: [PATCH v2 23/25] bhyvexml2argvtest: Use internal wrapping of command line arguments

2021-04-12 Thread Peter Krempa
On Fri, Apr 09, 2021 at 17:36:40 +0200, Pavel Hrdina wrote: > On Fri, Apr 09, 2021 at 02:50:25PM +0200, Peter Krempa wrote: > > virCommandToString has the possibility to return an already wrapped > > string with better format than what we get from the test wrapper script. > > > > The main advantag

Re: [PATCH] virfile: Replace AbsPath judgement method with g_path_is_absolute()

2021-04-12 Thread Martin Kletzander
On Tue, Mar 30, 2021 at 10:58:36PM +0800, Luke Yue wrote: The g_path_is_absolute() considers more situations than just a simply "path[0] == '/'". Related issue: https://gitlab.com/libvirt/libvirt/-/issues/12 Signed-off-by: Luke Yue --- src/util/virfile.c | 2 +- 1 file changed, 1 insertion(+),

Re: [libvirt][PATCH v4 0/3] introduce 'restrictive' mode in numatune

2021-04-12 Thread Martin Kletzander
On Mon, Apr 12, 2021 at 07:31:25AM +, Zhong, Luyao wrote: Hi all, After several rounds of discussion, let me give a summary again in case of you missed my email: For this new "restrictive" mode, there is a concrete use case about a new feature in kernel but not merged yet, we call it mem

RE: [libvirt][PATCH v4 0/3] introduce 'restrictive' mode in numatune

2021-04-12 Thread Zhong, Luyao
Hi all, After several rounds of discussion, let me give a summary again in case of you missed my email: For this new "restrictive" mode, there is a concrete use case about a new feature in kernel but not merged yet, we call it memory tiering. (https://lwn.net/Articles/802544/). If memory tie

[PATCH 1/1] cpu:Get the host by reading DMI for Phytium.

2021-04-12 Thread 2860939690
From: Jiadong Zeng Reasons: 1.The Libvirt source code does not add information about Phytium's machine,which is reflected in the fact that the Phytium's information cannot be obtained when running the command "virsh capabilities". 2.Phytium identifies CPU chip information based on dmi informatio

[PATCH RFC v5 09/12] target/riscv: Add host cpu type

2021-04-12 Thread Yifei Jiang
'host' type cpu is set isa to RVXLEN simply, more isa info will obtain from KVM in kvm_arch_init_vcpu() Signed-off-by: Yifei Jiang Signed-off-by: Yipeng Yin --- target/riscv/cpu.c | 9 + target/riscv/cpu.h | 1 + 2 files changed, 10 insertions(+) diff --git a/target/riscv/cpu.c b/targe

[PATCH RFC v5 11/12] target/riscv: Implement virtual time adjusting with vm state changing

2021-04-12 Thread Yifei Jiang
We hope that virtual time adjusts with vm state changing. When a vm is stopped, guest virtual time should stop counting and kvm_timer should be stopped. When the vm is resumed, guest virtual time should continue to count and kvm_timer should be restored. Signed-off-by: Yifei Jiang Signed-off-by:

[PATCH RFC v5 06/12] target/riscv: Support start kernel directly by KVM

2021-04-12 Thread Yifei Jiang
Get kernel and fdt start address in virt.c, and pass them to KVM when cpu reset. In addition, add kvm_riscv.h to place riscv specific interface. Signed-off-by: Yifei Jiang Signed-off-by: Yipeng Yin --- hw/riscv/boot.c | 11 +++ hw/riscv/virt.c | 7 +++ include/hw/

[PATCH RFC v5 01/12] linux-header: Update linux/kvm.h

2021-04-12 Thread Yifei Jiang
Update linux-headers/linux/kvm.h from https://github.com/avpatel/linux/tree/riscv_kvm_v17. Only use this header file, so here do not update all linux headers by update-linux-headers.sh until above KVM series is accepted. Signed-off-by: Yifei Jiang Signed-off-by: Yipeng Yin --- linux-headers/lin

[PATCH RFC v5 02/12] target/riscv: Add target/riscv/kvm.c to place the public kvm interface

2021-04-12 Thread Yifei Jiang
Add target/riscv/kvm.c to place kvm_arch_* function needed by kvm/kvm-all.c. Meanwhile, add kvm support in meson.build file. Signed-off-by: Yifei Jiang Signed-off-by: Yipeng Yin Reviewed-by: Alistair Francis --- meson.build | 2 + target/riscv/kvm.c | 133 +

[PATCH RFC v5 10/12] target/riscv: Add kvm_riscv_get/put_regs_timer

2021-04-12 Thread Yifei Jiang
Add kvm_riscv_get/put_regs_timer to synchronize virtual time context from KVM. To set register of RISCV_TIMER_REG(state) will occur a error from KVM on kvm_timer_state == 0. It's better to adapt in KVM, but it doesn't matter that adaping in QEMU. Signed-off-by: Yifei Jiang Signed-off-by: Yipeng

[PATCH RFC v5 12/12] target/riscv: Support virtual time context synchronization

2021-04-12 Thread Yifei Jiang
Add virtual time context description to vmstate_riscv_cpu. After cpu being loaded, virtual time context is updated to KVM. Signed-off-by: Yifei Jiang Signed-off-by: Yipeng Yin --- target/riscv/machine.c | 14 ++ 1 file changed, 14 insertions(+) diff --git a/target/riscv/machine.c b

[PATCH RFC v5 00/12] Add riscv kvm accel support

2021-04-12 Thread Yifei Jiang
This series adds both riscv32 and riscv64 kvm support, and implements migration based on riscv. It is based on temporarily unaccepted kvm: https://github.com/kvm-riscv/linux (lastest version v17). This series depends on above pending changes which haven't yet been accepted, so this QEMU patch seri

[PATCH RFC v5 08/12] target/riscv: Handle KVM_EXIT_RISCV_SBI exit

2021-04-12 Thread Yifei Jiang
Use char-fe to handle console sbi call, which implement early console io while apply 'earlycon=sbi' into kernel parameters. Signed-off-by: Yifei Jiang Signed-off-by: Yipeng Yin --- target/riscv/kvm.c | 42 - target/riscv/sbi_ecall_interface.h | 72 +++

[PATCH RFC v5 04/12] target/riscv: Implement kvm_arch_get_registers

2021-04-12 Thread Yifei Jiang
Get GPR CSR and FP registers from kvm by KVM_GET_ONE_REG ioctl. Signed-off-by: Yifei Jiang Signed-off-by: Yipeng Yin --- target/riscv/kvm.c | 150 - 1 file changed, 149 insertions(+), 1 deletion(-) diff --git a/target/riscv/kvm.c b/target/riscv/kvm.c

[PATCH RFC v5 05/12] target/riscv: Implement kvm_arch_put_registers

2021-04-12 Thread Yifei Jiang
Put GPR CSR and FP registers to kvm by KVM_SET_ONE_REG ioctl Signed-off-by: Yifei Jiang Signed-off-by: Yipeng Yin --- target/riscv/kvm.c | 142 - 1 file changed, 141 insertions(+), 1 deletion(-) diff --git a/target/riscv/kvm.c b/target/riscv/kvm.c in

[PATCH RFC v5 07/12] hw/riscv: PLIC update external interrupt by KVM when kvm enabled

2021-04-12 Thread Yifei Jiang
Only support supervisor external interrupt currently. Signed-off-by: Yifei Jiang Signed-off-by: Yipeng Yin --- hw/intc/sifive_plic.c| 29 - target/riscv/kvm-stub.c | 5 + target/riscv/kvm.c | 20 target/riscv/kvm_riscv.h | 1 + 4

[PATCH RFC v5 03/12] target/riscv: Implement function kvm_arch_init_vcpu

2021-04-12 Thread Yifei Jiang
Get isa info from kvm while kvm init. Signed-off-by: Yifei Jiang Signed-off-by: Yipeng Yin --- target/riscv/kvm.c | 27 ++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/target/riscv/kvm.c b/target/riscv/kvm.c index 687dd4b621..0d924be33f 100644 --- a/tar