[libvirt] [PATCH v2] qemu: fix vcpupin fail as no vcpu tid set

Yi Wang posted 1 patch 5 years, 2 months ago
Failed in applying to current master (apply log)
src/qemu/qemu_domain.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[libvirt] [PATCH v2] qemu: fix vcpupin fail as no vcpu tid set
Posted by Yi Wang 5 years, 2 months ago
vcpupin will fail when maxvcpus is larger than current
vcpu:

virsh vcpupin win7 --vcpu 0 --cpulist 5-6
error: Requested operation is not valid: cpu affinity is not supported

win7 xml in the command above is like below:
...
<vcpu current="3" placement="static">8</vcpu>
...

The reason is vcpu[3] and vcpu[4] have zero tids and should not been
compared as valid situation in qemuDomainRefreshVcpuInfo().

This issue is introduced by commit 34f7743, which fix recording of vCPU
pids for MTTCG.

Signed-off-by: Yi Wang <wang.yi59@zte.com.cn>
---
v2: stop considering zero TIDs as duplicate. Thanks to Jano.
---
 src/qemu/qemu_domain.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index ac01e86..c70d3f3 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -10708,7 +10708,7 @@ qemuDomainRefreshVcpuInfo(virQEMUDriverPtr driver,
         }
 
         for (j = 0; j < i; j++) {
-            if (info[i].tid == info[j].tid) {
+            if (0 != info[i].tid && info[i].tid == info[j].tid) {
                 VIR_DEBUG("vCPU[%zu] PID %llu duplicates vCPU[%zu]",
                           i, (unsigned long long)info[i].tid, j);
                 validTIDs = false;
-- 
1.8.3.1

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH v2] qemu: fix vcpupin fail as no vcpu tid set
Posted by Ján Tomko 5 years, 1 month ago
more descriptive as:
qemu: fix vcpu pinning when not all vcpus are enabled

On Tue, Feb 26, 2019 at 10:01:28AM +0800, Yi Wang wrote:
>vcpupin will fail when maxvcpus is larger than current
>vcpu:
>
>virsh vcpupin win7 --vcpu 0 --cpulist 5-6
>error: Requested operation is not valid: cpu affinity is not supported
>
>win7 xml in the command above is like below:
>...
><vcpu current="3" placement="static">8</vcpu>
>...
>
>The reason is vcpu[3] and vcpu[4] have zero tids and should not been
>compared as valid situation in qemuDomainRefreshVcpuInfo().
>
>This issue is introduced by commit 34f7743, which fix recording of vCPU
>pids for MTTCG.
>
>Signed-off-by: Yi Wang <wang.yi59@zte.com.cn>
>---
>v2: stop considering zero TIDs as duplicate. Thanks to Jano.
>---
> src/qemu/qemu_domain.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
>diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
>index ac01e86..c70d3f3 100644
>--- a/src/qemu/qemu_domain.c
>+++ b/src/qemu/qemu_domain.c
>@@ -10708,7 +10708,7 @@ qemuDomainRefreshVcpuInfo(virQEMUDriverPtr driver,
>         }
>
>         for (j = 0; j < i; j++) {
>-            if (info[i].tid == info[j].tid) {
>+            if (0 != info[i].tid && info[i].tid == info[j].tid) {

The prevalent style is with the '0' on the right side. I'll fix that
when pushing.

>                 VIR_DEBUG("vCPU[%zu] PID %llu duplicates vCPU[%zu]",
>                           i, (unsigned long long)info[i].tid, j);
>                 validTIDs = false;

Reviewed-by: Ján Tomko <jtomko@redhat.com>

Jano
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt][PATCH v2] qemu: fix vcpupin fail as no vcpu tid set
Posted by wang.yi59@zte.com.cn 5 years, 1 month ago
> more descriptive as:
> qemu: fix vcpu pinning when not all vcpus are enabled

Thanks.

>
> On Tue, Feb 26, 2019 at 10:01:28AM +0800, Yi Wang wrote:
> >vcpupin will fail when maxvcpus is larger than current
> >vcpu:
> >
> >virsh vcpupin win7 --vcpu 0 --cpulist 5-6
> >error: Requested operation is not valid: cpu affinity is not supported
> >
> >win7 xml in the command above is like below:
> >...
> ><vcpu current="3" placement="static">8</vcpu>
> >...
> >
> >The reason is vcpu[3] and vcpu[4] have zero tids and should not been
> >compared as valid situation in qemuDomainRefreshVcpuInfo().
> >
> >This issue is introduced by commit 34f7743, which fix recording of vCPU
> >pids for MTTCG.
> >
> >Signed-off-by: Yi Wang <wang.yi59@zte.com.cn>
> >---
> >v2: stop considering zero TIDs as duplicate. Thanks to Jano.
> >---
> > src/qemu/qemu_domain.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> >diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
> >index ac01e86..c70d3f3 100644
> >--- a/src/qemu/qemu_domain.c
> >+++ b/src/qemu/qemu_domain.c
> >@@ -10708,7 +10708,7 @@ qemuDomainRefreshVcpuInfo(virQEMUDriverPtr driver,
> >         }
> >
> >         for (j = 0; j < i; j++) {
> >-            if (info[i].tid == info[j].tid) {
> >+            if (0 != info[i].tid && info[i].tid == info[j].tid) {
>
> The prevalent style is with the '0' on the right side. I'll fix that
> when pushing.

Thank you, Jano.

>
> >                 VIR_DEBUG("vCPU[%zu] PID %llu duplicates vCPU[%zu]",
> >                           i, (unsigned long long)info[i].tid, j);
> >                 validTIDs = false;
>
> Reviewed-by: Ján Tomko <jtomko@redhat.com>
>
> Jano

---
Best wishes
Yi Wang--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list