Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp432250pxa; Wed, 12 Aug 2020 05:58:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyM6iC3xb/FvfWcZk4uQbW8UNjnd/bYL2rZPHQrnnEq1bn369Zmqr6RN5uf6tmuu1yNjhbT X-Received: by 2002:aa7:c74f:: with SMTP id c15mr31236759eds.331.1597237096432; Wed, 12 Aug 2020 05:58:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597237096; cv=none; d=google.com; s=arc-20160816; b=Z0mRSTg+N0212+5b2IBZPePD38gM4J/ay4audaDiJCBo9zjEKKSC28abCSOUQZfrit yQdKgkSl0MyLHauaJJZVxcmbcL6mlhiysoNBAGw2RZiz0QOnZNz2+VRSLArfmrkfbh0C n9bP+PO8tHItgrYSKCLbCkeY/05u9tAL3LigDw/pwBmGsSHE/fj2Lwpw57a2f12nCLiL nkI/XJsSMJP1vc9D83/8wvorCTys5BDEzkh9RZBS6tY1RsNPMYvfHSaLco4LWdjwg8Cg TW20jvX/dKwxYKpCEyHj01E7lkRWdQVQC4I+lgGYqotexiDrrkZdCgJiwgL13jCMs8Lu UCHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=JzYMEVcmPzrorz73XqrxxZmM+7qHMF66iywvHw+2Wpk=; b=yI0IKLHIEo4nU3cwH0BewQdNCQ6s9gxrc0hA6SdgVdt4ZMENtcsSlsYMxQ7UM7R7Ob 94uGaAnt7DGBY7yo4aY02yzezAjOkwbXAj6vUc03FnIo5JDZwSFzpbnqE3gLaTP672Ed YPojhbKaXXdQtnogVhKzBO1s/g94l+79iLiH3yxKV8jDTmjx8WK3NqixvXIekadtdUQS cdXecHnM21A21JCCUs6yf8+EIemo3r529z2QnmcYPXJmUMgTAVDO6P3liXRBmbm7KBMk IyTtmd2ox7Hkgqlc3MM+aLfLtcE2P76tqvwwkOmXzbYdU6ZlJLPCSN85MfBZlnqAnsnC NG9A== ARC-Authentication-Results: i=1; mx.google.com; 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 n1si1116590ejb.57.2020.08.12.05.57.54; Wed, 12 Aug 2020 05:58:16 -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; 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 S1728212AbgHLMy2 (ORCPT + 99 others); Wed, 12 Aug 2020 08:54:28 -0400 Received: from foss.arm.com ([217.140.110.172]:44562 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727980AbgHLMxU (ORCPT ); Wed, 12 Aug 2020 08:53:20 -0400 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 221F51396; Wed, 12 Aug 2020 05:53:20 -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 DF62D3F70D; Wed, 12 Aug 2020 05:53:18 -0700 (PDT) From: Valentin Schneider To: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: Dietmar Eggemann , mingo@kernel.org, peterz@infradead.org, vincent.guittot@linaro.org, morten.rasmussen@arm.com, Quentin Perret Subject: [PATCH v5 05/17] sched/topology: Verify SD_* flags setup when sched_debug is on Date: Wed, 12 Aug 2020 13:52:48 +0100 Message-Id: <20200812125300.11889-6-valentin.schneider@arm.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200812125300.11889-1-valentin.schneider@arm.com> References: <20200812125300.11889-1-valentin.schneider@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Now that we have some description of what we expect the flags layout to be, we can use that to assert at runtime that the actual layout is sane. Reviewed-by: Dietmar Eggemann Signed-off-by: Valentin Schneider --- kernel/sched/topology.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/kernel/sched/topology.c b/kernel/sched/topology.c index 865fff3ef20a..f128fcf46a41 100644 --- a/kernel/sched/topology.c +++ b/kernel/sched/topology.c @@ -29,6 +29,8 @@ static int sched_domain_debug_one(struct sched_domain *sd, int cpu, int level, struct cpumask *groupmask) { struct sched_group *group = sd->groups; + unsigned long flags = sd->flags; + unsigned int idx; cpumask_clear(groupmask); @@ -43,6 +45,21 @@ static int sched_domain_debug_one(struct sched_domain *sd, int cpu, int level, printk(KERN_ERR "ERROR: domain->groups does not contain CPU%d\n", cpu); } + for_each_set_bit(idx, &flags, __SD_FLAG_CNT) { + unsigned int flag = BIT(idx); + unsigned int meta_flags = sd_flag_debug[idx].meta_flags; + + if ((meta_flags & SDF_SHARED_CHILD) && sd->child && + !(sd->child->flags & flag)) + printk(KERN_ERR "ERROR: flag %s set here but not in child\n", + sd_flag_debug[idx].name); + + if ((meta_flags & SDF_SHARED_PARENT) && sd->parent && + !(sd->parent->flags & flag)) + printk(KERN_ERR "ERROR: flag %s set here but not in parent\n", + sd_flag_debug[idx].name); + } + printk(KERN_DEBUG "%*s groups:", level + 1, ""); do { if (!group) { -- 2.27.0