413 Commits

Author SHA1 Message Date
imxcc
4daf6a89f5 Add migration support for VFIO devices
Add migration support for VFIO devices and the pre-requisite for this

Signed-off-by: imxcc <xingchaochao@huawei.com>
2021-07-29 11:36:27 +08:00
openeuler-ci-bot
0ca7fd6709 !342 some bugfix sync from 20.09
From: @imxcc
Reviewed-by: @kevinzhu1
Signed-off-by: @kevinzhu1
2021-07-28 08:32:06 +00:00
imxcc
d609107256 some bugfix sync from 20.09
Signed-off-by: imxcc <xingchaochao@huawei.com>
2021-07-28 15:19:15 +08:00
openeuler-ci-bot
18493867e7 !341 bugfix: 为热插的CPU初始化PMU
From: @imxcc
Reviewed-by: @kevinzhu1
Signed-off-by: @kevinzhu1
2021-07-23 10:36:04 +00:00
imxcc
a97ab16112 hw/arm/virt: Init PMU for hotplugged vCPU
Factor out PMU init code from fdt_add_pmu_nodes and
do PMU init for hotplugged vCPU.

Signed-off-by: imxcc <xingchaochao@huawei.com>
2021-07-23 17:31:00 +08:00
openeuler-ci-bot
1088a4bdfb !340 Automatically generate code patches with openeuler !171
From: @kuhnchen18
Reviewed-by: @imxcc
Signed-off-by: @imxcc
2021-07-23 07:23:43 +00:00
Chen Qun
360c933e51 spec: Update release version with !171
increase release verison by one

Signed-off-by: Chen Qun <kuhn.chenqun@huawei.com>
2021-07-23 11:28:28 +08:00
Chen Qun
02150b62a8 spec: Update patch and changelog with !171 i386: backport qemu-4.1 bugfix !171
vl: Don't mismatch g_strsplit()/g_free()
seqlock: fix seqlock_write_unlock_impl function
target/i386: kvm: initialize microcode revision from KVM
target/i386: check for availability of MSR_IA32_UCODE_REV as an emulated MSR

Signed-off-by: Chen Qun<kuhn.chenqun@huawei.com>
2021-07-23 11:28:28 +08:00
Chen Qun
b2d0fd64d3 target/i386: check for availability of MSR_IA32_UCODE_REV as an emulated MSR
Even though MSR_IA32_UCODE_REV has been available long before Linux 5.6,
which added it to the emulated MSR list, a bug caused the microcode
version to revert to 0x100000000 on INIT.  As a result, processors other
than the bootstrap processor would not see the host microcode revision;
some Windows version complain loudly about this and crash with a
fairly explicit MICROCODE REVISION MISMATCH error.

