Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp4237834pxb; Tue, 17 Nov 2020 15:26:22 -0800 (PST) X-Google-Smtp-Source: ABdhPJzQgzgLw6CApryzKdXGdWNCyY5MOsIldZQ3ynbuOgGdUDLIbKGiY9bkgvN0ika9GnJFCulr X-Received: by 2002:a05:6402:308b:: with SMTP id de11mr23475725edb.5.1605655581776; Tue, 17 Nov 2020 15:26:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605655581; cv=none; d=google.com; s=arc-20160816; b=JoUFdQWsiZ47HbkFH+01cQh7huqeuemBUEsmXXHOaOBssI738kta5w8sDZgm1JtAEq I6nU5i8xWz0D8ptLqx6yoQfZDUCEV/UTySnz58TBBUHQbfLiMoRlRP4W3LH53sqELu/J lWh8+ge/irK5qia/qpC4rrn3NnVn9nhForjMgh+BAYh+vCaQMtYFBAMBUJvMwr/dXMPJ 8S8Oi3hmbFwV93noMtiX3Is38HQ5uofdPxjUTnSxGQOPpt0bRkoNgPmVDpmlJXlCbJt3 P1Ebl34lhTWjigQZL46Y36AHxWIailBwi7u2XumCXjd9CvOu5iswNFKVAL7zecRwpL/F lyCQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ajwhDz4Rg5ERPE+hyKxmItX3n9b7wMqRzgmxb1+SNEo=; b=d20z4x84lsne+fn52kPe71HrCQci9RIs0SKnJ3E+2DSIx48+n0wRAAvIv82WqQWOcM 7oeLUO1Ex1zVAghiCgjpWqJ2gWQ0EMXlktrCk4VFvqBJrsAi1yOivaiwrhQyo9a1tCZ9 5PtnQHLuFZZRDt9QJnPhGpfa53tMbgD89KOyOTdkce5lUmvwsgfcLILPL5/adv6EfmEG /2bQbllJKygsZH/KJbpGRNOCcubUoe+m7suhePYA1/av/4ZeFyvEDYLg+QqoGr4ub9Du wAHZv+09NfyphW/x/xOKaPbtGUwYCyj9au9CntpBMBLZ5uG89B74fJ8U3+XUKMCvwz5+ 4Wrg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b=K7UFzx9W; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l9si15252252edi.199.2020.11.17.15.25.59; Tue, 17 Nov 2020 15:26:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b=K7UFzx9W; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729699AbgKQXVZ (ORCPT + 99 others); Tue, 17 Nov 2020 18:21:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40062 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729594AbgKQXVP (ORCPT ); Tue, 17 Nov 2020 18:21:15 -0500 Received: from mail-qk1-x72d.google.com (mail-qk1-x72d.google.com [IPv6:2607:f8b0:4864:20::72d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2CF4DC0613CF for ; Tue, 17 Nov 2020 15:21:15 -0800 (PST) Received: by mail-qk1-x72d.google.com with SMTP id q22so15653qkq.6 for ; Tue, 17 Nov 2020 15:21:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=joelfernandes.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ajwhDz4Rg5ERPE+hyKxmItX3n9b7wMqRzgmxb1+SNEo=; b=K7UFzx9W//sTno7KAXZomMYLzhEM8Bbt4P7ci5nvPA44NtArkBnF+RYot07goPCnxF Uby6hyoDHcIs58LU+2zA1PT31ItrWFo0Rvu/VEe7JSI/IjtQuwYuz4xhPtji3WsFd7SY hx4zQCtubhtgsSJVoB0j7R3jltBbgMCqkEYZQ= 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:mime-version:content-transfer-encoding; bh=ajwhDz4Rg5ERPE+hyKxmItX3n9b7wMqRzgmxb1+SNEo=; b=RUtEPYOhT/BJKQANt4Lk0lvnzQ54ZFD2QR2J+1WBph+IdXAPYAHmg/NUcSgzyDuy45 k230Q89i4iARfdr7BSblkllKD5OUsm5JLsx3PzWlvQIQbFqtzx9+PVwmjGE2NPr4nfy+ SrERTtI5r+q3u4oFBqAWpUo4XCf2HtYiHnSfUckVnxoe+UbDolv1+TlmCJCUeVZmDE7I F9S5p9xYgggEzlD8a8WbP1co0/xtGoosoeDSMLZ9O3/9rkLXQMO96j9ujPZbBLTzZerq gOwL6zlGuXFLK+RuqUTcvMkEtgfAUDEPFi7X9RkFHrXI1r++ulQQjUNDOzjT7gMCcoF5 lgCQ== X-Gm-Message-State: AOAM533T1O5sDX4r91XHp10euZgavVp6uHhZ+Xb5WUSOmL8v3/4a5Ny/ ohUj5ZM6mnfumBowZdwqoviyog== X-Received: by 2002:a37:a402:: with SMTP id n2mr2065409qke.131.1605655274410; Tue, 17 Nov 2020 15:21:14 -0800 (PST) Received: from joelaf.cam.corp.google.com ([2620:15c:6:411:cad3:ffff:feb3:bd59]) by smtp.gmail.com with ESMTPSA id d12sm14555544qtp.77.2020.11.17.15.21.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Nov 2020 15:21:13 -0800 (PST) From: "Joel Fernandes (Google)" To: Nishanth Aravamudan , Julien Desfossez , Peter Zijlstra , Tim Chen , Vineeth Pillai , Aaron Lu , Aubrey Li , tglx@linutronix.de, linux-kernel@vger.kernel.org Cc: mingo@kernel.org, torvalds@linux-foundation.org, fweisbec@gmail.com, keescook@chromium.org, kerrnel@google.com, Phil Auld , Valentin Schneider , Mel Gorman , Pawan Gupta , Paolo Bonzini , joel@joelfernandes.org, vineeth@bitbyteword.org, Chen Yu , Christian Brauner , Agata Gruza , Antonio Gomez Iglesias , graf@amazon.com, konrad.wilk@oracle.com, dfaggioli@suse.com, pjt@google.com, rostedt@goodmis.org, derkling@google.com, benbjiang@tencent.com, Alexandre Chartre , James.Bottomley@hansenpartnership.com, OWeisse@umich.edu, Dhaval Giani , Junaid Shahid , jsbarnes@google.com, chris.hyser@oracle.com, Ben Segall , Josh Don , Hao Luo , Tom Lendacky , Aubrey Li , "Paul E. McKenney" , Tim Chen Subject: [PATCH -tip 32/32] sched: Debug bits... Date: Tue, 17 Nov 2020 18:20:02 -0500 Message-Id: <20201117232003.3580179-33-joel@joelfernandes.org> X-Mailer: git-send-email 2.29.2.299.gdc1121823c-goog In-Reply-To: <20201117232003.3580179-1-joel@joelfernandes.org> References: <20201117232003.3580179-1-joel@joelfernandes.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Tested-by: Julien Desfossez Not-Signed-off-by: Peter Zijlstra (Intel) --- kernel/sched/core.c | 35 ++++++++++++++++++++++++++++++++++- kernel/sched/fair.c | 9 +++++++++ 2 files changed, 43 insertions(+), 1 deletion(-) diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 01938a2154fd..bbeeb18d460e 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -127,6 +127,10 @@ static inline bool prio_less(struct task_struct *a, struct task_struct *b, bool 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; @@ -317,12 +321,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"); } DEFINE_STATIC_KEY_TRUE(sched_coresched_supported); @@ -5486,6 +5494,13 @@ pick_next_task(struct rq *rq, struct task_struct *prev, struct rq_flags *rf) 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); + rq->core_pick = NULL; return next; } @@ -5580,6 +5595,9 @@ pick_next_task(struct rq *rq, struct task_struct *prev, struct rq_flags *rf) rq->core->core_forceidle_seq++; } + 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 @@ -5596,6 +5614,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) { rq->core->core_forceidle = false; for_each_cpu(j, smt_mask) { @@ -5617,6 +5637,7 @@ pick_next_task(struct rq *rq, struct task_struct *prev, struct rq_flags *rf) /* Something should have been selected for current CPU */ WARN_ON_ONCE(!next); + trace_printk("picked: %s/%d %lx\n", next->comm, next->pid, next->core_cookie); /* * Reschedule siblings @@ -5658,13 +5679,21 @@ pick_next_task(struct rq *rq, struct task_struct *prev, struct rq_flags *rf) } /* 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); + } if (rq_i->curr == rq_i->core_pick) { rq_i->core_pick = NULL; continue; } + trace_printk("IPI(%d)\n", i); resched_curr(rq_i); } @@ -5704,6 +5733,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); diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index a89c7c917cc6..81c8a50ab4c4 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -10798,6 +10798,15 @@ static void se_fi_update(struct sched_entity *se, unsigned int fi_seq, bool forc cfs_rq->forceidle_seq = fi_seq; } + + if (root) { + old = cfs_rq->min_vruntime_fi; + new = cfs_rq->min_vruntime; + root = false; + trace_printk("cfs_rq(min_vruntime_fi) %lu->%lu\n", + old, new); + } + cfs_rq->min_vruntime_fi = cfs_rq->min_vruntime; } } -- 2.29.2.299.gdc1121823c-goog