[PATCH] rtld: cache cpuid results on the stack for intel

Florian Weimer fweimer@redhat.com
Tue Feb 3 10:58:24 GMT 2026


* Fabian Rast:

> On Mon Feb 2, 2026 at 10:26 AM CET, Florian Weimer wrote:
>> * Fabian Rast:
>>
>>> Does anyone have experience with slow cpuid that could explain whats going =
>>> on?
>>
>> In the slow case, are you running on bare metal, or is it virtualized?
>
> This is on bare metal. An Intel(R) Xeon(R) Gold 6430.
>
> My supervisor has access to more hardware - here are the results for
> different processors:
>
> model name      : Intel(R) Xeon(R) Gold 6338 CPU @ 2.00GHz
> ./selfexec_patch 1000 ran 1.03 ± 0.01 times faster than ./selfexec_master 1000
>
> model name      : Intel(R) Core(TM) i9-7900X CPU @ 3.30GHz
> ./selfexec_patch 1000 ran 1.03 ± 0.02 times faster than ./selfexec_master 1000
>
> model name      : Intel(R) Core(TM) i5-8250U CPU @ 1.60GHz
> ./selfexec_patch 1000 ran 1.02 ± 0.01 times faster than ./selfexec_master 1000
>
> Note that these binaries are statically linked, which amplifies the
> effect (less loader overhead...). For comparison, here is the Intel(R)
> Xeon(R) Gold 6430 again:
> ./selfexec_patch 1000 ran 1.23 ± 0.04 times faster than ./selfexec_master 1000
>
> It looks like there is something special going on with the 6430, or I
> am missing something... It would be great if someone that has access to
> a xeon gold 6430 could reproduce this.

I could reproduce it on the first Xeon 6430 I picked:

Benchmark 1: /tmp/r0 100
  Time (mean ± σ):      16.2 ms ±   0.2 ms    [User: 6.5 ms, System: 9.6 ms]
  Range (min … max):    15.8 ms …  16.8 ms    171 runs
 
Benchmark 2: /tmp/r1 100
  Time (mean ± σ):      13.7 ms ±   0.1 ms    [User: 4.0 ms, System: 9.6 ms]
  Range (min … max):    13.3 ms …  14.2 ms    198 runs
 
Summary
  /tmp/r1 100 ran
    1.19 ± 0.02 times faster than /tmp/r0 100

(r1 is patched.)

This is with kernel-5.14.0-611.27.1.el9_7.x86_64, with microcode version
0x2b000650.

I don't if the CPU is pre-production silicon, so I'm hesitant to share
more detail here.  I'll bring it to Intel's attention.

Thanks,
Florian



More information about the Libc-alpha mailing list