[If running 5.6 prereleases, the kernel fix "KVM: x86: do not reset
 microcode version on INIT or RESET" should also be applied.]

Reported-by: Alex Williamson <alex.williamson@redhat.com>
Message-id: <20200211175516.10716-1-pbonzini@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-07-23 11:28:28 +08:00
Chen Qun
9ea7723f30 target/i386: kvm: initialize microcode revision from KVM
KVM can return the host microcode revision as a feature MSR.
Use it as the default value for -cpu host.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <1579544504-3616-4-git-send-email-pbonzini@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-07-23 11:28:28 +08:00
Chen Qun
e00e657c1e seqlock: fix seqlock_write_unlock_impl function
The seqlock write unlock function was incorrectly calling
seqlock_write_begin() instead of seqlock_write_end(), and was releasing
the lock before incrementing the sequence. This could lead to a race
condition and a corrupted sequence number becoming odd even though the
lock is not held.

Signed-off-by: Luc Michel <luc.michel@greensocs.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20200129144948.2161551-1-luc.michel@greensocs.com>
Fixes: 988fcafc73 ("seqlock: add QemuLockable support", 2018-08-23)
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-07-23 11:28:28 +08:00
Chen Qun
4a9e59da20 vl: Don't mismatch g_strsplit()/g_free()
It's a mismatch between g_strsplit and g_free, it will cause a memory leak as follow:

[root@localhost]# ./aarch64-softmmu/qemu-system-aarch64 -accel help
Accelerators supported in QEMU binary:
tcg
kvm
=================================================================
==1207900==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 8 byte(s) in 2 object(s) allocated from:
    #0 0xfffd700231cb in __interceptor_malloc (/lib64/libasan.so.4+0xd31cb)
    #1 0xfffd6ec57163 in g_malloc (/lib64/libglib-2.0.so.0+0x57163)
    #2 0xfffd6ec724d7 in g_strndup (/lib64/libglib-2.0.so.0+0x724d7)
    #3 0xfffd6ec73d3f in g_strsplit (/lib64/libglib-2.0.so.0+0x73d3f)
    #4 0xaaab66be5077 in main /mnt/sdc/qemu-master/qemu-4.2.0-rc0/vl.c:3517
    #5 0xfffd6e140b9f in __libc_start_main (/lib64/libc.so.6+0x20b9f)
    #6 0xaaab66bf0f53  (./build/aarch64-softmmu/qemu-system-aarch64+0x8a0f53)

Direct leak of 2 byte(s) in 2 object(s) allocated from:
    #0 0xfffd700231cb in __interceptor_malloc (/lib64/libasan.so.4+0xd31cb)
    #1 0xfffd6ec57163 in g_malloc (/lib64/libglib-2.0.so.0+0x57163)
    #2 0xfffd6ec7243b in g_strdup (/lib64/libglib-2.0.so.0+0x7243b)
    #3 0xfffd6ec73e6f in g_strsplit (/lib64/libglib-2.0.so.0+0x73e6f)
    #4 0xaaab66be5077 in main /mnt/sdc/qemu-master/qemu-4.2.0-rc0/vl.c:3517
    #5 0xfffd6e140b9f in __libc_start_main (/lib64/libc.so.6+0x20b9f)
    #6 0xaaab66bf0f53  (./build/aarch64-softmmu/qemu-system-aarch64+0x8a0f53)

Reported-by: Euler Robot <euler.robot@huawei.com>
Signed-off-by: Pan Nengyuan <pannengyuan@huawei.com>
Message-Id: <20200110091710.53424-2-pannengyuan@huawei.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-07-23 11:28:28 +08:00
openeuler-ci-bot
3228f21737 !339 Automatically generate code patches with openeuler !168 !169 !170
From: @kuhnchen18
Reviewed-by: @imxcc
Signed-off-by: @imxcc
2021-07-23 00:59:09 +00:00
Chen Qun
02c35518f2 spec: Update release version with !168 !169 !170
increase release verison by one

Signed-off-by: Chen Qun <kuhn.chenqun@huawei.com>
2021-07-22 21:28:35 +08:00
Chen Qun
81f1d7c169 spec: Update patch and changelog with !170 block: backport qemu-4.1 bugfix !170
qapi/block-core: Introduce BackupCommon
drive-backup: create do_backup_common
blockdev-backup: utilize do_backup_common
qapi: add BitmapSyncMode enum
block/backup: Add mirror sync mode 'bitmap'
block/backup: add 'never' policy to bitmap sync mode
block/backup: loosen restriction on readonly bitmaps
block/backup: hoist bitmap check into QMP interface
block/backup: deal with zero detection
mirror: Fix bdrv_has_zero_init() use
blockdev: fix coding style issues in drive_backup_prepare
blockdev: unify qmp_drive_backup and drive-backup transaction paths
blockdev: unify qmp_blockdev_backup and blockdev-backup transaction paths
blockdev: honor bdrv_try_set_aio_context() context requirements
blockdev: Return bs to the proper context on snapshot abort
block: Fix cross-AioContext blockdev-snapshot

Signed-off-by: Chen Qun<kuhn.chenqun@huawei.com>
2021-07-22 21:28:35 +08:00
Chen Qun
bdfa280bbe block: Fix cross-AioContext blockdev-snapshot
external_snapshot_prepare() tries to move the overlay to the AioContext
of the backing file (the snapshotted node). However, it's possible that
this doesn't work, but the backing file can instead be moved to the
overlay's AioContext (e.g. opening the backing chain for a mirror
target).

bdrv_append() already indirectly uses bdrv_attach_node(), which takes
care to move nodes to make sure they use the same AioContext and which
tries both directions.

