Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp4701925ybf; Wed, 4 Mar 2020 09:01:20 -0800 (PST) X-Google-Smtp-Source: ADFU+vsxqeek1wYoq81GDYjVatHv78OUIBlkOwk4MNCh0SvogOi+nDWQe0+aKc7cPpRASaaxn9qw X-Received: by 2002:a05:6830:1d7a:: with SMTP id l26mr3023070oti.138.1583341280501; Wed, 04 Mar 2020 09:01:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583341280; cv=none; d=google.com; s=arc-20160816; b=LfD4gp3wiM/kUGl32BuLcHal4Nf+MGdBZtBPJzjVyCYtlrythZT+n93PaKgIDVZb2q TDCZdURQUhgwhOxpCfaE0b2IIXvdXjvNHK6sJ1VtJbzPoajLvruPGijBAPjbK0EzvdW6 cm9P6s7lbxStBo4AjcFnu4ADwSkL5DjVxbAi5gNF91KDb/wCkRXgyL7DGa/RV41P8dpQ Tq3px8U7LC5mdBGNdQTLb1h5WJcFKSLexcAW62MVq57PQTfhjWeyPYAyX09aE13bERYc 6Wlq+sp8K2Sm2yQB99sd0XuHwijlBMkswH955IEqkMnZsIM2neevIlwDQtW3+BRU2Fx/ kJxg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature; bh=4bsjMovkwgawW7FUXP1JiJFQIK3+Hyda7U4iU54bPrA=; b=VfiE1/GabrFB3h8gSS1zgqYHhH8uR1Wx7u0CSSAr6XWzet2zzb3bgyN90voQwBkPJ0 yNmwCl48TCqz1Y2VVNkMnUit25FLEH+7F/PLM+mJlKenLsj3C0wR9BCKPHkG9OTWENNi WcXu9Gln1Y0oW80xEorVTPx2epe9r3l+hBPEjy5+UdSxhvnNzMcM/0TMHiPvIwqk+9IO pXWLfR5b/89rehV/7epZ+wW4EahKvAff5hY1kRIVRghLNdKF4yAxMoYzt8J9xdINq236 PFi4hY9jlhD7sfeIFgxAaRDKI3VvW+88KQkLut3+IdmxgQNVBqwAt2NY1+k+QVgAuqfv HHzw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@digitalocean.com header.s=google header.b=TxyonjsA; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=digitalocean.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 2si1426484oix.27.2020.03.04.09.01.07; Wed, 04 Mar 2020 09:01:20 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@digitalocean.com header.s=google header.b=TxyonjsA; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=digitalocean.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388386AbgCDRAc (ORCPT + 99 others); Wed, 4 Mar 2020 12:00:32 -0500 Received: from mail-qk1-f193.google.com ([209.85.222.193]:36196 "EHLO mail-qk1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388374AbgCDRAW (ORCPT ); Wed, 4 Mar 2020 12:00:22 -0500 Received: by mail-qk1-f193.google.com with SMTP id u25so2332742qkk.3 for ; Wed, 04 Mar 2020 09:00:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=digitalocean.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=4bsjMovkwgawW7FUXP1JiJFQIK3+Hyda7U4iU54bPrA=; b=TxyonjsA7uD+j2WSiYAXbIU3VZwHbhl1Gp24lb+qdD7KxFJJ3f1aucxyoWTko19LNR wtiPxPj4CYOVvP2oGy/VF95K1JPXL31wMrELHBkUZqpwS2za6ExZ1NJlgXuUnxY8bocY Lt9LV/e9UQQG+Ju7gxW+puFxCfiM+coK+XADY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=4bsjMovkwgawW7FUXP1JiJFQIK3+Hyda7U4iU54bPrA=; b=KipLq4KQOYoqbnPqOx5qDGLT5n7stggsjCQLiL1fDBrf+oUbuOYOeo+tK12CFIQRaY nj/l84niCo3c5eLwceWrJiIfIiCyAAvebfZjswTT0eq3uZpQAmlMUMopFyGv0kXHi4lI m/rmth7F0DuLt82e+wQfq1j1zK7crbsfOhAat4196nn9dT9AGnxtgPBrwUZEgEHDFoby u+jDhJ+WLY/6Y7lnTeWhkBfefC5WOQStEeql9u6AS6wvO/fCf0FemGL1Oz+fEEJGR7hJ cLidDhQgD0xeDd3qG+fhevdZCxRRs3jP5jrDlHvW1zw4a9xeSXdsTeFl/QPwwRga91/z Y3Lg== X-Gm-Message-State: ANhLgQ3AZYl9iAEYz+oS4cxpW+jr+aJuovivGwZxNhU5MyRzwIJfHV9g 4wmgYJccsp5qKQUrb7aZ0bMLUw== X-Received: by 2002:a37:f502:: with SMTP id l2mr3579248qkk.76.1583341221142; Wed, 04 Mar 2020 09:00:21 -0800 (PST) Received: from s2r5node9 ([162.243.188.99]) by smtp.gmail.com with ESMTPSA id x44sm13241963qtc.88.2020.03.04.09.00.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Mar 2020 09:00:20 -0800 (PST) From: vpillai To: Nishanth Aravamudan , Julien Desfossez , Peter Zijlstra , Tim Chen , mingo@kernel.org, tglx@linutronix.de, pjt@google.com, torvalds@linux-foundation.org Cc: linux-kernel@vger.kernel.org, fweisbec@gmail.com, keescook@chromium.org, kerrnel@google.com, Phil Auld , Aaron Lu , Aubrey Li , aubrey.li@linux.intel.com, Valentin Schneider , Mel Gorman , Pawan Gupta , Paolo Bonzini , Joel Fernandes , joel@joelfernandes.org Subject: [RFC PATCH 13/13] sched: Debug bits... Date: Wed, 4 Mar 2020 17:00:03 +0000 Message-Id: <24c0294bb28dc7d2f984ce3aeae5d0a85fd33671.1583332765.git.vpillai@digitalocean.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Peter Zijlstra Not-Signed-off-by: Peter Zijlstra (Intel) --- kernel/sched/core.c | 44 ++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 42 insertions(+), 2 deletions(-) diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 11e5a2a494ac..a01df3e0b11e 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -110,6 +110,10 @@ static inline bool prio_less(struct task_struct *a, struct task_struct *b) int pa = __task_prio(a), pb = __task_prio(b); + trace_printk("(%s/%d;%d,%Lu,%Lu) ?< (%s/%d;%d,%Lu,%Lu)\n", + a->comm, a->pid, pa, a->se.vruntime, a->dl.deadline, + b->comm, b->pid, pb, b->se.vruntime, b->dl.deadline); + if (-pa < -pb) return true; @@ -315,12 +319,16 @@ static void __sched_core_enable(void) static_branch_enable(&__sched_core_enabled); stop_machine(__sched_core_stopper, (void *)true, NULL); + + printk("core sched enabled\n"); } static void __sched_core_disable(void) { stop_machine(__sched_core_stopper, (void *)false, NULL); static_branch_disable(&__sched_core_enabled); + + printk("core sched disabled\n"); } void sched_core_get(void) @@ -4460,6 +4468,14 @@ pick_next_task(struct rq *rq, struct task_struct *prev, struct rq_flags *rf) put_prev_task(rq, prev); set_next_task(rq, next); } + + trace_printk("pick pre selected (%u %u %u): %s/%d %lx\n", + rq->core->core_task_seq, + rq->core->core_pick_seq, + rq->core_sched_seq, + next->comm, next->pid, + next->core_cookie); + return next; } @@ -4540,6 +4556,9 @@ pick_next_task(struct rq *rq, struct task_struct *prev, struct rq_flags *rf) */ if (i == cpu && !need_sync && !p->core_cookie) { next = p; + trace_printk("unconstrained pick: %s/%d %lx\n", + next->comm, next->pid, next->core_cookie); + goto done; } @@ -4548,6 +4567,9 @@ pick_next_task(struct rq *rq, struct task_struct *prev, struct rq_flags *rf) rq_i->core_pick = p; + trace_printk("cpu(%d): selected: %s/%d %lx\n", + i, p->comm, p->pid, p->core_cookie); + /* * If this new candidate is of higher priority than the * previous; and they're incompatible; we need to wipe @@ -4564,6 +4586,8 @@ pick_next_task(struct rq *rq, struct task_struct *prev, struct rq_flags *rf) rq->core->core_cookie = p->core_cookie; max = p; + trace_printk("max: %s/%d %lx\n", max->comm, max->pid, max->core_cookie); + if (old_max) { for_each_cpu(j, smt_mask) { if (j == i) @@ -4591,6 +4615,7 @@ next_class:; rq->core->core_pick_seq = rq->core->core_task_seq; next = rq->core_pick; rq->core_sched_seq = rq->core->core_pick_seq; + trace_printk("picked: %s/%d %lx\n", next->comm, next->pid, next->core_cookie); /* * Reschedule siblings @@ -4616,11 +4641,20 @@ next_class:; if (i == cpu) continue; - if (rq_i->curr != rq_i->core_pick) + if (rq_i->curr != rq_i->core_pick) { + trace_printk("IPI(%d)\n", i); resched_curr(rq_i); + } /* Did we break L1TF mitigation requirements? */ - WARN_ON_ONCE(!cookie_match(next, rq_i->core_pick)); + if (unlikely(!cookie_match(next, rq_i->core_pick))) { + trace_printk("[%d]: cookie mismatch. %s/%d/0x%lx/0x%lx\n", + rq_i->cpu, rq_i->core_pick->comm, + rq_i->core_pick->pid, + rq_i->core_pick->core_cookie, + rq_i->core->core_cookie); + WARN_ON_ONCE(1); + } } done: @@ -4659,6 +4693,10 @@ static bool try_steal_cookie(int this, int that) if (p->core_occupation > dst->idle->core_occupation) goto next; + trace_printk("core fill: %s/%d (%d->%d) %d %d %lx\n", + p->comm, p->pid, that, this, + p->core_occupation, dst->idle->core_occupation, cookie); + p->on_rq = TASK_ON_RQ_MIGRATING; deactivate_task(src, p, 0); set_task_cpu(p, this); @@ -7287,6 +7325,8 @@ int sched_cpu_starting(unsigned int cpu) WARN_ON_ONCE(rq->core && rq->core != core_rq); rq->core = core_rq; } + + printk("core: %d -> %d\n", cpu, cpu_of(core_rq)); #endif /* CONFIG_SCHED_CORE */ sched_rq_cpu_starting(cpu); -- 2.17.1