Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1522568ybt; Thu, 2 Jul 2020 07:34:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxrInA7saZQHosTasVRwODoLFjqVe8mmEF6LjnNkdIMNZ8HornFN/mcaBAubuOPxjHNqAt9 X-Received: by 2002:a17:906:27c9:: with SMTP id k9mr27255583ejc.74.1593700440878; Thu, 02 Jul 2020 07:34:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593700440; cv=none; d=google.com; s=arc-20160816; b=tSkX0cfCgyXlnwQB5VnLFR0wXtPBSGtrzu1bSbiS9CJtpSSkWHvA7b424uZemW9VTx lHIPHF1k1CY0kbYFKa5g4FowkhxJ2KYT9SB9d/XuRjQBeIn+0HebvPYoB4zM8O4gd3EB Iux9BrilfgW6JXEARqMgTY+gcbfJ0yHkP1arEKtNjIGkfggs8lQA0NrH5eKL5TxLHfjb vGK13rXS2IZwSUxjr9c7YF9fVnWndNECtGJKR9gm8AgTQWcBOh6asvd+Z9Vk9zPgaoig YqZlRiIyceZjQXZx5Os8BmEuRpZwQR0rUYsBY0wlu8jP0RUSz13mOnAcBr6/EDQaawLN TqGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:in-reply-to :subject:cc:to:from:user-agent:references; bh=ZORnOFOtUKEGB7EshWckSoOVQixXtbeWaowV8w7uJXg=; b=jfv9dJelKTxZ9niSfW66m6Z/vxSOgsXII7prxqzFDPEmfSAD/yyu9LpZ7lnhP7J5I8 RhksPua7gequ7BrFcw+FmZVA1KtyHkPMgkkDIaH3UpJdFtB5PEDpo/j8mytbtU7j8W/8 4G4rePWASwfm6fQIVNQGvQHRd4Xg+QoO4JEgcY8bgB/M2ZllPeNHYRbVbT3j0FQminxK Rw9dYr4Rju9cljv4djVY9OiNCYRTw/hwKAFGwlFtByDkc4CHM/h2T8H1yNWCKoGfEhWv TcL0i3qkh+jgJdTdG6qHGrxsNgCjPtPLMDJ7daZTkuGRFmk+nqf6TexOIiFr9ODhd6ee Cljg== 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 j23si5291560ejt.141.2020.07.02.07.33.38; Thu, 02 Jul 2020 07:34:00 -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 S1729700AbgGBOdB (ORCPT + 99 others); Thu, 2 Jul 2020 10:33:01 -0400 Received: from foss.arm.com ([217.140.110.172]:58042 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728179AbgGBOdB (ORCPT ); Thu, 2 Jul 2020 10:33:01 -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 CCF8531B; Thu, 2 Jul 2020 07:33:00 -0700 (PDT) Received: from e113632-lin (e113632-lin.cambridge.arm.com [10.1.194.46]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id E25243F68F; Thu, 2 Jul 2020 07:32:59 -0700 (PDT) References: <20200701190656.10126-1-valentin.schneider@arm.com> <20200701190656.10126-4-valentin.schneider@arm.com> <20200702142042.GI4817@hirez.programming.kicks-ass.net> User-agent: mu4e 0.9.17; emacs 26.3 From: Valentin Schneider To: Peter Zijlstra Cc: linux-kernel@vger.kernel.org, mingo@kernel.org, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, morten.rasmussen@arm.com Subject: Re: [PATCH v3 3/7] sched/topology: Verify SD_* flags setup when sched_debug is on In-reply-to: <20200702142042.GI4817@hirez.programming.kicks-ass.net> Date: Thu, 02 Jul 2020 15:32:57 +0100 Message-ID: MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 02/07/20 15:20, Peter Zijlstra wrote: > On Wed, Jul 01, 2020 at 08:06:51PM +0100, Valentin Schneider wrote: > >> @@ -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; > > unsigned long 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); > > for_each_set_bit(idx, &flags, SD_MAX_BIT) { > > Yes, it's a bit yuck, but far more readable imo. > Much better than homegrown stuff, thanks! >> + 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 >>