From patchwork Thu Mar 9 11:45:11 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 95107 Delivered-To: patch@linaro.org Received: by 10.140.82.71 with SMTP id g65csp318718qgd; Thu, 9 Mar 2017 03:45:48 -0800 (PST) X-Received: by 10.99.138.202 with SMTP id y193mr13210424pgd.60.1489059948148; Thu, 09 Mar 2017 03:45:48 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b7si6247698pll.139.2017.03.09.03.45.47; Thu, 09 Mar 2017 03:45:48 -0800 (PST) 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; dkim=pass header.i=@linaro.org; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932237AbdCILpr (ORCPT + 25 others); Thu, 9 Mar 2017 06:45:47 -0500 Received: from mail-pf0-f172.google.com ([209.85.192.172]:33677 "EHLO mail-pf0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932196AbdCILpn (ORCPT ); Thu, 9 Mar 2017 06:45:43 -0500 Received: by mail-pf0-f172.google.com with SMTP id w189so28054421pfb.0 for ; Thu, 09 Mar 2017 03:45:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=BCst2qgvgJ5sAOCiw6nsb9VX9a0hNl0JcOBULhjvY10=; b=WhmVaugLazhUszeP6Fi+sOsZfgQ6B+8RPVO35FeUTdWWYJTsnK2S6PnaCkCMiId7TS 1clSOMbURH0V/a/DdI0KuKgDTS4ryJb+N8GlixBGv2rtd/dtC/7SOvbaSGEfd3sti8YZ JLo8Wr0YhhiaZIxfWTuLuW9WvAGeFx//TJAb4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=BCst2qgvgJ5sAOCiw6nsb9VX9a0hNl0JcOBULhjvY10=; b=Xtnrbo9YWfJoK0V/tkTAqfyzCM9DvdnggJQIa/UcNRjFIrskLo+UMGMYE0T/n4mWbt STtnPTKCU/E4rfw3lHdf9pru8SsjkAzv4ZoxbTtcGmrlMOi8GAactxBeoCZcFx41ZUPp JjgX1Qfya3+ruXop/rZCx/Cj6h7HkkikNTT9OHaYoeICaqgjhclQ1qFoWxO2f5Xx6iGR ENnk4uSX60E1Uo9+R2grxqOI96DujaF63EhXb/5pTZh3cyQqnPpxTRkZPRbw1CF7otsc 4UOfcD/bzLPl6DUoZbF8h3Sgo6w7Nn07vpsaMIyIW23sWirljpQBcmQA0iQsACihl574 jqGg== X-Gm-Message-State: AMke39lSf2OqMkyiwvR3t2nF38lHwezurXYtLFW0wz71PcYaBQEcadBs+RQbZ5sQJwDLUR+L X-Received: by 10.98.38.5 with SMTP id m5mr13448240pfm.65.1489059942207; Thu, 09 Mar 2017 03:45:42 -0800 (PST) Received: from localhost ([122.171.239.200]) by smtp.gmail.com with ESMTPSA id g78sm12144748pfe.5.2017.03.09.03.45.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 09 Mar 2017 03:45:41 -0800 (PST) From: Viresh Kumar To: Rafael Wysocki , Ingo Molnar , Peter Zijlstra Cc: linaro-kernel@lists.linaro.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Vincent Guittot , smuckle.linux@gmail.com, juri.lelli@arm.com, Morten.Rasmussen@arm.com, patrick.bellasi@arm.com, eas-dev@lists.linaro.org, Viresh Kumar Subject: [RFC 1/9] sched: cpufreq: add cpu to update_util_data Date: Thu, 9 Mar 2017 17:15:11 +0530 Message-Id: <529d5f2d865f5982f7e0d4a7a44176e81f50ffc5.1489058244.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.7.1.410.g6faf27b In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Steve Muckle Upcoming support for scheduler cpufreq callbacks on remote wakeups will require the client to know what the target CPU is that the callback is being invoked for. Add this information into the callback data structure. Signed-off-by: Steve Muckle Signed-off-by: Viresh Kumar --- include/linux/sched/cpufreq.h | 1 + kernel/sched/cpufreq.c | 1 + 2 files changed, 2 insertions(+) -- 2.7.1.410.g6faf27b diff --git a/include/linux/sched/cpufreq.h b/include/linux/sched/cpufreq.h index d2be2ccbb372..f798f63d93e8 100644 --- a/include/linux/sched/cpufreq.h +++ b/include/linux/sched/cpufreq.h @@ -16,6 +16,7 @@ #ifdef CONFIG_CPU_FREQ struct update_util_data { void (*func)(struct update_util_data *data, u64 time, unsigned int flags); + int cpu; }; void cpufreq_add_update_util_hook(int cpu, struct update_util_data *data, diff --git a/kernel/sched/cpufreq.c b/kernel/sched/cpufreq.c index dbc51442ecbc..ee4c596b71b4 100644 --- a/kernel/sched/cpufreq.c +++ b/kernel/sched/cpufreq.c @@ -42,6 +42,7 @@ void cpufreq_add_update_util_hook(int cpu, struct update_util_data *data, return; data->func = func; + data->cpu = cpu; rcu_assign_pointer(per_cpu(cpufreq_update_util_data, cpu), data); } EXPORT_SYMBOL_GPL(cpufreq_add_update_util_hook); From patchwork Thu Mar 9 11:45:12 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 95108 Delivered-To: patch@linaro.org Received: by 10.140.82.71 with SMTP id g65csp318768qgd; Thu, 9 Mar 2017 03:45:57 -0800 (PST) X-Received: by 10.99.127.27 with SMTP id a27mr12982020pgd.87.1489059957358; Thu, 09 Mar 2017 03:45:57 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n1si6219661pgc.376.2017.03.09.03.45.57; Thu, 09 Mar 2017 03:45:57 -0800 (PST) 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; dkim=pass header.i=@linaro.org; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932255AbdCILpu (ORCPT + 25 others); Thu, 9 Mar 2017 06:45:50 -0500 Received: from mail-pf0-f177.google.com ([209.85.192.177]:35783 "EHLO mail-pf0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932217AbdCILpq (ORCPT ); Thu, 9 Mar 2017 06:45:46 -0500 Received: by mail-pf0-f177.google.com with SMTP id j5so28041056pfb.2 for ; Thu, 09 Mar 2017 03:45:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=Z0f+ZC9K/bV9q6oQ+xhoCRZZqKdX+12WD6C7/ocPsSs=; b=NFy5T/Ymk2L1hBqgDHaXksQ6ytVhKx7t+WpY1BPfntwaQF1HuRla0qgtdSHbo9eZDj a+MFcaiTyJzME3f5FIpZlUXB0O2nzvrZvX7VtcNvTqvUVJVIQt01j1lfvAarB/m7JKgD ZV4o4R7ju3xkF6I8bTpF1civJBGvLXh4Fb628= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=Z0f+ZC9K/bV9q6oQ+xhoCRZZqKdX+12WD6C7/ocPsSs=; b=hdPEjAGJSizbv9Hi8K4PBYfFa50OBDX52hZL69ijzGoFfjSqG1HDvmBon3sjUgGylE XloSAABe43KiyZ67QqTav78LJouZ6LXO8rhbvYEWvAU3UCJ7qhuXkqYPLxLg8HlOlZZy DzCiK9jJWMpAoWQnMzS06vzygOxkEwmK2GboXYnK1ekEMNALR7ZWswO9T0QTPTZyFzmW 1x6nFfebxSE2wcS/TLmzRiof/FaWTyIhsEayEEU3PSGhxQhGdfYayBeV8qkOjDC61U2W egXyOdFzSfCQeWJBv4Ox7wVrgel9CfiCm80QXTAQ0sr33mq46PSJRYfkMiH/uYdK2jHT p1lQ== X-Gm-Message-State: AMke39lcssaJ1FaVynKPD7ecVnQpazkYVx4TprtMHsyWC+cfKmyCE5djZFH3VUzP5LAEJqP4 X-Received: by 10.98.196.221 with SMTP id h90mr13535216pfk.149.1489059945230; Thu, 09 Mar 2017 03:45:45 -0800 (PST) Received: from localhost ([122.171.239.200]) by smtp.gmail.com with ESMTPSA id c11sm12097942pfe.68.2017.03.09.03.45.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 09 Mar 2017 03:45:44 -0800 (PST) From: Viresh Kumar To: Rafael Wysocki , Ingo Molnar , Peter Zijlstra Cc: linaro-kernel@lists.linaro.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Vincent Guittot , smuckle.linux@gmail.com, juri.lelli@arm.com, Morten.Rasmussen@arm.com, patrick.bellasi@arm.com, eas-dev@lists.linaro.org, Viresh Kumar Subject: [RFC 2/9] irq_work: add irq_work_queue_on for !CONFIG_SMP Date: Thu, 9 Mar 2017 17:15:12 +0530 Message-Id: <85403db254e26655d608137d7df49ebf3aade0c3.1489058244.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.7.1.410.g6faf27b In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Steve Muckle Having irq_work_queue_on() available for !CONFIG_SMP can make some call sites cleaner. Signed-off-by: Steve Muckle Signed-off-by: Viresh Kumar --- include/linux/irq_work.h | 7 +++++++ 1 file changed, 7 insertions(+) -- 2.7.1.410.g6faf27b diff --git a/include/linux/irq_work.h b/include/linux/irq_work.h index 47b9ebd4a74f..0195c3502d6b 100644 --- a/include/linux/irq_work.h +++ b/include/linux/irq_work.h @@ -1,6 +1,7 @@ #ifndef _LINUX_IRQ_WORK_H #define _LINUX_IRQ_WORK_H +#include #include /* @@ -36,6 +37,12 @@ bool irq_work_queue(struct irq_work *work); #ifdef CONFIG_SMP bool irq_work_queue_on(struct irq_work *work, int cpu); +#else +static inline bool irq_work_queue_on(struct irq_work *work, int cpu) +{ + BUG_ON(cpu != 0); + return irq_work_queue(work); +} #endif void irq_work_tick(void); From patchwork Thu Mar 9 11:45:13 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 95115 Delivered-To: patch@linaro.org Received: by 10.140.82.71 with SMTP id g65csp319740qgd; Thu, 9 Mar 2017 03:48:46 -0800 (PST) X-Received: by 10.99.67.6 with SMTP id q6mr13210955pga.156.1489060126514; Thu, 09 Mar 2017 03:48:46 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b128si6247598pfa.161.2017.03.09.03.48.46; Thu, 09 Mar 2017 03:48:46 -0800 (PST) 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; dkim=pass header.i=@linaro.org; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932438AbdCILsp (ORCPT + 25 others); Thu, 9 Mar 2017 06:48:45 -0500 Received: from mail-pf0-f176.google.com ([209.85.192.176]:33696 "EHLO mail-pf0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932262AbdCILp7 (ORCPT ); Thu, 9 Mar 2017 06:45:59 -0500 Received: by mail-pf0-f176.google.com with SMTP id w189so28055303pfb.0 for ; Thu, 09 Mar 2017 03:45:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=2A74XnESQ3WL10JM/NNkjcDPGeQjnVPbJwdkHT2TOsQ=; b=EfBj+3jOm42Sa5wFQmboX1axVBnJzdZM1/6/PgJKR6RVuo15VswfG3r9fdUuHrjK0t CikWnIWGWyDQ6FB6OMOI11z6F2+og7elnrhmCxg0DsB1Kl2bepAywl/dN0Uc1RiJpjjJ 7M0R/IacDTOY4AmGsuT5WZjjdh38vy5oCcOUs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=2A74XnESQ3WL10JM/NNkjcDPGeQjnVPbJwdkHT2TOsQ=; b=Fv3SZnlJe2tG2mzOZceK249yrElQy3zj6UrmlANC5Yt86tgO6t7f8V5NvIqr6ADUNg 5CL0eJRhhRa5jU7uw5nGwotyU7o/HQvMeLl9kaFGl5mgwR+t0je3VnSLB3HdvgN/iP0y NkpZ1HN54nDKKruTYoRkI2n3oYXowvf4NZVD7RqhHkyaNNcLKZAaMoTG0h+ZwQBaP4WW /6tO6ikpojLHomowAiaofe1GHll9YkkHRS6grZbJM1TABqRu8iCZsJg11yg0G9BsXL1+ CjyOWC6WJcQ6QgsoeQodZKksLA+sgRwT5RvK5TENG0V+mmgOt+OgEpolP3AiNHQhgEXn EgcQ== X-Gm-Message-State: AMke39lHGYpjWCAoRT6E5EDD4Cm8nEXx+T5R6u5DMrsInNF8IF9lngP/PZ8GYkCUMikRWVem X-Received: by 10.99.213.81 with SMTP id v17mr12962941pgi.130.1489059948436; Thu, 09 Mar 2017 03:45:48 -0800 (PST) Received: from localhost ([122.171.239.200]) by smtp.gmail.com with ESMTPSA id 67sm12042232pfd.120.2017.03.09.03.45.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 09 Mar 2017 03:45:47 -0800 (PST) From: Viresh Kumar To: Rafael Wysocki , Ingo Molnar , Peter Zijlstra , Viresh Kumar Cc: linaro-kernel@lists.linaro.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Vincent Guittot , smuckle.linux@gmail.com, juri.lelli@arm.com, Morten.Rasmussen@arm.com, patrick.bellasi@arm.com, eas-dev@lists.linaro.org Subject: [RFC 3/9] cpufreq: Add dvfs_possible_from_any_cpu policy flag Date: Thu, 9 Mar 2017 17:15:13 +0530 Message-Id: <4f57e9a7dddcd7e0f821c127cd4e9d87c5807c6c.1489058244.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.7.1.410.g6faf27b In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On many platforms any CPU (from any cpufreq policy) can perform DVFS on behalf of other CPUs. Add a flag to identify such cpufreq policies. Also enable it for cpufreq-dt driver which is used only on ARM platforms currently. Signed-off-by: Viresh Kumar --- drivers/cpufreq/cpufreq-dt.c | 1 + include/linux/cpufreq.h | 9 +++++++++ 2 files changed, 10 insertions(+) -- 2.7.1.410.g6faf27b diff --git a/drivers/cpufreq/cpufreq-dt.c b/drivers/cpufreq/cpufreq-dt.c index c943787d761e..e57b45f20544 100644 --- a/drivers/cpufreq/cpufreq-dt.c +++ b/drivers/cpufreq/cpufreq-dt.c @@ -274,6 +274,7 @@ static int cpufreq_init(struct cpufreq_policy *policy) transition_latency = CPUFREQ_ETERNAL; policy->cpuinfo.transition_latency = transition_latency; + policy->dvfs_possible_from_any_cpu = true; return 0; diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h index 87165f06a307..9490a314c515 100644 --- a/include/linux/cpufreq.h +++ b/include/linux/cpufreq.h @@ -120,6 +120,15 @@ struct cpufreq_policy { bool fast_switch_possible; bool fast_switch_enabled; + /* + * Remote DVFS flag (Not added to the driver structure as we don't want + * to access another structure from scheduler hotpath). + * + * Should be set if any CPU (from same or different policy) can do DVFS + * on behalf of any other CPU. + */ + bool dvfs_possible_from_any_cpu; + /* Cached frequency lookup from cpufreq_driver_resolve_freq. */ unsigned int cached_target_freq; int cached_resolved_idx; From patchwork Thu Mar 9 11:45:14 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 95110 Delivered-To: patch@linaro.org Received: by 10.140.82.71 with SMTP id g65csp318801qgd; Thu, 9 Mar 2017 03:46:02 -0800 (PST) X-Received: by 10.98.149.80 with SMTP id p77mr13519984pfd.56.1489059962662; Thu, 09 Mar 2017 03:46:02 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n1si6219661pgc.376.2017.03.09.03.46.02; Thu, 09 Mar 2017 03:46:02 -0800 (PST) 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; dkim=pass header.i=@linaro.org; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932279AbdCILqB (ORCPT + 25 others); Thu, 9 Mar 2017 06:46:01 -0500 Received: from mail-pf0-f172.google.com ([209.85.192.172]:33705 "EHLO mail-pf0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932257AbdCILp6 (ORCPT ); Thu, 9 Mar 2017 06:45:58 -0500 Received: by mail-pf0-f172.google.com with SMTP id w189so28055750pfb.0 for ; Thu, 09 Mar 2017 03:45:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=m2zi9E1Wzn/Q0NQ3CDi+IzVAr0zLPwDntGZ7IMHpt8Q=; b=FeqKiZzrtFqLj2elriJc+UatB4AtaqQPf+v/rD8qJJc605QJYT6nsrChpWrzBpSA6s JPFDTSs6QxTz3ewWlqo6BoYurZGsE91EODxKOPlrt4uD3f/+zRPIvSoHoR6RCMVljqtf U3h+Bl5o1HjGQYIb/jpm7DLSTyiGKK+1mYlXo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=m2zi9E1Wzn/Q0NQ3CDi+IzVAr0zLPwDntGZ7IMHpt8Q=; b=C3KRBgbHKV2QVQx2fKQ1gYMSDzFyLrexTVFEUy3/wa0aJMzk0mYc51bVC/OGzRFjNj zKJ5KXg0JMf2Mu35f/4nnQhIwUHDLRr9AMFprUGl8a0MNCRR+lKiXaUAUAP2Jg94DguX bGgk9i2WaC6Swy/UETSS38MA5SofeA3BP4lvcM0RgE9BhZse/gjjTmvq65HMdUgVNF0T peN6MEBrKKS1mKRAhJ9/KuwCyTrGvy81lnFgo2B6Lfh9pNetLuwMm65TKgbpan9vXc4s db3BBvQbIjNaWVTLXDLWgYVsz/ajrcANQ0BmqVcDMH5dwBtOhNcjyDxr3EZNv75q8o9B ZBnA== X-Gm-Message-State: AMke39mY7inKRlZy+EaN93XR/zJFQGEF1ifQtzqtJe82SWh3mqlIMWS8l8dystVgYJVL7+ng X-Received: by 10.98.4.71 with SMTP id 68mr13594411pfe.92.1489059951709; Thu, 09 Mar 2017 03:45:51 -0800 (PST) Received: from localhost ([122.171.239.200]) by smtp.gmail.com with ESMTPSA id z74sm12078777pfd.70.2017.03.09.03.45.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 09 Mar 2017 03:45:50 -0800 (PST) From: Viresh Kumar To: Rafael Wysocki , Ingo Molnar , Peter Zijlstra Cc: linaro-kernel@lists.linaro.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Vincent Guittot , smuckle.linux@gmail.com, juri.lelli@arm.com, Morten.Rasmussen@arm.com, patrick.bellasi@arm.com, eas-dev@lists.linaro.org, Viresh Kumar Subject: [RFC 4/9] sched: cpufreq: extend irq work to support fast switches Date: Thu, 9 Mar 2017 17:15:14 +0530 Message-Id: <9d2ff35af95f5accb40d3447e6ff5970c0ba405e.1489058244.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.7.1.410.g6faf27b In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Steve Muckle In preparation for schedutil receiving sched cpufreq callbacks for remote CPUs, extend the irq work in schedutil to support policies with fast switching enabled in addition to policies using the slow path. Signed-off-by: Steve Muckle [ vk: minor code updates ] Signed-off-by: Viresh Kumar --- kernel/sched/cpufreq_schedutil.c | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) -- 2.7.1.410.g6faf27b diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c index f5ffe241812e..a418544c51b1 100644 --- a/kernel/sched/cpufreq_schedutil.c +++ b/kernel/sched/cpufreq_schedutil.c @@ -88,6 +88,17 @@ static bool sugov_should_update_freq(struct sugov_policy *sg_policy, u64 time) return delta_ns >= sg_policy->freq_update_delay_ns; } +static void sugov_fast_switch(struct cpufreq_policy *policy, + unsigned int next_freq) +{ + next_freq = cpufreq_driver_fast_switch(policy, next_freq); + if (next_freq == CPUFREQ_ENTRY_INVALID) + return; + + policy->cur = next_freq; + trace_cpu_frequency(next_freq, smp_processor_id()); +} + static void sugov_update_commit(struct sugov_policy *sg_policy, u64 time, unsigned int next_freq) { @@ -100,12 +111,7 @@ static void sugov_update_commit(struct sugov_policy *sg_policy, u64 time, } sg_policy->next_freq = next_freq; sg_policy->last_freq_update_time = time; - next_freq = cpufreq_driver_fast_switch(policy, next_freq); - if (next_freq == CPUFREQ_ENTRY_INVALID) - return; - - policy->cur = next_freq; - trace_cpu_frequency(next_freq, smp_processor_id()); + sugov_fast_switch(policy, next_freq); } else if (sg_policy->next_freq != next_freq) { sg_policy->next_freq = next_freq; sg_policy->last_freq_update_time = time; @@ -303,9 +309,15 @@ static void sugov_work(struct kthread_work *work) static void sugov_irq_work(struct irq_work *irq_work) { - struct sugov_policy *sg_policy; + struct sugov_policy *sg_policy = container_of(irq_work, struct + sugov_policy, irq_work); + struct cpufreq_policy *policy = sg_policy->policy; - sg_policy = container_of(irq_work, struct sugov_policy, irq_work); + if (policy->fast_switch_enabled) { + sugov_fast_switch(policy, sg_policy->next_freq); + sg_policy->work_in_progress = false; + return; + } /* * For RT and deadline tasks, the schedutil governor shoots the From patchwork Thu Mar 9 11:45:16 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 95111 Delivered-To: patch@linaro.org Received: by 10.140.82.71 with SMTP id g65csp318817qgd; Thu, 9 Mar 2017 03:46:05 -0800 (PST) X-Received: by 10.84.209.203 with SMTP id y69mr16467311plh.179.1489059965782; Thu, 09 Mar 2017 03:46:05 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n1si6219661pgc.376.2017.03.09.03.46.05; Thu, 09 Mar 2017 03:46:05 -0800 (PST) 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; dkim=pass header.i=@linaro.org; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932297AbdCILqE (ORCPT + 25 others); Thu, 9 Mar 2017 06:46:04 -0500 Received: from mail-pg0-f48.google.com ([74.125.83.48]:36400 "EHLO mail-pg0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932258AbdCILp7 (ORCPT ); Thu, 9 Mar 2017 06:45:59 -0500 Received: by mail-pg0-f48.google.com with SMTP id g2so8332165pge.3 for ; Thu, 09 Mar 2017 03:45:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=k4czk0t9cFGmYvjDexUY9hydsMMKP1NDMYxCZM/mHlE=; b=Q0NAWGrKBkF00oz3jS4yUjaOVcefXNCBkCsMeQgqDwXxzG7KZUKonj6IQhPBQLXP7k kGenfM7edsy6+OKb6rWGk9I4OtjyHw7+2LuD/O33ofK+/uCrEg2cs01i6xktgGYQ3j7G mVMDwWkqf/E84T+a9+lAdeRFsfvZ7LQS5su9k= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=k4czk0t9cFGmYvjDexUY9hydsMMKP1NDMYxCZM/mHlE=; b=XUHOctC0rK2lrqledAHY5vNSmojLMJNogJLWbB2rlgR24fPrQQhTkE0XYS2xVzfyWE 3bfvPf0QvxT+Evo4al8w2ytS2zYsh3y4omy35sIumtaQ1XxPv1WPfp1CCkVZQujY/4yV rfi0VfvHexcnRXnThFqHUx/5QBeqyuEmhETYi5yDoqmP5EtZD6/9A18N0rC0uUuvNmRR 0yGWYSqJh+bzMm2plAewzWQ2nxPYDe8Ejn+789ymW9rGstU2064fDzYoWbpO/7+C2KD5 TLqaN/0GWTAei1MJ9+y/pi/d/+s8aseWqRcBhKq99425Nrs7UcU9OXi1RUJ446NssEWk MVQA== X-Gm-Message-State: AMke39mzO+SswLVn5g2DCu9VT3rASbgsl6LnrElzI96b0j/FU6ssGbLo244Lg5/4s+4iami0 X-Received: by 10.84.229.10 with SMTP id b10mr16597110plk.148.1489059957941; Thu, 09 Mar 2017 03:45:57 -0800 (PST) Received: from localhost ([122.171.239.200]) by smtp.gmail.com with ESMTPSA id c195sm12089795pfb.60.2017.03.09.03.45.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 09 Mar 2017 03:45:57 -0800 (PST) From: Viresh Kumar To: Rafael Wysocki , Ingo Molnar , Peter Zijlstra Cc: linaro-kernel@lists.linaro.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Vincent Guittot , smuckle.linux@gmail.com, juri.lelli@arm.com, Morten.Rasmussen@arm.com, patrick.bellasi@arm.com, eas-dev@lists.linaro.org, Viresh Kumar Subject: [RFC 6/9] sched: cpufreq: detect, process remote callbacks Date: Thu, 9 Mar 2017 17:15:16 +0530 Message-Id: <2e807adcbf0d5136876f9de48c62e9e2dd2a5b06.1489058244.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.7.1.410.g6faf27b In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Steve Muckle A callback is considered remote if the target CPU is not the current CPU and if it is not managed by the policy managing the current CPU or the current CPU can't do DVFS on its behalf. Queue the irq work for remote callbacks on the destination CPU. The irq work will carry out the fast or slow switch as appropriate. Signed-off-by: Steve Muckle [ vk: commit log, code cleanups, introduce dvfs_possible_from_any_cpu and drop late callback support to avoid IPIs on remote CPUs. ] Signed-off-by: Viresh Kumar --- kernel/sched/cpufreq_schedutil.c | 40 +++++++++++++++++++++++++++++++++++----- 1 file changed, 35 insertions(+), 5 deletions(-) -- 2.7.1.410.g6faf27b diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c index b168c31f1c8f..9bad579b6b08 100644 --- a/kernel/sched/cpufreq_schedutil.c +++ b/kernel/sched/cpufreq_schedutil.c @@ -100,11 +100,11 @@ static void sugov_fast_switch(struct cpufreq_policy *policy, } static void sugov_update_commit(struct sugov_policy *sg_policy, u64 time, - unsigned int next_freq) + int cpu, bool remote, unsigned int next_freq) { struct cpufreq_policy *policy = sg_policy->policy; - if (policy->fast_switch_enabled) { + if (policy->fast_switch_enabled && !remote) { if (sg_policy->next_freq == next_freq) { trace_cpu_frequency(policy->cur, policy->cpu); return; @@ -116,7 +116,7 @@ static void sugov_update_commit(struct sugov_policy *sg_policy, u64 time, sg_policy->next_freq = next_freq; sg_policy->last_freq_update_time = time; sg_policy->work_in_progress = true; - irq_work_queue(&sg_policy->irq_work); + irq_work_queue_on(&sg_policy->irq_work, cpu); } } @@ -206,6 +206,20 @@ static void sugov_update_single(struct update_util_data *hook, u64 time, struct cpufreq_policy *policy = sg_policy->policy; unsigned long util, max; unsigned int next_f; + int cpu, this_cpu = smp_processor_id(); + bool remote; + + if (policy->dvfs_possible_from_any_cpu) { + /* + * Avoid sending IPI to 'hook->cpu' if this CPU can change + * frequency on its behalf. + */ + remote = false; + cpu = this_cpu; + } else { + cpu = hook->cpu; + remote = this_cpu != hook->cpu; + } sugov_set_iowait_boost(sg_cpu, time, flags); sg_cpu->last_update = time; @@ -220,7 +234,7 @@ static void sugov_update_single(struct update_util_data *hook, u64 time, sugov_iowait_boost(sg_cpu, &util, &max); next_f = get_next_freq(sg_policy, util, max); } - sugov_update_commit(sg_policy, time, next_f); + sugov_update_commit(sg_policy, time, cpu, remote, next_f); } static unsigned int sugov_next_freq_shared(struct sugov_cpu *sg_cpu) @@ -269,8 +283,24 @@ static void sugov_update_shared(struct update_util_data *hook, u64 time, { struct sugov_cpu *sg_cpu = container_of(hook, struct sugov_cpu, update_util); struct sugov_policy *sg_policy = sg_cpu->sg_policy; + struct cpufreq_policy *policy = sg_policy->policy; unsigned long util, max; unsigned int next_f; + int cpu, this_cpu = smp_processor_id(); + bool remote; + + if (policy->dvfs_possible_from_any_cpu || + cpumask_test_cpu(this_cpu, policy->cpus)) { + /* + * Avoid sending IPI to 'hook->cpu' if this CPU can change + * frequency on its behalf. + */ + remote = false; + cpu = this_cpu; + } else { + cpu = hook->cpu; + remote = this_cpu != hook->cpu; + } sugov_get_util(&util, &max, hook->cpu); @@ -289,7 +319,7 @@ static void sugov_update_shared(struct update_util_data *hook, u64 time, else next_f = sugov_next_freq_shared(sg_cpu); - sugov_update_commit(sg_policy, time, next_f); + sugov_update_commit(sg_policy, time, cpu, remote, next_f); } raw_spin_unlock(&sg_policy->update_lock);