[libvirt] [PATCH 0/6] qemu: PCI-related bug fixes and cleanups
by Andrea Bolognani
Patches 1-3 are straightforward code cleanups.
Patch 4 is a massive reduction in the size of our test suite,
achieved by removing legacy PCI controllers from test cases
that don't need them.
Patch 5 removes some incorrect assumptions that, for all
intents and purposes, made the availablilty of pci-bridge
mandatory even for guests that only used PCIe controllers
and devices.
Patch 6 reduces the test suite in size further by dropping
the capabilities that are no longer required after patch 5:
if you apply this patch before the previous one and run the
test suite, you'll get a lot of failures.
Andrea Bolognani (6):
conf: Remove dead code
qemu: Make switch statements more strict
conf: Make switch statements more strict
tests: Reduce usage of legacy PCI controllers on PCIe machines
qemu: Allow multiple bridges when pci-bridges is not available
tests: Reduce QEMU_CAPS_DEVICE_{DMI_TO_,}PCI_BRIDGE usage
src/conf/domain_addr.c | 17 +-
src/conf/domain_conf.c | 12 +-
src/qemu/qemu_command.c | 23 +--
src/qemu/qemu_domain_address.c | 10 +-
.../qemuxml2argv-boot-floppy-q35.args | 5 +-
.../qemuxml2argv-boot-floppy-q35.xml | 10 +-
.../qemuxml2argv-bootindex-floppy-q35.args | 5 +-
.../qemuxml2argv-bootindex-floppy-q35.xml | 10 +-
.../qemuxml2argv-intel-iommu-machine.args | 5 +-
.../qemuxml2argv-intel-iommu-machine.xml | 13 +-
.../qemuxml2argvdata/qemuxml2argv-intel-iommu.args | 5 +-
.../qemuxml2argvdata/qemuxml2argv-intel-iommu.xml | 13 +-
.../qemuxml2argv-pcie-expander-bus-bad-bus.xml | 18 +-
.../qemuxml2argv-pcie-expander-bus.args | 136 ++++++-------
.../qemuxml2argv-pcie-expander-bus.xml | 85 ++++----
.../qemuxml2argv-pcie-root-port-too-many.xml | 6 +-
.../qemuxml2argv-pcie-root-port.args | 6 +-
.../qemuxml2argv-pcie-root-port.xml | 6 +-
.../qemuxml2argv-pcie-switch-downstream-port.args | 22 +-
.../qemuxml2argv-pcie-switch-downstream-port.xml | 18 +-
.../qemuxml2argv-pcie-switch-upstream-port.args | 10 +-
.../qemuxml2argv-pcie-switch-upstream-port.xml | 10 +-
.../qemuxml2argv-pcihole64-q35.args | 2 -
.../qemuxml2argv-pcihole64-q35.xml | 2 -
.../qemuxml2argv-q35-dmi-bad-address1.xml | 5 +-
.../qemuxml2argv-q35-dmi-bad-address2.xml | 21 +-
.../qemuxml2argv-q35-wrong-root.xml | 7 -
tests/qemuxml2argvdata/qemuxml2argv-q35.args | 2 -
tests/qemuxml2argvdata/qemuxml2argv-q35.xml | 7 -
.../qemuxml2argv-usb-controller-default-q35.args | 2 -
.../qemuxml2argv-usb-controller-default-q35.xml | 5 -
.../qemuxml2argv-usb-controller-explicit-q35.args | 2 -
.../qemuxml2argv-usb-controller-explicit-q35.xml | 5 -
.../qemuxml2argv-vcpu-placement-static.xml | 6 -
tests/qemuxml2argvtest.c | 83 ++------
.../qemuxml2xmlout-intel-iommu.xml | 13 +-
.../qemuxml2xmlout-pcie-expander-bus.xml | 225 ++++++++++-----------
.../qemuxml2xmlout-pcie-root-port.xml | 15 +-
.../qemuxml2xmlout-pcie-switch-downstream-port.xml | 61 +++---
.../qemuxml2xmlout-pcie-switch-upstream-port.xml | 25 +--
.../qemuxml2xmlout-pcihole64-q35.xml | 9 -
tests/qemuxml2xmloutdata/qemuxml2xmlout-q35.xml | 9 -
.../qemuxml2xmlout-usb-controller-default-q35.xml | 9 -
.../qemuxml2xmlout-usb-controller-explicit-q35.xml | 9 -
.../qemuxml2xmlout-vcpu-placement-static.xml | 9 -
tests/qemuxml2xmltest.c | 56 ++---
46 files changed, 354 insertions(+), 680 deletions(-)
--
2.7.4
7 years, 9 months
[libvirt] [PATCH] virsh: Alter formatting a bit for output of domstats fields
by John Ferlan
Alter the formatting of each line to not give the appearance of
one long run-on sentance and to be consistent between the various
elements of collected/displayed data. The formatting should fit
within the 80 character display. This removes the need for commas
at the end of each line.
Signed-off-by: John Ferlan <jferlan(a)redhat.com>
---
tools/virsh.pod | 163 ++++++++++++++++++++++++++++++++------------------------
1 file changed, 93 insertions(+), 70 deletions(-)
diff --git a/tools/virsh.pod b/tools/virsh.pod
index a470409..c3cd6bb 100644
--- a/tools/virsh.pod
+++ b/tools/virsh.pod
@@ -885,67 +885,85 @@ Note that - depending on the hypervisor type and version or the domain state
- not all of the following statistics may be returned.
When selecting the I<--state> group the following fields are returned:
-"state.state" - state of the VM, returned as number from virDomainState enum,
-"state.reason" - reason for entering given state, returned as int from
-virDomain*Reason enum corresponding to given state.
+
+ "state.state" - state of the VM, returned as number from
+ virDomainState enum
+ "state.reason" - reason for entering given state, returned
+ as int from virDomain*Reason enum corresponding
+ to given state
I<--cpu-total> returns:
-"cpu.time" - total cpu time spent for this domain in nanoseconds,
-"cpu.user" - user cpu time spent in nanoseconds,
-"cpu.system" - system cpu time spent in nanoseconds
+
+ "cpu.time" - total cpu time spent for this domain in nanoseconds
+ "cpu.user" - user cpu time spent in nanoseconds
+ "cpu.system" - system cpu time spent in nanoseconds
I<--balloon> returns:
-"balloon.current" - the memory in kiB currently used,
-"balloon.maximum" - the maximum memory in kiB allowed,
-"balloon.swap_in" - the amount of data read from swap space (in kB),
-"balloon.swap_out" - the amount of memory written out to swap space (in kB),
-"balloon.major_fault" - the number of page faults then disk IO was required,
-"balloon.minor_fault" - the number of other page faults,
-"balloon.unused" - the amount of memory left unused by the system (in kB),
-"balloon.available" - the amount of usable memory as seen by the domain (in kB),
-"balloon.rss" - Resident Set Size of running domain's process (in kB),
-"balloon.usable" - the amount of memory which can be reclaimed by balloon
-without causing host swapping (in KB),
-"balloon.last-update" - timestamp of the last update of statistics (in seconds)
+
+ "balloon.current" - the memory in kiB currently used
+ "balloon.maximum" - the maximum memory in kiB allowed
+ "balloon.swap_in" - the amount of data read from swap space (in kB)
+ "balloon.swap_out" - the amount of memory written out to swap
+ space (in kB)
+ "balloon.major_fault" - the number of page faults then disk IO
+ was required
+ "balloon.minor_fault" - the number of other page faults
+ "balloon.unused" - the amount of memory left unused by the
+ system (in kB)
+ "balloon.available" - the amount of usable memory as seen by
+ the domain (in kB)
+ "balloon.rss" - Resident Set Size of running domain's process
+ (in kB)
+ "balloon.usable" - the amount of memory which can be reclaimed by
+ balloon without causing host swapping (in KB)
+ "balloon.last-update" - timestamp of the last update of statistics
+ (in seconds)
I<--vcpu> returns:
-"vcpu.current" - current number of online virtual CPUs,
-"vcpu.maximum" - maximum number of online virtual CPUs,
-"vcpu.<num>.state" - state of the virtual CPU <num>, as number
-from virVcpuState enum,
-"vcpu.<num>.time" - virtual cpu time spent by virtual CPU <num>
- (in microseconds),
-"vcpu.<num>.wait" - virtual cpu time spent by virtual CPU <num>
-waiting on I/O (in microseconds),
-"vcpu.<num>.halted" - virtual CPU <num> is halted: yes or no (may indicate
-the processor is idle or even disabled, depending on the architecture)
+
+ "vcpu.current" - current number of online virtual CPUs
+ "vcpu.maximum" - maximum number of online virtual CPUs
+ "vcpu.<num>.state" - state of the virtual CPU <num>, as
+ number from virVcpuState enum
+ "vcpu.<num>.time" - virtual cpu time spent by virtual
+ CPU <num> (in microseconds)
+ "vcpu.<num>.wait" - virtual cpu time spent by virtual
+ CPU <num> waiting on I/O (in microseconds)
+ "vcpu.<num>.halted" - virtual CPU <num> is halted: yes or
+ no (may indicate the processor is idle
+ or even disabled, depending on the
+ architecture)
I<--interface> returns:
-"net.count" - number of network interfaces on this domain,
-"net.<num>.name" - name of the interface <num>,
-"net.<num>.rx.bytes" - number of bytes received,
-"net.<num>.rx.pkts" - number of packets received,
-"net.<num>.rx.errs" - number of receive errors,
-"net.<num>.rx.drop" - number of receive packets dropped,
-"net.<num>.tx.bytes" - number of bytes transmitted,
-"net.<num>.tx.pkts" - number of packets transmitted,
-"net.<num>.tx.errs" - number of transmission errors,
-"net.<num>.tx.drop" - number of transmit packets dropped
+
+ "net.count" - number of network interfaces on this domain
+ "net.<num>.name" - name of the interface <num>
+ "net.<num>.rx.bytes" - number of bytes received
+ "net.<num>.rx.pkts" - number of packets received
+ "net.<num>.rx.errs" - number of receive errors
+ "net.<num>.rx.drop" - number of receive packets dropped
+ "net.<num>.tx.bytes" - number of bytes transmitted
+ "net.<num>.tx.pkts" - number of packets transmitted
+ "net.<num>.tx.errs" - number of transmission errors
+ "net.<num>.tx.drop" - number of transmit packets dropped
I<--perf> returns the statistics of all enabled perf events:
-"perf.cmt" - the cache usage in Byte currently used,
-"perf.mbmt" - total system bandwidth from one level of cache,
-"perf.mbml" - bandwidth of memory traffic for a memory controller,
-"perf.cpu_cycles" - the count of cpu cycles (total/elapsed),
-"perf.instructions" - the count of instructions,
-"perf.cache_references" - the count of cache hits,
-"perf.cache_misses" - the count of caches misses,
-"perf.branch_instructions" - the count of branch instructions,
-"perf.branch_misses" - the count of branch misses,
-"perf.bus_cycles" - the count of bus cycles,
-"perf.stalled_cycles_frontend" - the count of stalled frontend cpu cycles,
-"perf.stalled_cycles_backend" - the count of stalled backend cpu cycles,
-"perf.ref_cpu_cycles" - the count of ref cpu cycles
+
+ "perf.cmt" - the cache usage in Byte currently used
+ "perf.mbmt" - total system bandwidth from one level of cache
+ "perf.mbml" - bandwidth of memory traffic for a memory controller
+ "perf.cpu_cycles" - the count of cpu cycles (total/elapsed)
+ "perf.instructions" - the count of instructions
+ "perf.cache_references" - the count of cache hits
+ "perf.cache_misses" - the count of caches misses
+ "perf.branch_instructions" - the count of branch instructions
+ "perf.branch_misses" - the count of branch misses
+ "perf.bus_cycles" - the count of bus cycles
+ "perf.stalled_cycles_frontend" - the count of stalled frontend
+ cpu cycles
+ "perf.stalled_cycles_backend" - the count of stalled backend
+ cpu cycles
+ "perf.ref_cpu_cycles" - the count of ref cpu cycles
See the B<perf> command for more details about each event.
@@ -954,25 +972,30 @@ domain. Using the I<--backing> flag extends this information to
cover all resources in the backing chain, rather than the default
of limiting information to the active layer for each guest disk.
Information listed includes:
-"block.count" - number of block devices being listed,
-"block.<num>.name" - name of the target of the block device <num> (the
-same name for multiple entries if I<--backing> is present),
-"block.<num>.backingIndex" - when I<--backing> is present, matches up
-with the <backingStore> index listed in domain XML for backing files,
-"block.<num>.path" - file source of block device <num>, if it is a
-local file or block device,
-"block.<num>.rd.reqs" - number of read requests,
-"block.<num>.rd.bytes" - number of read bytes,
-"block.<num>.rd.times" - total time (ns) spent on reads,
-"block.<num>.wr.reqs" - number of write requests,
-"block.<num>.wr.bytes" - number of written bytes,
-"block.<num>.wr.times" - total time (ns) spent on writes,
-"block.<num>.fl.reqs" - total flush requests,
-"block.<num>.fl.times" - total time (ns) spent on cache flushing,
-"block.<num>.errors" - Xen only: the 'oo_req' value,
-"block.<num>.allocation" - offset of highest written sector in bytes,
-"block.<num>.capacity" - logical size of source file in bytes,
-"block.<num>.physical" - physical size of source file in bytes
+
+ "block.count" - number of block devices being listed
+ "block.<num>.name" - name of the target of the block
+ device <num> (the same name for
+ multiple entries if I<--backing>
+ is present)
+ "block.<num>.backingIndex" - when I<--backing> is present,
+ matches up with the <backingStore>
+ index listed in domain XML for
+ backing files
+ "block.<num>.path" - file source of block device <num>, if
+ it is a local file or block device
+ "block.<num>.rd.reqs" - number of read requests
+ "block.<num>.rd.bytes" - number of read bytes
+ "block.<num>.rd.times" - total time (ns) spent on reads
+ "block.<num>.wr.reqs" - number of write requests
+ "block.<num>.wr.bytes" - number of written bytes
+ "block.<num>.wr.times" - total time (ns) spent on writes
+ "block.<num>.fl.reqs" - total flush requests
+ "block.<num>.fl.times" - total time (ns) spent on cache flushing
+ "block.<num>.errors" - Xen only: the 'oo_req' value
+ "block.<num>.allocation" - offset of highest written sector in bytes
+ "block.<num>.capacity" - logical size of source file in bytes
+ "block.<num>.physical" - physical size of source file in bytes
Selecting a specific statistics groups doesn't guarantee that the
daemon supports the selected group of stats. Flag I<--enforce>
--
2.7.4
7 years, 9 months
[libvirt] [RFC] Substitute poll by epoll in virEventPollRunOnce
by Derbyshev Dmitriy
From: Derbyshev Dmitry <dderbyshev(a)virtuozzo.com>
This makes it possible to avoid allocations in
virEventPollMakePollFDs, as well as generally reduces time spent in
kernel if handles remain the same, which should generally be true.
__________________________________________
Questions:
1) What to do with probe in virEventPollRunOnce?
2) Are ifdef an acceptable solution to epoll avaliability issues?
3) Is using MAX_POLL_EVENTS_AT_ONCE constant a valid solution?
4) some fds are sometimes added twice, but only once with events!=0? This complicates virEventPoll*Handle fuctions. At the very least, it is called twice in _dbus_watch_list_set_functions.
Signed-off-by: Derbyshev Dmitry <dderbyshev(a)virtuozzo.com>
---
configure.ac | 26 +++++
src/util/vireventpoll.c | 205 ++++++++++++++++++++++++++++++++++++---
src/util/vireventpoll.h | 5 +
tests/commanddata/test3epoll.log | 15 +++
tests/commandtest.c | 4 +
5 files changed, 242 insertions(+), 13 deletions(-)
create mode 100644 tests/commanddata/test3epoll.log
diff --git a/configure.ac b/configure.ac
index dfc536f..c985ccc 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2695,6 +2695,32 @@ AC_DEFINE_UNQUOTED([isbase64],[libvirt_gl_isbase64],[Hack to avoid symbol clash]
AC_DEFINE_UNQUOTED([base64_encode],[libvirt_gl_base64_encode],[Hack to avoid symbol clash])
AC_DEFINE_UNQUOTED([base64_encode_alloc],[libvirt_gl_base64_encode_alloc],[Hack to avoid symbol clash])
+AC_ARG_ENABLE([epoll],
+ [AS_HELP_STRING([--enable-epoll],[use epoll(4) on Linux])],
+ [enable_epoll=$enableval], [enable_epoll=auto])
+if test x$enable_epoll = xno; then
+ have_linux_epoll=no
+else
+ AC_MSG_CHECKING([for Linux epoll(4)])
+ AC_LINK_IFELSE([AC_LANG_PROGRAM(
+ [
+ #ifndef __linux__
+ #error This is not Linux
+ #endif
+ #include <sys/epoll.h>
+ ],
+ [epoll_create1 (EPOLL_CLOEXEC);])],
+ [have_linux_epoll=yes],
+ [have_linux_epoll=no])
+ AC_MSG_RESULT([$have_linux_epoll])
+fi
+if test x$enable_epoll,$have_linux_epoll = xyes,no; then
+ AC_MSG_ERROR([epoll support explicitly enabled but not available])
+fi
+if test "x$have_linux_epoll" = xyes; then
+ AC_DEFINE_UNQUOTED([HAVE_LINUX_EPOLL], 1, [whether epoll is supported])
+fi
+
AC_CONFIG_FILES([run],
[chmod +x,-w run])
AC_CONFIG_FILES([\
diff --git a/src/util/vireventpoll.c b/src/util/vireventpoll.c
index 81ecab4..1541706 100644
--- a/src/util/vireventpoll.c
+++ b/src/util/vireventpoll.c
@@ -25,7 +25,11 @@
#include <stdlib.h>
#include <string.h>
-#include <poll.h>
+#ifdef HAVE_LINUX_EPOLL
+# include <sys/epoll.h>
+#else
+# include <poll.h>
+#endif
#include <sys/time.h>
#include <errno.h>
#include <unistd.h>
@@ -87,6 +91,9 @@ struct virEventPollLoop {
size_t timeoutsCount;
size_t timeoutsAlloc;
struct virEventPollTimeout *timeouts;
+#ifdef HAVE_LINUX_EPOLL
+ int epollfd;
+#endif
};
/* Only have one event loop */
@@ -109,6 +116,11 @@ int virEventPollAddHandle(int fd, int events,
virFreeCallback ff)
{
int watch;
+#ifdef HAVE_LINUX_EPOLL
+ size_t i;
+ struct epoll_event ev;
+#endif
+ int native = virEventPollToNativeEvents(events);
virMutexLock(&eventLoop.lock);
if (eventLoop.handlesCount == eventLoop.handlesAlloc) {
EVENT_DEBUG("Used %zu handle slots, adding at least %d more",
@@ -124,8 +136,7 @@ int virEventPollAddHandle(int fd, int events,
eventLoop.handles[eventLoop.handlesCount].watch = watch;
eventLoop.handles[eventLoop.handlesCount].fd = fd;
- eventLoop.handles[eventLoop.handlesCount].events =
- virEventPollToNativeEvents(events);
+ eventLoop.handles[eventLoop.handlesCount].events = native;
eventLoop.handles[eventLoop.handlesCount].cb = cb;
eventLoop.handles[eventLoop.handlesCount].ff = ff;
eventLoop.handles[eventLoop.handlesCount].opaque = opaque;
@@ -133,7 +144,30 @@ int virEventPollAddHandle(int fd, int events,
eventLoop.handlesCount++;
+#ifdef HAVE_LINUX_EPOLL
+ ev.events = native;
+ ev.data.fd = fd;
+ if (epoll_ctl(eventLoop.epollfd, EPOLL_CTL_ADD, fd, &ev) < 0) {
+ if (errno == EEXIST) {
+ for (i = 0; i < eventLoop.handlesCount; i++) {
+ if (eventLoop.handles[i].fd == fd &&
+ !eventLoop.handles[i].deleted) {
+ ev.events |= eventLoop.handles[i].events;
+ }
+ }
+ if (epoll_ctl(eventLoop.epollfd, EPOLL_CTL_MOD, fd, &ev) < 0) {
+ virMutexUnlock(&eventLoop.lock);
+ return -1;
+ }
+ }
+ else {
+ virMutexUnlock(&eventLoop.lock);
+ return -1;
+ }
+ }
+#else
virEventPollInterruptLocked();
+#endif
PROBE(EVENT_POLL_ADD_HANDLE,
"watch=%d fd=%d events=%d cb=%p opaque=%p ff=%p",
@@ -145,8 +179,14 @@ int virEventPollAddHandle(int fd, int events,
void virEventPollUpdateHandle(int watch, int events)
{
+#ifdef HAVE_LINUX_EPOLL
+ struct epoll_event ev;
+ size_t i, j;
+#else
size_t i;
+#endif
bool found = false;
+ int native = virEventPollToNativeEvents(events);
PROBE(EVENT_POLL_UPDATE_HANDLE,
"watch=%d events=%d",
watch, events);
@@ -159,13 +199,34 @@ void virEventPollUpdateHandle(int watch, int events)
virMutexLock(&eventLoop.lock);
for (i = 0; i < eventLoop.handlesCount; i++) {
if (eventLoop.handles[i].watch == watch) {
- eventLoop.handles[i].events =
- virEventPollToNativeEvents(events);
+ eventLoop.handles[i].events = native;
+#ifndef HAVE_LINUX_EPOLL
virEventPollInterruptLocked();
+#endif
found = true;
break;
}
}
+
+#ifdef HAVE_LINUX_EPOLL
+ ev.events = native;
+ for (j = 0; j < eventLoop.handlesCount; j++) {
+ if (eventLoop.handles[i].fd == eventLoop.handles[i].fd &&
+ !eventLoop.handles[i].deleted &&
+ i != j) {
+ ev.events |= eventLoop.handles[i].events;
+ }
+ }
+ ev.data.fd = eventLoop.handles[i].fd;
+
+ if (found && epoll_ctl(eventLoop.epollfd, EPOLL_CTL_MOD,
+ eventLoop.handles[i].fd, &ev) < 0) {
+ VIR_WARN("Update for existing handle watch %d failed", watch);
+ virMutexUnlock(&eventLoop.lock);
+ return;
+ }
+#endif
+
virMutexUnlock(&eventLoop.lock);
if (!found)
@@ -180,7 +241,12 @@ void virEventPollUpdateHandle(int watch, int events)
*/
int virEventPollRemoveHandle(int watch)
{
+#ifdef HAVE_LINUX_EPOLL
+ struct epoll_event ev;
+ size_t i, j;
+#else
size_t i;
+#endif
PROBE(EVENT_POLL_REMOVE_HANDLE,
"watch=%d",
watch);
@@ -196,15 +262,47 @@ int virEventPollRemoveHandle(int watch)
continue;
if (eventLoop.handles[i].watch == watch) {
- EVENT_DEBUG("mark delete %zu %d", i, eventLoop.handles[i].fd);
- eventLoop.handles[i].deleted = 1;
- virEventPollInterruptLocked();
+ break;
+ }
+ }
+
+ if (i == eventLoop.handlesCount) {
+ virMutexUnlock(&eventLoop.lock);
+ return -1;
+ }
+
+#ifdef HAVE_LINUX_EPOLL
+ ev.events = 0;
+ for (j = 0; j < eventLoop.handlesCount; j++) {
+ if (eventLoop.handles[j].fd == eventLoop.handles[i].fd &&
+ !eventLoop.handles[j].deleted &&
+ i != j) {
+ ev.events |= eventLoop.handles[i].events;
+ }
+ }
+
+ ev.data.fd = eventLoop.handles[i].fd;
+ if (ev.events) {
+ if (epoll_ctl(eventLoop.epollfd, EPOLL_CTL_MOD, eventLoop.handles[i].fd,
+ &ev) < 0) {
virMutexUnlock(&eventLoop.lock);
- return 0;
+ return -1;
}
}
+ else {
+ if (epoll_ctl(eventLoop.epollfd, EPOLL_CTL_DEL, eventLoop.handles[i].fd,
+ &ev) < 0) {
+ virMutexUnlock(&eventLoop.lock);
+ return -1;
+ }
+ }
+#endif
+
+ EVENT_DEBUG("mark delete %zu %d", i, eventLoop.handles[i].fd);
+ eventLoop.handles[i].deleted = 1;
+ virEventPollInterruptLocked();
virMutexUnlock(&eventLoop.lock);
- return -1;
+ return 0;
}
@@ -373,6 +471,7 @@ static int virEventPollCalculateTimeout(int *timeout)
return 0;
}
+#ifndef HAVE_LINUX_EPOLL
/*
* Allocate a pollfd array containing data for all registered
* file handles. The caller must free the returned data struct
@@ -409,6 +508,7 @@ static struct pollfd *virEventPollMakePollFDs(int *nfds) {
return fds;
}
+#endif
/*
@@ -472,7 +572,11 @@ static int virEventPollDispatchTimeouts(void)
*
* Returns 0 upon success, -1 if an error occurred
*/
+#ifdef HAVE_LINUX_EPOLL
+static int virEventPollDispatchHandles(int nfds, struct epoll_event *events)
+#else
static int virEventPollDispatchHandles(int nfds, struct pollfd *fds)
+#endif
{
size_t i, n;
VIR_DEBUG("Dispatch %d", nfds);
@@ -482,7 +586,11 @@ static int virEventPollDispatchHandles(int nfds, struct pollfd *fds)
* in the fds array we've got */
for (i = 0, n = 0; n < nfds && i < eventLoop.handlesCount; n++) {
while (i < eventLoop.handlesCount &&
+#ifdef HAVE_LINUX_EPOLL
+ (eventLoop.handles[i].fd != events[n].data.fd ||
+#else
(eventLoop.handles[i].fd != fds[n].fd ||
+#endif
eventLoop.handles[i].events == 0)) {
i++;
}
@@ -496,16 +604,25 @@ static int virEventPollDispatchHandles(int nfds, struct pollfd *fds)
continue;
}
+#ifdef HAVE_LINUX_EPOLL
+ if (events[n].events) {
+ int hEvents = virEventPollFromNativeEvents(events[n].events);
+#else
if (fds[n].revents) {
+ int hEvents = virEventPollFromNativeEvents(fds[n].revents);
+#endif
virEventHandleCallback cb = eventLoop.handles[i].cb;
int watch = eventLoop.handles[i].watch;
void *opaque = eventLoop.handles[i].opaque;
- int hEvents = virEventPollFromNativeEvents(fds[n].revents);
PROBE(EVENT_POLL_DISPATCH_HANDLE,
"watch=%d events=%d",
watch, hEvents);
virMutexUnlock(&eventLoop.lock);
+#ifdef HAVE_LINUX_EPOLL
+ (cb)(watch, events[n].data.fd, hEvents, opaque);
+#else
(cb)(watch, fds[n].fd, hEvents, opaque);
+#endif
virMutexLock(&eventLoop.lock);
}
}
@@ -618,7 +735,11 @@ static void virEventPollCleanupHandles(void)
*/
int virEventPollRunOnce(void)
{
+#ifdef HAVE_LINUX_EPOLL
+ struct epoll_event events[MAX_POLL_EVENTS_AT_ONCE];
+#else
struct pollfd *fds = NULL;
+#endif
int ret, timeout, nfds;
virMutexLock(&eventLoop.lock);
@@ -628,17 +749,29 @@ int virEventPollRunOnce(void)
virEventPollCleanupTimeouts();
virEventPollCleanupHandles();
- if (!(fds = virEventPollMakePollFDs(&nfds)) ||
- virEventPollCalculateTimeout(&timeout) < 0)
+#ifndef HAVE_LINUX_EPOLL
+ if (!(fds = virEventPollMakePollFDs(&nfds)))
+ goto error;
+#endif
+ if (virEventPollCalculateTimeout(&timeout) < 0)
goto error;
virMutexUnlock(&eventLoop.lock);
retry:
+#ifdef HAVE_LINUX_EPOLL
+//FIXME: PROBE handles
+ PROBE(EVENT_POLL_RUN,
+ "nhandles=%d timeout=%d",
+ 42, timeout);
+ nfds = ret = epoll_wait(eventLoop.epollfd, events,
+ MAX_POLL_EVENTS_AT_ONCE, timeout);
+#else
PROBE(EVENT_POLL_RUN,
"nhandles=%d timeout=%d",
nfds, timeout);
ret = poll(fds, nfds, timeout);
+#endif
if (ret < 0) {
EVENT_DEBUG("Poll got error event %d", errno);
if (errno == EINTR || errno == EAGAIN)
@@ -653,22 +786,32 @@ int virEventPollRunOnce(void)
if (virEventPollDispatchTimeouts() < 0)
goto error;
+#ifdef HAVE_LINUX_EPOLL
+ if (ret > 0 &&
+ virEventPollDispatchHandles(nfds, events) < 0)
+ goto error;
+#else
if (ret > 0 &&
virEventPollDispatchHandles(nfds, fds) < 0)
goto error;
+#endif
virEventPollCleanupTimeouts();
virEventPollCleanupHandles();
eventLoop.running = 0;
virMutexUnlock(&eventLoop.lock);
+#ifndef HAVE_LINUX_EPOLL
VIR_FREE(fds);
+#endif
return 0;
error:
virMutexUnlock(&eventLoop.lock);
error_unlocked:
+#ifndef HAVE_LINUX_EPOLL
VIR_FREE(fds);
+#endif
return -1;
}
@@ -698,6 +841,17 @@ int virEventPollInit(void)
return -1;
}
+#ifdef HAVE_LINUX_EPOLL
+ eventLoop.epollfd = epoll_create1(0);
+ if (eventLoop.epollfd < 0) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Unable to initialize epoll"));
+ VIR_FORCE_CLOSE(eventLoop.wakeupfd[0]);
+ VIR_FORCE_CLOSE(eventLoop.wakeupfd[1]);
+ return -1;
+ }
+#endif
+
if (virEventPollAddHandle(eventLoop.wakeupfd[0],
VIR_EVENT_HANDLE_READABLE,
virEventPollHandleWakeup, NULL, NULL) < 0) {
@@ -706,6 +860,9 @@ int virEventPollInit(void)
eventLoop.wakeupfd[0]);
VIR_FORCE_CLOSE(eventLoop.wakeupfd[0]);
VIR_FORCE_CLOSE(eventLoop.wakeupfd[1]);
+#ifdef HAVE_LINUX_EPOLL
+ VIR_FORCE_CLOSE(eventLoop.epollfd);
+#endif
return -1;
}
@@ -742,6 +899,16 @@ int
virEventPollToNativeEvents(int events)
{
int ret = 0;
+#ifdef HAVE_LINUX_EPOLL
+ if (events & VIR_EVENT_HANDLE_READABLE)
+ ret |= EPOLLIN;
+ if (events & VIR_EVENT_HANDLE_WRITABLE)
+ ret |= EPOLLOUT;
+ if (events & VIR_EVENT_HANDLE_ERROR)
+ ret |= EPOLLERR;
+ if (events & VIR_EVENT_HANDLE_HANGUP)
+ ret |= EPOLLHUP;
+#else
if (events & VIR_EVENT_HANDLE_READABLE)
ret |= POLLIN;
if (events & VIR_EVENT_HANDLE_WRITABLE)
@@ -750,6 +917,7 @@ virEventPollToNativeEvents(int events)
ret |= POLLERR;
if (events & VIR_EVENT_HANDLE_HANGUP)
ret |= POLLHUP;
+#endif
return ret;
}
@@ -757,6 +925,16 @@ int
virEventPollFromNativeEvents(int events)
{
int ret = 0;
+#ifdef HAVE_LINUX_EPOLL
+ if (events & EPOLLIN)
+ ret |= VIR_EVENT_HANDLE_READABLE;
+ if (events & EPOLLOUT)
+ ret |= VIR_EVENT_HANDLE_WRITABLE;
+ if (events & EPOLLERR)
+ ret |= VIR_EVENT_HANDLE_ERROR;
+ if (events & EPOLLHUP)
+ ret |= VIR_EVENT_HANDLE_HANGUP;
+#else
if (events & POLLIN)
ret |= VIR_EVENT_HANDLE_READABLE;
if (events & POLLOUT)
@@ -767,5 +945,6 @@ virEventPollFromNativeEvents(int events)
ret |= VIR_EVENT_HANDLE_ERROR;
if (events & POLLHUP)
ret |= VIR_EVENT_HANDLE_HANGUP;
+#endif
return ret;
}
diff --git a/src/util/vireventpoll.h b/src/util/vireventpoll.h
index 8844c9c..172009a 100644
--- a/src/util/vireventpoll.h
+++ b/src/util/vireventpoll.h
@@ -26,6 +26,11 @@
# include "internal.h"
+# ifdef HAVE_LINUX_EPOLL
+/* Maximum number of events that are returned by epoll in virEventPollRunOnce */
+# define MAX_POLL_EVENTS_AT_ONCE 10
+# endif
+
/**
* virEventPollAddHandle: register a callback for monitoring file handle events
*
diff --git a/tests/commanddata/test3epoll.log b/tests/commanddata/test3epoll.log
new file mode 100644
index 0000000..e4619b3
--- /dev/null
+++ b/tests/commanddata/test3epoll.log
@@ -0,0 +1,15 @@
+ENV:DISPLAY=:0.0
+ENV:HOME=/home/test
+ENV:HOSTNAME=test
+ENV:LANG=C
+ENV:LOGNAME=testTMPDIR=/tmp
+ENV:PATH=/usr/bin:/bin
+ENV:USER=test
+FD:0
+FD:1
+FD:2
+FD:6
+FD:8
+DAEMON:no
+CWD:/tmp
+UMASK:0022
diff --git a/tests/commandtest.c b/tests/commandtest.c
index 7bf5447..6b23659 100644
--- a/tests/commandtest.c
+++ b/tests/commandtest.c
@@ -227,7 +227,11 @@ static int test3(const void *unused ATTRIBUTE_UNUSED)
goto cleanup;
}
+#ifdef HAVE_LINUX_EPOLL
+ ret = checkoutput("test3epoll", NULL);
+#else
ret = checkoutput("test3", NULL);
+#endif
cleanup:
virCommandFree(cmd);
--
1.9.5.msysgit.0
7 years, 9 months
[libvirt] [PATCH v2 0/4] Virtio-crypto device support
by Longpeng(Mike)
As virtio-crypto has been supported in QEMU 2.8 and the frontend
driver has been merged in linux 4.10, so it's necessary to support
virtio-crypto in libvirt.
---
Changes since v1:
- split patch [Martin]
- rebase on master [Martin]
- add docs/tests/schema [Martin]
- fix typos [Gonglei]
---
Longpeng(Mike) (4):
docs: schema: Add basic documentation for the virtual crypto device
support
conf: Parse virtio-crypto in the domain XML
qemu: Implement support for 'builtin' backend for virtio-crypto
tests: Add testcase for virtio-crypto XML parsing
docs/formatdomain.html.in | 60 ++++++
docs/schemas/domaincommon.rng | 27 +++
src/conf/domain_conf.c | 213 ++++++++++++++++++++-
src/conf/domain_conf.h | 32 ++++
src/libvirt_private.syms | 2 +
src/qemu/qemu_alias.c | 20 ++
src/qemu/qemu_alias.h | 3 +
src/qemu/qemu_capabilities.c | 4 +
src/qemu/qemu_capabilities.h | 2 +
src/qemu/qemu_command.c | 132 +++++++++++++
src/qemu/qemu_command.h | 3 +
src/qemu/qemu_domain.c | 2 +
src/qemu/qemu_domain_address.c | 25 +++
src/qemu/qemu_driver.c | 6 +
src/qemu/qemu_hotplug.c | 1 +
tests/qemucapabilitiesdata/caps_2.8.0.s390x.xml | 2 +
tests/qemucapabilitiesdata/caps_2.8.0.x86_64.xml | 2 +
.../qemuxml2argv-virtio-crypto-builtin.xml | 26 +++
.../qemuxml2argv-virtio-crypto.args | 22 +++
.../qemuxml2xmlout-virtio-crypto-builtin.xml | 31 +++
tests/qemuxml2xmltest.c | 2 +
21 files changed, 616 insertions(+), 1 deletion(-)
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-virtio-crypto-builtin.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-virtio-crypto.args
create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-virtio-crypto-builtin.xml
--
1.8.3.1
7 years, 9 months
[libvirt] [PATCH REPOST v2 0/3] Add callback mech for qemu and nodedev
by John Ferlan
Repost: http://www.redhat.com/archives/libvir-list/2017-February/msg00501.html
to update to top of branch as of commit id '5ad03b9db2'
John Ferlan (3):
nodedev: Add driver callback mechanism to add/remove devices
qemu: Use nodedev callback mechanism to to get a nodedev data
qemu: Add configuration variable to control nodedev enumeration
src/check-aclrules.pl | 3 +-
src/check-driverimpls.pl | 1 +
src/conf/node_device_conf.c | 112 ++++++++++++++++++++++++++++++++++++-
src/conf/node_device_conf.h | 18 ++++++
src/libvirt_private.syms | 3 +
src/node_device/node_device_udev.c | 29 ++++++++++
src/qemu/libvirtd_qemu.aug | 1 +
src/qemu/qemu.conf | 19 +++++++
src/qemu/qemu_conf.c | 53 ++++++++++++++++++
src/qemu/qemu_conf.h | 17 ++++++
src/qemu/qemu_driver.c | 46 +++++++++++++++
src/qemu/test_libvirtd_qemu.aug.in | 1 +
12 files changed, 301 insertions(+), 2 deletions(-)
--
2.9.3
7 years, 9 months
[libvirt] [PATCH 0/5] Add API for individual/specific vCPU hotplug
by Peter Krempa
The new API allows selecting specific vCPUs to be added/removed from the VM.
The existing APIs allowed only adding/removing from the end which did not play
well with NUMA.
Peter Krempa (5):
lib: Add API for specific vCPU hot(un)plug
virsh: Implement command for virDomainSetVcpu called setvcpu
qemu: Implement individual vcpu hotplug API
test: qemuhotplugtest: Add testing of individual vcpu hotplug
news: Mention specific vCPU hotplug API
docs/news.xml | 10 +
include/libvirt/libvirt-domain.h | 5 +
src/driver-hypervisor.h | 7 +
src/libvirt-domain.c | 48 ++++
src/libvirt_public.syms | 5 +
src/qemu/qemu_driver.c | 74 +++++
src/qemu/qemu_hotplug.c | 153 ++++++++++
src/qemu/qemu_hotplug.h | 7 +
src/remote/remote_driver.c | 1 +
src/remote/remote_protocol.x | 16 +-
src/remote_protocol-structs | 7 +
tests/qemuhotplugtest.c | 63 ++++
.../ppc64-modern-individual-domain.xml | 20 ++
.../ppc64-modern-individual-monitor.json | 318 +++++++++++++++++++++
.../ppc64-modern-individual-result-conf.xml | 64 +++++
.../ppc64-modern-individual-result-live.xml | 72 +++++
.../x86-modern-individual-add-domain.xml | 21 ++
.../x86-modern-individual-add-monitor.json | 299 +++++++++++++++++++
.../x86-modern-individual-add-result-conf.xml | 40 +++
.../x86-modern-individual-add-result-live.xml | 48 ++++
tools/virsh-domain.c | 88 ++++++
tools/virsh.pod | 19 ++
22 files changed, 1384 insertions(+), 1 deletion(-)
create mode 100644 tests/qemuhotplugtestcpus/ppc64-modern-individual-domain.xml
create mode 100644 tests/qemuhotplugtestcpus/ppc64-modern-individual-monitor.json
create mode 100644 tests/qemuhotplugtestcpus/ppc64-modern-individual-result-conf.xml
create mode 100644 tests/qemuhotplugtestcpus/ppc64-modern-individual-result-live.xml
create mode 100644 tests/qemuhotplugtestcpus/x86-modern-individual-add-domain.xml
create mode 100644 tests/qemuhotplugtestcpus/x86-modern-individual-add-monitor.json
create mode 100644 tests/qemuhotplugtestcpus/x86-modern-individual-add-result-conf.xml
create mode 100644 tests/qemuhotplugtestcpus/x86-modern-individual-add-result-live.xml
--
2.11.0
7 years, 9 months
[libvirt] [PATCH] conf: Allow omitting of numa node memory size
by Peter Krempa
Memory-less numa nodes could be specified by setting the memory size to
0. Allow ommiting of the parameter completely to specify the same.
Partially resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1217144
---
docs/schemas/cputypes.rng | 12 ++++----
src/conf/numa_conf.c | 11 ++++---
tests/qemuxml2argvdata/qemuxml2argv-cpu-numa4.args | 22 ++++++++++++++
tests/qemuxml2argvdata/qemuxml2argv-cpu-numa4.xml | 25 ++++++++++++++++
tests/qemuxml2argvtest.c | 1 +
.../qemuxml2xmlout-cpu-numa4.xml | 34 ++++++++++++++++++++++
tests/qemuxml2xmltest.c | 1 +
7 files changed, 97 insertions(+), 9 deletions(-)
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-cpu-numa4.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-cpu-numa4.xml
create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-cpu-numa4.xml
diff --git a/docs/schemas/cputypes.rng b/docs/schemas/cputypes.rng
index 7cc9dd3d8..fdac7878f 100644
--- a/docs/schemas/cputypes.rng
+++ b/docs/schemas/cputypes.rng
@@ -103,13 +103,15 @@
<attribute name="cpus">
<ref name="cpuset"/>
</attribute>
- <attribute name="memory">
- <ref name="memoryKB"/>
- </attribute>
<optional>
- <attribute name="unit">
- <ref name="unit"/>
+ <attribute name="memory">
+ <ref name="memoryKB"/>
</attribute>
+ <optional>
+ <attribute name="unit">
+ <ref name="unit"/>
+ </attribute>
+ </optional>
</optional>
<optional>
<attribute name="memAccess">
diff --git a/src/conf/numa_conf.c b/src/conf/numa_conf.c
index bfd37032a..ee55b421b 100644
--- a/src/conf/numa_conf.c
+++ b/src/conf/numa_conf.c
@@ -774,7 +774,7 @@ virDomainNumaDefCPUParseXML(virDomainNumaPtr def,
ctxt->node = nodes[i];
if (virDomainParseMemory("./@memory", "./@unit", ctxt,
- &def->mem_nodes[cur_cell].mem, true, false) < 0)
+ &def->mem_nodes[cur_cell].mem, false, false) < 0)
goto cleanup;
if ((tmp = virXMLPropString(nodes[i], "memAccess"))) {
@@ -807,6 +807,7 @@ virDomainNumaDefCPUFormat(virBufferPtr buf,
virDomainMemoryAccess memAccess;
char *cpustr;
size_t ncells = virDomainNumaGetNodeCount(def);
+ unsigned long long cellmem;
size_t i;
if (ncells == 0)
@@ -823,9 +824,11 @@ virDomainNumaDefCPUFormat(virBufferPtr buf,
virBufferAddLit(buf, "<cell");
virBufferAsprintf(buf, " id='%zu'", i);
virBufferAsprintf(buf, " cpus='%s'", cpustr);
- virBufferAsprintf(buf, " memory='%llu'",
- virDomainNumaGetNodeMemorySize(def, i));
- virBufferAddLit(buf, " unit='KiB'");
+ cellmem = virDomainNumaGetNodeMemorySize(def, i);
+ if (cellmem > 0) {
+ virBufferAsprintf(buf, " memory='%llu'", cellmem);
+ virBufferAddLit(buf, " unit='KiB'");
+ }
if (memAccess)
virBufferAsprintf(buf, " memAccess='%s'",
virDomainMemoryAccessTypeToString(memAccess));
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-cpu-numa4.args b/tests/qemuxml2argvdata/qemuxml2argv-cpu-numa4.args
new file mode 100644
index 000000000..db53409a4
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-cpu-numa4.args
@@ -0,0 +1,22 @@
+LC_ALL=C \
+PATH=/bin \
+HOME=/home/test \
+USER=test \
+LOGNAME=test \
+QEMU_AUDIO_DRV=none \
+/usr/bin/qemu \
+-name QEMUGuest1 \
+-S \
+-M pc \
+-m 107 \
+-smp 1,maxcpus=16,sockets=2,cores=4,threads=2 \
+-numa node,nodeid=0,cpus=0-7,mem=107 \
+-numa node,nodeid=1,cpus=8-15,mem=0 \
+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
+-nographic \
+-nodefaults \
+-monitor unix:/tmp/lib/domain--1-QEMUGuest1/monitor.sock,server,nowait \
+-no-acpi \
+-boot n \
+-usb \
+-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-cpu-numa4.xml b/tests/qemuxml2argvdata/qemuxml2argv-cpu-numa4.xml
new file mode 100644
index 000000000..af30f785f
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-cpu-numa4.xml
@@ -0,0 +1,25 @@
+<domain type='qemu'>
+ <name>QEMUGuest1</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <memory unit='KiB'>219100</memory>
+ <currentMemory unit='KiB'>219100</currentMemory>
+ <vcpu placement='static' current='1'>16</vcpu>
+ <os>
+ <type arch='x86_64' machine='pc'>hvm</type>
+ <boot dev='network'/>
+ </os>
+ <cpu>
+ <topology sockets='2' cores='4' threads='2'/>
+ <numa>
+ <cell id='1' cpus='8-15'/>
+ <cell id='0' cpus='0-7' memory='109550' unit='KiB'/>
+ </numa>
+ </cpu>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <emulator>/usr/bin/qemu</emulator>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index f55b04b05..7ef555736 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -1521,6 +1521,7 @@ mymain(void)
DO_TEST("cpu-strict1", QEMU_CAPS_KVM);
DO_TEST("cpu-numa1", NONE);
DO_TEST("cpu-numa2", NONE);
+ DO_TEST("cpu-numa4", NONE);
DO_TEST("cpu-numa-no-memory-element", NONE);
DO_TEST_PARSE_ERROR("cpu-numa3", NONE);
DO_TEST_FAILURE("cpu-numa-disjoint", NONE);
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-cpu-numa4.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-cpu-numa4.xml
new file mode 100644
index 000000000..a5161a158
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-cpu-numa4.xml
@@ -0,0 +1,34 @@
+<domain type='qemu'>
+ <name>QEMUGuest1</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <memory unit='KiB'>219100</memory>
+ <currentMemory unit='KiB'>219100</currentMemory>
+ <vcpu placement='static' current='1'>16</vcpu>
+ <os>
+ <type arch='x86_64' machine='pc'>hvm</type>
+ <boot dev='network'/>
+ </os>
+ <cpu>
+ <topology sockets='2' cores='4' threads='2'/>
+ <numa>
+ <cell id='0' cpus='0-7' memory='109550' unit='KiB'/>
+ <cell id='1' cpus='8-15'/>
+ </numa>
+ </cpu>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <emulator>/usr/bin/qemu</emulator>
+ <controller type='usb' index='0'>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+ </controller>
+ <controller type='pci' index='0' model='pci-root'/>
+ <input type='mouse' bus='ps2'/>
+ <input type='keyboard' bus='ps2'/>
+ <memballoon model='virtio'>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+ </memballoon>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index 0702f581e..ae55d1d7f 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -962,6 +962,7 @@ mymain(void)
DO_TEST("cpu-numa1", NONE);
DO_TEST("cpu-numa2", NONE);
+ DO_TEST("cpu-numa4", NONE);
DO_TEST("cpu-numa-no-memory-element", NONE);
DO_TEST("cpu-numa-disordered", NONE);
DO_TEST("cpu-numa-disjoint", NONE);
--
2.11.1
7 years, 9 months
[libvirt] [PATCH 0/2] Add support for 'raw' block driver to Qemu JSON backend parsing code
by Tomáš Golembiovský
The raw driver is not very interesting on its own but it can be layered on top
of other block drivers. New parameters that allow using only part of the
underlying file/device were recently added to Qemu. This is useful e.g. to
directly access partitions inside a disk image or disks inside an archive (like
OVA).
This feature is utilised in OVA import in virt-v2v tool where we access the
disks directly in OVA without needing to unpack the tar archive first. After
implementing this in virt-v2v we noticed that it does not work when libguestfs
uses libvirt as a backend because libvirt fails with error:
internal error: missing parser implementation for JSON backing volume driver 'raw'
Tomáš Golembiovský (2):
util: storage: split function for JSON backing volume parsing in two
util: storage: add JSON backing volume parser 'raw' block driver
src/util/virstoragefile.c | 51 +++++++++++++++++++++++++++++++++++++----------
tests/virstoragetest.c | 6 ++++++
2 files changed, 47 insertions(+), 10 deletions(-)
--
2.11.1
7 years, 9 months
[libvirt] [v7 00/10] Support cache tune in libvirt
by Eli Qiao
Addressed comment from v7 -> v6
Marcelo:
* Fix flock usage while VM initialization.
Addressed comment from v6 -> v5
Marcelo:
* Support other APPs to operate /sys/fs/resctrl at same time
Libvirt will scan /sys/fs/resctrl again before doing cache allocation.
patch 10 will address this.
Addressed comment from v4 -> v5:
Marcelo:
* Several typos
* Use flock instead of virFileLock
Addressed comment from v3 -> v4:
Daniel & Marcelo:
* Added concurrence support
Addressed comment from v2 -> v3:
Daniel:
* Fixed coding style, passed `make check` and `make syntax-check`
* Variables renaming and move from header file to c file.
* For locking/mutex support, no progress.
There are some discussion from mailing list, but I can not find a better
way to add locking support without performance impact.
I'll explain the process and please help to advice what shoud we do.
VM create:
1) Get the cache left value on each bank of the host. This should be
shared amount all VMs.
2) Calculate the schemata on the bank based on all created resctrl
domain's schemata
3) Calculate the default schemata by scaning all domain's schemata.
4) Flush default schemata to /sys/fs/resctrl/schemata
VM destroy:
1) Remove the resctrl domain of that VM
2) Recalculate default schemata
3) Flush default schemata to /sys/fs/resctrl/schemata
The key point is that all VMs shares /sys/fs/resctrl/schemata, and
when a VM create a resctrl domain, the schemata of that VM depends on
the default schemata and all other exsited schematas. So a global
mutex is reqired.
Before calculate a schemata or update default schemata, libvirt
should gain this global mutex.
I will try to think more about how to support this gracefully in next
patch set.
Marcelo:
* Added vcpu support for cachetune, this will allow user to define which
vcpu using which cache allocation bank.
<cachetune id='0' host_id=0 size='3072' unit='KiB' vcpus='0,1'/>
vcpus is a cpumap, the vcpu pids will be added to tasks file
* Added cdp compatible, user can specify l3 cache even host enable cdp.
See patch 8.
On a cdp enabled host, specify l3code/l3data by
<cachetune id='0' host_id='0' type='l3' size='3072' unit='KiB'/>
This will create a schemata like:
L3data:0=0xff00;...
L3code:0=0xff00;...
* Would you please help to test if the functions work.
Martin:
* Xml test case, I have no time to work on this yet, would you please
show me an example, would like to amend it later.
This series patches are for supportting CAT featues, which also
called cache tune in libvirt.
First to expose cache information which could be tuned in capabilites XML.
Then add new domain xml element support to add cacahe bank which will apply
on this libvirt domain.
This series patches add a util file `resctrl.c/h`, an interface to talk with
linux kernel's system fs.
There are still one TODO left:
1. Expose a new public interface to get free cache information.
2. Expose a new public interface to set cachetune lively.
Some discussion about this feature support can be found from:
https://www.redhat.com/archives/libvir-list/2017-January/msg00644.html
*** BLURB HERE ***
Eli Qiao (10):
Resctrl: Add some utils functions
Resctrl: expose cache information to capabilities
Resctrl: Add new xml element to support cache tune
Resctrl: Add private interface to set cachebanks
Qemu: Set cache banks
Resctrl: enable l3code/l3data
Resctrl: Make sure l3data/l3code are pairs
Resctrl: Compatible mode for cdp enabled
Resctrl: concurrence support
Resctrl: Scan resctrl before doing cache allocation
docs/schemas/domaincommon.rng | 46 ++
include/libvirt/virterror.h | 1 +
po/POTFILES.in | 1 +
src/Makefile.am | 1 +
src/conf/capabilities.c | 56 ++
src/conf/capabilities.h | 23 +
src/conf/domain_conf.c | 182 +++++++
src/conf/domain_conf.h | 19 +
src/libvirt_private.syms | 11 +
src/nodeinfo.c | 64 +++
src/nodeinfo.h | 1 +
src/qemu/qemu_capabilities.c | 8 +
src/qemu/qemu_driver.c | 6 +
src/qemu/qemu_process.c | 53 ++
src/util/virerror.c | 1 +
src/util/virresctrl.c | 1202 +++++++++++++++++++++++++++++++++++++++++
src/util/virresctrl.h | 88 +++
17 files changed, 1763 insertions(+)
create mode 100644 src/util/virresctrl.c
create mode 100644 src/util/virresctrl.h
--
1.9.1
7 years, 9 months
[libvirt] [PATH v8 00/10] Support cache tune in libvirt
by Eli Qiao
Addressed comment from v8 -> v7
Martin:
* Patch subject prefix.
* Move some of cpu related information to virhostcpu.c.
* Fix some memory leak in src/utils/resctrl.c
Martin & Marcelo:
* Don't remove directories which are not maintained by libvirt.
Addressed comment from v7 -> v6
Marcelo:
* Fix flock usage while VM initialization.
Addressed comment from v6 -> v5
Marcelo:
* Support other APPs to operate /sys/fs/resctrl at same time
Libvirt will scan /sys/fs/resctrl again before doing cache allocation.
patch 10 will address this.
Addressed comment from v4 -> v5:
Marcelo:
* Several typos
* Use flock instead of virFileLock
Addressed comment from v3 -> v4:
Daniel & Marcelo:
* Added concurrence support
Addressed comment from v2 -> v3:
Daniel:
* Fixed coding style, passed `make check` and `make syntax-check`
* Variables renaming and move from header file to c file.
* For locking/mutex support, no progress.
There are some discussion from mailing list, but I can not find a better
way to add locking support without performance impact.
I'll explain the process and please help to advice what shoud we do.
VM create:
1) Get the cache left value on each bank of the host. This should be
shared amount all VMs.
2) Calculate the schemata on the bank based on all created resctrl
domain's schemata
3) Calculate the default schemata by scaning all domain's schemata.
4) Flush default schemata to /sys/fs/resctrl/schemata
VM destroy:
1) Remove the resctrl domain of that VM
2) Recalculate default schemata
3) Flush default schemata to /sys/fs/resctrl/schemata
The key point is that all VMs shares /sys/fs/resctrl/schemata, and
when a VM create a resctrl domain, the schemata of that VM depends on
the default schemata and all other exsited schematas. So a global
mutex is reqired.
Before calculate a schemata or update default schemata, libvirt
should gain this global mutex.
I will try to think more about how to support this gracefully in next
patch set.
Marcelo:
* Added vcpu support for cachetune, this will allow user to define which
vcpu using which cache allocation bank.
<cachetune id='0' host_id=0 size='3072' unit='KiB' vcpus='0,1'/>
vcpus is a cpumap, the vcpu pids will be added to tasks file
* Added cdp compatible, user can specify l3 cache even host enable cdp.
See patch 8.
On a cdp enabled host, specify l3code/l3data by
<cachetune id='0' host_id='0' type='l3' size='3072' unit='KiB'/>
This will create a schemata like:
L3data:0=0xff00;...
L3code:0=0xff00;...
* Would you please help to test if the functions work.
Martin:
* Xml test case, I have no time to work on this yet, would you please
show me an example, would like to amend it later.
This series patches are for supportting CAT featues, which also
called cache tune in libvirt.
First to expose cache information which could be tuned in capabilites XML.
Then add new domain xml element support to add cacahe bank which will apply
on this libvirt domain.
This series patches add a util file `resctrl.c/h`, an interface to talk with
linux kernel's system fs.
There are still one TODO left:
1. Expose a new public interface to get free cache information.
2. Expose a new public interface to set cachetune lively.
Some discussion about this feature support can be found from:
https://www.redhat.com/archives/libvir-list/2017-January/msg00644.html
Eli Qiao (10):
Resctrl: Add some utils functions
Resctrl: expose cache information to capabilities
Resctrl: Add new xml element to support cache tune
Resctrl: Add private interfaces to operate cache bank
Qemu: Set cache tune while booting a new domain.
Resctrl: enable l3code/l3data
Resctrl: Make sure l3data/l3code are pairs
Resctrl: Compatible mode for cdp enabled
Resctrl: concurrence support
Resctrl: Scan resctrl before doing cache allocation
docs/schemas/domaincommon.rng | 46 ++
include/libvirt/virterror.h | 1 +
po/POTFILES.in | 1 +
src/Makefile.am | 1 +
src/conf/capabilities.c | 56 +++
src/conf/capabilities.h | 23 +
src/conf/domain_conf.c | 182 ++++++++
src/conf/domain_conf.h | 19 +
src/libvirt_private.syms | 11 +
src/nodeinfo.c | 64 +++
src/nodeinfo.h | 1 +
src/qemu/qemu_capabilities.c | 8 +
src/qemu/qemu_driver.c | 6 +
src/qemu/qemu_process.c | 54 +++
src/util/virerror.c | 1 +
src/util/virhostcpu.c | 186 +++++++-
src/util/virhostcpu.h | 6 +
src/util/virresctrl.c | 1027 +++++++++++++++++++++++++++++++++++++++++
src/util/virresctrl.h | 88 ++++
19 files changed, 1764 insertions(+), 17 deletions(-)
create mode 100644 src/util/virresctrl.c
create mode 100644 src/util/virresctrl.h
--
1.9.1
7 years, 9 months