[libvirt] [PATCH v2] qemu: Start domain on a node without cpu affinity

Roman Bolshakov posted 1 patch 6 years, 3 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/20180823084948.37524-1-r.bolshakov@yadro.com
Test syntax-check passed
src/qemu/qemu_process.c | 8 ++++++++
1 file changed, 8 insertions(+)
[libvirt] [PATCH v2] qemu: Start domain on a node without cpu affinity
Posted by Roman Bolshakov 6 years, 3 months ago
qemuProcessInitCpuAffinity prevents a VM from getting started on a
platform that uses cpu affinity wrapper stubs e.g. macOS.

The patch adds qemuProcessInitCpuAffinity stub on all platforms without
HAVE_SCHED_GETAFFINITY or HAVE_BSD_CPU_AFFINITY.

Signed-off-by: Roman Bolshakov <r.bolshakov@yadro.com>
---

Changes since v1:
* Replaced no-op virProcessGetAffinity with qemuProcessInitCpuAffinity
  stub.

 src/qemu/qemu_process.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index ab749389ee..28d52f01f6 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -2343,6 +2343,7 @@ qemuProcessDetectIOThreadPIDs(virQEMUDriverPtr driver,
 /*
  * To be run between fork/exec of QEMU only
  */
+#if defined(HAVE_SCHED_GETAFFINITY) || defined(HAVE_BSD_CPU_AFFINITY)
 static int
 qemuProcessInitCpuAffinity(virDomainObjPtr vm)
 {
@@ -2413,6 +2414,13 @@ qemuProcessInitCpuAffinity(virDomainObjPtr vm)
     virBitmapFree(hostcpumap);
     return ret;
 }
+#else
+static int
+qemuProcessInitCpuAffinity(virDomainObjPtr vm ATTRIBUTE_UNUSED)
+{
+    return 0;
+}
+#endif
 
 /* set link states to down on interfaces at qemu start */
 static int
-- 
2.17.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH v2] qemu: Start domain on a node without cpu affinity
Posted by Michal Prívozník 6 years, 3 months ago
On 08/23/2018 10:49 AM, Roman Bolshakov wrote:
> qemuProcessInitCpuAffinity prevents a VM from getting started on a
> platform that uses cpu affinity wrapper stubs e.g. macOS.
> 
> The patch adds qemuProcessInitCpuAffinity stub on all platforms without
> HAVE_SCHED_GETAFFINITY or HAVE_BSD_CPU_AFFINITY.
> 
> Signed-off-by: Roman Bolshakov <r.bolshakov@yadro.com>
> ---
> 
> Changes since v1:
> * Replaced no-op virProcessGetAffinity with qemuProcessInitCpuAffinity
>   stub.
> 
>  src/qemu/qemu_process.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
> index ab749389ee..28d52f01f6 100644
> --- a/src/qemu/qemu_process.c
> +++ b/src/qemu/qemu_process.c
> @@ -2343,6 +2343,7 @@ qemuProcessDetectIOThreadPIDs(virQEMUDriverPtr driver,
>  /*
>   * To be run between fork/exec of QEMU only
>   */
> +#if defined(HAVE_SCHED_GETAFFINITY) || defined(HAVE_BSD_CPU_AFFINITY)
>  static int
>  qemuProcessInitCpuAffinity(virDomainObjPtr vm)
>  {
> @@ -2413,6 +2414,13 @@ qemuProcessInitCpuAffinity(virDomainObjPtr vm)
>      virBitmapFree(hostcpumap);
>      return ret;
>  }
> +#else
> +static int
> +qemuProcessInitCpuAffinity(virDomainObjPtr vm ATTRIBUTE_UNUSED)
> +{
> +    return 0;
> +}
> +#endif

I've put comments after these #else and #endif to help anybody reading
the code understand what's the condition.

ACKed and pushed.

Michal

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list