[PULL v2 10/11] nbd/server: use bdrv_dirty_bitmap_next_dirty_area

2020-03-18 Thread John Snow
From: Vladimir Sementsov-Ogievskiy Use bdrv_dirty_bitmap_next_dirty_area for bitmap_to_extents. Since bdrv_dirty_bitmap_next_dirty_area is very accurate in its interface, we'll never exceed requested region with last chunk. So, we don't need dont_fragment, and bitmap_to_extents() interface

[PULL v2 11/11] block/qcow2-bitmap: use bdrv_dirty_bitmap_next_dirty

2020-03-18 Thread John Snow
From: Vladimir Sementsov-Ogievskiy store_bitmap_data() loop does bdrv_set_dirty_iter() on each iteration, which means that we actually don't need iterator itself and we can use simpler bitmap API. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Max Reitz Reviewed-by: John Snow

[PULL v2 04/11] hbitmap: unpublish hbitmap_iter_skip_words

2020-03-18 Thread John Snow
From: Vladimir Sementsov-Ogievskiy Function is internal and even commented as internal. Drop its definition from .h file. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Max Reitz Reviewed-by: John Snow Message-id: 20200205112041.6003-4-vsement...@virtuozzo.com Signed-off-by: John

[PULL v2 05/11] hbitmap: drop meta bitmaps as they are unused

2020-03-18 Thread John Snow
From: Vladimir Sementsov-Ogievskiy Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Max Reitz Reviewed-by: John Snow Message-id: 20200205112041.6003-5-vsement...@virtuozzo.com Signed-off-by: John Snow --- include/qemu/hbitmap.h | 21 tests/test-hbitmap.c | 115

[PULL v2 01/11] build: Silence clang warning on older glib autoptr usage

2020-03-18 Thread John Snow
From: Eric Blake glib's G_DEFINE_AUTOPTR_CLEANUP_FUNC() macro defines several static inline functions, often with some of them unused, but prior to 2.57.2 did not mark the functions as such. As a result, clang (but not gcc) fails to build with older glib unless -Wno-unused-function is enabled.

[PULL v2 08/11] block/dirty-bitmap: improve _next_dirty_area API

2020-03-18 Thread John Snow
From: Vladimir Sementsov-Ogievskiy Firstly, _next_dirty_area is for scenarios when we may contiguously search for next dirty area inside some limited region, so it is more comfortable to specify "end" which should not be recalculated on each iteration. Secondly, let's add a possibility to limit

[PULL v2 02/11] hbitmap: assert that we don't create bitmap larger than INT64_MAX

2020-03-18 Thread John Snow
From: Vladimir Sementsov-Ogievskiy We have APIs which returns signed int64_t, to be able to return error. Therefore we can't handle bitmaps with absolute size larger than (INT64_MAX+1). Still, keep maximum to be INT64_MAX which is a bit safer. Note, that bitmaps are used to represent disk

[PULL v2 03/11] hbitmap: move hbitmap_iter_next_word to hbitmap.c

