Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp873357ybt; Wed, 1 Jul 2020 12:08:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwJeg5hu29y8WzaS5MqEHwHdvS7HcsaZJ2kVATQU7H9GJdKiCgb0Pe8d1adqT0vtXwCSEEl X-Received: by 2002:aa7:c606:: with SMTP id h6mr29568757edq.363.1593630510904; Wed, 01 Jul 2020 12:08:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593630510; cv=none; d=google.com; s=arc-20160816; b=pZyysNfQ/k8QC76DcsYv0krJpFz5pexg1HZeUPG5Sc9DSYJIiG4wmLPQIT/QNTBJPk VTqDx238NuhhKstfT/VjlQgYVmW3T3OkXcft2vHnLUqRWQa3RZChlWImU8NO4VYq3NUO gsPvztxRCkn3BpKflPraE56U2a5JRYr57sXuG8mzlpPziz27Xc15qJ1KPbmCsAR2U2Wd SlDoVpia4aMUY6O9EdU8vkH1P3s9/LyK+7onWJ/haSa0o+k6O0vGlyp8q2TDSh4BSMvV vHtdaiGBHMW/pwQ6HQKrEIZdRjy13KYMy3hyLwWikvWtdLbrOV2/3mABABbLhGsCF9FA bMMw== 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=9aAQNcz1Qx1V79Owc16DYFa+RIPIvyP2w/NpzJTwoQI=; b=ycpWTqF+v5kQ9PSdQlCWAeWE79+l6Yy7n9lSgqjo2o3jW454WaHPqhi+IurrrJk1Au xi//rWjwEg8utvS58fv9iJAGlek8PsK1kdOGm22zC1+ZO7n1vjxfwo4ihMY5stXgwa8b ah8UE1CacFiBms+QEFMkuOIO9DjxBBfJtaxAmBxbCPQC9C0MtritvJyTef8EwTxna/nh dDjl8a+Z3hGzEgoR2foJkZjybhJZLutQDq+76+gU1xx78Rt2M31qm8Ju3SqZyCvcGJe6 bNJv5IBcDs4CPHYjHWUM4Kb+neEvF/mGJTd5tBxgf5i3q3HMahKQli7LRj68dkf4ONvU X04w== 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 t22si4230132eje.467.2020.07.01.12.07.44; Wed, 01 Jul 2020 12:08:30 -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 S1726907AbgGATHa (ORCPT + 99 others); Wed, 1 Jul 2020 15:07:30 -0400 Received: from foss.arm.com ([217.140.110.172]:39806 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726554AbgGATHY (ORCPT ); Wed, 1 Jul 2020 15:07:24 -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 E26CB1042; Wed, 1 Jul 2020 12:07:23 -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 E3B043F68F; Wed, 1 Jul 2020 12:07:22 -0700 (PDT) From: Valentin Schneider To: linux-kernel@vger.kernel.org Cc: mingo@kernel.org, peterz@infradead.org, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, morten.rasmussen@arm.com Subject: [PATCH v3 3/7] sched/topology: Verify SD_* flags setup when sched_debug is on Date: Wed, 1 Jul 2020 20:06:51 +0100 Message-Id: <20200701190656.10126-4-valentin.schneider@arm.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200701190656.10126-1-valentin.schneider@arm.com> References: <20200701190656.10126-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. 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 9079d865a935..b3f891db16a7 100644 --- a/kernel/sched/topology.c +++ b/kernel/sched/topology.c @@ -29,6 +29,7 @@ static int sched_domain_debug_one(struct sched_domain *sd, int cpu, int level, struct cpumask *groupmask) { struct sched_group *group = sd->groups; + int flags = sd->flags; cpumask_clear(groupmask); @@ -43,6 +44,22 @@ 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 (; flags; flags &= flags - 1) { + unsigned int idx = __ffs(flags); + 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