Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp512920ybg; Fri, 18 Oct 2019 03:19:16 -0700 (PDT) X-Google-Smtp-Source: APXvYqzVqIQJ0XELmherEyIEppoKvLWP6H2le5hxD5kCjbIJgdfjIjrKhv1ty2dmuD5xEIE7cE7j X-Received: by 2002:a05:6402:1511:: with SMTP id f17mr8704203edw.232.1571393956175; Fri, 18 Oct 2019 03:19:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571393956; cv=none; d=google.com; s=arc-20160816; b=pRlVzjAGMRmJRgg+JbSKv0NGzKHjpRYG0ETfTLDDJWxuMRWi+SmU9m1NsFzMA4jjSJ m/hbe1fB6gtMaNd85OiDOAH/S8jgXo0gmGZbuGcSMXWfesAN3HdlisfWwIf9ZQIKdVpz HBDKyYsHPpa8bZr/cKk1hWHL8Ibzd2OTZFVxMLiEIKeQySx8DSmaZQqZ6OkyF1hm2i9C B7G5BqF3Kb56ujcj0ldjiDK6nCE5yAtBVSWFXbTGEufw5sbQPq6VPfJwS9lTu02wnY5Q m9rBmtJmrewWZiwUrwqpobSzk8LxA/AQUdsQgJUiTPp9PWjpx4eL2SmcGNJ7xDVvszpt qEvQ== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=1kUY76c4UJ1K7Dwz84QG34fyIx3UunQtiAZCt7yM248=; b=lsBtKjcvaqS4wUvzFVq9OumtC0bB85cAyORgbEYjTwmqRFtsJ//fHovG7StSVdyrxt XagGj3EdlXJIf+pnnBudGWm+tIUkZ17RMW8OWKnm8l6+m6d6sqdD63YiQoN6o4T18x+p neEgP0//0DPzCyFnOA4/rQtxIP8GYS4ebQOgmfpiGN0JWRuFW30QpBx49ttAY4/U3jSr /AXRRCVyFfGLUdy4aKoy/1wLoZKRbOaA7UaN8eRI3sNjV2LLAK1KcUk52WK79gv2HBmo iY5QGWon0OEf+/ifyAf7lDYwo8uSdUfBSOdA/Hb3jWWKUIZUmvMcJvW4jnHVozBRimLU Imdw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b27si2920007ejq.266.2019.10.18.03.18.53; Fri, 18 Oct 2019 03:19:16 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2408404AbfJQI5o (ORCPT + 99 others); Thu, 17 Oct 2019 04:57:44 -0400 Received: from [217.140.110.172] ([217.140.110.172]:35926 "EHLO foss.arm.com" rhost-flags-FAIL-FAIL-OK-OK) by vger.kernel.org with ESMTP id S2408397AbfJQI5o (ORCPT ); Thu, 17 Oct 2019 04:57:44 -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 AF68B15BF; Thu, 17 Oct 2019 01:57:23 -0700 (PDT) Received: from [192.168.0.9] (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id E296E3F718; Thu, 17 Oct 2019 01:57:21 -0700 (PDT) Subject: Re: [RFC PATCH v3 2/6] sched/cpufreq: Attach perf domain to sugov policy To: Douglas RAILLARD , linux-kernel@vger.kernel.org Cc: linux-pm@vger.kernel.org, mingo@redhat.com, peterz@infradead.org, rjw@rjwysocki.net, viresh.kumar@linaro.org, juri.lelli@redhat.com, vincent.guittot@linaro.org, qperret@qperret.net, patrick.bellasi@matbug.net, dh.han@samsung.com References: <20191011134500.235736-1-douglas.raillard@arm.com> <20191011134500.235736-3-douglas.raillard@arm.com> From: Dietmar Eggemann Message-ID: <4ebf6419-c8e0-3998-41e0-3f7b49b34084@arm.com> Date: Thu, 17 Oct 2019 10:57:16 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <20191011134500.235736-3-douglas.raillard@arm.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/10/2019 15:44, Douglas RAILLARD wrote: [...] > @@ -66,6 +70,38 @@ static DEFINE_PER_CPU(struct sugov_cpu, sugov_cpu); > > /************************ Governor internals ***********************/ > > +#ifdef CONFIG_ENERGY_MODEL > +static void sugov_policy_attach_pd(struct sugov_policy *sg_policy) > +{ > + struct em_perf_domain *pd; > + struct cpufreq_policy *policy = sg_policy->policy; Shouldn't always order local variable declarations from longest to shortest line? > + > + sg_policy->pd = NULL; > + pd = em_cpu_get(policy->cpu); > + if (!pd) > + return; > + > + if (cpumask_equal(policy->related_cpus, to_cpumask(pd->cpus))) > + sg_policy->pd = pd; > + else > + pr_warn("%s: Not all CPUs in schedutil policy %u share the same perf domain, no perf domain for that policy will be registered\n", > + __func__, policy->cpu); Maybe {} because of 2 lines? > +} > + > +static struct em_perf_domain *sugov_policy_get_pd( > + struct sugov_policy *sg_policy) Maybe this way? This format is already used in this file. static struct em_perf_domain * sugov_policy_get_pd(struct sugov_policy *sg_policy) > +{ > + return sg_policy->pd; > +} > +#else /* CONFIG_ENERGY_MODEL */ > +static void sugov_policy_attach_pd(struct sugov_policy *sg_policy) {} > +static struct em_perf_domain *sugov_policy_get_pd( > + struct sugov_policy *sg_policy) > +{ > + return NULL; > +} > +#endif /* CONFIG_ENERGY_MODEL */ > + > static bool sugov_should_update_freq(struct sugov_policy *sg_policy, u64 time) > { > s64 delta_ns; > @@ -859,6 +895,9 @@ static int sugov_start(struct cpufreq_policy *policy) > sugov_update_shared : > sugov_update_single); > } > + > + sugov_policy_attach_pd(sg_policy); > + > return 0; > } A sugov_policy_detach_pd() called from sugov_stop() (doing for instance the g_policy->pd = NULL) is not needed?