So the problem has a simple fix: Just delete the unnecessary extra
bdrv_try_set_aio_context() call in external_snapshot_prepare() and
instead assert in bdrv_append() that both nodes were indeed moved to the
same AioContext.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Message-Id: <20200310113831.27293-6-kwolf@redhat.com>
Tested-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2021-07-22 21:28:35 +08:00
Chen Qun
4f28b80853 blockdev: Return bs to the proper context on snapshot abort
external_snapshot_abort() calls to bdrv_set_backing_hd(), which
returns state->old_bs to the main AioContext, as it's intended to be
used then the BDS is going to be released. As that's not the case when
aborting an external snapshot, return it to the AioContext it was
before the call.

This issue can be triggered by issuing a transaction with two actions,
a proper blockdev-snapshot-sync and a bogus one, so the second will
trigger a transaction abort. This results in a crash with an stack
trace like this one:

 #0  0x00007fa1048b28df in __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
 #1  0x00007fa10489ccf5 in __GI_abort () at abort.c:79
 #2  0x00007fa10489cbc9 in __assert_fail_base
     (fmt=0x7fa104a03300 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x5572240b44d8 "bdrv_get_aio_context(old_bs) == bdrv_get_aio_context(new_bs)", file=0x557224014d30 "block.c", line=2240, function=<optimized out>) at assert.c:92
 #3  0x00007fa1048aae96 in __GI___assert_fail
     (assertion=assertion@entry=0x5572240b44d8 "bdrv_get_aio_context(old_bs) == bdrv_get_aio_context(new_bs)", file=file@entry=0x557224014d30 "block.c", line=line@entry=2240, function=function@entry=0x5572240b5d60 <__PRETTY_FUNCTION__.31620> "bdrv_replace_child_noperm") at assert.c:101
 #4  0x0000557223e631f8 in bdrv_replace_child_noperm (child=0x557225b9c980, new_bs=new_bs@entry=0x557225c42e40) at block.c:2240
 #5  0x0000557223e68be7 in bdrv_replace_node (from=0x557226951a60, to=0x557225c42e40, errp=0x5572247d6138 <error_abort>) at block.c:4196
 #6  0x0000557223d069c4 in external_snapshot_abort (common=0x557225d7e170) at blockdev.c:1731
 #7  0x0000557223d069c4 in external_snapshot_abort (common=0x557225d7e170) at blockdev.c:1717
 #8  0x0000557223d09013 in qmp_transaction (dev_list=<optimized out>, has_props=<optimized out>, props=0x557225cc7d70, errp=errp@entry=0x7ffe704c0c98) at blockdev.c:2360
 #9  0x0000557223e32085 in qmp_marshal_transaction (args=<optimized out>, ret=<optimized out>, errp=0x7ffe704c0d08) at qapi/qapi-commands-transaction.c:44
 #10 0x0000557223ee798c in do_qmp_dispatch (errp=0x7ffe704c0d00, allow_oob=<optimized out>, request=<optimized out>, cmds=0x5572247d3cc0 <qmp_commands>) at qapi/qmp-dispatch.c:132
 #11 0x0000557223ee798c in qmp_dispatch (cmds=0x5572247d3cc0 <qmp_commands>, request=<optimized out>, allow_oob=<optimized out>) at qapi/qmp-dispatch.c:175
 #12 0x0000557223e06141 in monitor_qmp_dispatch (mon=0x557225c69ff0, req=<optimized out>) at monitor/qmp.c:120
 #13 0x0000557223e0678a in monitor_qmp_bh_dispatcher (data=<optimized out>) at monitor/qmp.c:209
 #14 0x0000557223f2f366 in aio_bh_call (bh=0x557225b9dc60) at util/async.c:117
 #15 0x0000557223f2f366 in aio_bh_poll (ctx=ctx@entry=0x557225b9c840) at util/async.c:117
 #16 0x0000557223f32754 in aio_dispatch (ctx=0x557225b9c840) at util/aio-posix.c:459
 #17 0x0000557223f2f242 in aio_ctx_dispatch (source=<optimized out>, callback=<optimized out>, user_data=<optimized out>) at util/async.c:260
 #18 0x00007fa10913467d in g_main_dispatch (context=0x557225c28e80) at gmain.c:3176
 #19 0x00007fa10913467d in g_main_context_dispatch (context=context@entry=0x557225c28e80) at gmain.c:3829
 #20 0x0000557223f31808 in glib_pollfds_poll () at util/main-loop.c:219
 #21 0x0000557223f31808 in os_host_main_loop_wait (timeout=<optimized out>) at util/main-loop.c:242
 #22 0x0000557223f31808 in main_loop_wait (nonblocking=<optimized out>) at util/main-loop.c:518
 #23 0x0000557223d13201 in main_loop () at vl.c:1828
 #24 0x0000557223bbfb82 in main (argc=<optimized out>, argv=<optimized out>, envp=<optimized out>) at vl.c:4504

RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=1779036
Signed-off-by: Sergio Lopez <slp@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2021-07-22 21:28:35 +08:00
Chen Qun
32605c9dc3 blockdev: honor bdrv_try_set_aio_context() context requirements
bdrv_try_set_aio_context() requires that the old context is held, and
the new context is not held. Fix all the occurrences where it's not
done this way.

Suggested-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Sergio Lopez <slp@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2021-07-22 21:28:35 +08:00
Chen Qun
26ad20e4a1 blockdev: unify qmp_blockdev_backup and blockdev-backup transaction paths
Issuing a blockdev-backup from qmp_blockdev_backup takes a slightly
different path than when it's issued from a transaction. In the code,
this is manifested as some redundancy between do_blockdev_backup() and
blockdev_backup_prepare().

This change unifies both paths, merging do_blockdev_backup() and
blockdev_backup_prepare(), and changing qmp_blockdev_backup() to
create a transaction instead of calling do_backup_common() direcly.

As a side-effect, now qmp_blockdev_backup() is executed inside a
drained section, as it happens when creating a blockdev-backup
transaction. This change is visible from the user's perspective, as
the job gets paused and immediately resumed before starting the actual
work.

Signed-off-by: Sergio Lopez <slp@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2021-07-22 21:28:35 +08:00
Chen Qun
38929e0e68 blockdev: unify qmp_drive_backup and drive-backup transaction paths
Issuing a drive-backup from qmp_drive_backup takes a slightly
different path than when it's issued from a transaction. In the code,
this is manifested as some redundancy between do_drive_backup() and
drive_backup_prepare().

This change unifies both paths, merging do_drive_backup() and
drive_backup_prepare(), and changing qmp_drive_backup() to create a
transaction instead of calling do_backup_common() direcly.

As a side-effect, now qmp_drive_backup() is executed inside a drained
section, as it happens when creating a drive-backup transaction. This
change is visible from the user's perspective, as the job gets paused
and immediately resumed before starting the actual work.

Also fix tests 141, 185 and 219 to cope with the extra
JOB_STATUS_CHANGE lines.

Signed-off-by: Sergio Lopez <slp@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2021-07-22 21:28:35 +08:00
Chen Qun
c9ae03e3f3 blockdev: fix coding style issues in drive_backup_prepare
Fix a couple of minor coding style issues in drive_backup_prepare.

Signed-off-by: Sergio Lopez <slp@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2021-07-22 21:28:34 +08:00
Chen Qun
19b8d6bdf3 mirror: Fix bdrv_has_zero_init() use
bdrv_has_zero_init() only has meaning for newly created images or image
areas.  If the mirror job itself did not create the image, it cannot
rely on bdrv_has_zero_init()'s result to carry any meaning.

This is the case for drive-mirror with mode=existing and always for
blockdev-mirror.

Note that we only have to zero-initialize the target with sync=full,
because other modes actually do not promise that the target will contain
the same data as the source after the job -- sync=top only promises to
copy anything allocated in the top layer, and sync=none will only copy
new I/O.  (Which is how mirror has always handled it.)

