CPU Pinning Alder Lake

Do you see 1,3,5,7 as not running/doing nothing, or they completely removed?

I don’t know if the topology is the same for all systems, it might be different for systems that can disable HT in the firmware. I can’t disable HT in the firmware, I can only use the Xen smt=off option, which might be why I see all the cores all the time, for me smt=off just seems to set the affinity to 0,2,4,6…

Xen will balance the load across the affinity set for the domain, you can use xl vcpu-list to see which cores are current being used by which vcpu.

When using smt=off instead of disabling HT in the firmware, all cores/threads are enumerated, but then sibling threads are disabled. Which leaves a bit weird numbering, with holes after sibling threads.

4 Likes

I shifted my main Qubes system from an Intel E5-2699AV4 22-core 2.4 / 3.6Ghz to an i9-14900K 24-core with two max 6Ghz P-cores and I’d say the performance difference is on the order of ~10’s of percent without P/E pinning. I was hoping for quite a bit more and P/E pinning doesn’t look like it will provide much more.

Do make certain to turn off hyper-threading in the BIOS, as that does make the Qubes OS respond better (I expected no difference as the OS turns off hyper-threading, but that was wrong).

Possible improvements:
/usr/share/qubes/templates/libvirt/xen-user.xml

{% extends 'libvirt/xen.xml' %}
{% block basic %}
        {% if vm.features.get('vcpu_pin_pcores', '0') == '1' -%}
        <vcpu>{{ vm.vcpus }}</vcpu>
            <cputune>
                {% for i in range(vm.vcpus) %}
                    <vcpupin vcpu='{{ i }}' cpuset='{{ i }}'/>
                {% endfor %}
            </cputune>
        {% else -%}
        <vcpu>{{ vm.vcpus }}</vcpu>
            <cputune>
                {% for i in range(vm.vcpus) %}
                    <vcpupin vcpu='{{ i }}' cpuset='16-23'/>
                {% endfor %}
            </cputune>
        {% endif -%}
        {{ super() }}
{% endblock %}

Set vcpu_pin_pcores feature to 1 for the qubes that should use P-cores:

qvm-features GamingQube vcpu_pin_pcores 1

Other qubes will use E-cores.

Automatically set the HVM stubdomains to use specific cores using libxl hook: