x86 and memory backends queue, 2016-09-05

This includes a few features that were submitted just after hard
 freeze, and a bug fix for memory backend initialization ordering.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABCAAGBQJXzcx2AAoJECgHk2+YTcWmTKoP/1xCdbQoYPui9lPbh2z/A6PL
 jmi6Koxy1ohmNaJcxrsnh7uM6QBvidU99iUPZNqNuqLOgVj/T4UPA7+rbesKwJJQ
 bG4cFK2puAemlXggvqk2hLfVu6C9dlL3W52DqnsYcVjyJBNpWYcessORNRHfRESw
 9LohZzMiBoMpgetRc8GgfnWW2C65YbruLXNA73o1YQDv7XljeUdYpuG9wHaeMCKg
 chFlsPIU+JzynefhK8TnP48ju6CGL0aFY3VplHn3OfTDYN9Vvp3Ap7JjJMdKU15M
 +6bnTkJUkoA8T3HMiRshGyXd+HGhgmxsjBMSmU2mDR0Z3sjR51F/V5PJzd+OcLLE
 LSZ5kj66BbPppESvnTHGTQkKQn+L4d6s4EzD+NkExEAlm2/b3Ya6CJ4wQecBWfkp
 r7i2ylQTf8W92qpEBe/HhArI3YNzcFtQvhaVMqqj2O3/FPVtAjJBw5PBHzuNjv9z
 O8lvT/UAIgTeWwVAB+hRGXfU4EogK7P9ijEQt/Dmo0EaKP65OLf5SoFfPCuhClId
 XqKGNLzRHmvvALrxLWxoRfnbTMIEGxZVP7QW9UCLM5gaDrJEyelebXg0pR8LEVpD
 MvxH5h8OAJQ4r6VtG3UqZ+CBjH6b80H463YspBclNLdhGkZNd27c/12/Mk66q7nI
 EqfbZ8Y6hvPE3XRWoWDB
 =BhnF
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/ehabkost/tags/x86-pull-request' into staging

x86 and memory backends queue, 2016-09-05

This includes a few features that were submitted just after hard
freeze, and a bug fix for memory backend initialization ordering.

# gpg: Signature made Mon 05 Sep 2016 20:50:14 BST
# gpg:                using RSA key 0x2807936F984DC5A6
# gpg: Good signature from "Eduardo Habkost <ehabkost@redhat.com>"
# Primary key fingerprint: 5A32 2FD5 ABC4 D3DB ACCF  D1AA 2807 936F 984D C5A6

* remotes/ehabkost/tags/x86-pull-request:
  vl: Delay initialization of memory backends
  vhost-user-test: Use libqos instead of pxe-virtio.rom
  target-i386: Add more Intel AVX-512 instructions support
  exec: Ensure the only one cpu_index allocation method is used

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Peter Maydell 2016-09-06 13:33:17 +01:00
commit 085c915019
6 changed files with 69 additions and 9 deletions

7
exec.c
View File

@ -598,11 +598,14 @@ AddressSpace *cpu_get_address_space(CPUState *cpu, int asidx)
}
#endif
static bool cpu_index_auto_assigned;
static int cpu_get_free_index(void)
{
CPUState *some_cpu;
int cpu_index = 0;
cpu_index_auto_assigned = true;
CPU_FOREACH(some_cpu) {
cpu_index++;
}
@ -620,6 +623,8 @@ void cpu_exec_exit(CPUState *cpu)
return;
}
assert(!(cpu_index_auto_assigned && cpu != QTAILQ_LAST(&cpus, CPUTailQ)));
QTAILQ_REMOVE(&cpus, cpu, node);
cpu->node.tqe_prev = NULL;
cpu->cpu_index = UNASSIGNED_CPU_INDEX;
@ -663,6 +668,8 @@ void cpu_exec_init(CPUState *cpu, Error **errp)
if (cpu->cpu_index == UNASSIGNED_CPU_INDEX) {
cpu->cpu_index = cpu_get_free_index();
assert(cpu->cpu_index != UNASSIGNED_CPU_INDEX);
} else {
assert(!cpu_index_auto_assigned);
}
QTAILQ_INSERT_TAIL(&cpus, cpu, node);
cpu_list_unlock();

View File

@ -298,14 +298,18 @@ static const char *svm_feature_name[] = {
};
static const char *cpuid_7_0_ebx_feature_name[] = {
"fsgsbase", "tsc_adjust", NULL, "bmi1", "hle", "avx2", NULL, "smep",
"bmi2", "erms", "invpcid", "rtm", NULL, NULL, "mpx", NULL,
"avx512f", NULL, "rdseed", "adx", "smap", NULL, "pcommit", "clflushopt",
"clwb", NULL, "avx512pf", "avx512er", "avx512cd", NULL, NULL, NULL,
"fsgsbase", "tsc_adjust", NULL, "bmi1",
"hle", "avx2", NULL, "smep",
"bmi2", "erms", "invpcid", "rtm",
NULL, NULL, "mpx", NULL,
"avx512f", "avx512dq", "rdseed", "adx",
"smap", "avx512ifma", "pcommit", "clflushopt",
"clwb", NULL, "avx512pf", "avx512er",
"avx512cd", NULL, "avx512bw", "avx512vl",
};
static const char *cpuid_7_0_ecx_feature_name[] = {
NULL, NULL, "umip", "pku",
NULL, "avx512vbmi", "umip", "pku",
"ospke", NULL, NULL, NULL,
NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL,

View File

@ -606,16 +606,21 @@ typedef uint32_t FeatureWordArray[FEATURE_WORDS];
#define CPUID_7_0_EBX_RTM (1U << 11)
#define CPUID_7_0_EBX_MPX (1U << 14)
#define CPUID_7_0_EBX_AVX512F (1U << 16) /* AVX-512 Foundation */
#define CPUID_7_0_EBX_AVX512DQ (1U << 17) /* AVX-512 Doubleword & Quadword Instrs */
#define CPUID_7_0_EBX_RDSEED (1U << 18)
#define CPUID_7_0_EBX_ADX (1U << 19)
#define CPUID_7_0_EBX_SMAP (1U << 20)
#define CPUID_7_0_EBX_AVX512IFMA (1U << 21) /* AVX-512 Integer Fused Multiply Add */
#define CPUID_7_0_EBX_PCOMMIT (1U << 22) /* Persistent Commit */
#define CPUID_7_0_EBX_CLFLUSHOPT (1U << 23) /* Flush a Cache Line Optimized */
#define CPUID_7_0_EBX_CLWB (1U << 24) /* Cache Line Write Back */
#define CPUID_7_0_EBX_AVX512PF (1U << 26) /* AVX-512 Prefetch */
#define CPUID_7_0_EBX_AVX512ER (1U << 27) /* AVX-512 Exponential and Reciprocal */
#define CPUID_7_0_EBX_AVX512CD (1U << 28) /* AVX-512 Conflict Detection */
#define CPUID_7_0_EBX_AVX512BW (1U << 30) /* AVX-512 Byte and Word Instructions */
#define CPUID_7_0_EBX_AVX512VL (1U << 31) /* AVX-512 Vector Length Extensions */
#define CPUID_7_0_ECX_VBMI (1U << 1) /* AVX-512 Vector Byte Manipulation Instrs */
#define CPUID_7_0_ECX_UMIP (1U << 2)
#define CPUID_7_0_ECX_PKU (1U << 3)
#define CPUID_7_0_ECX_OSPKE (1U << 4)

View File

@ -622,7 +622,7 @@ tests/usb-hcd-ehci-test$(EXESUF): tests/usb-hcd-ehci-test.o $(libqos-usb-obj-y)
tests/usb-hcd-xhci-test$(EXESUF): tests/usb-hcd-xhci-test.o $(libqos-usb-obj-y)
tests/pc-cpu-test$(EXESUF): tests/pc-cpu-test.o
tests/postcopy-test$(EXESUF): tests/postcopy-test.o
tests/vhost-user-test$(EXESUF): tests/vhost-user-test.o qemu-char.o qemu-timer.o $(qtest-obj-y) $(test-io-obj-y)
tests/vhost-user-test$(EXESUF): tests/vhost-user-test.o qemu-char.o qemu-timer.o $(qtest-obj-y) $(test-io-obj-y) $(libqos-virtio-obj-y)
tests/qemu-iotests/socket_scm_helper$(EXESUF): tests/qemu-iotests/socket_scm_helper.o
tests/test-qemu-opts$(EXESUF): tests/test-qemu-opts.o $(test-util-obj-y)
tests/test-write-threshold$(EXESUF): tests/test-write-threshold.o $(test-block-obj-y)

View File

@ -16,8 +16,13 @@
#include "qemu/sockets.h"
#include "sysemu/char.h"
#include "sysemu/sysemu.h"
#include "libqos/libqos.h"
#include "libqos/pci-pc.h"
#include "libqos/virtio-pci.h"
#include <linux/vhost.h>
#include <linux/virtio_ids.h>
#include <linux/virtio_net.h>
#include <sys/vfs.h>
/* GLIB version compatibility flags */
@ -29,14 +34,13 @@
#define HAVE_MONOTONIC_TIME
#endif
#define QEMU_CMD_ACCEL " -machine accel=tcg"
#define QEMU_CMD_MEM " -m %d -object memory-backend-file,id=mem,size=%dM,"\
"mem-path=%s,share=on -numa node,memdev=mem"
#define QEMU_CMD_CHR " -chardev socket,id=%s,path=%s%s"
#define QEMU_CMD_NETDEV " -netdev vhost-user,id=net0,chardev=%s,vhostforce"
#define QEMU_CMD_NET " -device virtio-net-pci,netdev=net0,romfile=./pc-bios/pxe-virtio.rom"
#define QEMU_CMD_NET " -device virtio-net-pci,netdev=net0"
#define QEMU_CMD QEMU_CMD_ACCEL QEMU_CMD_MEM QEMU_CMD_CHR \
#define QEMU_CMD QEMU_CMD_MEM QEMU_CMD_CHR \
QEMU_CMD_NETDEV QEMU_CMD_NET
#define HUGETLBFS_MAGIC 0x958458f6
@ -136,6 +140,30 @@ typedef struct TestServer {
static const char *tmpfs;
static const char *root;
static void init_virtio_dev(TestServer *s)
{
QPCIBus *bus;
QVirtioPCIDevice *dev;
uint32_t features;
bus = qpci_init_pc();
g_assert_nonnull(bus);
dev = qvirtio_pci_device_find(bus, VIRTIO_ID_NET);
g_assert_nonnull(dev);
qvirtio_pci_device_enable(dev);
qvirtio_reset(&qvirtio_pci, &dev->vdev);
qvirtio_set_acknowledge(&qvirtio_pci, &dev->vdev);
qvirtio_set_driver(&qvirtio_pci, &dev->vdev);
features = qvirtio_get_features(&qvirtio_pci, &dev->vdev);
features = features & VIRTIO_NET_F_MAC;
qvirtio_set_features(&qvirtio_pci, &dev->vdev, features);
qvirtio_set_driver_ok(&qvirtio_pci, &dev->vdev);
}
static void wait_for_fds(TestServer *s)
{
gint64 end_time;
@ -548,6 +576,7 @@ static void test_migrate(void)
from = qtest_start(cmd);
g_free(cmd);
init_virtio_dev(s);
wait_for_fds(s);
size = get_log_size(s);
g_assert_cmpint(size, ==, (2 * 1024 * 1024) / (VHOST_LOG_PAGE * 8));
@ -662,6 +691,7 @@ static void test_reconnect_subprocess(void)
qtest_start(cmd);
g_free(cmd);
init_virtio_dev(s);
wait_for_fds(s);
wait_for_rings_started(s, 2);
@ -728,6 +758,7 @@ int main(int argc, char **argv)
s = qtest_start(qemu_cmd);
g_free(qemu_cmd);
init_virtio_dev(server);
qtest_add_data_func("/vhost-user/read-guest-mem", server, read_guest_mem);
qtest_add_func("/vhost-user/migrate", test_migrate);

13
vl.c
View File

@ -2810,6 +2810,19 @@ static bool object_create_initial(const char *type)
return false;
}
/* Memory allocation by backends needs to be done
* after configure_accelerator() (due to the tcg_enabled()
* checks at memory_region_init_*()).
*
* Also, allocation of large amounts of memory may delay
* chardev initialization for too long, and trigger timeouts
* on software that waits for a monitor socket to be created
* (e.g. libvirt).
*/
if (g_str_has_prefix(type, "memory-backend-")) {
return false;
}
return true;
}