Enabling WARN_DOUBLE_CLOCK in /sys/kernel/debug/sched_features causes
warning to fire in update_rq_clock. This seems to be caused by onlining
a new fair sched group not using the rq lock wrappers.

[  612.379993] rq->clock_update_flags & RQCF_UPDATED
[  612.380007]  WARNING: CPU: 6 PID: 21426 at kernel/sched/core.c:225 
update_rq_clock+0x90/0x130
[  612.393082] Modules linked in: binfmt_misc rpcsec_gss_krb5 auth_rpcgss nfsv4 
dns_resolver nfs lockd grace fscache sunrpc vfat fat sg xgene_hwmon 
gpio_xgene_sb gpio_dwapb gpio_generic xgene_edac mailbox_xgene_slimpro 
xgene_rng uio_pdrv_genirq uio sch_fq_codel xfs libcrc32c xgene_enet 
i2c_xgene_slimpro at803x realtek ahci_xgene libahci_platform mdio_xgene 
dm_mirror dm_region_hash dm_log dm_mod
[  612.427615] CPU: 6 PID: 21426 Comm: (dnf) Not tainted 
4.16.0-10.el8+5.aarch64 #1
[  612.434973] Hardware name: AppliedMicro X-Gene Mustang Board/X-Gene Mustang 
Board, BIOS 3.06.25 Oct 17 2016
[  612.444667] pstate: 60000085 (nZCv daIf -PAN -UAO)
[  612.449434] pc : update_rq_clock+0x90/0x130
[  612.453595] lr : update_rq_clock+0x90/0x130
[  612.457754] sp : ffff00000efefd60
[  612.461050] x29: ffff00000efefd60 x28: ffff8003c23d5400
[  612.466335] x27: ffff8003ca119c00 x26: ffff0000090bc000
[  612.471620] x25: ffff0000090bc090 x24: ffff0000090b3c68
[  612.476905] x23: ffff8003cefe1500 x22: ffff000008dbd280
[  612.482192] x21: 0000000000000000 x20: 0000000000000000
[  612.487478] x19: ffff8003ffddd280 x18: ffffffffffffffff
[  612.492763] x17: 0000000000000000 x16: 0000000000000000
[  612.498049] x15: ffff0000090b3c08 x14: ffff0000897a5a17
[  612.503334] x13: ffff0000097a5a25 x12: ffff0000090ff000
[  612.508620] x11: ffff0000090bbc90 x10: ffff000008548a78
[  612.513906] x9 : 00000000ffffffd0 x8 : 50555f4643515220
[  612.519191] x7 : 26207367616c665f x6 : 00000000000001cd
[  612.524477] x5 : 00ffffffffffffff x4 : 0000000000000000
[  612.529761] x3 : 0000000000000000 x2 : ffffffffffffffff
[  612.535047] x1 : 1f9a6a58385a9900 x0 : 0000000000000000
[  612.540333] Call trace:
[  612.542767]  update_rq_clock+0x90/0x130
[  612.546585]  online_fair_sched_group+0x70/0x140
[  612.551092]  sched_online_group+0xd0/0xf0
[  612.555082]  sched_autogroup_create_attach+0xd0/0x198
[  612.560108]  sys_setsid+0x140/0x160
[  612.563579]  el0_svc_naked+0x44/0x48

Signed-off-by: Phil Auld <pa...@redhat.com>
Cc: Peter Zijlstra <pet...@infradead.org>
Cc: Ingo Molnar <mi...@kernel.org>
Cc: Vincent Guittot <vincent.guit...@linaro.org>

---
 kernel/sched/fair.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 036be95a87e9..5c1299a5675c 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -10242,17 +10242,17 @@ void online_fair_sched_group(struct task_group *tg)
 {
        struct sched_entity *se;
        struct rq *rq;
+       struct rq_flags rf;
        int i;
 
        for_each_possible_cpu(i) {
                rq = cpu_rq(i);
                se = tg->se[i];
-
-               raw_spin_lock_irq(&rq->lock);
+               rq_lock(rq, &rf);
                update_rq_clock(rq);
                attach_entity_cfs_rq(se);
                sync_throttle(tg, i);
-               raw_spin_unlock_irq(&rq->lock);
+               rq_unlock(rq, &rf);
        }
 }
 
-- 
2.18.0

Reply via email to