Massive variations of execution time on x86
Hi!
A well established RT application failed lately in QA.
It fails only on newer x86 systems such as Tremont, Tiger-Lake or Elkhart-Lake.
While analyzing the failure I've noticed that the application never is interrupted by the CPU scheduler, it has the CPU all the time
and it does not call into the kernel (neither Linux nor cobalt).
It turned out that a CPU bound computation within the application takes sometimes significant longer.
I can reproduce also using a simple for() loop.
So it is also not a memory bus issue, IMHO.
For example, a pure user space computation takes most of the time 100us but in about 10% of all executions it can take up to 500us. The number vary heavily depending on CPU type and generation but execution is still often way slower than expected.
The most problematic case thus far is with a Tremont-L system,
where the execution time varies between 100us and 500us.
On the other hand, the discrepancy is slightly better with an Elkhart Lake system, with a delta of "only" 60us.
Initially, I suspected that the CPU frequency governor might not be set to performance, but I have confirmed that it is indeed configured correctly.
Since the application consistently acquires the CPU when necessary, latency does not appear to be the issue.
This has been verified by running cyclictest and latency programs plus an in-house test.
I have also experimented with various kernel settings, such as idle=poll, intel_idle.max_cstate=0, and ensuring that turbo mode is disabled.
However, none of these adjustments have provided any improvement thus far. Additionally, I have tried using the cpuidle.off=1 setting.
According to the hardware vendor, SMIs are also disabled.
I would greatly appreciate your insights on this matter.
Is there any obvious setting or configuration that I might have overlooked?
Please note that we are currently using kernel 5.15 with Xenomai 3.2, although I do not believe this to be a significant factor in the issue.
Thanks,
//richard
Quoted 19 lines · Richard Weinberger
Hi!
A well established RT application failed lately in QA.
It fails only on newer x86 systems such as Tremont, Tiger-Lake or Elkhart-Lake.While analyzing the failure I've noticed that the application never is interrupted by the CPU scheduler, it has the CPU all the time
and it does not call into the kernel (neither Linux nor cobalt).
It turned out that a CPU bound computation within the application takes sometimes significant longer.I can reproduce also using a simple
for()loop.
So it is also not a memory bus issue, IMHO.For example, a pure user space computation takes most of the time 100us but in about 10% of all executions it can take up to 500us. The number vary heavily depending on CPU type and generation but execution is still often way slower than expected.
Quoted 7 lines
The most problematic case thus far is with a Tremont-L system,
where the execution time varies between 100us and 500us.
On the other hand, the discrepancy is slightly better with an Elkhart Lake system, with a delta of "only" 60us.Initially, I suspected that the CPU frequency governor might not be set to performance, but I have confirmed that it is indeed configured correctly.
We just had such a case in-house with the governor not being set to performance and frequency varying on RT entry - too bad that it's not that simple here apparently.
Quoted 10 lines
Since the application consistently acquires the CPU when necessary, latency does not appear to be the issue.
This has been verified by running cyclictest and latency programs plus an in-house test.I have also experimented with various kernel settings, such as idle=poll, intel_idle.max_cstate=0, and ensuring that turbo mode is disabled.
However, none of these adjustments have provided any improvement thus far. Additionally, I have tried using the cpuidle.off=1 setting.
According to the hardware vendor, SMIs are also disabled.
Quoted 5 lines
I would greatly appreciate your insights on this matter.
Is there any obvious setting or configuration that I might have overlooked?Please note that we are currently using kernel 5.15 with Xenomai 3.2, although I do not believe this to be a significant factor in the issue.
Thermal throttling of any kind? Is the system passively cooled and may overheat under performance settings for power management?
Also, do you see similar variations with similar variations on the same hardware with preempt-rt (provided at least your synthetic tests are portable)?
Jan
Signature · 2 lines
Siemens AG, Technology Competence Center Embedded Linux
----- Ursprüngliche Mail -----
Quoted 3 lines
Von: "Jan Kiszka" <[email protected]>
Thermal throttling of any kind? Is the system passively cooled and may overheat under performance settings for power management?
It is passive cooled but according to hardware engineers, the temperature is not even close to a limit.
Is comparing /sys/devices/system/cpu/cpuX/cpufreq/scaling_cur_freq and scaling_max_freq the correct way to detect throttling?
Quoted 3 lines
Also, do you see similar variations with similar variations on the same hardware with preempt-rt (provided at least your synthetic tests are portable)?
I think I can do this. But might need some time.
Thanks,
//richard
Quoted 17 lines
-----Original Message-----
From: Richard Weinberger <[email protected]>
Sent: Monday, June 12, 2023 7:16 PM
To: Kiszka, Jan <[email protected]>
Cc: xenomai <[email protected]>
Subject: Re: Massive variations of execution time on x86----- Ursprüngliche Mail -----
Quoted 3 lines
Von: "Jan Kiszka" <[email protected]>
Thermal throttling of any kind? Is the system passively cooled and may overheat under performance settings for power management?It is passive cooled but according to hardware engineers, the temperature is not even close to a limit.
Quoted 8 lines
Is comparing
/sys/devices/system/cpu/cpuX/cpufreq/scaling_cur_freqandscaling_max_freqthe correct way to detect throttling?Quoted 3 lines
Also, do you see similar variations with similar variations on the same hardware with preempt-rt (provided at least your synthetic tests are portable)?
I think I can do this. But might need some time.
Did you try with disabling Hyper-threading?
Regards
Hongzhan Chen
Quoted 3 lines
Thanks,
//richard
----- Ursprüngliche Mail -----
Quoted 2 lines
Von: "Hongzhan Chen" <[email protected]>
Did you try with disabling Hyper-threading?
Hyperthreading is always disabled on all x86 systems here.
Thanks,
//richard
----- Ursprüngliche Mail -----
Quoted 5 lines
Von: "richard" <[email protected]>
An: "Jan Kiszka" <[email protected]>
It is passive cooled but according to hardware engineers, the temperature is not even close to a limit.
Quoted 8 lines
Is comparing
/sys/devices/system/cpu/cpuX/cpufreq/scaling_cur_freqandscaling_max_freqthe correct way to detect throttling?Quoted 3 lines
Also, do you see similar variations with similar variations on the same hardware with preempt-rt (provided at least your synthetic tests are portable)?
I think I can do this. But might need some time.
I can confirm that the variations are also observable without Xenomai/Dovetail.
Thanks,
//richard
Quoted 18 lines
-----Original Message-----
From: Richard Weinberger <[email protected]>
Sent: Wednesday, June 14, 2023 1:20 AM
To: Kiszka, Jan <[email protected]>
Cc: xenomai <[email protected]>
Subject: Re: Massive variations of execution time on x86----- Ursprüngliche Mail -----
Quoted 8 lines
Von: "richard" <[email protected]>
An: "Jan Kiszka" <[email protected]>
It is passive cooled but according to hardware engineers, the temperature is not even close to a limit.Is comparing
/sys/devices/system/cpu/cpuX/cpufreq/scaling_cur_freqandscaling_max_freqthe correct way to detect throttling?
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
Also, do you see similar variations with similar variations on the same hardware with preempt-rt (provided at least your synthetic tests are portable)?
I think I can do this. But might need some time.
I can confirm that the variations are also observable without Xenomai/Dovetail.
SMI processing can last for hundreds of microseconds depending on system.
I know that it are all disabled according to your hardware vendor. I do not know if it is worth double confirming the value through rdmsr 0x34 really does not increase when issue happen but we have no idea about the root cause.
Regards
Hongzhan Chen
Quoted 2 lines
Thanks,
//richard
----- Ursprüngliche Mail -----
Quoted 7 lines
Von: "Hongzhan Chen" <[email protected]>
SMI processing can last for hundreds of microseconds depending on system. I know that it are all disabled according to your hardware vendor. I do not know if it is worth
double confirming the value through rdmsr0x34really does not increase when issue happen
but we have no idea about the root cause.
Our test case monitors the SMI counter via /dev/cpu/X/msr and observes no change in the counters while the test runs.
So I'd rule out SMI.
Thanks,
//richard
Quoted 9 lines · Richard Weinberger
----- Ursprüngliche Mail -----
Quoted 7 lines
Von: "Hongzhan Chen" <[email protected]>
SMI processing can last for hundreds of microseconds depending on system. I know that it are all disabled according to your hardware vendor. I do not know if it is worth
double confirming the value through rdmsr0x34really does not increase when issue happen
but we have no idea about the root cause.
Quoted 6 lines
Our test case monitors the SMI counter via
/dev/cpu/X/msrand observes no change in the counters while the test runs.
So I'd rule out SMI.Thanks,
//richard
Any chance an NMI-based Perf event handler might be causing this? (nmi_watchdog=0)
Signature · 1 line
Philippe.
----- Ursprüngliche Mail -----
Quoted 3 lines
Von: "Philippe Gerum" <[email protected]>
Any chance an NMI-based Perf event handler might be causing this? (nmi_watchdog=0)
Hm, I did check "NMI" in /proc/interrupts, the numbers don't raise.
Thanks,
//richard