Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp1705562pxf; Fri, 19 Mar 2021 13:36:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwvWPeMLEZGtUSJPsYdY8pM78VOAT4el6DzBcMhTQNgqmAfztaUW3L1mj5aNccesS1FYQM+ X-Received: by 2002:a17:907:6005:: with SMTP id fs5mr6584636ejc.184.1616186215569; Fri, 19 Mar 2021 13:36:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616186215; cv=none; d=google.com; s=arc-20160816; b=uK68rHovuezR9HaJDqs52sGUd4JyZCG8ug8KTC0Fp0EVReiixe2VUHdeFXU6cju4QM 9JwjjLP3oAZduRjLt6WDpR4mh8NeRbZr+ZB7nVE7YZBSRiE6uoTZTTRlcqpOFvQaKq9V 0PuDrkaNlU0Di1/g/9oAuvNucMA3d9PKKlrRsBTDaG9wC82ovT6AYxXyKKWRT0/sGEYp 7IuBrh0P6iTzUUDrBwHTnkxzarSP+vhpDy1BZHJOiDTQkGpSVdKkkJ1dRKp+6sOsCKcj ja8FgCR24iYne766DlCGlYxs31fPIrW7U4XbS6BpJusllCT6phHIFMelpO0/rb5uwcxG 1idQ== 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=wpPOdQxY/Cp24iJgZMVQYaJRsN5Sc7SW8aM4kNhFnG8=; b=GNaQDDmCXysRk7dQGrpyQDSiwMfnCZjshsBKMmY7pGmX4n7/hatMlqc+WRAZeJvzAw hC2sETD+PY5y3P4JHfk0csTNgqkoEsJNCPq+Wjpd9UPnKJuVEjtoTSHUjZ90jqioOmB9 q7SF2MZGsTcbg7FNeLSYjMORmsQDRe3co5f96oP8jlVj1TsRG2Pyp3dmcuCHqQOSC2LL AA3WszX8N/9IdL8vFTDOJ0wxr1WhFjJpy6OtCHXhfXFd+vgL4qwe/jjNSjw1ysn6I/V7 7MtTib1tkZWpjStJYPRHha24mcTnIvjFK4GapDHQk7y4K3dYgU9P7zncv6SUUorCva6d 3XjA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b=B0ae8JCQ; 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 h12si5549667ejx.570.2021.03.19.13.36.32; Fri, 19 Mar 2021 13:36:55 -0700 (PDT) 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=B0ae8JCQ; 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 S231139AbhCSUdi (ORCPT + 99 others); Fri, 19 Mar 2021 16:33:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49360 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230370AbhCSUdJ (ORCPT ); Fri, 19 Mar 2021 16:33:09 -0400 Received: from mail-qt1-x829.google.com (mail-qt1-x829.google.com [IPv6:2607:f8b0:4864:20::829]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9C0D2C06175F for ; Fri, 19 Mar 2021 13:33:09 -0700 (PDT) Received: by mail-qt1-x829.google.com with SMTP id 94so7840998qtc.0 for ; Fri, 19 Mar 2021 13:33:09 -0700 (PDT) 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=wpPOdQxY/Cp24iJgZMVQYaJRsN5Sc7SW8aM4kNhFnG8=; b=B0ae8JCQoR1/xCcpWUO7ZVcHBl0eQiDQB8pn60n0m9zpBnta+Iyf3V0rppmSoNbjJk QkvVREKyP2QIC6mZP7t6mdI+0bhxknP6pRDpxadGsGDmgLFokJckDuYovvSh8B0/KhAI X9sgGjQw9ZUaGBY66UpksGrdP16oyapnoeT4o= 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=wpPOdQxY/Cp24iJgZMVQYaJRsN5Sc7SW8aM4kNhFnG8=; b=o6lAtdZpXLmu5TqfWsOyaYnfLld68efMlBtTUbLlli5DANv9xxjWWKBU4ZefQm8uC8 b57XPPIvbwMEEOpD5axXT1R61dCV4UGPPDKJ4uAoQZ6rLjNKVXyc4WZrWtxS/UGP6Mbw DAzu5lEbHl8U0mK+hRLhXvz0KiTODpOjf1OikS2vvrtaTtq8HnM4Tdi21gD3RgfTGxnX XLeWJN8+oVMdSqRhl3R94p/ylbPlZ+i6ZTqoxMxRw4tXlpB+dvwtphWGrP901NGEWoXJ c2gJ9H2GnVTh9VQgFvxPbS2svTCGaC1lUX7OULp59LtDbFu2enuF0mXwA4ckbbyk5/8L lUfQ== X-Gm-Message-State: AOAM533UBDwhC6cX92ZbGPe1hSNzbCwBhr9tgon8xe/+O3n7nFXi8AD5 yH4FeMC8vHwpLbSrd8eW+IDtlg== X-Received: by 2002:ac8:4558:: with SMTP id z24mr488100qtn.66.1616185988880; Fri, 19 Mar 2021 13:33:08 -0700 (PDT) Received: from joelaf.cam.corp.google.com ([2620:15c:6:411:7422:5a6f:e616:23c9]) by smtp.gmail.com with ESMTPSA id j26sm4588187qtp.30.2021.03.19.13.33.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Mar 2021 13:33:08 -0700 (PDT) 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, 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, rostedt@goodmis.org, benbjiang@tencent.com, Alexandre Chartre , James.Bottomley@hansenpartnership.com, OWeisse@umich.edu, Dhaval Giani , chris.hyser@oracle.com, Josh Don , Hao Luo , Tom Lendacky Subject: [PATCH 6/6] sched: Debug bits... Date: Fri, 19 Mar 2021 16:32:53 -0400 Message-Id: <20210319203253.3352417-7-joel@joelfernandes.org> X-Mailer: git-send-email 2.31.0.rc2.261.g7f71774620-goog In-Reply-To: <20210319203253.3352417-1-joel@joelfernandes.org> References: <20210319203253.3352417-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 | 40 +++++++++++++++++++++++++++++++++++++++- kernel/sched/fair.c | 9 +++++++++ 2 files changed, 48 insertions(+), 1 deletion(-) diff --git a/kernel/sched/core.c b/kernel/sched/core.c index a62e8ad5ce58..58cca96ba93d 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -147,6 +147,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; @@ -312,12 +316,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) @@ -5503,6 +5511,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 %llu\n", + rq->core->core_task_seq, + rq->core->core_pick_seq, + rq->core_sched_seq, + next->comm, next->pid, + next->core_cookie.userspace_id); + rq->core_pick = NULL; return next; } @@ -5597,6 +5612,10 @@ 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 %llu\n", + i, p->comm, p->pid, + p->core_cookie.userspace_id); + /* * If this new candidate is of higher priority than the * previous; and they're incompatible; we need to wipe @@ -5613,6 +5632,10 @@ 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 %llu\n", + max->comm, max->pid, + max->core_cookie.userspace_id); + if (old_max) { rq->core->core_forceidle = false; for_each_cpu(j, smt_mask) { @@ -5634,6 +5657,8 @@ 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 %llu\n", next->comm, next->pid, + next->core_cookie.userspace_id); /* * Reschedule siblings @@ -5675,13 +5700,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%llu/0x%llu\n", + rq_i->cpu, rq_i->core_pick->comm, + rq_i->core_pick->pid, + rq_i->core_pick->core_cookie.userspace_id, + rq_i->core->core_cookie.userspace_id); + 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); } @@ -5721,6 +5754,11 @@ 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 %llu\n", + p->comm, p->pid, that, this, + p->core_occupation, dst->idle->core_occupation, + cookie->userspace_id); + 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 fddd7c44bbf3..ebeeebc4223a 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -10769,6 +10769,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.31.0.rc2.261.g7f71774620-goog