Pull request

-----BEGIN PGP SIGNATURE-----
 
 iQEzBAABCAAdFiEEhpWov9P5fNqsNXdanKSrs4Grc8gFAl3zoOsACgkQnKSrs4Gr
 c8jeYQgAvpGixIk4yPRhxlbWmOyNao0ves8F8HE0JAbGxKHo12/EJQFAoe7H+fBe
 pNNAzOCGZUF5YplXcrHdwmrDCjCQTWUT6deAKMbUoUJrw6nOxyCQJDuV5Xzuxvbn
 ekou59uLRFGnVnBKNlVnYXJuN0AKoEAnM2Z6qnrjhBvecYVooZAJO8XTAwbQoese
 2fs5fqcEz9SOYsGPd55DahCAt8DKxBqJ4lugq6KdztxS3/2KWgXASKJtsWXsmVFX
 YeUo2Y1zo35JbvwDtGtXOTo8DTzxiHPqHDA9Jm4mL0W7nPHUvpHS+5bmFhwyF/qz
 /2M1/zOt3YXnwR2V15c3/IaekoOk2g==
 =UNxY
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/stefanha/tags/block-pull-request' into staging

Pull request

# gpg: Signature made Fri 13 Dec 2019 14:32:11 GMT
# gpg:                using RSA key 8695A8BFD3F97CDAAC35775A9CA4ABB381AB73C8
# gpg: Good signature from "Stefan Hajnoczi <stefanha@redhat.com>" [full]
# gpg:                 aka "Stefan Hajnoczi <stefanha@gmail.com>" [full]
# Primary key fingerprint: 8695 A8BF D3F9 7CDA AC35  775A 9CA4 ABB3 81AB 73C8

* remotes/stefanha/tags/block-pull-request:
  iothread: document -object iothread on man page
  virtio-blk: advertise F_WCE (F_FLUSH) if F_CONFIG_WCE is advertised

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Peter Maydell 2019-12-13 18:14:07 +00:00
commit 084a398bf8
10 changed files with 57 additions and 2 deletions

View File

@ -2149,6 +2149,7 @@ type_init(machvirt_machine_init);
static void virt_machine_4_2_options(MachineClass *mc)
{
compat_props_add(mc->compat_props, hw_compat_4_2, hw_compat_4_2_len);
}
DEFINE_VIRT_MACHINE_AS_LATEST(4, 2)

View File