Signed-off-by: Max Reitz <mreitz@redhat.com>
Message-id: 20190724171239.8764-3-mreitz@redhat.com
Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>
2021-07-22 21:28:34 +08:00
Chen Qun
6751482910 block/backup: deal with zero detection
We have detect_zeroes option, so at least for blockdev-backup user
should define it if zero-detection is needed. For drive-backup leave
detection enabled by default but do it through existing option instead
of open-coding.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Reviewed-by: John Snow <jsnow@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Message-id: 20190730163251.755248-2-vsementsov@virtuozzo.com
Signed-off-by: John Snow <jsnow@redhat.com>
2021-07-22 21:28:34 +08:00
Chen Qun
19b6914ef5 block/backup: hoist bitmap check into QMP interface
This is nicer to do in the unified QMP interface that we have now,
because it lets us use the right terminology back at the user.

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Message-id: 20190716000117.25219-5-jsnow@redhat.com
Signed-off-by: John Snow <jsnow@redhat.com>
2021-07-22 21:28:34 +08:00
Chen Qun
13d5e14c13 block/backup: loosen restriction on readonly bitmaps
With the "never" sync policy, we actually can utilize readonly bitmaps
now. Loosen the check at the QMP level, and tighten it based on
provided arguments down at the job creation level instead.

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Message-id: 20190709232550.10724-19-jsnow@redhat.com
Signed-off-by: John Snow <jsnow@redhat.com>
2021-07-22 21:28:34 +08:00
Chen Qun
b4ad4436e1 block/backup: add 'never' policy to bitmap sync mode
This adds a "never" policy for bitmap synchronization. Regardless of if
the job succeeds or fails, we never update the bitmap. This can be used
to perform differential backups, or simply to avoid the job modifying a
bitmap.

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Message-id: 20190709232550.10724-7-jsnow@redhat.com
Signed-off-by: John Snow <jsnow@redhat.com>
2021-07-22 21:28:34 +08:00
Chen Qun
a5b372dbc6 block/backup: Add mirror sync mode 'bitmap'
We don't need or want a new sync mode for simple differences in
semantics.  Create a new mode simply named "BITMAP" that is designed to
make use of the new Bitmap Sync Mode field.

Because the only bitmap sync mode is 'on-success', this adds no new
functionality to the backup job (yet). The old incremental backup mode
is maintained as a syntactic sugar for sync=bitmap, mode=on-success.

Add all of the plumbing necessary to support this new instruction.

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Message-id: 20190709232550.10724-6-jsnow@redhat.com
Signed-off-by: John Snow <jsnow@redhat.com>
2021-07-22 21:28:34 +08:00
Chen Qun
dd816556ff qapi: add BitmapSyncMode enum
Depending on what a user is trying to accomplish, there might be a few
bitmap cleanup actions that occur when an operation is finished that
could be useful.

I am proposing three:
- NEVER: The bitmap is never synchronized against what was copied.
- ALWAYS: The bitmap is always synchronized, even on failures.
- ON-SUCCESS: The bitmap is synchronized only on success.

The existing incremental backup modes use 'on-success' semantics,
so add just that one for right now.

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Message-id: 20190709232550.10724-5-jsnow@redhat.com
Signed-off-by: John Snow <jsnow@redhat.com>
2021-07-22 21:28:34 +08:00
Chen Qun
9d74b7ea25 blockdev-backup: utilize do_backup_common
Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Message-id: 20190709232550.10724-4-jsnow@redhat.com
Signed-off-by: John Snow <jsnow@redhat.com>
2021-07-22 21:28:34 +08:00
Chen Qun
458a9d4b68 drive-backup: create do_backup_common
Create a common core that comprises the actual meat of what the backup API
boundary needs to do, and then switch drive-backup to use it.

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Message-id: 20190709232550.10724-3-jsnow@redhat.com
Signed-off-by: John Snow <jsnow@redhat.com>
2021-07-22 21:28:34 +08:00
Chen Qun
9d7ad585b2 qapi/block-core: Introduce BackupCommon
drive-backup and blockdev-backup have an awful lot of things in common
that are the same. Let's fix that.

I don't deduplicate 'target', because the semantics actually did change
between each structure. Leave that one alone so it can be documented
separately.

Where documentation was not identical, use the most up-to-date version.
For "speed", use Blockdev-Backup's version. For "sync", use
Drive-Backup's version.

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
[Maintainer edit: modified commit message. --js]
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Message-id: 20190709232550.10724-2-jsnow@redhat.com
Signed-off-by: John Snow <jsnow@redhat.com>
2021-07-22 21:28:34 +08:00
Chen Qun
50771bbc53 spec: Update patch and changelog with !169 bugfix: Move hot plug capability check to pre_plug callback !169
hw/pci/pcie: Move hot plug capability check to pre_plug callback

Signed-off-by: Chen Qun<kuhn.chenqun@huawei.com>
2021-07-22 21:28:33 +08:00
Chen Qun
54d6c83994 hw/pci/pcie: Move hot plug capability check to pre_plug callback
RH-Author: Julia Suvorova <jusual@redhat.com>
Message-id: <20200616122536.1027685-1-jusual@redhat.com>
Patchwork-id: 97548
O-Subject: [RHEL-AV-8.2.1 qemu-kvm PATCH 1/1] hw/pci/pcie: Move hot plug capability check to pre_plug callback
Bugzilla: 1820531
RH-Acked-by: Danilo de Paula <ddepaula@redhat.com>
RH-Acked-by: Auger Eric <eric.auger@redhat.com>
RH-Acked-by: Sergio Lopez Pascual <slp@redhat.com>

BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1820531
BRANCH: rhel-av-8.2.1
UPSTREAM: merged
BREW: 29422092

Check for hot plug capability earlier to avoid removing devices attached
during the initialization process.

Run qemu with an unattached drive:
  -drive file=$FILE,if=none,id=drive0 \
  -device pcie-root-port,id=rp0,slot=3,bus=pcie.0,hotplug=off
Hotplug a block device:
  device_add virtio-blk-pci,id=blk0,drive=drive0,bus=rp0
If hotplug fails on plug_cb, drive0 will be deleted.

Fixes: 0501e1aa1d32a6 ("hw/pci/pcie: Forbid hot-plug if it's disabled on the slot")

Acked-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Julia Suvorova <jusual@redhat.com>
Message-Id: <20200604125947.881210-1-jusual@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
(cherry picked from commit 0dabc0f6544f2c0310546f6d6cf3b68979580a9c)
Signed-off-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
2021-07-22 21:28:33 +08:00
Chen Qun
322d615298 spec: Update patch and changelog with !168 migration: Rate limit inside host pages !168
migration: use migration_is_active to represent active state
migration: Rate limit inside host pages

Signed-off-by: Chen Qun<kuhn.chenqun@huawei.com>
2021-07-22 21:28:32 +08:00
Chen Qun
4706000a5e migration: Rate limit inside host pages
RH-Author: Laurent Vivier <lvivier@redhat.com>
Message-id: <20200317170518.9303-1-lvivier@redhat.com>
Patchwork-id: 94374
O-Subject: [RHEL-AV-8.2.0 qemu-kvm PATCH] migration: Rate limit inside host pages
Bugzilla: 1814336
RH-Acked-by: Peter Xu <peterx@redhat.com>
RH-Acked-by: Juan Quintela <quintela@redhat.com>
RH-Acked-by: Dr. David Alan Gilbert <dgilbert@redhat.com>

From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>

When using hugepages, rate limiting is necessary within each huge
page, since a 1G huge page can take a significant time to send, so
you end up with bursty behaviour.

Fixes: 4c011c37ecb3 ("postcopy: Send whole huge pages")
Reported-by: Lin Ma <LMa@suse.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
(cherry picked from commit 97e1e06780e70f6e98a0d2df881e0c0927d3aeb6)
Signed-off-by: Laurent Vivier <lvivier@redhat.com>

BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1814336
BRANCH: rhel-av-8.2.0
UPSTREAM: Merged
BREW: https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=27283241
TESTED: Tested that the migration abort doesn't trigger an error message in
        the kernel logs on P9

Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
2021-07-22 21:28:32 +08:00
Chen Qun
21ed8e10c0 migration: use migration_is_active to represent active state
Wrap the check into a function to make it easy to read.

Signed-off-by: Wei Yang <richardw.yang@linux.intel.com>
Message-Id: <20190717005341.14140-1-richardw.yang@linux.intel.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
2021-07-22 21:28:32 +08:00
openeuler-ci-bot
170f7a1dd6 !338 Automatically generate code patches with openeuler !167
From: @kuhnchen18
Reviewed-by: @imxcc
Signed-off-by: @imxcc
2021-07-22 11:19:05 +00:00
Chen Qun
aeae451238 spec: Update release version with !167
increase release verison by one

Signed-off-by: Chen Qun <kuhn.chenqun@huawei.com>
2021-07-22 16:27:31 +08:00
Chen Qun
8eeb6bb9d4 spec: Update patch and changelog with !167 backport some qemu-4.1 bugfix !167
virtio-net: delete also control queue when TX/RX deleted
target/i386: enable monitor and ucode revision with -cpu max
target/i386: set the CPUID level to 0x14 on old machine-type
target/i386: kvm: initialize feature MSRs very early
target/i386: add a ucode-rev property

