diff options
| author | Mark Asselstine <mark.asselstine@windriver.com> | 2018-11-28 11:17:32 -0500 |
|---|---|---|
| committer | Bruce Ashfield <bruce.ashfield@windriver.com> | 2018-11-29 12:05:18 -0500 |
| commit | 9ad042c295179a99f2f774cc42faea6fd42badcd (patch) | |
| tree | 2fc93e11f4769cd0c45bd63f89e54de5316eeefc | |
| parent | 885e8770585d4010f19a5b462764e8cc8455c2fd (diff) | |
| download | meta-virtualization-9ad042c295179a99f2f774cc42faea6fd42badcd.tar.gz | |
libvirt: uprev from 4.7.0 to 4.9.0
Minor update bringing in new features such as better support for
cgroup v2, vfio AP support, support for XEN suspend/wakeup.
Basic usecases pass and the ptest return similar results we have been
achieving with the last few uprevs:
====================================
Testsuite summary for libvirt 4.9.0
====================================
# TOTAL: 120
# PASS: 117
# SKIP: 0
# XFAIL: 0
# FAIL: 3
# XPASS: 0
# ERROR: 0
Signed-off-by: Mark Asselstine <mark.asselstine@windriver.com>
| -rw-r--r-- | recipes-extended/libvirt/libvirt-python.inc | 4 | ||||
| -rw-r--r-- | recipes-extended/libvirt/libvirt/lxc_monitor-Avoid-AB-BA-lock-race.patch | 106 | ||||
| -rw-r--r-- | recipes-extended/libvirt/libvirt_4.9.0.bb (renamed from recipes-extended/libvirt/libvirt_4.7.0.bb) | 5 |
3 files changed, 4 insertions, 111 deletions
diff --git a/recipes-extended/libvirt/libvirt-python.inc b/recipes-extended/libvirt/libvirt-python.inc index be9079d7..ae43ba80 100644 --- a/recipes-extended/libvirt/libvirt-python.inc +++ b/recipes-extended/libvirt/libvirt-python.inc | |||
| @@ -18,8 +18,8 @@ FILES_${PN}-python = "${bindir}/* ${libdir}/* ${libdir}/${PYTHON_DIR}/*" | |||
| 18 | SRC_URI += "http://libvirt.org/sources/python/libvirt-python-${PV}.tar.gz;name=libvirt_python" | 18 | SRC_URI += "http://libvirt.org/sources/python/libvirt-python-${PV}.tar.gz;name=libvirt_python" |
| 19 | SRC_URI += "file://libvirt_api_xml_path.patch;patchdir=../libvirt-python-${PV}" | 19 | SRC_URI += "file://libvirt_api_xml_path.patch;patchdir=../libvirt-python-${PV}" |
| 20 | 20 | ||
| 21 | SRC_URI[libvirt_python.md5sum] = "32cf281199367aec2881c96d1bd80dc6" | 21 | SRC_URI[libvirt_python.md5sum] = "cba7dc90d564aa8c267c38d452b83f80" |
| 22 | SRC_URI[libvirt_python.sha256sum] = "e36fee5898de3550ed7e63d5d0a8447f9d78f06574634855dee59eae27930908" | 22 | SRC_URI[libvirt_python.sha256sum] = "01c4becf50b521a9e3d1b48a3a79d83cb389d86d760b895d911d78f5b6ae7b60" |
| 23 | 23 | ||
| 24 | export LIBVIRT_API_PATH = "${S}/docs/libvirt-api.xml" | 24 | export LIBVIRT_API_PATH = "${S}/docs/libvirt-api.xml" |
| 25 | export LIBVIRT_CFLAGS = "-I${S}/include" | 25 | export LIBVIRT_CFLAGS = "-I${S}/include" |
diff --git a/recipes-extended/libvirt/libvirt/lxc_monitor-Avoid-AB-BA-lock-race.patch b/recipes-extended/libvirt/libvirt/lxc_monitor-Avoid-AB-BA-lock-race.patch deleted file mode 100644 index fc3880fb..00000000 --- a/recipes-extended/libvirt/libvirt/lxc_monitor-Avoid-AB-BA-lock-race.patch +++ /dev/null | |||
| @@ -1,106 +0,0 @@ | |||
| 1 | From 7882c6eca53fe9abe253497a50f6c5ae062176d3 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Mark Asselstine <mark.asselstine@windriver.com> | ||
| 3 | Date: Mon, 24 Sep 2018 11:11:35 -0400 | ||
| 4 | Subject: [PATCH] lxc_monitor: Avoid AB / BA lock race | ||
| 5 | |||
| 6 | A deadlock situation can occur when autostarting a LXC domain 'guest' | ||
| 7 | due to two threads attempting to take opposing locks while holding | ||
| 8 | opposing locks (AB BA problem). Thread A takes and holds the 'vm' lock | ||
| 9 | while attempting to take the 'client' lock, meanwhile, thread B takes | ||
| 10 | and holds the 'client' lock while attempting to take the 'vm' lock. | ||
| 11 | |||
| 12 | The potential for this can be seen as follows: | ||
| 13 | |||
| 14 | Thread A: | ||
| 15 | virLXCProcessAutostartDomain (takes vm lock) | ||
| 16 | --> virLXCProcessStart | ||
| 17 | --> virLXCProcessConnectMonitor | ||
| 18 | --> virLXCMonitorNew | ||
| 19 | --> virNetClientSetCloseCallback (wants client lock) | ||
| 20 | |||
| 21 | Thread B: | ||
| 22 | virNetClientIncomingEvent (takes client lock) | ||
| 23 | --> virNetClientIOHandleInput | ||
| 24 | --> virNetClientCallDispatch | ||
| 25 | --> virNetClientCallDispatchMessage | ||
| 26 | --> virNetClientProgramDispatch | ||
| 27 | --> virLXCMonitorHandleEventInit | ||
| 28 | --> virLXCProcessMonitorInitNotify (wants vm lock) | ||
| 29 | |||
| 30 | Since these threads are scheduled independently and are preemptible it | ||
| 31 | is possible for the deadlock scenario to occur where each thread locks | ||
| 32 | their first lock but both will fail to get their second lock and just | ||
| 33 | spin forever. You get something like: | ||
| 34 | |||
| 35 | virLXCProcessAutostartDomain (takes vm lock) | ||
| 36 | --> virLXCProcessStart | ||
| 37 | --> virLXCProcessConnectMonitor | ||
| 38 | --> virLXCMonitorNew | ||
| 39 | <...> | ||
| 40 | virNetClientIncomingEvent (takes client lock) | ||
| 41 | --> virNetClientIOHandleInput | ||
| 42 | --> virNetClientCallDispatch | ||
| 43 | --> virNetClientCallDispatchMessage | ||
| 44 | --> virNetClientProgramDispatch | ||
| 45 | --> virLXCMonitorHandleEventInit | ||
| 46 | --> virLXCProcessMonitorInitNotify (wants vm lock but spins) | ||
| 47 | <...> | ||
| 48 | --> virNetClientSetCloseCallback (wants client lock but spins) | ||
| 49 | |||
| 50 | Neither thread ever gets the lock it needs to be able to continue | ||
| 51 | while holding the lock that the other thread needs. | ||
| 52 | |||
| 53 | The actual window for preemption which can cause this deadlock is | ||
| 54 | rather small, between the calls to virNetClientProgramNew() and | ||
| 55 | execution of virNetClientSetCloseCallback(), both in | ||
| 56 | virLXCMonitorNew(). But it can be seen in real world use that this | ||
| 57 | small window is enough. | ||
| 58 | |||
| 59 | By moving the call to virNetClientSetCloseCallback() ahead of | ||
| 60 | virNetClientProgramNew() we can close any possible chance of the | ||
| 61 | deadlock taking place. There should be no other implications to the | ||
| 62 | move since the close callback (in the unlikely event was called) will | ||
| 63 | spin on the vm lock. The remaining work that takes place between the | ||
| 64 | old call location of virNetClientSetCloseCallback() and the new | ||
| 65 | location is unaffected by the move. | ||
| 66 | |||
| 67 | Upstream-Status: Backport commit 7882c6eca53f | ||
| 68 | |||
| 69 | Signed-off-by: Mark Asselstine <mark.asselstine@windriver.com> | ||
| 70 | Signed-off-by: Michal Privoznik <mprivozn@redhat.com> | ||
| 71 | --- | ||
| 72 | src/lxc/lxc_monitor.c | 11 +++++++---- | ||
| 73 | 1 file changed, 7 insertions(+), 4 deletions(-) | ||
| 74 | |||
| 75 | diff --git a/src/lxc/lxc_monitor.c b/src/lxc/lxc_monitor.c | ||
| 76 | index e765c16..0b18a14 100644 | ||
| 77 | --- a/src/lxc/lxc_monitor.c | ||
| 78 | +++ b/src/lxc/lxc_monitor.c | ||
| 79 | @@ -161,6 +161,13 @@ virLXCMonitorPtr virLXCMonitorNew(virDomainObjPtr vm, | ||
| 80 | if (virNetClientRegisterAsyncIO(mon->client) < 0) | ||
| 81 | goto error; | ||
| 82 | |||
| 83 | + /* avoid deadlock by making this call before assigning virLXCMonitorEvents */ | ||
| 84 | + virNetClientSetCloseCallback(mon->client, virLXCMonitorEOFNotify, mon, | ||
| 85 | + virLXCMonitorCloseFreeCallback); | ||
| 86 | + | ||
| 87 | + /* close callback now has its own reference */ | ||
| 88 | + virObjectRef(mon); | ||
| 89 | + | ||
| 90 | if (!(mon->program = virNetClientProgramNew(VIR_LXC_MONITOR_PROGRAM, | ||
| 91 | VIR_LXC_MONITOR_PROGRAM_VERSION, | ||
| 92 | virLXCMonitorEvents, | ||
| 93 | @@ -175,10 +182,6 @@ virLXCMonitorPtr virLXCMonitorNew(virDomainObjPtr vm, | ||
| 94 | mon->vm = virObjectRef(vm); | ||
| 95 | memcpy(&mon->cb, cb, sizeof(mon->cb)); | ||
| 96 | |||
| 97 | - virObjectRef(mon); | ||
| 98 | - virNetClientSetCloseCallback(mon->client, virLXCMonitorEOFNotify, mon, | ||
| 99 | - virLXCMonitorCloseFreeCallback); | ||
| 100 | - | ||
| 101 | cleanup: | ||
| 102 | VIR_FREE(sockpath); | ||
| 103 | return mon; | ||
| 104 | -- | ||
| 105 | 2.7.4 | ||
| 106 | |||
diff --git a/recipes-extended/libvirt/libvirt_4.7.0.bb b/recipes-extended/libvirt/libvirt_4.9.0.bb index 51367985..768cf0e7 100644 --- a/recipes-extended/libvirt/libvirt_4.7.0.bb +++ b/recipes-extended/libvirt/libvirt_4.9.0.bb | |||
| @@ -35,11 +35,10 @@ SRC_URI = "http://libvirt.org/sources/libvirt-${PV}.tar.xz;name=libvirt \ | |||
| 35 | file://install-missing-file.patch \ | 35 | file://install-missing-file.patch \ |
| 36 | file://0001-ptest-Remove-Windows-1252-check-from-esxutilstest.patch \ | 36 | file://0001-ptest-Remove-Windows-1252-check-from-esxutilstest.patch \ |
| 37 | file://configure.ac-search-for-rpc-rpc.h-in-the-sysroot.patch \ | 37 | file://configure.ac-search-for-rpc-rpc.h-in-the-sysroot.patch \ |
| 38 | file://lxc_monitor-Avoid-AB-BA-lock-race.patch \ | ||
| 39 | " | 38 | " |
| 40 | 39 | ||
| 41 | SRC_URI[libvirt.md5sum] = "38da6c33250dcbc0a6d68de5c758262b" | 40 | SRC_URI[libvirt.md5sum] = "aaf7b265ac2013d6eb184a86b5f7eeb9" |
| 42 | SRC_URI[libvirt.sha256sum] = "92c279f7321624ac5a37a81f8bbe8c8d2a16781da04c63c99c92d3de035767e4" | 41 | SRC_URI[libvirt.sha256sum] = "4fd4bfe7312b7996a817c7919cf0062de0d5b3c400c93bd30855a46c40dd455a" |
| 43 | 42 | ||
| 44 | inherit autotools gettext update-rc.d pkgconfig ptest systemd | 43 | inherit autotools gettext update-rc.d pkgconfig ptest systemd |
| 45 | 44 | ||
