Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp376330imm; Mon, 21 May 2018 07:27:46 -0700 (PDT) X-Google-Smtp-Source: AB8JxZo5x1IoQOJ7+7uodIF3tsZTl1h6iLrhK+gzScBF/4For/dLg7TeNQMUiLj5qUf9OD+DmrgV X-Received: by 2002:a62:5281:: with SMTP id g123-v6mr20240786pfb.22.1526912865943; Mon, 21 May 2018 07:27:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526912865; cv=none; d=google.com; s=arc-20160816; b=I6C4p/IjyorJfECYzpNHvgT0vANXpG3cZYD3YpFxejSK1NJR5Q5FxfHiU1942TCu6F eAZQa9r8O6yKjzW+yJsIOPpWP/W7Eu3cP37fira3Lve9XMnCotdb9PNyN4bo9++EGEO8 yW4LRJIUwXhiMpwMjGLcDokqn4MAzUriqwqrSyvBxW9gMKca/rVitrNHBnHvvGQmGIyF Mp0XLs6IeStK08boOwdqqRaq8hWFXiS0qny5DsfGQnjANinmiaZZj2Vvk0h1dt1/emcS bjp+DlTGKW0JmnLZ763adVjlkGpLfHBsO8k1ru/OO76E5C1Z0kj6kyRdt54h5MSsc8wU y7lw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=xmVykeTIBsE1s+e4wGhgxYbMgJXkbS+LgIOsp+/hZdw=; b=QfaYj/HBj/DSY1xAhMtlwgiNgRJipz20+B0mejR8ER7qVOCRGKc374M4h9SsUD5Fn/ SlEDw5kf9OepP1UTy5qP7UCiZSwfaugeoSkETO8rXu8RbPVy+IOXxHnZTtKsy5TMQbnX zVGexPHJv+6FXYp4B1QWUSJaQd1HVmJDJ+PyYx7JjKLfxjqtj6VGBX4HLBS2xXEsIxcm uTC4hOfsWqkb2/bV7XPORQJNZlxTjjvvyxhKiAKIFJAWo3nYli+1aH7IfO+sWSWSvwQo u5Kp9VIlg6W5VACtN/z9y2XlyIy49UeIzB0Erhm4Pr2O6Y67t205W/ryowjsOUjwqKgE JicQ== 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 r126-v6si14623878pfc.202.2018.05.21.07.27.31; Mon, 21 May 2018 07:27:45 -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 S1753071AbeEUO0S (ORCPT + 99 others); Mon, 21 May 2018 10:26:18 -0400 Received: from foss.arm.com ([217.140.101.70]:51136 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753038AbeEUO0G (ORCPT ); Mon, 21 May 2018 10:26:06 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 2F62E1529; Mon, 21 May 2018 07:26:06 -0700 (PDT) Received: from e108498-lin.cambridge.arm.com (e108498-lin.cambridge.arm.com [10.1.210.84]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 189293F577; Mon, 21 May 2018 07:26:01 -0700 (PDT) From: Quentin Perret To: peterz@infradead.org, rjw@rjwysocki.net, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org Cc: mingo@redhat.com, dietmar.eggemann@arm.com, morten.rasmussen@arm.com, chris.redpath@arm.com, patrick.bellasi@arm.com, valentin.schneider@arm.com, vincent.guittot@linaro.org, thara.gopinath@linaro.org, viresh.kumar@linaro.org, tkjos@google.com, joelaf@google.com, smuckle@google.com, adharmap@quicinc.com, skannan@quicinc.com, pkondeti@codeaurora.org, juri.lelli@redhat.com, edubezval@gmail.com, srinivas.pandruvada@linux.intel.com, currojerez@riseup.net, javi.merino@kernel.org, quentin.perret@arm.com Subject: [RFC PATCH v3 10/10] arch_topology: Start Energy Aware Scheduling Date: Mon, 21 May 2018 15:25:05 +0100 Message-Id: <20180521142505.6522-11-quentin.perret@arm.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180521142505.6522-1-quentin.perret@arm.com> References: <20180521142505.6522-1-quentin.perret@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Energy Aware Scheduling starts when the scheduling domains are built if the Energy Model is present and all conditions are met. However, in the typical case of Arm/Arm64 systems, the Energy Model is provided after the scheduling domains are first built at boot time, which results in EAS staying disabled. This commit fixes this issue by re-building the scheduling domain from the arch topology driver, once CPUfreq is up and running and when the capacity of the CPUs have been updated to their final value. Cc: Greg Kroah-Hartman Signed-off-by: Quentin Perret --- drivers/base/arch_topology.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/drivers/base/arch_topology.c b/drivers/base/arch_topology.c index e7cb0c6ade81..7f9fa10ef940 100644 --- a/drivers/base/arch_topology.c +++ b/drivers/base/arch_topology.c @@ -15,6 +15,8 @@ #include #include #include +#include +#include DEFINE_PER_CPU(unsigned long, freq_scale) = SCHED_CAPACITY_SCALE; @@ -173,6 +175,9 @@ static cpumask_var_t cpus_to_visit; static void parsing_done_workfn(struct work_struct *work); static DECLARE_WORK(parsing_done_work, parsing_done_workfn); +static void start_eas_workfn(struct work_struct *work); +static DECLARE_WORK(start_eas_work, start_eas_workfn); + static int init_cpu_capacity_callback(struct notifier_block *nb, unsigned long val, @@ -204,6 +209,7 @@ init_cpu_capacity_callback(struct notifier_block *nb, free_raw_capacity(); pr_debug("cpu_capacity: parsing done\n"); schedule_work(&parsing_done_work); + schedule_work(&start_eas_work); } return 0; @@ -249,6 +255,19 @@ static void parsing_done_workfn(struct work_struct *work) free_cpumask_var(cpus_to_visit); } +static void start_eas_workfn(struct work_struct *work) +{ + /* Make sure the EM knows about the updated CPU capacities. */ + rcu_read_lock(); + em_rescale_cpu_capacity(); + rcu_read_unlock(); + + /* Inform the scheduler about the EM availability. */ + cpus_read_lock(); + rebuild_sched_domains(); + cpus_read_unlock(); +} + #else core_initcall(free_raw_capacity); #endif -- 2.17.0