Signed-off-by: Chen Qun<kuhn.chenqun@huawei.com>
2021-07-22 16:27:31 +08:00
Chen Qun
508a514225 target/i386: add a ucode-rev property
RH-Author: Paolo Bonzini <pbonzini@redhat.com>
Message-id: <20200217162316.2464-3-pbonzini@redhat.com>
Patchwork-id: 93909
O-Subject: [RHEL-AV-8.2.0 qemu-kvm PATCH 2/6] target/i386: add a ucode-rev property
Bugzilla: 1791648
RH-Acked-by: Eduardo Habkost <ehabkost@redhat.com>
RH-Acked-by: Maxim Levitsky <mlevitsk@redhat.com>
RH-Acked-by: Dr. David Alan Gilbert <dgilbert@redhat.com>

Add the property and plumb it in TCG and HVF (the latter of which
tried to support returning a constant value but used the wrong MSR).

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <1579544504-3616-3-git-send-email-pbonzini@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
(cherry picked from commit 4e45aff398cd1542c2a384a2a3b8600f23337d86)
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
2021-07-22 16:27:31 +08:00
Chen Qun
3dd3d58959 target/i386: kvm: initialize feature MSRs very early
RH-Author: Paolo Bonzini <pbonzini@redhat.com>
Message-id: <20200217162316.2464-2-pbonzini@redhat.com>
Patchwork-id: 93899
O-Subject: [RHEL-AV-8.2.0 qemu-kvm PATCH 1/6] target/i386: kvm: initialize feature MSRs very early
Bugzilla: 1791648
RH-Acked-by: Philippe Mathieu-Daudé <philmd@redhat.com>
RH-Acked-by: Maxim Levitsky <mlevitsk@redhat.com>
RH-Acked-by: Dr. David Alan Gilbert <dgilbert@redhat.com>

Some read-only MSRs affect the behavior of ioctls such as
KVM_SET_NESTED_STATE.  We can initialize them once and for all
right after the CPU is realized, since they will never be modified
by the guest.

Reported-by: Qingua Cheng <qcheng@redhat.com>
Cc: qemu-stable@nongnu.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <1579544504-3616-2-git-send-email-pbonzini@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
(cherry picked from commit 420ae1fc51c99abfd03b1c590f55617edd2a2bed)
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
2021-07-22 16:27:31 +08:00
Chen Qun
bf66fc7980 target/i386: set the CPUID level to 0x14 on old machine-type
RH-Author: plai@redhat.com
Message-id: <20200507220923.13723-1-plai@redhat.com>
Patchwork-id: 96347
O-Subject: [RHEL8.2.1 AV qemu-kvm PATCH RESEND] target/i386: set the CPUID level to 0x14 on old machine-type
Bugzilla: 1513681
RH-Acked-by: Eduardo Habkost <ehabkost@redhat.com>
RH-Acked-by: Igor Mammedov <imammedo@redhat.com>
RH-Acked-by: Danilo de Paula <ddepaula@redhat.com>

From: Luwei Kang <luwei.kang@intel.com>

BZ https://bugzilla.redhat.com/show_bug.cgi?id=1513681
Brew: http://brewweb.devel.redhat.com/brew/taskinfo?taskID=28146304
Branch: rhel-av-8.2.1

Tested on intel-icelake-y-01.ml3.eng.bos.redhat.com.

The CPUID level need to be set to 0x14 manually on old
machine-type if Intel PT is enabled in guest. E.g. the
CPUID[0].EAX(level)=7 and CPUID[7].EBX[25](intel-pt)=1 when the
Qemu with "-machine pc-i440fx-3.1 -cpu qemu64,+intel-pt" parameter.

Some Intel PT capabilities are exposed by leaf 0x14 and the
missing capabilities will cause some MSRs access failed.
This patch add a warning message to inform the user to extend
the CPUID level.

Suggested-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Luwei Kang <luwei.kang@intel.com>
Message-Id: <1584031686-16444-1-git-send-email-luwei.kang@intel.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
(cherry picked from commit ddc2fc9e4e42ebce48b088963dc7fbd1c08d5f33)
Signed-off-by: Paul Lai <plai@redhat.com>
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
2021-07-22 16:27:31 +08:00
Chen Qun
b84eae3513 target/i386: enable monitor and ucode revision with -cpu max
RH-Author: Paolo Bonzini <pbonzini@redhat.com>
Message-id: <20200217162316.2464-7-pbonzini@redhat.com>
Patchwork-id: 93910
O-Subject: [RHEL-AV-8.2.0 qemu-kvm PATCH 6/6] target/i386: enable monitor and ucode revision with -cpu max
Bugzilla: 1791648
RH-Acked-by: Philippe Mathieu-Daudé <philmd@redhat.com>
RH-Acked-by: Maxim Levitsky <mlevitsk@redhat.com>
RH-Acked-by: Dr. David Alan Gilbert <dgilbert@redhat.com>