@ -991,7 +991,9 @@ static uint64_t virtio_blk_get_features(VirtIODevice *vdev, uint64_t features,
virtio_add_feature(&features, VIRTIO_BLK_F_SCSI);
}
if (blk_enable_write_cache(s->blk)) {
if (blk_enable_write_cache(s->blk) ||
(s->conf.x_enable_wce_if_config_wce &&
virtio_has_feature(features, VIRTIO_BLK_F_CONFIG_WCE))) {
virtio_add_feature(&features, VIRTIO_BLK_F_WCE);
}
if (blk_is_read_only(s->blk)) {
@ -1270,6 +1272,8 @@ static Property virtio_blk_properties[] = {
conf.max_discard_sectors, BDRV_REQUEST_MAX_SECTORS),
DEFINE_PROP_UINT32("max-write-zeroes-sectors", VirtIOBlock,
conf.max_write_zeroes_sectors, BDRV_REQUEST_MAX_SECTORS),
DEFINE_PROP_BOOL("x-enable-wce-if-config-wce", VirtIOBlock,
conf.x_enable_wce_if_config_wce, true),
DEFINE_PROP_END_OF_LIST(),
};

View File

@ -27,6 +27,11 @@
#include "hw/pci/pci.h"
#include "hw/mem/nvdimm.h"
GlobalProperty hw_compat_4_2[] = {
{ "virtio-blk-device", "x-enable-wce-if-config-wce", "off" },
};
const size_t hw_compat_4_2_len = G_N_ELEMENTS(hw_compat_4_2);
GlobalProperty hw_compat_4_1[] = {
{ "virtio-pci", "x-pcie-flr-init", "off" },
};

View File

@ -431,6 +431,7 @@ static void pc_i440fx_4_2_machine_options(MachineClass *m)
m->alias = "pc";
m->is_default = 1;
pcmc->default_cpu_version = 1;
compat_props_add(m->compat_props, hw_compat_4_2, hw_compat_4_2_len);
}
DEFINE_I440FX_MACHINE(v4_2, "pc-i440fx-4.2", NULL,

View File

@ -354,6 +354,7 @@ static void pc_q35_4_2_machine_options(MachineClass *m)
pc_q35_machine_options(m);
m->alias = "q35";
pcmc->default_cpu_version = 1;
compat_props_add(m->compat_props, hw_compat_4_2, hw_compat_4_2_len);
}
DEFINE_Q35_MACHINE(v4_2, "pc-q35-4.2", NULL,

View File

@ -4496,7 +4496,7 @@ static const TypeInfo spapr_machine_info = {
*/
static void spapr_machine_4_2_class_options(MachineClass *mc)
{
/* Defaults for the latest behaviour inherited from the base class */
compat_props_add(mc->compat_props, hw_compat_4_2, hw_compat_4_2_len);
}
DEFINE_SPAPR_MACHINE(4_2, "4.2", true);

View File

@ -645,6 +645,7 @@ static void ccw_machine_4_2_instance_options(MachineState *machine)
static void ccw_machine_4_2_class_options(MachineClass *mc)
{
compat_props_add(mc->compat_props, hw_compat_4_2, hw_compat_4_2_len);
}
DEFINE_CCW_MACHINE(4_2, "4.2", true);

View File

@ -329,6 +329,9 @@ struct MachineState {
} \
type_init(machine_initfn##_register_types)
extern GlobalProperty hw_compat_4_2[];
extern const size_t hw_compat_4_2_len;
extern GlobalProperty hw_compat_4_1[];
extern const size_t hw_compat_4_1_len;

View File

@ -40,6 +40,7 @@ struct VirtIOBlkConf
uint16_t queue_size;
uint32_t max_discard_sectors;
uint32_t max_write_zeroes_sectors;
bool x_enable_wce_if_config_wce;
};
struct VirtIOBlockDataPlane;

View File

@ -4916,6 +4916,44 @@ access
CN=laptop.example.com,O=Example Home,L=London,ST=London,C=GB
@end example
@item -object iothread,id=@var{id},poll-max-ns=@var{poll-max-ns},poll-grow=@var{poll-grow},poll-shrink=@var{poll-shrink}
Creates a dedicated event loop thread that devices can be assigned to. This is
known as an IOThread. By default device emulation happens in vCPU threads or
the main event loop thread. This can become a scalability bottleneck.
IOThreads allow device emulation and I/O to run on other host CPUs.
The @option{id} parameter is a unique ID that will be used to reference this
IOThread from @option{-device ...,iothread=@var{id}}. Multiple devices can be
assigned to an IOThread. Note that not all devices support an
@option{iothread} parameter.
The @code{query-iothreads} QMP command lists IOThreads and reports their thread
IDs so that the user can configure host CPU pinning/affinity.
IOThreads use an adaptive polling algorithm to reduce event loop latency.
Instead of entering a blocking system call to monitor file descriptors and then
pay the cost of being woken up when an event occurs, the polling algorithm
spins waiting for events for a short time. The algorithm's default parameters
are suitable for many cases but can be adjusted based on knowledge of the
workload and/or host device latency.
The @option{poll-max-ns} parameter is the maximum number of nanoseconds to busy
wait for events. Polling can be disabled by setting this value to 0.
The @option{poll-grow} parameter is the multiplier used to increase the polling
time when the algorithm detects it is missing events due to not polling long
enough.
The @option{poll-shrink} parameter is the divisor used to decrease the polling
time when the algorithm detects it is spending too long polling without
encountering events.
The polling parameters can be modified at run-time using the @code{qom-set} command (where @code{iothread1} is the IOThread's @code{id}):
@example
(qemu) qom-set /objects/iothread1 poll-max-ns 100000
@end example
@end table