[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <jhjimf67zs6.mognet@arm.com>
Date: Thu, 02 Jul 2020 15:32:57 +0100
From: Valentin Schneider <valentin.schneider@....com>
To: Peter Zijlstra <peterz@...radead.org>
Cc: linux-kernel@...r.kernel.org, mingo@...nel.org,
vincent.guittot@...aro.org, dietmar.eggemann@....com,
morten.rasmussen@....com
Subject: Re: [PATCH v3 3/7] sched/topology: Verify SD_* flags setup when sched_debug is on
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
>>
Powered by blists - more mailing lists