Re: [RFC PATCH] cpufreq: qcom-cpufreq-hw: allow work to be done on other CPU for PREEMPT_RT

From: Krzysztof Kozlowski
Date: Thu Mar 16 2023 - 08:29:02 EST



On 15/03/2023 17:49, Krzysztof Kozlowski wrote:
> Qualcomm cpufreq driver configures interrupts with affinity to each
> cluster, e.g. dcvsh-irq-0, dcvsh-irq-4 and dcvsh-irq-7 on SM8250.
> Triggered interrupt will schedule delayed work, but, since workqueue
> prefers local CPUs, it might get executed on a CPU dedicated to realtime
> tasks causing unexpected latencies in realtime workload.
>
> Use unbound workqueue for such case. This might come with performance
> or energy penalty, e.g. because of cache miss or when other CPU is
> sleeping.
>
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@xxxxxxxxxx>
> ---
> drivers/cpufreq/qcom-cpufreq-hw.c | 11 ++++++++++-

Let me also paste impact of this patch - rtla osnoise on entirely idle
system (cores 2-7 isolated for Realtime):

BEFORE:
osnoise/7-2967 [007] d..h2.. 3937.898311: irq_noise: dcvsh-irq-7:179 start 3937.898310871 duration 104 ns
irq/179-dcvsh-i-343 [007] d..h2.. 3937.898318: irq_noise: IPI:6 start 3937.898317537 duration 104 ns
irq/179-dcvsh-i-343 [007] d...3.. 3937.898321: thread_noise: irq/179-dcvsh-i:343 start 3937.898316287 duration 4740 ns
kworker/7:0-85 [007] d..h2.. 3937.898323: irq_noise: IPI:6 start 3937.898322381 duration 104 ns
kworker/7:0-85 [007] d...3.. 3937.898343: thread_noise: kworker/7:0:85 start 3937.898321339 duration 20990 ns
osnoise/7-2967 [007] ....... 3937.898343: sample_threshold: start 3937.898308475 duration 34531 ns interference 5

Noise duration: 34 us

AFTER:
osnoise/7-2637 [007] d..h2.. 530.563819: irq_noise: dcvsh-irq-7:178 start 530.563817139 duration 260 ns
osnoise/7-2637 [007] d..h2.. 530.563827: irq_noise: IPI:6 start 530.563826670 duration 156 ns
osnoise/7-2637 [007] ....... 530.563828: sample_threshold: start 530.563814587 duration 12864 ns interference 2

Noise duration: 13 us

Best regards,
Krzysztof