Re: [External] Re: [PATCH v3] sched/core: Adapt WARN_DOUBLE_CLOCK machinery for core-sched

From: Hao Jia
Date: Tue Apr 04 2023 - 05:07:20 EST




On 2023/3/31 Phil Auld wrote:
Hi,

On Thu, Mar 30, 2023 at 11:58:27AM +0800 Hao Jia wrote:
When sched_core_enabled(), we sometimes need to call update_rq_clock()
to update the rq clock of sibling CPUs on the same core, before that we
need to clear RQCF_UPDATED of rq->clock_update_flags to avoid the
WARN_DOUBLE_CLOCK warning. Because at this time the rq->clock_update_flags
of sibling CPUs may be RQCF_UPDATED. If sched_core_enabled(), we will get
a core wide rq->lock, so at this point we can safely clear RQCF_UPDATED of
rq->clock_update_flags of all CPUs on this core to avoid the
WARN_DOUBLE_CLOCK warning.

We sometimes use rq_pin_lock() and raw_spin_rq_lock() separately,
For example newidle_balance() and _double_lock_balance(). We will
temporarily give up core wide rq->lock, and then use raw_spin_rq_lock()
to reacquire core wide rq->lock without rq_pin_lock(), so We can not
clear RQCF_UPDATED of rq->clock_update_flags of other cpus on the
same core in rq_pin_lock().

Steps to reproduce:
1. Enable CONFIG_SCHED_DEBUG and CONFIG_SCHED_CORE when compiling
the kernel
2. echo 1 > /sys/kernel/debug/clear_warn_once
echo "WARN_DOUBLE_CLOCK" > /sys/kernel/debug/sched/features
3. Run the linux/tools/testing/selftests/sched/cs_prctl_test test

Signed-off-by: Hao Jia <jiahao.os@xxxxxxxxxxxxx>

I think this looks good. One small nit is that I think you might
replace "core wide" with "core-wide" everywhere.


Reviewed-by: Phil Auld <pauld@xxxxxxxxxx>


Thank you for your review, I will do it in the next version.

Thanks,
Hao