From patchwork Mon Aug 17 11:29:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Valentin Schneider X-Patchwork-Id: 11718041 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CCE1A109B for ; Mon, 17 Aug 2020 11:30:55 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A13E22067C for ; Mon, 17 Aug 2020 11:30:55 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="ndhPxse7" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A13E22067C Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To:From: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=HTl/3jyYsTD2LoK/o4ViBP2+yOTQmt9tP1hXaHxNIMw=; b=ndhPxse7QZsJO3rvohhKHxN7fq uGdZfubL7EOfYiqT5ztCTv+cDfX29etMeQbsWCKbKpWXcu5h1KuJ4Jg27GYmelFJzbCfcr3Xo1nFD DuEgS9zQ37R2B8LGyNyBALwu0d1z2c1HO+TlnCZJ/ogQ3XQTt338YCDlARogEDfKEF/XBT0CGwqfy T7SrO9zjo+qXHmphxKPuw6olGYHmb41/rfPuHS7zMCue/Lbbd6f4YExOJWGLslCn1ckGESngakdF8 YeU7AbT01y/Cn0zoH6NJjAiwKWKNyfGeuq5CnICXL4d83FNVNYxTyBflcX4H1bENAIs/DIqNFAAMe UcRa1WIw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1k7dLg-0000Nk-8i; Mon, 17 Aug 2020 11:30:44 +0000 Received: from foss.arm.com ([217.140.110.172]) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1k7dLI-00009P-9i for linux-arm-kernel@lists.infradead.org; Mon, 17 Aug 2020 11:30:22 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 4630531B; Mon, 17 Aug 2020 04:30:13 -0700 (PDT) Received: from e113632-lin.cambridge.arm.com (e113632-lin.cambridge.arm.com [10.1.194.46]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 0F7983F66B; Mon, 17 Aug 2020 04:30:11 -0700 (PDT) From: Valentin Schneider To: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v6 00/17] sched: Instrument sched domain flags Date: Mon, 17 Aug 2020 12:29:46 +0100 Message-Id: <20200817113003.20802-1-valentin.schneider@arm.com> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200817_073020_543085_8C64DBFD X-CRM114-Status: GOOD ( 18.21 ) X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [217.140.110.172 listed in list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: vincent.guittot@linaro.org, Quentin Perret , peterz@infradead.org, morten.rasmussen@arm.com, mingo@kernel.org, dietmar.eggemann@arm.com Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Hi, I've repeatedly stared at an SD flag and asked myself "how should that be set up in the domain hierarchy anyway?". I figured that if we formalize our flags zoology a bit, we could also do some runtime assertions on them - this is what this series is all about. Patches ======= The idea is to associate the flags with metaflags that describes how they should be set in a sched domain hierarchy ("if this SD has it, all its {parents, children} have it") or how they behave wrt degeneration - details are in the comments and commit logs. The good thing is that the debugging bits go away when CONFIG_SCHED_DEBUG isn't set. The bad thing is that this replaces SD_* flags definitions with some unsavoury macros. This is mainly because I wanted to avoid having to duplicate work between declaring the flags and declaring their metaflags. Conceptually they are pretty close to the macros used for SCHED_FEAT. o Patches 1-2 remove a derelict flag and align the arm scheduler topology with arm64's o Patches 3-8 instrument SD flags with metadata and add assertions o Patches 9-10 are additional topology cleanups o Patches 11-16 each add a new flag to SD_DEGENERATE_GROUPS_MASK o Patch 17 leverage the previous 6 patches to further factorize domain degeneration Revisions ========= v5 -> v6 -------- o Fixed kernelbot warnings o Tweaked ARM patches changelogs (Ingo) v4 -> v5 -------- The final git diff between v4 and v5 isn't too big; there is no diff on the domain degeneration side of things, it has just been split up in more patches. o Shuffled the series around to facilitate bisection (Ingo) I kept the ARM bits at the start because that was a bit simpler, and in the unlikely case that needs to be reverted it won't be too hard. o Split the degeneration mask tweak into individual commits per new flag (Ingo) o Collected Reviewed-by from Dietmar; since I shuffled the whole lot I didn't keep your Tested-by, sorry! o Turned the SD flags into an enum with automagic power of 2 assignment. I poked the dwarves and they assured me the SD flag values haven't changed. o [new patch] Made SD flag debug file output flag names v3 -> v4 -------- o Reordered the series to have fixes / cleanups first o Added SD_ASYM_CPUCAPACITY propagation (Quentin) o Made ARM revert back to the default sched topology (Dietmar) o Removed SD_SERIALIZE degeneration special case (Peter) o Made SD_NUMA and SD_SERIALIZE have SDF_NEEDS_GROUPS As discussed on v3, I thought this wasn't required, but thinking some more about it there can be cases where that changes the current behaviour. For instance, in the following wacky triangle: 0\ 30 | \ 20 | 2 | / 1/ 30 there are two unique distances thus two NUMA topology levels, however the first one for node 2 would have the same span as its child domain and thus should be degenerated. If we don't give SD_NUMA and SD_SERIALIZE SDF_NEEDS_GROUPS, this domain wouldn't be denegerated since its child *doesn't* have either SD_NUMA or SD_SERIALIZE (it's the first NUMA domain), and we'd have this weird NUMA domain lingering with a single group. v2 -> v3 -------- o Reworded comment for SD_OVERLAP (it's about the groups, not the domains) o Added more flags to the SD degeneration mask o Added generation of an SD flag mask for the degeneration functions (Peter) RFC -> v2 --------- o Rebased on top of tip/sched/core o Aligned wording of comments between flags o Rectified some flag descriptions (Morten) o Added removal of SD_SHARE_POWERDOMAIN (Morten) Valentin Schneider (17): ARM, sched/topology: Remove SD_SHARE_POWERDOMAIN ARM: Revert back to default scheduler topology. sched/topology: Split out SD_* flags declaration to its own file sched/topology: Define and assign sched_domain flag metadata sched/topology: Verify SD_* flags setup when sched_debug is on sched/debug: Output SD flag names rather than their values sched/topology: Introduce SD metaflag for flags needing > 1 groups sched/topology: Use prebuilt SD flag degeneration mask sched/topology: Remove SD_SERIALIZE degeneration special case sched/topology: Propagate SD_ASYM_CPUCAPACITY upwards sched/topology: Mark SD_PREFER_SIBLING as SDF_NEEDS_GROUPS sched/topology: Mark SD_BALANCE_WAKE as SDF_NEEDS_GROUPS sched/topology: Mark SD_SERIALIZE as SDF_NEEDS_GROUPS sched/topology: Mark SD_ASYM_PACKING as SDF_NEEDS_GROUPS sched/topology: Mark SD_OVERLAP as SDF_NEEDS_GROUPS sched/topology: Mark SD_NUMA as SDF_NEEDS_GROUPS sched/topology: Expand use of SD_DEGENERATE_GROUPS_MASK to flags not needing groups arch/arm/kernel/topology.c | 26 ------ include/linux/sched/sd_flags.h | 156 +++++++++++++++++++++++++++++++++ include/linux/sched/topology.h | 45 +++++++--- kernel/sched/debug.c | 56 +++++++++++- kernel/sched/topology.c | 54 ++++++------ 5 files changed, 268 insertions(+), 69 deletions(-) create mode 100644 include/linux/sched/sd_flags.h --- 2.27.0