<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, 31 Jan 2023 at 22:49, Michal Prívozník <<a href="mailto:mprivozn@redhat.com">mprivozn@redhat.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On 1/31/23 13:43, Dipanjan Das wrote:<br>
> Hello,<br>
> <br>
> I am getting the following error message when trying to run a VM with<br>
> the emulatorpin cpuset set to a value -<br>
> <br>
> "cannot set CPU affinity on process 78: Invalid argument".<br>
> <br>
> Note that removing the emulatorpin leads to the VM running successfully.<br>
> <br>
> The core that I am setting for the emulatorpin cpuset is present on the<br>
> system and is not in the isolcpus set of the host.<br>
<br>
The question is, whether the container that libvirtd runs in is allowed<br>
to run on the selected cpuset. I mean, you can have a cgroup that allows<br>
a subset of physical CPUs, and when a process running within the cgroup<br>
tries to set affinity to a CPU that's not allowed it gets EINVAL.<br></blockquote><div><br></div><div>Makes sense. </div><div><br></div><div>I am now wondering whether we can check the cgroups on the host or inside the containers to confirm that this is the case. Since I am setting the emulator pin thread to a known cpu, being able to check whether the cpu is in the cpu subset of the cgroup might be a quick way to find the problem.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
The function this error message comes from is: virProcessSetAffinity()<br>
(the linux version)<br>
<br>
<a href="https://gitlab.com/libvirt/libvirt/-/blob/master/src/util/virprocess.c#L445" rel="noreferrer" target="_blank">https://gitlab.com/libvirt/libvirt/-/blob/master/src/util/virprocess.c#L445</a><br>
<br>
Another reason for the error might be insufficient permissions (though<br>
the man page of sched_setaffinity() says you'd get an EPERM so maybe not).<br>
<br>
> <br>
> Any suggestions on what could be the problem? Any pointers to how to<br>
> debug the issue would help greatly too.<br>
<br>
Turning on debug logs is a good start. From there you'd need a trained<br>
eye to see the code path, but if you post a link to the logs here I'll<br>
try to help.<br>
<br></blockquote><div><br></div><div>Thank you very much. Should I enable debug logs for any specific module(s) or for all of them? </div></div></div></div></div>