These two features were incorrectly tied to host_cpuid_required rather than
cpu->max_features.  As a result, -cpu max was not enabling either MONITOR
features or ucode revision.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
(cherry picked from commit be02cda3afde60d219786e23c3f8edb53aec8e17)

[RHEL7: context, upstream uses g_autofree]

Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
2021-07-22 16:27:31 +08:00
Chen Qun
2e461358e3 virtio-net: delete also control queue when TX/RX deleted
RH-Author: Julia Suvorova <jusual@redhat.com>
Message-id: <20200219213431.11913-5-jusual@redhat.com>
Patchwork-id: 93983
O-Subject: [RHEL-AV-8.2.0 qemu-kvm PATCH 4/4] virtio-net: delete also control queue when TX/RX deleted
Bugzilla: 1791590
RH-Acked-by: Danilo de Paula <ddepaula@redhat.com>
RH-Acked-by: Stefano Garzarella <sgarzare@redhat.com>
RH-Acked-by: Michael S. Tsirkin <mst@redhat.com>

From: Yuri Benditovich <yuri.benditovich@daynix.com>

https://bugzilla.redhat.com/show_bug.cgi?id=1708480
If the control queue is not deleted together with TX/RX, it
later will be ignored in freeing cache resources and hot
unplug will not be completed.

Cc: qemu-stable@nongnu.org
Signed-off-by: Yuri Benditovich <yuri.benditovich@daynix.com>
Message-Id: <20191226043649.14481-3-yuri.benditovich@daynix.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
(cherry picked from commit d945d9f1731244ef341f74ede93120fc9de35913)
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
2021-07-22 16:27:30 +08:00
openeuler-ci-bot
f814f65ab1 !337 Automatically generate code patches with openeuler !166
From: @kuhnchen18
Reviewed-by: @imxcc
Signed-off-by: @imxcc
2021-07-22 07:46:57 +00:00
Chen Qun
0cfcdff701 spec: Update release version with !166
increase release verison by one

Signed-off-by: Chen Qun <kuhn.chenqun@huawei.com>
2021-07-22 11:27:53 +08:00
Chen Qun
1f5c5e9ea8 spec: Update patch and changelog with !166 mirror/qcow2: backport qemu-4.1 bugfix !166
qcow2: Fix qcow2_alloc_cluster_abort() for external data file
mirror: Wait only for in-flight operations

Signed-off-by: Chen Qun<kuhn.chenqun@huawei.com>
2021-07-22 11:27:53 +08:00
Chen Qun
d59e6f7dbe mirror: Wait only for in-flight operations
mirror_wait_for_free_in_flight_slot() just picks a random operation to
wait for. However, a MirrorOp is already in s->ops_in_flight when
mirror_co_read() waits for free slots, so if not enough slots are
immediately available, an operation can end up waiting for itself, or
two or more operations can wait for each other to complete, which
results in a hang.

Fix this by adding a flag to MirrorOp that tells us if the request is
already in flight (and therefore occupies slots that it will later
free), and picking only such operations for waiting.

Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1794692
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Message-Id: <20200326153628.4869-3-kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2021-07-22 11:27:53 +08:00
Chen Qun
e9b39dadb6 qcow2: Fix qcow2_alloc_cluster_abort() for external data file
For external data file, cluster allocations return an offset in the data
file and are not refcounted. In this case, there is nothing to do for
qcow2_alloc_cluster_abort(). Freeing the same offset in the qcow2 file
is wrong and causes crashes in the better case or image corruption in
the worse case.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Message-Id: <20200211094900.17315-3-kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2021-07-22 11:27:53 +08:00
openeuler-ci-bot
d7b0ae52b5 !335 Automatically generate code patches with openeuler !164 !165
From: @kuhnchen18
Reviewed-by: @imxcc
Signed-off-by: @imxcc
2021-07-21 17:27:49 +00:00