From patchwork Tue Jul 16 09:54:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 169043 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp618962ilk; Tue, 16 Jul 2019 02:55:08 -0700 (PDT) X-Google-Smtp-Source: APXvYqynw8RL2IHNFIgQeh2ruD8E6sGdhZEx5e+fdLzilQHHoGg7Sw21YPfkAV4pYS31ydnC73Co X-Received: by 2002:a65:5348:: with SMTP id w8mr32030428pgr.176.1563270908299; Tue, 16 Jul 2019 02:55:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563270908; cv=none; d=google.com; s=arc-20160816; b=if3jKD3XeZZNMia9lCCs6xJL1Z3dsHcUP+Q3HslCIbaybRxIhGN8sOr5ULMW7AP8mQ AI4Skrr9zLUkp5dLZEySIq1zcPLTUOk8JPXV4s4D0qVQPENLohgBsI9+6qg4QlK2ZrAk TIA2r5a/UzC0Fg3bb/E4JPtU8pTTl3s51hyn34eL9GucTVXmKEW3KNFSPkt1YHvW1Ydu fkQP5IgaNlYxScJ5uEEgEY0dvBHdavPslvCSsxInOCqlNcKUAitWuek5flXQGlRVX2hd +KhksIqeBryixVP0/w3r9+xnr9gZUaAzsfC6JxHLucauQxaTomzWmCcNgVjQ1kAmwZCU h2Ig== 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:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=QxH+UbD9tCF0KwHpPpNeLuejcWOqKPoBzOiXe/lF/gk=; b=Vu5qoHGn3Y8YsdalMCfOFub+uKvgWZLkbFOL8aKFcQ44DPmZbvc6jGJg+opkF0IItj NsYjt4n6SLYh+9438W7tHokpWAgQk3JsFt5KQBUUYSxr5ZE6mqXzELBK5fLuUi/2p3MW 9EcvMbFbsbDj/rnOI7RIDWBVbP/tMsRXH2d77ZsKpxzi5IsnyqfpZwycK28reENy3jPb NttuqoOp9f+FnA0RSzOEATa+fsCRGuJsjEoXw5aV7DvNpQCu+6JDbGc4gLlswSTtpuJ3 fw+/3+8fk4fXg7kT3MjyL3yWAV2dVfMw91bpS2JdYMJKPmyWqxEQRrU6kwQzcDxzf4Rj +XZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FbuySQDt; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x7si18937972plv.130.2019.07.16.02.55.08; Tue, 16 Jul 2019 02:55:08 -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; dkim=pass header.i=@linaro.org header.s=google header.b=FbuySQDt; 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 S1732644AbfGPJzH (ORCPT + 29 others); Tue, 16 Jul 2019 05:55:07 -0400 Received: from mail-pf1-f196.google.com ([209.85.210.196]:40996 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732520AbfGPJzG (ORCPT ); Tue, 16 Jul 2019 05:55:06 -0400 Received: by mail-pf1-f196.google.com with SMTP id m30so8858951pff.8 for ; Tue, 16 Jul 2019 02:55:05 -0700 (PDT) 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 :mime-version:content-transfer-encoding; bh=QxH+UbD9tCF0KwHpPpNeLuejcWOqKPoBzOiXe/lF/gk=; b=FbuySQDtO2afso3Zxf3ISnrj/v2hbYkqAmDXCqX8MPUrL4zaHSiS5SY9RiGeUl4DBd QYFEwKX1LxMARj+z317ztFPrv0F4GtsdtsOHbWT6MhcS3V4/9MxUrlc/V3gklYoUHOs0 a0Spyg/DNkDb/ExzrNrp0C/TIFJvN5XdZaLcrQXHaPYP7DRkPij+Gm8j2iS8Iyt81NpU RYd8ZR0FhyMs9jTWMMD516MbMp+JLzFaFrHFq19l7iCxCkC2OJKVFaH838fVGVaiF5Eu OFM4DMWboMqSSpHzjsdkOte3wz2s1/FFebxDMVpx5oLeFUyRxm8T3ZLw1FKyPtdKY9IX KCQQ== 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:mime-version:content-transfer-encoding; bh=QxH+UbD9tCF0KwHpPpNeLuejcWOqKPoBzOiXe/lF/gk=; b=OJisu7+HxeNKlbYKdHeV7wUIsqNYHy4btmRsserczKS4k0oxKs66pjNp0cVaZAsvcS g7k21B55BTEQlpHga69MEr+19QpiyYISDZT/rggsxLzu7tM17+MF5xKpj1w6QAXEvjcU nqgXhtgCG2MJ6lxuSA33+/uA2jWi0LQBSDj6AQkCs46YhC+Rdc6VhbhI/dmQpV1eqANI Hbktfd4yLfUI/nZTETshWZ9LgaokRe4r9fwa/9uTU2sN1xKPsxjWVQWAXxLwbhg7P+jM GDf+JN2FVk5WYYi5mqWWSYENbvKddb7jj5QbskRlFAyyETy1hxKxWHQr7jQnRj5c32ll OtIQ== X-Gm-Message-State: APjAAAU9K9NdPlUxe9LDdSODD01Zy6O8+OAxpajo2U7sgXJiioDgxbDE ktFIKE9i9g2d3UQMNZvlmdNoGA== X-Received: by 2002:a63:ad07:: with SMTP id g7mr30139354pgf.405.1563270905182; Tue, 16 Jul 2019 02:55:05 -0700 (PDT) Received: from localhost ([122.172.28.117]) by smtp.gmail.com with ESMTPSA id r188sm33754776pfr.16.2019.07.16.02.55.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 16 Jul 2019 02:55:04 -0700 (PDT) From: Viresh Kumar To: Rafael Wysocki Cc: Viresh Kumar , linux-pm@vger.kernel.org, Vincent Guittot , dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 03/10] video: pxafb: Remove cpufreq policy notifier Date: Tue, 16 Jul 2019 15:24:47 +0530 Message-Id: X-Mailer: git-send-email 2.21.0.rc0.269.g1a574e7a288b In-Reply-To: References: MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The cpufreq policy notifier's CPUFREQ_ADJUST notification is going to get removed soon. The notifier callback pxafb_freq_policy() isn't doing anything apart from printing a debug message on CPUFREQ_ADJUST notification. There is no point in keeping an otherwise empty callback and registering the notifier. Remove it. Signed-off-by: Viresh Kumar --- drivers/video/fbdev/pxafb.c | 21 --------------------- drivers/video/fbdev/pxafb.h | 1 - 2 files changed, 22 deletions(-) -- 2.21.0.rc0.269.g1a574e7a288b diff --git a/drivers/video/fbdev/pxafb.c b/drivers/video/fbdev/pxafb.c index 4282cb117b92..f70c9f79622e 100644 --- a/drivers/video/fbdev/pxafb.c +++ b/drivers/video/fbdev/pxafb.c @@ -1678,24 +1678,6 @@ pxafb_freq_transition(struct notifier_block *nb, unsigned long val, void *data) } return 0; } - -static int -pxafb_freq_policy(struct notifier_block *nb, unsigned long val, void *data) -{ - struct pxafb_info *fbi = TO_INF(nb, freq_policy); - struct fb_var_screeninfo *var = &fbi->fb.var; - struct cpufreq_policy *policy = data; - - switch (val) { - case CPUFREQ_ADJUST: - pr_debug("min dma period: %d ps, " - "new clock %d kHz\n", pxafb_display_dma_period(var), - policy->max); - /* TODO: fill in min/max values */ - break; - } - return 0; -} #endif #ifdef CONFIG_PM @@ -2400,11 +2382,8 @@ static int pxafb_probe(struct platform_device *dev) #ifdef CONFIG_CPU_FREQ fbi->freq_transition.notifier_call = pxafb_freq_transition; - fbi->freq_policy.notifier_call = pxafb_freq_policy; cpufreq_register_notifier(&fbi->freq_transition, CPUFREQ_TRANSITION_NOTIFIER); - cpufreq_register_notifier(&fbi->freq_policy, - CPUFREQ_POLICY_NOTIFIER); #endif /* diff --git a/drivers/video/fbdev/pxafb.h b/drivers/video/fbdev/pxafb.h index b641289c8a99..86b1e9ab1a38 100644 --- a/drivers/video/fbdev/pxafb.h +++ b/drivers/video/fbdev/pxafb.h @@ -162,7 +162,6 @@ struct pxafb_info { #ifdef CONFIG_CPU_FREQ struct notifier_block freq_transition; - struct notifier_block freq_policy; #endif struct regulator *lcd_supply; From patchwork Tue Jul 16 09:54:48 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 169044 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp619004ilk; Tue, 16 Jul 2019 02:55:11 -0700 (PDT) X-Google-Smtp-Source: APXvYqwQvJugYHaHzh54XR4m+mM1PS3KQq0e0CFc8IV/FR1CF2nDDXA4Jc5PjqQgN7oJ1n+ZWa2X X-Received: by 2002:a17:902:1566:: with SMTP id b35mr34984530plh.147.1563270911521; Tue, 16 Jul 2019 02:55:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563270911; cv=none; d=google.com; s=arc-20160816; b=pYKvuabQBtUKg1qNUqf2NIjrNmA9aGpdCYz7tC0w2JIKjlhkmixXE66RM4CSvEsHy4 +BWC3v46PkFhI6vHKgruv/8a2TccOKMXacBIUGLEQ80QW6+3PGfBwrmHLNgiAdlvygN7 nw6tZ8fYZVHkbeGLkXrocGrcSNsESZiMw5uPlBs3rlmjdydPKqvZaspvkJJiqjNxnqEA NMYZmuWMgYctsJf9Zw0eLRL3ufXX/701/GyMNrWs4lITkvSkqvzPNqit+4RhL9KXZUGd gl4QpBtLjGu5NDjBolQ306eN56bX9j776cYcVO1dbwkHVZh1Snp7mn1UdjdzR7SlYBNt o+bg== 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:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=72lapS1gikWJzRuHujLBmPCAQQBs6mR5D22kmc/6LFI=; b=uc9eARkeiE4yzSoY+lHyJnTOqugE3PD6i3dVUY4ENTs8l1hI9K/O6v8wGOc2pf+OtH dYxkLsLC+O1eYW0GAZq/9AB2VNrc4hxqHor3P6ACCJrmFWUPy9NGC0dgfflYdECFS9BQ +PxnM7NI3KZYBxwxEiFpyWf+qekS0Ug2QOb4Qkh4VkzhFgoVg1N0nPiXKm6N8wJ5TMu8 PRFCUA88t+LUAUuI4su0/LFrAmEO2h5rOs6TAtwOLD5Fokh0hBVLWY7HECdFm8s+HbUg Erz+fKa9Fai6hygDr6mU7t22WgNM0vgTGgFX76fILzo7AMNXdoDrB+Mxrva0f6heNyNX 5ung== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Ic+8VmZB; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x7si18937972plv.130.2019.07.16.02.55.11; Tue, 16 Jul 2019 02:55:11 -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; dkim=pass header.i=@linaro.org header.s=google header.b=Ic+8VmZB; 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 S1732742AbfGPJzK (ORCPT + 29 others); Tue, 16 Jul 2019 05:55:10 -0400 Received: from mail-pl1-f196.google.com ([209.85.214.196]:44996 "EHLO mail-pl1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732520AbfGPJzJ (ORCPT ); Tue, 16 Jul 2019 05:55:09 -0400 Received: by mail-pl1-f196.google.com with SMTP id t14so9817255plr.11 for ; Tue, 16 Jul 2019 02:55:08 -0700 (PDT) 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 :mime-version:content-transfer-encoding; bh=72lapS1gikWJzRuHujLBmPCAQQBs6mR5D22kmc/6LFI=; b=Ic+8VmZBJDL+AveYtejzGXQn+oCRJbcOkYUcEdKomP2PxUCxknQBSiHwU/AXBFr7ud L+wyHFUGzxanL6nLtLdNriPaJsYtakivv2DKKpX8kE58v2PUaQduuMX4+DiCOk3QhUOE QrRIcJu96ZU06gv6PTc+D4xzaoIoTccec2ZqJPlg2zdqwspbE5tN/ILsRmsEkvg+IUha 3tIr4/FS6SXdYCQvg4MlXTwrcyHBInZrJR0cs9F9Reu5+8In9qNkgJqbJgjwBE9QOOKd IJ/xaYDVX7aesT7XMV/ZUpdMv2d7rS5M8jjt4u38R5nt6ZDf8mBtp/EJLWLlvdfbSFLN Qysw== 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:mime-version:content-transfer-encoding; bh=72lapS1gikWJzRuHujLBmPCAQQBs6mR5D22kmc/6LFI=; b=J8e4u3DS4M8ElEw+4+T3EXgxuRmpcUC8H9BOLejeO+3EQ6aXk4tu5ZNrdxwM9ZAfKS /aqLJ1fDlkVdrmVEG2iJjQE22n1XqhpcAvHA5WJnJuxe5U2ZDeoJi0kh9xQwdbagyWNa rTdHfYN+31ccd3h6UD218oLZ5bVi5roFY12ns+VjEbWI7AELhqwfCnVTqRB8E0Wz9H6T DootWAPlULm+vv7XXCqIW9lDJ9XjtQDflg+3JKiAkGwlQGZORwx6mvLddQByYctDY7SF 2gV2l6JMAjJIAwTdHevwBNi5Yrx2h0A4cFpM5v7yfqSIYIkDUzVJ/x5U3s7WDgPmvz3M 1ing== X-Gm-Message-State: APjAAAVO+wuzpazSa3MZ85N+P72r8Hopp5qsz1GgAHTONKOC/xYGdMlp aV6mj0v0UkOxdfS0uMuLWTLYLg== X-Received: by 2002:a17:902:f216:: with SMTP id gn22mr33365742plb.118.1563270908342; Tue, 16 Jul 2019 02:55:08 -0700 (PDT) Received: from localhost ([122.172.28.117]) by smtp.gmail.com with ESMTPSA id m4sm38578557pff.108.2019.07.16.02.55.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 16 Jul 2019 02:55:07 -0700 (PDT) From: Viresh Kumar To: Rafael Wysocki , Greg Kroah-Hartman , "Rafael J. Wysocki" Cc: Viresh Kumar , linux-pm@vger.kernel.org, Vincent Guittot , linux-kernel@vger.kernel.org Subject: [PATCH 04/10] arch_topology: Use CPUFREQ_CREATE_POLICY instead of CPUFREQ_NOTIFY Date: Tue, 16 Jul 2019 15:24:48 +0530 Message-Id: X-Mailer: git-send-email 2.21.0.rc0.269.g1a574e7a288b In-Reply-To: References: MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org CPUFREQ_NOTIFY is going to get removed soon, lets use CPUFREQ_CREATE_POLICY instead of that here. CPUFREQ_CREATE_POLICY is called only once (which is exactly what we want here) for each cpufreq policy when it is first created. Signed-off-by: Viresh Kumar --- drivers/base/arch_topology.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.21.0.rc0.269.g1a574e7a288b diff --git a/drivers/base/arch_topology.c b/drivers/base/arch_topology.c index 9b09e31ae82f..49f2884fe77f 100644 --- a/drivers/base/arch_topology.c +++ b/drivers/base/arch_topology.c @@ -175,7 +175,7 @@ init_cpu_capacity_callback(struct notifier_block *nb, if (!raw_capacity) return 0; - if (val != CPUFREQ_NOTIFY) + if (val != CPUFREQ_CREATE_POLICY) return 0; pr_debug("cpu_capacity: init cpu capacity for CPUs [%*pbl] (to_visit=%*pbl)\n", From patchwork Tue Jul 16 09:54:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 169045 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp619064ilk; Tue, 16 Jul 2019 02:55:14 -0700 (PDT) X-Google-Smtp-Source: APXvYqzP5B3gwh7QmEOQLpP/GlajMCL9IO1vdnRu54KA54LyRAWtEGWysC8dPr8jjgwwPzFKoT7u X-Received: by 2002:a65:534c:: with SMTP id w12mr32517686pgr.51.1563270914767; Tue, 16 Jul 2019 02:55:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563270914; cv=none; d=google.com; s=arc-20160816; b=K4/gPU5A/+MQpeoWMgdb1WlKA4oIL5aUAdxTrFs9krzDX5n5DIJLBA4zHwJF7VRIBz GqZ/z2PKjsJi13W1xCJvJaaaP6rv2U/uUNiVDGS6ZBPbn8s6wzmXfp7C137TVWYOt6lO sJ1ePOHNr984BdJwBnMfnXyYtg+aUgPox5/ly4BFHk64JAG0tvfXru9vKBBhwLJ19YgM V7Y+cQNkA2Hv7Dn8p4p1B1u1rhe1Dsq9MGcV+7BIjVUcUkZImi03+fORODGGkItXl5PP ryRnuawWdOVRqJrs/3F1T2PnAdydyj8S7uBkJNMztlcrFuarVTa3YN87MXlWjrhxccnQ atXw== 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:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=T27u9AQsojQ674GAmNKFLMWAOrQITFIdhdVL3SNGHa0=; b=seRensEAEQ8jL7bvAeu/fshYbSMtEHtsAQPBRoum0jkMVF+91bEE/Fq9aMmX+QXtP6 9NY9mCRqMWu9Xuml+CKOG7k0QWnQb5T4HJB/j39t43SBgUb7bBxGv3f4ypKQ+Duz11Oa s8qmoLpOjkuy0af0CqnWRBRLlZOjVn0F9p2T3TczyXKB1JgQRo9ltyCbFvgQB6W9CZOQ NaGoq7jQ/+30r6vYOJz1dijXgIKXHcyuTe6gWJQGU0RaxXfdKKEQnGs6y2+GZ7Y45kWM PQDOsJmXIYIARJiPZvREl7sKaL9/RBgzoori5e4PMEmrCHV1Soex4pWaHZ3s7WP2o6+S 5Sfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Ya2E0F0K; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b15si471011plz.109.2019.07.16.02.55.14; Tue, 16 Jul 2019 02:55:14 -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; dkim=pass header.i=@linaro.org header.s=google header.b=Ya2E0F0K; 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 S1732920AbfGPJzN (ORCPT + 29 others); Tue, 16 Jul 2019 05:55:13 -0400 Received: from mail-pf1-f196.google.com ([209.85.210.196]:40687 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732520AbfGPJzM (ORCPT ); Tue, 16 Jul 2019 05:55:12 -0400 Received: by mail-pf1-f196.google.com with SMTP id p184so8853985pfp.7 for ; Tue, 16 Jul 2019 02:55:11 -0700 (PDT) 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 :mime-version:content-transfer-encoding; bh=T27u9AQsojQ674GAmNKFLMWAOrQITFIdhdVL3SNGHa0=; b=Ya2E0F0Kpsdp0ttA6naaYP2zJx2kYW+h4/n4+NG/MQdbcO2+aQfnQEJkZLQ9tg1IiE LX+8ONNPhgfmujOE3LMRsyCTIjud6ZaL7d6XCXOEcyGKlhQkrJ5/w23QMtezvJRWLK+O mGs6kCsv0aUcf2RmgTLl1X8bv9Y6GQNBTCj2Nn27JzU3c/LizhYZC7T9mmsXsR0ap6d0 31PngFy12ihQsVK8r/izjoBloFuA3ryi2Ck8VejmUOML+kOxbEpWBCPFW/dx57VUIu05 y95wt1MSwxZH2sGlHEYflMvAabRwvVHwUKC5SUZutrT4j7T25CfaZAMxh5h4SS/hVJze cvew== 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:mime-version:content-transfer-encoding; bh=T27u9AQsojQ674GAmNKFLMWAOrQITFIdhdVL3SNGHa0=; b=BuJiyYP7MIaJs+24P/Aq97Yt8HvWm/W5wuKPDoMaovIH4sxiKrYT60lQtQHa2ZwwnL HfOdBVz4cFZODx4YLVlQ+a7awWRt3yNhl2Sf2cQnWLAOdPujeBtTK8ZZzF1WDrkFSOk4 HPhqfJ8m5hMsPbAMfsaCOhtKozufTXLSu1oakQHqeIwDabde0B7/aiJnCBeKS2fZwyJs dszh5am0k975+AcqD0J1RFurz2n2sGV8U9Cktk57rlRKl/kHpXTJV6MAiZEdsXWAzZ/V V+0nfP4Fbf1Y8xLYF5zfN3v9nFTR3k2IsjMM69l4zJtHKuyfn5QdfhZSZ8SgfrB1pTt2 lLjA== X-Gm-Message-State: APjAAAUmzlve2IVPv+xJ08DYeAZyK0VaFBCM1AdOQNcq8kLRRHbbdZGr jNfr20ObOV9n2ywfc37QvlUqrQ== X-Received: by 2002:a63:3fc9:: with SMTP id m192mr32998253pga.429.1563270911165; Tue, 16 Jul 2019 02:55:11 -0700 (PDT) Received: from localhost ([122.172.28.117]) by smtp.gmail.com with ESMTPSA id n7sm24363826pff.59.2019.07.16.02.55.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 16 Jul 2019 02:55:10 -0700 (PDT) From: Viresh Kumar To: Rafael Wysocki , Amit Daniel Kachhap , Viresh Kumar , Javi Merino , Zhang Rui , Eduardo Valentin , Daniel Lezcano Cc: linux-pm@vger.kernel.org, Vincent Guittot , linux-kernel@vger.kernel.org Subject: [PATCH 05/10] thermal: cpu_cooling: Switch to QoS requests instead of cpufreq notifier Date: Tue, 16 Jul 2019 15:24:49 +0530 Message-Id: X-Mailer: git-send-email 2.21.0.rc0.269.g1a574e7a288b In-Reply-To: References: MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The cpufreq core now takes the min/max frequency constraints via QoS requests and the CPUFREQ_ADJUST notifier shall get removed later on. Switch over to using the QoS request for maximum frequency constraint for cpu_cooling driver. Signed-off-by: Viresh Kumar --- drivers/thermal/cpu_cooling.c | 110 ++++++++-------------------------- 1 file changed, 26 insertions(+), 84 deletions(-) -- 2.21.0.rc0.269.g1a574e7a288b diff --git a/drivers/thermal/cpu_cooling.c b/drivers/thermal/cpu_cooling.c index 4c5db59a619b..391f39776c6a 100644 --- a/drivers/thermal/cpu_cooling.c +++ b/drivers/thermal/cpu_cooling.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include @@ -66,8 +67,6 @@ struct time_in_idle { * @last_load: load measured by the latest call to cpufreq_get_requested_power() * @cpufreq_state: integer value representing the current state of cpufreq * cooling devices. - * @clipped_freq: integer value representing the absolute value of the clipped - * frequency. * @max_level: maximum cooling level. One less than total number of valid * cpufreq frequencies. * @freq_table: Freq table in descending order of frequencies @@ -84,12 +83,12 @@ struct cpufreq_cooling_device { int id; u32 last_load; unsigned int cpufreq_state; - unsigned int clipped_freq; unsigned int max_level; struct freq_table *freq_table; /* In descending order */ struct cpufreq_policy *policy; struct list_head node; struct time_in_idle *idle_time; + struct dev_pm_qos_request qos_req; }; static DEFINE_IDA(cpufreq_ida); @@ -118,59 +117,6 @@ static unsigned long get_level(struct cpufreq_cooling_device *cpufreq_cdev, return level - 1; } -/** - * cpufreq_thermal_notifier - notifier callback for cpufreq policy change. - * @nb: struct notifier_block * with callback info. - * @event: value showing cpufreq event for which this function invoked. - * @data: callback-specific data - * - * Callback to hijack the notification on cpufreq policy transition. - * Every time there is a change in policy, we will intercept and - * update the cpufreq policy with thermal constraints. - * - * Return: 0 (success) - */ -static int cpufreq_thermal_notifier(struct notifier_block *nb, - unsigned long event, void *data) -{ - struct cpufreq_policy *policy = data; - unsigned long clipped_freq; - struct cpufreq_cooling_device *cpufreq_cdev; - - if (event != CPUFREQ_ADJUST) - return NOTIFY_DONE; - - mutex_lock(&cooling_list_lock); - list_for_each_entry(cpufreq_cdev, &cpufreq_cdev_list, node) { - /* - * A new copy of the policy is sent to the notifier and can't - * compare that directly. - */ - if (policy->cpu != cpufreq_cdev->policy->cpu) - continue; - - /* - * policy->max is the maximum allowed frequency defined by user - * and clipped_freq is the maximum that thermal constraints - * allow. - * - * If clipped_freq is lower than policy->max, then we need to - * readjust policy->max. - * - * But, if clipped_freq is greater than policy->max, we don't - * need to do anything. - */ - clipped_freq = cpufreq_cdev->clipped_freq; - - if (policy->max > clipped_freq) - cpufreq_verify_within_limits(policy, 0, clipped_freq); - break; - } - mutex_unlock(&cooling_list_lock); - - return NOTIFY_OK; -} - /** * update_freq_table() - Update the freq table with power numbers * @cpufreq_cdev: the cpufreq cooling device in which to update the table @@ -374,7 +320,6 @@ static int cpufreq_set_cur_state(struct thermal_cooling_device *cdev, unsigned long state) { struct cpufreq_cooling_device *cpufreq_cdev = cdev->devdata; - unsigned int clip_freq; /* Request state should be less than max_level */ if (WARN_ON(state > cpufreq_cdev->max_level)) @@ -384,13 +329,10 @@ static int cpufreq_set_cur_state(struct thermal_cooling_device *cdev, if (cpufreq_cdev->cpufreq_state == state) return 0; - clip_freq = cpufreq_cdev->freq_table[state].frequency; cpufreq_cdev->cpufreq_state = state; - cpufreq_cdev->clipped_freq = clip_freq; - - cpufreq_update_policy(cpufreq_cdev->policy->cpu); - return 0; + return dev_pm_qos_update_request(&cpufreq_cdev->qos_req, + cpufreq_cdev->freq_table[state].frequency); } /** @@ -554,11 +496,6 @@ static struct thermal_cooling_device_ops cpufreq_power_cooling_ops = { .power2state = cpufreq_power2state, }; -/* Notifier for cpufreq policy change */ -static struct notifier_block thermal_cpufreq_notifier_block = { - .notifier_call = cpufreq_thermal_notifier, -}; - static unsigned int find_next_max(struct cpufreq_frequency_table *table, unsigned int prev_max) { @@ -596,9 +533,16 @@ __cpufreq_cooling_register(struct device_node *np, struct cpufreq_cooling_device *cpufreq_cdev; char dev_name[THERMAL_NAME_LENGTH]; unsigned int freq, i, num_cpus; + struct device *dev; int ret; struct thermal_cooling_device_ops *cooling_ops; - bool first; + + dev = get_cpu_device(policy->cpu); + if (unlikely(!dev)) { + pr_warn("No cpu device for cpu %d\n", policy->cpu); + return ERR_PTR(-ENODEV); + } + if (IS_ERR_OR_NULL(policy)) { pr_err("%s: cpufreq policy isn't valid: %p\n", __func__, policy); @@ -671,25 +615,29 @@ __cpufreq_cooling_register(struct device_node *np, cooling_ops = &cpufreq_cooling_ops; } + ret = dev_pm_qos_add_request(dev, &cpufreq_cdev->qos_req, + DEV_PM_QOS_MAX_FREQUENCY, + cpufreq_cdev->freq_table[0].frequency); + if (ret < 0) { + pr_err("%s: Failed to add freq constraint (%d)\n", __func__, + ret); + cdev = ERR_PTR(ret); + goto remove_ida; + } + cdev = thermal_of_cooling_device_register(np, dev_name, cpufreq_cdev, cooling_ops); if (IS_ERR(cdev)) - goto remove_ida; - - cpufreq_cdev->clipped_freq = cpufreq_cdev->freq_table[0].frequency; + goto remove_qos_req; mutex_lock(&cooling_list_lock); - /* Register the notifier for first cpufreq cooling device */ - first = list_empty(&cpufreq_cdev_list); list_add(&cpufreq_cdev->node, &cpufreq_cdev_list); mutex_unlock(&cooling_list_lock); - if (first) - cpufreq_register_notifier(&thermal_cpufreq_notifier_block, - CPUFREQ_POLICY_NOTIFIER); - return cdev; +remove_qos_req: + dev_pm_qos_remove_request(&cpufreq_cdev->qos_req); remove_ida: ida_simple_remove(&cpufreq_ida, cpufreq_cdev->id); free_table: @@ -777,7 +725,6 @@ EXPORT_SYMBOL_GPL(of_cpufreq_cooling_register); void cpufreq_cooling_unregister(struct thermal_cooling_device *cdev) { struct cpufreq_cooling_device *cpufreq_cdev; - bool last; if (!cdev) return; @@ -786,15 +733,10 @@ void cpufreq_cooling_unregister(struct thermal_cooling_device *cdev) mutex_lock(&cooling_list_lock); list_del(&cpufreq_cdev->node); - /* Unregister the notifier for the last cpufreq cooling device */ - last = list_empty(&cpufreq_cdev_list); mutex_unlock(&cooling_list_lock); - if (last) - cpufreq_unregister_notifier(&thermal_cpufreq_notifier_block, - CPUFREQ_POLICY_NOTIFIER); - thermal_cooling_device_unregister(cdev); + dev_pm_qos_remove_request(&cpufreq_cdev->qos_req); ida_simple_remove(&cpufreq_ida, cpufreq_cdev->id); kfree(cpufreq_cdev->idle_time); kfree(cpufreq_cdev->freq_table); From patchwork Tue Jul 16 09:54:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 169046 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp619099ilk; Tue, 16 Jul 2019 02:55:17 -0700 (PDT) X-Google-Smtp-Source: APXvYqzz3YlRR6LUw+U69D4dNuh+VQLm/X1JZF5fEgVrqaW9FpVqhWMTXHEsZr55r8vBE/gTCKCk X-Received: by 2002:a17:902:da4:: with SMTP id 33mr31185561plv.209.1563270917376; Tue, 16 Jul 2019 02:55:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563270917; cv=none; d=google.com; s=arc-20160816; b=avVFVvHay/CyUOIpdDmEglZ3YpBWnjdB6fctLBSdic2xdCYUjoyONQzBD+Z0VSKy1Q xv9qhqbiA/Zts/Jw0UQod3VjBLmw9XSSZ5wZM39ADmloXJOtVqJTmSZ3mpFYJaN3aQHD G+pF/ff108A3G+RAQhKsj5PEEpGA6bOFc/Rkq150HZ6I26UbvTsnH5EpcrtKD+jyu0Y3 sYjII7d25NYE2gQjBKBJ0PkoVgSdBIK6LXjNaZc1V8k9APa4fp4HtPs1Tyt9uDduzuZh z07XB0j41xMbzqQafZaeBGEoWKTyX7RnFuHp5/4HEcKC1ezs4Mp+UPBcXIQSaMFsiAgO 1/cQ== 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:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=SWb56XEnAkwuUUTQuv4g9CftmyTnuWFI0OcyOh8bV4E=; b=uwKs1uYDzCDcZOBT+sAx31+JZc2YiTryfvVdCThaugzq03nHtNL5mbyUOE9J5XsfyV ubvTT4qXET2PCihTCWjCmLoResIWtzckyig+BIS+RUCGDWifBgaq7JNl72l7RBquKWj6 HV2JB+TyaFQofo73jKX92yyaGddh0csR2eBn6C95+PWmheYNS9hj/QwEm/q3gRjTVOIy MnRdFbQoIz3qAoZ+QQZhaPkNA9JWdbI2xsr5hSfhf/pYoTw8e1EeHkKva620tKVBGV0j atJ8cnV9AIj10YfREps5n20120jMmHzaBZ/8GPne59Dk+pPtCFePKNvDF4R9OdqKGm+x 3tWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=P7pXuZW1; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b15si471011plz.109.2019.07.16.02.55.17; Tue, 16 Jul 2019 02:55:17 -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; dkim=pass header.i=@linaro.org header.s=google header.b=P7pXuZW1; 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 S1733048AbfGPJzQ (ORCPT + 29 others); Tue, 16 Jul 2019 05:55:16 -0400 Received: from mail-pl1-f196.google.com ([209.85.214.196]:42077 "EHLO mail-pl1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732923AbfGPJzP (ORCPT ); Tue, 16 Jul 2019 05:55:15 -0400 Received: by mail-pl1-f196.google.com with SMTP id ay6so9839501plb.9 for ; Tue, 16 Jul 2019 02:55:14 -0700 (PDT) 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 :mime-version:content-transfer-encoding; bh=SWb56XEnAkwuUUTQuv4g9CftmyTnuWFI0OcyOh8bV4E=; b=P7pXuZW1lJ8u1aom5nEmPqGoSfpfcmLJUxPBNeM2o020xDjJZewv9KksFoB5SSIQVi QIBeycHlDSjUHhcf4/+gxvCfMbAAfvKV9unZPA3EHVyJH+Sb0UOZieH4z/zj+GuLl6TX IR20OZ6VkiyhUKOFhO4M65yEN3xmPEySfEpi7QIO+Y6OWH44PnWjq9iDQxSA+0l53k5I bho1MEAFwdg9BzUeHBuD5/bt2B9vKl15Jb41phYGVYEZxtClXjm82f9oAe/tTA7Pmcu6 8V13Iblir4uOpr7EzJTuZQL47KZXU19UiWMGXW79C38DHYcjHqmnP5PLPm6zAkJVhAHG TlSQ== 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:mime-version:content-transfer-encoding; bh=SWb56XEnAkwuUUTQuv4g9CftmyTnuWFI0OcyOh8bV4E=; b=J1FkuPssa6RM8Jx0HyHCyYt6T5hpj0tXOJYtdEdapHwxLffraL+2yQLT3YE+Axy8le LzTy0kpur+B61C3MaEzS+Yikl2gSbJOIQ6TQ+cT0ksT70FWcRD7LkvmatlFWNZ22PThg eB6u1J1RsbKMYNh7SKIXSSnwnrogA0J/d1jXVo9Dd7T1KhyjeP2fj2bY8r8MZcN7z2/N uJqjuzKg7X8lTQOYjHhIXm9z/kSRaESGNDXismoqaahm7OwKZrdt6geBlWc7rjGcw9VW zWntk6QbMjXHn7jpDT8Vr8xBUnlkAodaOm6oDaLfTdj389gIk0Sroy4FXtgnqXCXqNsS oHCg== X-Gm-Message-State: APjAAAXjs42W82N0s/yZkjH62rfXlk/ZVZWtY5uDRbdw9hYK4T5+WUsS JMExvbPLLdzY3YfRHadzCnGVUCPudVc= X-Received: by 2002:a17:902:e282:: with SMTP id cf2mr34506552plb.301.1563270914414; Tue, 16 Jul 2019 02:55:14 -0700 (PDT) Received: from localhost ([122.172.28.117]) by smtp.gmail.com with ESMTPSA id a5sm18383524pjv.21.2019.07.16.02.55.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 16 Jul 2019 02:55:13 -0700 (PDT) From: Viresh Kumar To: Rafael Wysocki , Benjamin Herrenschmidt Cc: Viresh Kumar , linux-pm@vger.kernel.org, Vincent Guittot , linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Subject: [PATCH 06/10] powerpc: macintosh: Switch to QoS requests instead of cpufreq notifier Date: Tue, 16 Jul 2019 15:24:50 +0530 Message-Id: X-Mailer: git-send-email 2.21.0.rc0.269.g1a574e7a288b In-Reply-To: References: MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The cpufreq core now takes the min/max frequency constraints via QoS requests and the CPUFREQ_ADJUST notifier shall get removed later on. Switch over to using the QoS request for maximum frequency constraint for windfarm_cpufreq_clamp driver. Signed-off-by: Viresh Kumar --- drivers/macintosh/windfarm_cpufreq_clamp.c | 77 ++++++++++++++-------- 1 file changed, 50 insertions(+), 27 deletions(-) -- 2.21.0.rc0.269.g1a574e7a288b diff --git a/drivers/macintosh/windfarm_cpufreq_clamp.c b/drivers/macintosh/windfarm_cpufreq_clamp.c index 52fd5fca89a0..705c6200814b 100644 --- a/drivers/macintosh/windfarm_cpufreq_clamp.c +++ b/drivers/macintosh/windfarm_cpufreq_clamp.c @@ -3,9 +3,11 @@ #include #include #include +#include #include #include #include +#include #include #include @@ -16,36 +18,24 @@ static int clamped; static struct wf_control *clamp_control; - -static int clamp_notifier_call(struct notifier_block *self, - unsigned long event, void *data) -{ - struct cpufreq_policy *p = data; - unsigned long max_freq; - - if (event != CPUFREQ_ADJUST) - return 0; - - max_freq = clamped ? (p->cpuinfo.min_freq) : (p->cpuinfo.max_freq); - cpufreq_verify_within_limits(p, 0, max_freq); - - return 0; -} - -static struct notifier_block clamp_notifier = { - .notifier_call = clamp_notifier_call, -}; +static struct dev_pm_qos_request qos_req; +static unsigned int min_freq, max_freq; static int clamp_set(struct wf_control *ct, s32 value) { - if (value) + unsigned int freq; + + if (value) { + freq = min_freq; printk(KERN_INFO "windfarm: Clamping CPU frequency to " "minimum !\n"); - else + } else { + freq = max_freq; printk(KERN_INFO "windfarm: CPU frequency unclamped !\n"); + } clamped = value; - cpufreq_update_policy(0); - return 0; + + return dev_pm_qos_update_request(&qos_req, freq); } static int clamp_get(struct wf_control *ct, s32 *value) @@ -74,27 +64,60 @@ static const struct wf_control_ops clamp_ops = { static int __init wf_cpufreq_clamp_init(void) { + struct cpufreq_policy *policy; struct wf_control *clamp; + struct device *dev; + int ret; + + policy = cpufreq_cpu_get(0); + if (!policy) { + pr_warn("%s: cpufreq policy not found cpu0\n", __func__); + return -EPROBE_DEFER; + } + + min_freq = policy->cpuinfo.min_freq; + max_freq = policy->cpuinfo.max_freq; + cpufreq_cpu_put(policy); + + dev = get_cpu_device(0); + if (unlikely(!dev)) { + pr_warn("%s: No cpu device for cpu0\n", __func__); + return -ENODEV; + } clamp = kmalloc(sizeof(struct wf_control), GFP_KERNEL); if (clamp == NULL) return -ENOMEM; - cpufreq_register_notifier(&clamp_notifier, CPUFREQ_POLICY_NOTIFIER); + + ret = dev_pm_qos_add_request(dev, &qos_req, DEV_PM_QOS_MAX_FREQUENCY, + max_freq); + if (ret < 0) { + pr_err("%s: Failed to add freq constraint (%d)\n", __func__, + ret); + goto free; + } + clamp->ops = &clamp_ops; clamp->name = "cpufreq-clamp"; - if (wf_register_control(clamp)) + ret = wf_register_control(clamp); + if (ret) goto fail; clamp_control = clamp; return 0; fail: + dev_pm_qos_remove_request(&qos_req); + + free: kfree(clamp); - return -ENODEV; + return ret; } static void __exit wf_cpufreq_clamp_exit(void) { - if (clamp_control) + if (clamp_control) { wf_unregister_control(clamp_control); + dev_pm_qos_remove_request(&qos_req); + } } From patchwork Tue Jul 16 09:54:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 169048 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp619217ilk; Tue, 16 Jul 2019 02:55:25 -0700 (PDT) X-Google-Smtp-Source: APXvYqwQi8y58jACK6NJ3X8cFv9MiDu+anhg0vTYmJvK12C98yJYv0g69zxAkNKbSa2oTO/OTbp5 X-Received: by 2002:a65:5c0a:: with SMTP id u10mr32637033pgr.410.1563270925328; Tue, 16 Jul 2019 02:55:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563270925; cv=none; d=google.com; s=arc-20160816; b=R0CqnvmLWd8rYGEioIxrjNz/TEhSCwpWxYCjQuy2mGu63foRUuWbkeTBFGgB2L+hix 2HTjUQEBZFCjp+1BsUXtrGanT1VSUf69eTo4AsLdBEVl1DRJwScUtSGu22NdANPM0noN 7SV41Y41yMTmZmhfDP9DWEbYoe+w3c84Z1M01/leCm8mN3PLtt+xcyPOwfmxyEre1AKh DGutxN255wP4HjIdLzccdhDQUUThEZ1lPhzYYWmD9FpwN6lG+pAZ+Flz0fMoPUudwt+/ LVSf3R9NmYd2/SoIVVk2FSpNvgSU0Lw8U9jWOwHTGBoFS8HrPmafnrvzUEDWfvO1Ba+a q3/g== 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:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=KfxdZKhpROdsD8TEUU0uSmTytrjjuhlMQjqVQfanDQg=; b=CqL03opalMI4KJEul4cd4SRYANzrRE5XgAp74J7kYCYIcFqh/PmzkcWcZXaDPZP9e9 GiIVpqaB2v2DJ8TpAQwY2muN7CHGmH9ub+BlOvgmzQj6nhfxvo/K948vqeu7N6VtWzcI /+hezxAwHNtu/N2Ki6VwFIvPSCKIY33/2JDEDcgEhe849DbXGu5KQXtuGnRxGyhJS+rL O7+Bjya7NiGgyZnt7Eh8mARNvbtOe0wRKbsh9d+PJ0AoM1qsCrtECJF4j/ccMGtWTBZ8 z99kAxoJjmKhEbwOBmTsakWyZfp1uqhE2lkFJWJXQVhHSDSOd4sRu8xT2l44B7CXj3yw aGrA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="sIKQq/n/"; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x1si2501189plb.28.2019.07.16.02.55.25; Tue, 16 Jul 2019 02:55:25 -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; dkim=pass header.i=@linaro.org header.s=google header.b="sIKQq/n/"; 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 S1733232AbfGPJzY (ORCPT + 29 others); Tue, 16 Jul 2019 05:55:24 -0400 Received: from mail-pf1-f193.google.com ([209.85.210.193]:46155 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1733186AbfGPJzV (ORCPT ); Tue, 16 Jul 2019 05:55:21 -0400 Received: by mail-pf1-f193.google.com with SMTP id c73so8846346pfb.13 for ; Tue, 16 Jul 2019 02:55:21 -0700 (PDT) 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 :mime-version:content-transfer-encoding; bh=KfxdZKhpROdsD8TEUU0uSmTytrjjuhlMQjqVQfanDQg=; b=sIKQq/n/IP1otU+tnWay329iLQbfeBKa+gHOLf+8BSb177O2C4PpldieNqWuCT7pMQ IB0y1ZFV1Bi1GaLSHgUZ7NDp6dWe2iC73pe8V2S+4CqjqjsyLioEzkAU2q6KedDUJuvc pO11+7NOTWd7xNAKLf754pD7YgdYV7g4hnvRaog6V7wl78et82SyyVfTViZ6GpPp/ait hCUOq5vwdQrZOBZVlzOb0CE8hL13BDcZUZWWWaQbwSIqar3FQIECqQRgcDbNrd+BtXN4 ePwK8gBXju9KzUq4cXlDjugl1gq3Bbe0/bfZ8uQmk+/iTwCH3aVgFsqrpTWiiS5IpNPF hgJA== 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:mime-version:content-transfer-encoding; bh=KfxdZKhpROdsD8TEUU0uSmTytrjjuhlMQjqVQfanDQg=; b=a4WM7O9GOHeutbMr9jPTFml6LKNE0iBnKsO/rtJwTIfo81aTmtawYUeTCwXM/JFO2H xseyqofuASGZFppzdCID5+Rgz2d1XF8T8HXIQUIJ0FCPi0BjiwboSMRYGQ8tKBnEOEFz Nbwa76cQXszY1sC2L4VdApHGQxcXx+zzaTmLnhfBjzWhlRuEX4msqdwyXpneB078GZZ0 Hj/K1QpfgggokkIHnXyAR5UaWHciZb1W7W0DFeXnPFRnZrTmWvxjN9Nb7csHMZ522fgL /znu8/m5xuncLICVVS9O4Sft2ay26gZlB72IZuMd3cj87tkg6iJPDzp6g5CpnxTm6lj5 GeoA== X-Gm-Message-State: APjAAAVFMlVUqluW0DOGrsH9ZgeEYB+BmuJ7OqKQ7KmqgbPlJ+c40fmV ic+ksLm1EXbQg56EsaKq2wltTg== X-Received: by 2002:a17:90a:17c4:: with SMTP id q62mr35620240pja.104.1563270920836; Tue, 16 Jul 2019 02:55:20 -0700 (PDT) Received: from localhost ([122.172.28.117]) by smtp.gmail.com with ESMTPSA id p68sm29575718pfb.80.2019.07.16.02.55.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 16 Jul 2019 02:55:20 -0700 (PDT) From: Viresh Kumar To: Rafael Wysocki , Len Brown , Zhang Rui , Robert Moore , Erik Schmauss Cc: Viresh Kumar , linux-pm@vger.kernel.org, Vincent Guittot , linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, devel@acpica.org Subject: [PATCH 08/10] ACPI: cpufreq: Switch to QoS requests instead of cpufreq notifier Date: Tue, 16 Jul 2019 15:24:52 +0530 Message-Id: X-Mailer: git-send-email 2.21.0.rc0.269.g1a574e7a288b In-Reply-To: References: MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The cpufreq core now takes the min/max frequency constraints via QoS requests and the CPUFREQ_ADJUST notifier shall get removed later on. Switch over to using the QoS request for maximum frequency constraint for acpi driver. Signed-off-by: Viresh Kumar --- drivers/acpi/processor_driver.c | 44 +++++++++++-- drivers/acpi/processor_perflib.c | 106 +++++++++++++------------------ drivers/acpi/processor_thermal.c | 81 ++++++++++++----------- include/acpi/processor.h | 22 ++++--- 4 files changed, 137 insertions(+), 116 deletions(-) -- 2.21.0.rc0.269.g1a574e7a288b diff --git a/drivers/acpi/processor_driver.c b/drivers/acpi/processor_driver.c index aea8d674a33d..e7a3f07e9879 100644 --- a/drivers/acpi/processor_driver.c +++ b/drivers/acpi/processor_driver.c @@ -284,6 +284,35 @@ static int acpi_processor_stop(struct device *dev) return 0; } +bool acpi_processor_cpufreq_init; + +static int acpi_processor_notifier(struct notifier_block *nb, + unsigned long event, void *data) +{ + struct cpufreq_policy *policy = data; + int cpu; + + if (event == CPUFREQ_CREATE_POLICY) { + for_each_cpu(cpu, policy->cpus) + per_cpu(processors, cpu)->policy = policy; + + acpi_thermal_cpufreq_init(policy); + acpi_processor_ppc_init(policy); + } else if (event == CPUFREQ_REMOVE_POLICY) { + acpi_processor_ppc_exit(policy); + acpi_thermal_cpufreq_exit(policy); + + for_each_cpu(cpu, policy->cpus) + per_cpu(processors, cpu)->policy = NULL; + } + + return 0; +} + +static struct notifier_block acpi_processor_notifier_block = { + .notifier_call = acpi_processor_notifier, +}; + /* * We keep the driver loaded even when ACPI is not running. * This is needed for the powernow-k8 driver, that works even without @@ -310,8 +339,11 @@ static int __init acpi_processor_driver_init(void) cpuhp_setup_state_nocalls(CPUHP_ACPI_CPUDRV_DEAD, "acpi/cpu-drv:dead", NULL, acpi_soft_cpu_dead); - acpi_thermal_cpufreq_init(); - acpi_processor_ppc_init(); + if (!cpufreq_register_notifier(&acpi_processor_notifier_block, + CPUFREQ_POLICY_NOTIFIER)) { + acpi_processor_cpufreq_init = true; + } + acpi_processor_throttling_init(); return 0; err: @@ -324,8 +356,12 @@ static void __exit acpi_processor_driver_exit(void) if (acpi_disabled) return; - acpi_processor_ppc_exit(); - acpi_thermal_cpufreq_exit(); + if (acpi_processor_cpufreq_init) { + cpufreq_unregister_notifier(&acpi_processor_notifier_block, + CPUFREQ_POLICY_NOTIFIER); + acpi_processor_cpufreq_init = false; + } + cpuhp_remove_state_nocalls(hp_online); cpuhp_remove_state_nocalls(CPUHP_ACPI_CPUDRV_DEAD); driver_unregister(&acpi_processor_driver); diff --git a/drivers/acpi/processor_perflib.c b/drivers/acpi/processor_perflib.c index ee87cb6f6e59..1a22b2415a8b 100644 --- a/drivers/acpi/processor_perflib.c +++ b/drivers/acpi/processor_perflib.c @@ -50,57 +50,13 @@ module_param(ignore_ppc, int, 0644); MODULE_PARM_DESC(ignore_ppc, "If the frequency of your machine gets wrongly" \ "limited by BIOS, this should help"); -#define PPC_REGISTERED 1 -#define PPC_IN_USE 2 - -static int acpi_processor_ppc_status; - -static int acpi_processor_ppc_notifier(struct notifier_block *nb, - unsigned long event, void *data) -{ - struct cpufreq_policy *policy = data; - struct acpi_processor *pr; - unsigned int ppc = 0; - - if (ignore_ppc < 0) - ignore_ppc = 0; - - if (ignore_ppc) - return 0; - - if (event != CPUFREQ_ADJUST) - return 0; - - mutex_lock(&performance_mutex); - - pr = per_cpu(processors, policy->cpu); - if (!pr || !pr->performance) - goto out; - - ppc = (unsigned int)pr->performance_platform_limit; - - if (ppc >= pr->performance->state_count) - goto out; - - cpufreq_verify_within_limits(policy, 0, - pr->performance->states[ppc]. - core_frequency * 1000); - - out: - mutex_unlock(&performance_mutex); - - return 0; -} - -static struct notifier_block acpi_ppc_notifier_block = { - .notifier_call = acpi_processor_ppc_notifier, -}; +static int acpi_processor_ppc_in_use; static int acpi_processor_get_platform_limit(struct acpi_processor *pr) { acpi_status status = 0; unsigned long long ppc = 0; - + int ret; if (!pr) return -EINVAL; @@ -112,7 +68,7 @@ static int acpi_processor_get_platform_limit(struct acpi_processor *pr) status = acpi_evaluate_integer(pr->handle, "_PPC", NULL, &ppc); if (status != AE_NOT_FOUND) - acpi_processor_ppc_status |= PPC_IN_USE; + acpi_processor_ppc_in_use = 1; if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) { ACPI_EXCEPTION((AE_INFO, status, "Evaluating _PPC")); @@ -124,6 +80,16 @@ static int acpi_processor_get_platform_limit(struct acpi_processor *pr) pr->performance_platform_limit = (int)ppc; + if (ignore_ppc || ppc >= pr->performance->state_count) + return 0; + + ret = dev_pm_qos_update_request(pr->perflib_req, + pr->performance->states[ppc].core_frequency * 1000); + if (ret) { + pr_warn("Failed to update perflib freq constraint: cpu%d (%d)\n", + pr->id, ret); + } + return 0; } @@ -184,23 +150,39 @@ int acpi_processor_get_bios_limit(int cpu, unsigned int *limit) } EXPORT_SYMBOL(acpi_processor_get_bios_limit); -void acpi_processor_ppc_init(void) +void acpi_processor_ppc_init(struct cpufreq_policy *policy) { - if (!cpufreq_register_notifier - (&acpi_ppc_notifier_block, CPUFREQ_POLICY_NOTIFIER)) - acpi_processor_ppc_status |= PPC_REGISTERED; - else - printk(KERN_DEBUG - "Warning: Processor Platform Limit not supported.\n"); + struct acpi_processor *pr = per_cpu(processors, policy->cpu); + struct dev_pm_qos_request *req; + int ret; + + req = kzalloc(sizeof(*req), GFP_KERNEL); + if (!req) + return; + + ret = dev_pm_qos_add_request(get_cpu_device(policy->cpu), + req, DEV_PM_QOS_MAX_FREQUENCY, + policy->cpuinfo.max_freq); + if (ret < 0) { + pr_err("Failed to add freq constraint for cpu%d (%d)\n", + policy->cpu, ret); + kfree(req); + return; + } + + pr->perflib_req = req; + + if (ignore_ppc < 0) + ignore_ppc = 0; } -void acpi_processor_ppc_exit(void) +void acpi_processor_ppc_exit(struct cpufreq_policy *policy) { - if (acpi_processor_ppc_status & PPC_REGISTERED) - cpufreq_unregister_notifier(&acpi_ppc_notifier_block, - CPUFREQ_POLICY_NOTIFIER); + struct acpi_processor *pr = per_cpu(processors, policy->cpu); - acpi_processor_ppc_status &= ~PPC_REGISTERED; + dev_pm_qos_remove_request(pr->perflib_req); + kfree(pr->perflib_req); + pr->perflib_req = NULL; } static int acpi_processor_get_performance_control(struct acpi_processor *pr) @@ -477,7 +459,7 @@ int acpi_processor_notify_smm(struct module *calling_module) static int is_done = 0; int result; - if (!(acpi_processor_ppc_status & PPC_REGISTERED)) + if (!acpi_processor_cpufreq_init) return -EBUSY; if (!try_module_get(calling_module)) @@ -513,7 +495,7 @@ int acpi_processor_notify_smm(struct module *calling_module) * we can allow the cpufreq driver to be rmmod'ed. */ is_done = 1; - if (!(acpi_processor_ppc_status & PPC_IN_USE)) + if (!acpi_processor_ppc_in_use) module_put(calling_module); return 0; @@ -742,7 +724,7 @@ acpi_processor_register_performance(struct acpi_processor_performance { struct acpi_processor *pr; - if (!(acpi_processor_ppc_status & PPC_REGISTERED)) + if (!acpi_processor_cpufreq_init) return -EINVAL; mutex_lock(&performance_mutex); diff --git a/drivers/acpi/processor_thermal.c b/drivers/acpi/processor_thermal.c index 50fb0107375e..02407b33b874 100644 --- a/drivers/acpi/processor_thermal.c +++ b/drivers/acpi/processor_thermal.c @@ -35,7 +35,6 @@ ACPI_MODULE_NAME("processor_thermal"); #define CPUFREQ_THERMAL_MAX_STEP 3 static DEFINE_PER_CPU(unsigned int, cpufreq_thermal_reduction_pctg); -static unsigned int acpi_thermal_cpufreq_is_init = 0; #define reduction_pctg(cpu) \ per_cpu(cpufreq_thermal_reduction_pctg, phys_package_first_cpu(cpu)) @@ -61,35 +60,11 @@ static int phys_package_first_cpu(int cpu) static int cpu_has_cpufreq(unsigned int cpu) { struct cpufreq_policy policy; - if (!acpi_thermal_cpufreq_is_init || cpufreq_get_policy(&policy, cpu)) + if (!acpi_processor_cpufreq_init || cpufreq_get_policy(&policy, cpu)) return 0; return 1; } -static int acpi_thermal_cpufreq_notifier(struct notifier_block *nb, - unsigned long event, void *data) -{ - struct cpufreq_policy *policy = data; - unsigned long max_freq = 0; - - if (event != CPUFREQ_ADJUST) - goto out; - - max_freq = ( - policy->cpuinfo.max_freq * - (100 - reduction_pctg(policy->cpu) * 20) - ) / 100; - - cpufreq_verify_within_limits(policy, 0, max_freq); - - out: - return 0; -} - -static struct notifier_block acpi_thermal_cpufreq_notifier_block = { - .notifier_call = acpi_thermal_cpufreq_notifier, -}; - static int cpufreq_get_max_state(unsigned int cpu) { if (!cpu_has_cpufreq(cpu)) @@ -108,7 +83,9 @@ static int cpufreq_get_cur_state(unsigned int cpu) static int cpufreq_set_cur_state(unsigned int cpu, int state) { - int i; + struct acpi_processor *pr; + unsigned long max_freq; + int i, ret; if (!cpu_has_cpufreq(cpu)) return 0; @@ -121,33 +98,53 @@ static int cpufreq_set_cur_state(unsigned int cpu, int state) * frequency. */ for_each_online_cpu(i) { - if (topology_physical_package_id(i) == + if (topology_physical_package_id(i) != topology_physical_package_id(cpu)) - cpufreq_update_policy(i); + continue; + + pr = per_cpu(processors, i); + max_freq = (pr->policy->cpuinfo.max_freq * (100 - reduction_pctg(i) * 20)) / 100; + + ret = dev_pm_qos_update_request(pr->thermal_req, max_freq); + if (ret) { + pr_warn("Failed to update thermal freq constraint: cpu%d (%d)\n", + pr->id, ret); + } } return 0; } -void acpi_thermal_cpufreq_init(void) +void acpi_thermal_cpufreq_init(struct cpufreq_policy *policy) { - int i; + struct acpi_processor *pr = per_cpu(processors, policy->cpu); + struct dev_pm_qos_request *req; + int ret; + + req = kzalloc(sizeof(*req), GFP_KERNEL); + if (!req) + return; + + ret = dev_pm_qos_add_request(get_cpu_device(policy->cpu), + req, DEV_PM_QOS_MAX_FREQUENCY, + policy->cpuinfo.max_freq); + if (ret < 0) { + pr_err("Failed to add freq constraint for cpu%d (%d)\n", + policy->cpu, ret); + kfree(req); + return; + } - i = cpufreq_register_notifier(&acpi_thermal_cpufreq_notifier_block, - CPUFREQ_POLICY_NOTIFIER); - if (!i) - acpi_thermal_cpufreq_is_init = 1; + pr->thermal_req = req; } -void acpi_thermal_cpufreq_exit(void) +void acpi_thermal_cpufreq_exit(struct cpufreq_policy *policy) { - if (acpi_thermal_cpufreq_is_init) - cpufreq_unregister_notifier - (&acpi_thermal_cpufreq_notifier_block, - CPUFREQ_POLICY_NOTIFIER); + struct acpi_processor *pr = per_cpu(processors, policy->cpu); - acpi_thermal_cpufreq_is_init = 0; + dev_pm_qos_remove_request(pr->thermal_req); + kfree(pr->thermal_req); + pr->thermal_req = NULL; } - #else /* ! CONFIG_CPU_FREQ */ static int cpufreq_get_max_state(unsigned int cpu) { diff --git a/include/acpi/processor.h b/include/acpi/processor.h index 1194a4c78d55..a1a7966bb755 100644 --- a/include/acpi/processor.h +++ b/include/acpi/processor.h @@ -4,6 +4,8 @@ #include #include +#include +#include #include #include @@ -230,6 +232,9 @@ struct acpi_processor { struct acpi_processor_limit limit; struct thermal_cooling_device *cdev; struct device *dev; /* Processor device. */ + struct cpufreq_policy *policy; + struct dev_pm_qos_request *perflib_req; + struct dev_pm_qos_request *thermal_req; }; struct acpi_processor_errata { @@ -296,16 +301,17 @@ static inline void acpi_processor_ffh_cstate_enter(struct acpi_processor_cx /* in processor_perflib.c */ #ifdef CONFIG_CPU_FREQ -void acpi_processor_ppc_init(void); -void acpi_processor_ppc_exit(void); +extern bool acpi_processor_cpufreq_init; +void acpi_processor_ppc_init(struct cpufreq_policy *policy); +void acpi_processor_ppc_exit(struct cpufreq_policy *policy); void acpi_processor_ppc_has_changed(struct acpi_processor *pr, int event_flag); extern int acpi_processor_get_bios_limit(int cpu, unsigned int *limit); #else -static inline void acpi_processor_ppc_init(void) +static inline void acpi_processor_ppc_init(struct cpufreq_policy *policy) { return; } -static inline void acpi_processor_ppc_exit(void) +static inline void acpi_processor_ppc_exit(struct cpufreq_policy *policy) { return; } @@ -421,14 +427,14 @@ static inline int acpi_processor_hotplug(struct acpi_processor *pr) int acpi_processor_get_limit_info(struct acpi_processor *pr); extern const struct thermal_cooling_device_ops processor_cooling_ops; #if defined(CONFIG_ACPI_CPU_FREQ_PSS) & defined(CONFIG_CPU_FREQ) -void acpi_thermal_cpufreq_init(void); -void acpi_thermal_cpufreq_exit(void); +void acpi_thermal_cpufreq_init(struct cpufreq_policy *policy); +void acpi_thermal_cpufreq_exit(struct cpufreq_policy *policy); #else -static inline void acpi_thermal_cpufreq_init(void) +static inline void acpi_thermal_cpufreq_init(struct cpufreq_policy *policy) { return; } -static inline void acpi_thermal_cpufreq_exit(void) +static inline void acpi_thermal_cpufreq_exit(struct cpufreq_policy *policy) { return; } From patchwork Tue Jul 16 09:54:54 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 169050 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp619357ilk; Tue, 16 Jul 2019 02:55:32 -0700 (PDT) X-Google-Smtp-Source: APXvYqzOpjrIkvFiHNiAUGiRJ6cB7bbETcR55bh0tlmgAvNdU6ic+Q5byd1K1yYbFNwORL/hyC4x X-Received: by 2002:a17:902:b582:: with SMTP id a2mr34606160pls.128.1563270932837; Tue, 16 Jul 2019 02:55:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563270932; cv=none; d=google.com; s=arc-20160816; b=cfHBgI255hoDmuQE90jcEBVM4cwWbCLceFI7ODOYEsrjpByZ6IqT3PStISl3gdjlz0 2//jZjb7/QVP74JAPwcdWc9QU/9RgQzsJLAyMuFqoiBn08IxIFKVBB1YU+J/HaAWQMbJ k/PfoojfNnQycG9Wop7imDBIS5QftUY/4r5SwccY710VPXOpAlHtbqg8cHBXW4IOhfEl /jH9V1QyYsvnDsPWMAc6Vy5blAsUXSPUtj/n4S402hsWty5+UFBVoDdqQem+8iTdvaZa E9uWZ0CkWopdw6fl8iriNVyFVtKtA1iogrYyM6hDLMFCPasBOKznk5ZQRfKnGY7SLd/5 F75g== 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:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=j9CPag+ihAeKmeHNKcPHDy3IUTBk0GySQWFpNM7jlh0=; b=QNdAxJ5lvJG1rZnN55H5zYyTgJ1wCoPl7sXccz4VSLYHWoAxFwMhnOLMH7Y4BeNKBP VXW4Z1XAcOsQG5ObIp8jAX7W5E6FS5u7soMaOltHCvxIDIwCnLRHoNKd6VTlxbEgYons hgK4OyzbkmjkvS+ZbrG97bUBk55Z7GJwvtP+PQFol+0IybwQ07wT6WkGuCKCzRiC6uJg RKXq5gziejuAuouwtguVuGzqYxgSJNTltwTO4gQzGc0G+0RxckIFr1q7BtPKGpW2DpOd bl2i8lJOQT+bcWQU5YyZOp278DlVAlHAjj0MbErbvg6wN3l17QgiSauXet2HCgsPFi+i cvCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=uakV8TcQ; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a24si20313130pfi.205.2019.07.16.02.55.32; Tue, 16 Jul 2019 02:55:32 -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; dkim=pass header.i=@linaro.org header.s=google header.b=uakV8TcQ; 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 S1733311AbfGPJzb (ORCPT + 29 others); Tue, 16 Jul 2019 05:55:31 -0400 Received: from mail-pg1-f193.google.com ([209.85.215.193]:44011 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1733254AbfGPJz1 (ORCPT ); Tue, 16 Jul 2019 05:55:27 -0400 Received: by mail-pg1-f193.google.com with SMTP id f25so9173069pgv.10 for ; Tue, 16 Jul 2019 02:55:27 -0700 (PDT) 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 :mime-version:content-transfer-encoding; bh=j9CPag+ihAeKmeHNKcPHDy3IUTBk0GySQWFpNM7jlh0=; b=uakV8TcQGVyYIY3mCGPNuqIsaoT779Q6itiqhB5woh+Rh4UZK047zRIWVEwZGqm/Uo R9tyHSLa4YS1kRHGj0xlEB4bsQaC6dKp7/BR7xQ9fqA3/riZMPfZnU4YUvqHvPKfuUV0 yzMy0zq1h1C1ra+z/k+whZQAJ7TmP9A70pJlzHhumNS5RQ8wousuAAKMnLmbiaPvlGT8 DC1MBvbhsZFOVnhcAAfU0Z7VCn+5kx18m7HOrXgrfUqQIEKP+w6TL498T8V0cCSI0JN4 0l8eUsimM2NqHmfrb68Lf/PYsX4n4eCZwcs6oGHdDFl3oa7zTKk+NBCKbDLWRiSeEk4v 5fuw== 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:mime-version:content-transfer-encoding; bh=j9CPag+ihAeKmeHNKcPHDy3IUTBk0GySQWFpNM7jlh0=; b=BKQ54Blf2Lmo2Qi2yJ9JiYoOne+dmj1Muzb3lon3UDrxNctE0g1qVc8SM/4ZXoi9Ar /TjJQ4w7BEr2pUxjSEmmW8ksqZLzB3VLz/RvbuGbLl+3n/YjawQEwgeeaddVJuYMIB2e cKyWI+DcbmvaCfP+7x5e/f1yzUh5IUdG+ifiyq7b64SSq297OObpA9+A5fkyIzyllOcp m4eAKMdvqFfdYeUfQaZOhdbsKNqculc5rIRGJ0PDL5BDZ+QdRf8hvOzfJdoVt3KLLSwY +8x6oDn8l+W/xFM0S9OI7rTsVywsL8xN6cjr6BCdIjVhSJz0a8iKF6XG07LUUIv7Fpsw UIYg== X-Gm-Message-State: APjAAAUbfNv0hLh5jCZ9eHNcYcIu7vWY8jZ38T3TjOWxPNkzev7jodV9 uNewPnLM8Wsl4oqNOensDL6zLQ== X-Received: by 2002:a65:50c8:: with SMTP id s8mr25725239pgp.339.1563270926697; Tue, 16 Jul 2019 02:55:26 -0700 (PDT) Received: from localhost ([122.172.28.117]) by smtp.gmail.com with ESMTPSA id 21sm8260153pfj.76.2019.07.16.02.55.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 16 Jul 2019 02:55:26 -0700 (PDT) From: Viresh Kumar To: Rafael Wysocki , Viresh Kumar Cc: linux-pm@vger.kernel.org, Vincent Guittot , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 10/10] Documentation: cpufreq: Update policy notifier documentation Date: Tue, 16 Jul 2019 15:24:54 +0530 Message-Id: <437a6b7e7876b6edee52f7ef829ee905b14d89a5.1563270828.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.21.0.rc0.269.g1a574e7a288b In-Reply-To: References: MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Update documentation with the recent policy notifier updates. Signed-off-by: Viresh Kumar --- Documentation/cpu-freq/core.txt | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) -- 2.21.0.rc0.269.g1a574e7a288b diff --git a/Documentation/cpu-freq/core.txt b/Documentation/cpu-freq/core.txt index 073f128af5a7..af5c0d60b466 100644 --- a/Documentation/cpu-freq/core.txt +++ b/Documentation/cpu-freq/core.txt @@ -57,19 +57,11 @@ transition notifiers. 2.1 CPUFreq policy notifiers ---------------------------- -These are notified when a new policy is intended to be set. Each -CPUFreq policy notifier is called twice for a policy transition: +These are notified when a new policy is created or removed. -1.) During CPUFREQ_ADJUST all CPUFreq notifiers may change the limit if - they see a need for this - may it be thermal considerations or - hardware limitations. - -2.) And during CPUFREQ_NOTIFY all notifiers are informed of the new policy - - if two hardware drivers failed to agree on a new policy before this - stage, the incompatible hardware shall be shut down, and the user - informed of this. - -The phase is specified in the second argument to the notifier. +The phase is specified in the second argument to the notifier. The phase is +CPUFREQ_CREATE_POLICY when the policy is first created and it is +CPUFREQ_REMOVE_POLICY when the policy is removed. The third argument, a void *pointer, points to a struct cpufreq_policy consisting of several values, including min, max (the lower and upper