2020-03-18 Thread John Snow
From: Vladimir Sementsov-Ogievskiy The function is definitely internal (it's not used by third party and it has complicated interface). Move it to .c file. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Max Reitz Reviewed-by: John Snow Message-id:

[PULL v2 09/11] nbd/server: introduce NBDExtentArray

2020-03-18 Thread John Snow
From: Vladimir Sementsov-Ogievskiy Introduce NBDExtentArray class, to handle extents list creation in more controlled way and with fewer OUT parameters in functions. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Eric Blake Message-id: 20200205112041.6003-9-vsement...@virtuozzo.com

[PULL v2 07/11] block/dirty-bitmap: add _next_dirty API

2020-03-18 Thread John Snow
From: Vladimir Sementsov-Ogievskiy We have bdrv_dirty_bitmap_next_zero, let's add corresponding bdrv_dirty_bitmap_next_dirty, which is more comfortable to use than bitmap iterators in some cases. For test modify test_hbitmap_next_zero_check_range to check both next_zero and next_dirty and add

[PULL v2 00/11] Bitmaps patches

2020-03-18 Thread John Snow
The following changes since commit d649689a8ecb2e276cc20d3af6d416e3c299cb17: Merge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into staging (2020-03-17 18:33:05 +) are available in the Git repository at: https://github.com/jnsnow/qemu.git tags/bitmaps-pull-request for

[PULL v2 06/11] block/dirty-bitmap: switch _next_dirty_area and _next_zero to int64_t

2020-03-18 Thread John Snow
From: Vladimir Sementsov-Ogievskiy We are going to introduce bdrv_dirty_bitmap_next_dirty so that same variable may be used to store its return value and to be its parameter, so it would int64_t. Similarly, we are going to refactor hbitmap_next_dirty_area to use hbitmap_next_dirty together with

[PATCH 0/6] Couple of qemu NS improvements

2020-03-18 Thread Michal Privoznik
The most important patch is 6/6 which relies on 5/6. The rest is just a few small nits I've noticed and had stuck on my local branch. Michal Prívozník (6): qemuDomainCreateDeviceRecursive: Report error if mkdir() fails qemuDomainBuildNamespace: Try harder to remove temp directories

[PATCH 5/6] virprocess: Passthru error from virProcessRunInForkHelper

2020-03-18 Thread Michal Privoznik
When running a function in a forked child, so far the only thing we could report is exit status of the child and the error message. However, it may be beneficial to the caller to know the actual error that happened in the child. Signed-off-by: Michal Privoznik --- build-aux/syntax-check.mk | 2

[PATCH 1/6] qemuDomainCreateDeviceRecursive: Report error if mkdir() fails

2020-03-18 Thread Michal Privoznik
The virFileMakePathWithMode() which is our recursive version of mkdir() fails, it simply just returns a negative value with errno set. No error is reported (as compared to virFileTouch() for instance). Signed-off-by: Michal Privoznik --- src/qemu/qemu_domain.c | 6 +- 1 file changed, 5

[PATCH 3/6] qemuDomainBuildNamespace: Make @devPath const

2020-03-18 Thread Michal Privoznik
The @devPath variable is not modifiable. It merely just points to string containing path where private devtmpfs is being constructed. Make it const so it doesn't look weird that it's not freed. Signed-off-by: Michal Privoznik --- src/qemu/qemu_domain.c | 2 +- 1 file changed, 1 insertion(+), 1

[PATCH 6/6] security: Try harder to run transactions

2020-03-18 Thread Michal Privoznik
When a QEMU process dies in the middle of a hotplug, then we fail to restore the seclabels on the device. The problem is that if the thread doing hotplug locks the domain object first and thus blocks the thread that wants to do qemuProcessStop(), the seclabel cleanup code will see vm->pid still

[PATCH 2/6] qemuDomainBuildNamespace: Try harder to remove temp directories

2020-03-18 Thread Michal Privoznik
If building namespace fails somewhere in the middle (that is some files exists under devMountsSavePath[i]), then plain rmdir() is not enough to remove dir. Umount the temp location and use virFileDeleteTree() to remove the directory. Signed-off-by: Michal Privoznik --- src/qemu/qemu_domain.c |

[PATCH 4/6] virfile: Handle directories in virFileBindMountDevice()

2020-03-18 Thread Michal Privoznik
The @src is not always a file. It may also be a directory (for instance qemuDomainCreateDeviceRecursive() assumes that) - even though it doesn't happen usually. Anyway, mount() can mount only a dir onto a dir and a file onto a file. Signed-off-by: Michal Privoznik --- src/util/virfile.c | 13

Re: qemu:///embed and isolation from global components

2020-03-18 Thread Michal Prívozník
On 18. 3. 2020 16:47, Andrea Bolognani wrote: > On Mon, 2020-03-09 at 18:04 +, Daniel P. Berrangé wrote: >> At a high level the embedded QEMU driver >> >> - Isolated from any other instance of the QEMU driver > > Replying here because it looks as good a place as any. > > Now that Michal has

Re: qemu:///embed and isolation from global components

2020-03-18 Thread Andrea Bolognani
On Mon, 2020-03-09 at 18:04 +, Daniel P. Berrangé wrote: > At a high level the embedded QEMU driver > > - Isolated from any other instance of the QEMU driver Replying here because it looks as good a place as any. Now that Michal has made it so that identically-name domains defined under

Re: [PATCH 2/2] conf: Don't generate clashing machine names for embed driver

2020-03-18 Thread Andrea Bolognani
On Fri, 2020-03-13 at 17:59 +0100, Michal Privoznik wrote: [...] > -if (privileged) { > +if (root) { > +g_autofree char * hash = NULL; > + > +/* When two embed drivers start two domains with the same @name and > @id > + * we would generate a non-unique name.

Re: [PATCH 1/2] qemu_conf: Track embed root dir

2020-03-18 Thread Andrea Bolognani
On Fri, 2020-03-13 at 17:59 +0100, Michal Privoznik wrote: > When initializing virQEMUDriverConfig structure we are given the > root directory for possible embed connection. Save it for future > use. While we could get it later from @uri member, it's not as > easy as dereferencing a pointer

Re: [PATCH] vmx: make 'fileName' optional for CD-ROMs

2020-03-18 Thread Richard W.M. Jones
On Wed, Mar 18, 2020 at 01:44:18PM +0100, Pino Toscano wrote: > (Apparently forgot to send it yesterday, so sending it with a small > addedum.) > > On Tuesday, 17 March 2020 18:09:04 CET Richard W.M. Jones wrote: > > My only worry about this patch is that it relies on fileName now > > possibly

Re: [PATCH] qemuDomainVcpuValidateConfig: Properly initialize 'firstcpu' variable

2020-03-18 Thread Daniel Henrique Barboza
On 3/17/20 2:50 PM, Peter Krempa wrote: The loop which checks whether the vcpus are in proper configuration for the requested hot(un)plug skips the first modified vcpu. This means that 'firstvcpu' which is used to print the error message in case the configuration is not suitable would never

Re: [PULL 00/10] Bitmaps patches

2020-03-18 Thread Eric Blake
On 3/17/20 9:00 AM, Peter Maydell wrote: block/qcow2-bitmap: use bdrv_dirty_bitmap_next_dirty (2020-03-12 16:36:46 -0400) Pull request --- Hi; this fails to

Re: [PATCH] vmx: make 'fileName' optional for CD-ROMs

2020-03-18 Thread Pino Toscano
(Apparently forgot to send it yesterday, so sending it with a small addedum.) On Tuesday, 17 March 2020 18:09:04 CET Richard W.M. Jones wrote: > My only worry about this patch is that it relies on fileName now > possibly being NULL, which means if there is any case that you've > missed now — or

Re: [PATCH v2 0/2] vmx: make 'fileName' optional for CD-ROMs

2020-03-18 Thread Richard W.M. Jones
Works, so: Tested-by: Richard W.M. Jones I have no further comments about the patches themselves other than what I said on the first version. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog:

[PATCH 2/5] qemuMonitorJSON(Add|Del)Object: Refactor cleanup

2020-03-18 Thread Peter Krempa
Use 'g_autoptr' and remove the cleanup label and ret variable. Signed-off-by: Peter Krempa --- src/qemu/qemu_monitor_json.c | 42 +--- 1 file changed, 15 insertions(+), 27 deletions(-) diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c

[PATCH 4/5] qemuMonitorJSONCheckError: Allow suppressing of error reporting

2020-03-18 Thread Peter Krempa
In some cases we'll need to check whether there was an error but avoid reporting an actual libvirt error. Rename qemuMonitorJSONCheckError to qemuMonitorJSONCheckErrorFull with a new flag to suppress the error reporting and add a wrapper with the original name so that callers don't need to be

[PATCH 1/5] qemuDomainChangeEjectableMedia: Don't always remove managed PR daemon

2020-03-18 Thread Peter Krempa
When changing media we'd attempt to remove the managed pr daemon even if neither of the images involved in the media change used it. This caused libvirtd to log a spurious error: 2020-03-18 01:41:19.832+: 643207: error : qemuMonitorJSONCheckError:412 : internal error: unable to execute QEMU

[PATCH 3/5] qemuMonitorJSONCheckError: Use g_autofree

2020-03-18 Thread Peter Krempa
Eliminate cleanup code by using g_autofree. Signed-off-by: Peter Krempa --- src/qemu/qemu_monitor_json.c | 12 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 00d7760a05..31eb01006c 100644 ---

[PATCH 5/5] qemu: Suppress error reporting from qemuMonitorDelObject in cleanup paths

2020-03-18 Thread Peter Krempa
Many calls of qemuMonitorDelObject don't actually check the return value or report the error from the object deletion itself since they are on cleanup paths. In some cases this can lead to reporting of spurious errors e.g. when qemuMonitorDelObject is used to clean up a possibly pre-existing

[PATCH 0/5] qemu: Don't log spurious errors on qemuMonitorDelObject

2020-03-18 Thread Peter Krempa
qemuMonitorDelObject is often used in cleanup cases so we need to control whether to log errors. First patch actually prevents one of the spurious calls in cases we know it would be pointless. Peter Krempa (5): qemuDomainChangeEjectableMedia: Don't always remove managed PR daemon

Re: [PATCH v2 1/1] cpu_map: Add more -noTSX x86 CPU models

2020-03-18 Thread Jiri Denemark
On Tue, Mar 10, 2020 at 11:48:06 +0100, Christian Ehrhardt wrote: > One of the mitigation methods for TAA[1] is to disable TSX > support on the host system. Linux added a mechanism to disable > TSX globally through the kernel command line, and many Linux > distributions now default to tsx=off.

[libvirt PATCH 4/4] cpu_map: Don't use new noTSX models for host-model CPUs

2020-03-18 Thread Jiri Denemark
Host-model CPU definitions (and domain capabilities) will use the original CPU models (without noTSX in their name) and explicitly disable hle and rtm features. This way domains with host-model CPUs will be migratable even to older versions of libvirt which do not support the noTSX model variants.

[libvirt PATCH 3/4] cpu_x86: Honor CPU models' element

2020-03-18 Thread Jiri Denemark
Signed-off-by: Jiri Denemark --- src/cpu/cpu_x86.c | 22 +- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index 366337ef57..ce15bb0454 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -2044,10 +2044,23 @@

[libvirt PATCH 2/4] cpu_map: Add element to x86 CPU model definitions

2020-03-18 Thread Jiri Denemark
The element specifies whether a particular CPU model can be used when creating a CPU definition from raw CPUID/MSR data. The @host attribute determines whether the CPU model can be used (host='on') for creating CPU definition for host capabilities. Usability of the model for domain capabilities

[libvirt PATCH 1/4] cpu_map: Add more -noTSX x86 CPU models

2020-03-18 Thread Jiri Denemark
From: Christian Ehrhardt One of the mitigation methods for TAA[1] is to disable TSX support on the host system. Linux added a mechanism to disable TSX globally through the kernel command line, and many Linux distributions now default to tsx=off. This makes existing CPU models that have HLE and

[libvirt PATCH 0/4] cpu_map: Add more -noTSX x86 CPU models

2020-03-18 Thread Jiri Denemark
Christian Ehrhardt (1): cpu_map: Add more -noTSX x86 CPU models Jiri Denemark (3): cpu_map: Add element to x86 CPU model definitions cpu_x86: Honor CPU models' element cpu_map: Don't use new noTSX models for host-model CPUs src/cpu/cpu_x86.c | 65

Re: [PATCH v2 0/2] vmx: make 'fileName' optional for CD-ROMs

2020-03-18 Thread Ján Tomko
On a Wednesday in 2020, Pino Toscano wrote: v1 is: https://www.redhat.com/archives/libvir-list/2020-March/msg00616.html Changes from v1: - added a patch to shortcut few checks - use NULLSTR - handle floppies (poor guys) Pino Toscano (2): vmx: shortcut earlier few 'ignore' cases in

[PATCH v2 1/2] vmx: shortcut earlier few 'ignore' cases in virVMXParseDisk()

2020-03-18 Thread Pino Toscano
Move earlier the checks for skipping a hard disk when parsing a CD-DROM, and for skipping a CD-ROM when parsing a hard disk. This should have no behaviour changes, and avoids to add repeated checks in following commits. Signed-off-by: Pino Toscano --- src/vmx/vmx.c | 48

[PATCH v2 2/2] vmx: make 'fileName' optional for CD-ROMs

2020-03-18 Thread Pino Toscano
It seems like CD-ROMs may have no 'fileName' property specified in case there is nothing configured as attachment for the drive. Hence, make sure that virVMXParseDisk() do not consider it mandatory anymore, considering it an empty block cdrom device. Sadly virVMXParseDisk() is used also to parse

[PATCH v2 0/2] vmx: make 'fileName' optional for CD-ROMs

2020-03-18 Thread Pino Toscano
v1 is: https://www.redhat.com/archives/libvir-list/2020-March/msg00616.html Changes from v1: - added a patch to shortcut few checks - use NULLSTR - handle floppies (poor guys) Pino Toscano (2): vmx: shortcut earlier few 'ignore' cases in virVMXParseDisk() vmx: make 'fileName' optional for