As pointed out by jtomko in his review of the IOThreads pinning code: http://www.redhat.com/archives/libvir-list/2015-March/msg00495.html there are some comments sprinkled in indicating IOThreads were using the same structure as the VcpuPin code... This is the first patch of a few that will change the virDomainVcpuPin* structures and code to just virDomainPin* - starting with the data structure naming... Signed-off-by: John Ferlan <jferlan@xxxxxxxxxx> --- src/conf/domain_conf.c | 42 ++++++++++++++++++++---------------------- src/conf/domain_conf.h | 33 ++++++++++++++++----------------- src/libxl/libxl_driver.c | 2 +- src/qemu/qemu_cgroup.c | 4 ++-- src/qemu/qemu_cgroup.h | 4 ++-- src/qemu/qemu_driver.c | 12 ++++++------ src/qemu/qemu_process.c | 4 ++-- 7 files changed, 49 insertions(+), 52 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 3d05844..6e54dc1 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -2003,11 +2003,11 @@ virDomainClockDefClear(virDomainClockDefPtr def) VIR_FREE(def->timers); } -virDomainVcpuPinDefPtr * -virDomainVcpuPinDefCopy(virDomainVcpuPinDefPtr *src, int nvcpupin) +virDomainPinDefPtr * +virDomainVcpuPinDefCopy(virDomainPinDefPtr *src, int nvcpupin) { size_t i; - virDomainVcpuPinDefPtr *ret = NULL; + virDomainPinDefPtr *ret = NULL; if (VIR_ALLOC_N(ret, nvcpupin) < 0) goto error; @@ -2037,7 +2037,7 @@ virDomainVcpuPinDefCopy(virDomainVcpuPinDefPtr *src, int nvcpupin) } void -virDomainVcpuPinDefFree(virDomainVcpuPinDefPtr def) +virDomainVcpuPinDefFree(virDomainPinDefPtr def) { if (def) { virBitmapFree(def->cpumask); @@ -2046,7 +2046,7 @@ virDomainVcpuPinDefFree(virDomainVcpuPinDefPtr def) } void -virDomainVcpuPinDefArrayFree(virDomainVcpuPinDefPtr *def, +virDomainVcpuPinDefArrayFree(virDomainPinDefPtr *def, int nvcpupin) { size_t i; @@ -12699,14 +12699,14 @@ virDomainIdmapDefParseXML(xmlXPathContextPtr ctxt, * A vcpuid of -1 is valid and only valid for emulatorpin. So callers * have to check the returned cpuid for validity. */ -static virDomainVcpuPinDefPtr +static virDomainPinDefPtr virDomainVcpuPinDefParseXML(xmlNodePtr node, xmlXPathContextPtr ctxt, int maxvcpus, bool emulator, bool iothreads) { - virDomainVcpuPinDefPtr def; + virDomainPinDefPtr def; xmlNodePtr oldnode = ctxt->node; int vcpuid = -1; unsigned int iothreadid; @@ -13463,7 +13463,7 @@ virDomainDefParseXML(xmlDocPtr xml, goto error; for (i = 0; i < n; i++) { - virDomainVcpuPinDefPtr vcpupin = NULL; + virDomainPinDefPtr vcpupin = NULL; vcpupin = virDomainVcpuPinDefParseXML(nodes[i], ctxt, def->maxvcpus, false, false); @@ -13506,7 +13506,7 @@ virDomainDefParseXML(xmlDocPtr xml, i)) continue; - virDomainVcpuPinDefPtr vcpupin = NULL; + virDomainPinDefPtr vcpupin = NULL; if (VIR_ALLOC(vcpupin) < 0) goto error; @@ -13555,7 +13555,7 @@ virDomainDefParseXML(xmlDocPtr xml, goto error; for (i = 0; i < n; i++) { - virDomainVcpuPinDefPtr iothreadpin = NULL; + virDomainPinDefPtr iothreadpin = NULL; iothreadpin = virDomainVcpuPinDefParseXML(nodes[i], ctxt, def->iothreads, false, true); @@ -16676,7 +16676,7 @@ virDomainDefAddImplicitControllers(virDomainDefPtr def) /* Check if vcpupin with same vcpuid already exists. * Return 1 if exists, 0 if not. */ int -virDomainVcpuPinIsDuplicate(virDomainVcpuPinDefPtr *def, +virDomainVcpuPinIsDuplicate(virDomainPinDefPtr *def, int nvcpupin, int vcpu) { @@ -16693,8 +16693,8 @@ virDomainVcpuPinIsDuplicate(virDomainVcpuPinDefPtr *def, return 0; } -virDomainVcpuPinDefPtr -virDomainVcpuPinFindByVcpu(virDomainVcpuPinDefPtr *def, +virDomainPinDefPtr +virDomainVcpuPinFindByVcpu(virDomainPinDefPtr *def, int nvcpupin, int vcpu) { @@ -16712,13 +16712,13 @@ virDomainVcpuPinFindByVcpu(virDomainVcpuPinDefPtr *def, } int -virDomainVcpuPinAdd(virDomainVcpuPinDefPtr **vcpupin_list, +virDomainVcpuPinAdd(virDomainPinDefPtr **vcpupin_list, size_t *nvcpupin, unsigned char *cpumap, int maplen, int vcpu) { - virDomainVcpuPinDefPtr vcpupin = NULL; + virDomainPinDefPtr vcpupin = NULL; if (!vcpupin_list) return -1; @@ -16760,7 +16760,7 @@ void virDomainVcpuPinDel(virDomainDefPtr def, int vcpu) { int n; - virDomainVcpuPinDefPtr *vcpupin_list = def->cputune.vcpupin; + virDomainPinDefPtr *vcpupin_list = def->cputune.vcpupin; for (n = 0; n < def->cputune.nvcpupin; n++) { if (vcpupin_list[n]->vcpuid == vcpu) { @@ -16777,7 +16777,7 @@ virDomainEmulatorPinAdd(virDomainDefPtr def, unsigned char *cpumap, int maplen) { - virDomainVcpuPinDefPtr emulatorpin = NULL; + virDomainPinDefPtr emulatorpin = NULL; if (!def->cputune.emulatorpin) { /* No emulatorpin exists yet. */ @@ -16818,14 +16818,13 @@ virDomainEmulatorPinDel(virDomainDefPtr def) } int -virDomainIOThreadsPinAdd(virDomainVcpuPinDefPtr **iothreadspin_list, +virDomainIOThreadsPinAdd(virDomainPinDefPtr **iothreadspin_list, size_t *niothreadspin, unsigned char *cpumap, int maplen, unsigned int iothread_id) { - /* IOThreads share the virDomainVcpuPinDefPtr */ - virDomainVcpuPinDefPtr iothreadpin = NULL; + virDomainPinDefPtr iothreadpin = NULL; if (!iothreadspin_list) return -1; @@ -16868,8 +16867,7 @@ virDomainIOThreadsPinDel(virDomainDefPtr def, unsigned int iothread_id) { size_t i; - /* IOThreads share the virDomainVcpuPinDefPtr */ - virDomainVcpuPinDefPtr *iothreadspin_list = def->cputune.iothreadspin; + virDomainPinDefPtr *iothreadspin_list = def->cputune.iothreadspin; for (i = 0; i < def->cputune.niothreadspin; i++) { if (iothreadspin_list[i]->vcpuid == iothread_id) { diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index f36315b..811a2ab 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -1896,26 +1896,26 @@ struct _virDomainClockDef { # define VIR_DOMAIN_CPUMASK_LEN 1024 -typedef struct _virDomainVcpuPinDef virDomainVcpuPinDef; -typedef virDomainVcpuPinDef *virDomainVcpuPinDefPtr; -struct _virDomainVcpuPinDef { +typedef struct _virDomainPinDef virDomainPinDef; +typedef virDomainPinDef *virDomainPinDefPtr; +struct _virDomainPinDef { int vcpuid; virBitmapPtr cpumask; }; -void virDomainVcpuPinDefFree(virDomainVcpuPinDefPtr def); -void virDomainVcpuPinDefArrayFree(virDomainVcpuPinDefPtr *def, int nvcpupin); +void virDomainVcpuPinDefFree(virDomainPinDefPtr def); +void virDomainVcpuPinDefArrayFree(virDomainPinDefPtr *def, int nvcpupin); -virDomainVcpuPinDefPtr *virDomainVcpuPinDefCopy(virDomainVcpuPinDefPtr *src, - int nvcpupin); +virDomainPinDefPtr *virDomainVcpuPinDefCopy(virDomainPinDefPtr *src, + int nvcpupin); -int virDomainVcpuPinIsDuplicate(virDomainVcpuPinDefPtr *def, +int virDomainVcpuPinIsDuplicate(virDomainPinDefPtr *def, int nvcpupin, int vcpu); -virDomainVcpuPinDefPtr virDomainVcpuPinFindByVcpu(virDomainVcpuPinDefPtr *def, - int nvcpupin, - int vcpu); +virDomainPinDefPtr virDomainVcpuPinFindByVcpu(virDomainPinDefPtr *def, + int nvcpupin, + int vcpu); typedef struct _virBlkioDevice virBlkioDevice; typedef virBlkioDevice *virBlkioDevicePtr; @@ -2005,10 +2005,10 @@ struct _virDomainCputune { unsigned long long emulator_period; long long emulator_quota; size_t nvcpupin; - virDomainVcpuPinDefPtr *vcpupin; - virDomainVcpuPinDefPtr emulatorpin; + virDomainPinDefPtr *vcpupin; + virDomainPinDefPtr emulatorpin; size_t niothreadspin; - virDomainVcpuPinDefPtr *iothreadspin; + virDomainPinDefPtr *iothreadspin; size_t nvcpusched; virDomainThreadSchedParamPtr vcpusched; @@ -2549,7 +2549,7 @@ int virDomainDefCompatibleDevice(virDomainDefPtr def, virDomainDeviceDefPtr dev, virDomainDeviceAction action); -int virDomainVcpuPinAdd(virDomainVcpuPinDefPtr **vcpupin_list, +int virDomainVcpuPinAdd(virDomainPinDefPtr **vcpupin_list, size_t *nvcpupin, unsigned char *cpumap, int maplen, @@ -2563,8 +2563,7 @@ int virDomainEmulatorPinAdd(virDomainDefPtr def, int virDomainEmulatorPinDel(virDomainDefPtr def); -/* IOThreads share the virDomainVcpuPinDefPtr */ -int virDomainIOThreadsPinAdd(virDomainVcpuPinDefPtr **iothreadspin_list, +int virDomainIOThreadsPinAdd(virDomainPinDefPtr **iothreadspin_list, size_t *niothreads, unsigned char *cpumap, int maplen, diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c index 54bbd3b..60a27f9 100644 --- a/src/libxl/libxl_driver.c +++ b/src/libxl/libxl_driver.c @@ -2047,7 +2047,7 @@ libxlDomainGetVcpuPinInfo(virDomainPtr dom, int ncpumaps, libxlDriverConfigPtr cfg = libxlDriverConfigGet(driver); virDomainObjPtr vm = NULL; virDomainDefPtr targetDef = NULL; - virDomainVcpuPinDefPtr *vcpupin_list; + virDomainPinDefPtr *vcpupin_list; virBitmapPtr cpumask = NULL; int maxcpu, hostcpus, vcpu, pcpu, n, ret = -1; unsigned char *cpumap; diff --git a/src/qemu/qemu_cgroup.c b/src/qemu/qemu_cgroup.c index 2b5a182..260c3c5 100644 --- a/src/qemu/qemu_cgroup.c +++ b/src/qemu/qemu_cgroup.c @@ -941,7 +941,7 @@ qemuSetupCgroupVcpuBW(virCgroupPtr cgroup, int qemuSetupCgroupVcpuPin(virCgroupPtr cgroup, - virDomainVcpuPinDefPtr *vcpupin, + virDomainPinDefPtr *vcpupin, int nvcpupin, int vcpuid) { @@ -957,7 +957,7 @@ qemuSetupCgroupVcpuPin(virCgroupPtr cgroup, int qemuSetupCgroupIOThreadsPin(virCgroupPtr cgroup, - virDomainVcpuPinDefPtr *iothreadspin, + virDomainPinDefPtr *iothreadspin, int niothreadspin, int iothreadid) { diff --git a/src/qemu/qemu_cgroup.h b/src/qemu/qemu_cgroup.h index a5d9c49..b311af3 100644 --- a/src/qemu/qemu_cgroup.h +++ b/src/qemu/qemu_cgroup.h @@ -53,12 +53,12 @@ int qemuSetupCgroupVcpuBW(virCgroupPtr cgroup, unsigned long long period, long long quota); int qemuSetupCgroupVcpuPin(virCgroupPtr cgroup, - virDomainVcpuPinDefPtr *vcpupin, + virDomainPinDefPtr *vcpupin, int nvcpupin, int vcpuid); int qemuSetupCgroupEmulatorPin(virCgroupPtr cgroup, virBitmapPtr cpumask); int qemuSetupCgroupIOThreadsPin(virCgroupPtr cgroup, - virDomainVcpuPinDefPtr *iothreadspin, + virDomainPinDefPtr *iothreadspin, int niothreadspin, int iothreadid); int qemuSetupCgroupForVcpu(virDomainObjPtr vm); diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index dea0788..01f92be 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -4599,7 +4599,7 @@ static int qemuDomainHotplugVcpus(virQEMUDriverPtr driver, /* vm->def->cputune.vcpupin can't be NULL if * vm->def->cpumask is not NULL. */ - virDomainVcpuPinDefPtr vcpupin = NULL; + virDomainPinDefPtr vcpupin = NULL; if (VIR_ALLOC(vcpupin) < 0) goto cleanup; @@ -4901,7 +4901,7 @@ qemuDomainPinVcpuFlags(virDomainPtr dom, qemuDomainObjPrivatePtr priv; bool doReset = false; size_t newVcpuPinNum = 0; - virDomainVcpuPinDefPtr *newVcpuPin = NULL; + virDomainPinDefPtr *newVcpuPin = NULL; virBitmapPtr pcpumap = NULL; virQEMUDriverConfigPtr cfg = NULL; virCapsPtr caps = NULL; @@ -5138,7 +5138,7 @@ qemuDomainGetVcpuPinInfo(virDomainPtr dom, goto cleanup; for (vcpu = 0; vcpu < ncpumaps; vcpu++) { - virDomainVcpuPinDefPtr pininfo; + virDomainPinDefPtr pininfo; virBitmapPtr bitmap = NULL; unsigned char *tmpmap = NULL; int tmpmaplen; @@ -5191,7 +5191,7 @@ qemuDomainPinEmulator(virDomainPtr dom, qemuDomainObjPrivatePtr priv; bool doReset = false; size_t newVcpuPinNum = 0; - virDomainVcpuPinDefPtr *newVcpuPin = NULL; + virDomainPinDefPtr *newVcpuPin = NULL; virBitmapPtr pcpumap = NULL; virQEMUDriverConfigPtr cfg = NULL; virCapsPtr caps = NULL; @@ -5670,7 +5670,7 @@ qemuDomainGetIOThreadsConfig(virDomainDefPtr targetDef, goto cleanup; for (i = 0; i < targetDef->iothreads; i++) { - virDomainVcpuPinDefPtr pininfo; + virDomainPinDefPtr pininfo; if (VIR_ALLOC(info_ret[i]) < 0) goto cleanup; @@ -5775,7 +5775,7 @@ qemuDomainPinIOThread(virDomainPtr dom, virDomainDefPtr persistentDef = NULL; virBitmapPtr pcpumap = NULL; qemuDomainObjPrivatePtr priv; - virDomainVcpuPinDefPtr *newIOThreadsPin = NULL; + virDomainPinDefPtr *newIOThreadsPin = NULL; size_t newIOThreadsPinNum = 0; virCgroupPtr cgroup_iothread = NULL; virObjectEventPtr event = NULL; diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index d1f089d..3eb0a6a 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -2494,7 +2494,7 @@ qemuProcessSetVcpuAffinities(virDomainObjPtr vm) { qemuDomainObjPrivatePtr priv = vm->privateData; virDomainDefPtr def = vm->def; - virDomainVcpuPinDefPtr pininfo; + virDomainPinDefPtr pininfo; int n; int ret = -1; VIR_DEBUG("Setting affinity on CPUs nvcpupin=%zu nvcpus=%d nvcpupids=%d", @@ -2560,7 +2560,7 @@ qemuProcessSetIOThreadsAffinity(virDomainObjPtr vm) { qemuDomainObjPrivatePtr priv = vm->privateData; virDomainDefPtr def = vm->def; - virDomainVcpuPinDefPtr pininfo; + virDomainPinDefPtr pininfo; size_t i; int ret = -1; -- 2.1.0 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list