Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp2206352imm; Mon, 28 May 2018 03:57:37 -0700 (PDT) X-Google-Smtp-Source: AB8JxZo69RWqJawxiU6d7Gm9roFdDikt+5hqOTh12Siev34sUAAkbdhEB2rfm5sKT/7UlREPM0m9 X-Received: by 2002:a17:902:bd46:: with SMTP id b6-v6mr13202234plx.170.1527505057759; Mon, 28 May 2018 03:57:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527505057; cv=none; d=google.com; s=arc-20160816; b=wHoR+PPqH7AxvomXmjQau41lka/xZSBgNHL6VzYrgdMk582f/p/ZAK/X5/bpqvknBt AqodpRI4kIWb2wh8tM3qrKO0py+/i0xUCvW4TsLfwTL+BWEgl7S9xxQYv81taQ4ZURem inHVjIIGCHYmfSkD7pdnAL+Nhf+r94cjq9zYaQ5PKJqbogzaBFcnZKLGvZV5Oir5pV+5 YAG7mURWsPM+MQRqV8R7Imj0UnWPTSZF96BevYdSlrnA5RydCPaeVQRwVN+i2FKF6Z6n gh8XP+uJ2Kym76+N8ZU4SUu/7hj2mMYTG/T68VYwC5T4xp/hOdcPjGrkhziCmvTPzDDC uaMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=o6TElJIe561SwkA16ZGeN7NPhAO1V5XaOfJH5utNTD0=; b=ojy0Im3nurJGgksqAmhjD99H5Rd/N2p2v+GBHPOrv7CXeqeHvKat4WM6OOnvIYZ8JK XYX+xDCJemf3Yl+apv7d9CWtGXSbxYvhCyQTd5eZ2avm3yt7ZsWpAVzawdGion5XKwZT 1O9U9tfOUOMPmXD8yp1aWiEQOEq8aL3hjAxj/QlcVTH2FUOU7ZZX5oE/srJkpoBGSGwR md2MnuMxwTPT7ZnwX/RnnHNSgbxJUPb3yJqALs/iOYgQoxyC2ZUQvJFJ6vfBabdkWn6b MiT/wpEPqe6yM0CK29jT4dz8/vrRuAq+KkVDRnCDBYTqlORwTmRyxa06aF4olPTnKSoi mhLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=M62wBp/r; 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 y9-v6si30385003pfk.34.2018.05.28.03.57.23; Mon, 28 May 2018 03:57:37 -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=@kernel.org header.s=default header.b=M62wBp/r; 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 S1164510AbeE1K4Q (ORCPT + 99 others); Mon, 28 May 2018 06:56:16 -0400 Received: from mail.kernel.org ([198.145.29.99]:44632 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1164489AbeE1K4L (ORCPT ); Mon, 28 May 2018 06:56:11 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 00EA0208A3; Mon, 28 May 2018 10:56:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1527504970; bh=tGI1+R/D4LZJRvggMBMmnBP9kK5S8MUbBvchRJYEjJ8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=M62wBp/r0lK/I5BNZL0UClXtwMoGl5pR0/SY4w6+xycIMzb9Ot37o1Lvt+8na6FmW XEOoYm3IB3iodrgPc6rgoLV7aZuLBa39UkvQIcFIcarjqbnvBZf7xwqyVlrK8V2I+a Zk2n46cnn9elNaq7/wST04Cb2NYYKr5oQqCSYfns= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Viresh Kumar , Shunyong Yang , "Rafael J. Wysocki" , Sasha Levin Subject: [PATCH 4.14 329/496] cpufreq: CPPC: Initialize shared perf capabilities of CPUs Date: Mon, 28 May 2018 12:01:54 +0200 Message-Id: <20180528100333.685407324@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180528100319.498712256@linuxfoundation.org> References: <20180528100319.498712256@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Shunyong Yang [ Upstream commit 8913315e9459b146e5888ab5138e10daa061b885 ] When multiple CPUs are related in one cpufreq policy, the first online CPU will be chosen by default to handle cpufreq operations. Let's take cpu0 and cpu1 as an example. When cpu0 is offline, policy->cpu will be shifted to cpu1. cpu1's perf capabilities should be initialized. Otherwise, perf capabilities are 0s and speed change can not take effect. This patch copies perf capabilities of the first online CPU to other shared CPUs when policy shared type is CPUFREQ_SHARED_TYPE_ANY. Acked-by: Viresh Kumar Signed-off-by: Shunyong Yang Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/cpufreq/cppc_cpufreq.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) --- a/drivers/cpufreq/cppc_cpufreq.c +++ b/drivers/cpufreq/cppc_cpufreq.c @@ -167,9 +167,19 @@ static int cppc_cpufreq_cpu_init(struct NSEC_PER_USEC; policy->shared_type = cpu->shared_type; - if (policy->shared_type == CPUFREQ_SHARED_TYPE_ANY) + if (policy->shared_type == CPUFREQ_SHARED_TYPE_ANY) { + int i; + cpumask_copy(policy->cpus, cpu->shared_cpu_map); - else if (policy->shared_type == CPUFREQ_SHARED_TYPE_ALL) { + + for_each_cpu(i, policy->cpus) { + if (unlikely(i == policy->cpu)) + continue; + + memcpy(&all_cpu_data[i]->perf_caps, &cpu->perf_caps, + sizeof(cpu->perf_caps)); + } + } else if (policy->shared_type == CPUFREQ_SHARED_TYPE_ALL) { /* Support only SW_ANY for now. */ pr_debug("Unsupported CPU co-ord type\n"); return -EFAULT;