Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp158419pxb; Tue, 2 Feb 2021 01:42:15 -0800 (PST) X-Google-Smtp-Source: ABdhPJyZqpnEmLblLmjxNGvW/kir+SXjZXKN37fR1szgYsKcHolqxp2rAwFFTZsScxwd78HNbHfm X-Received: by 2002:a05:6402:4389:: with SMTP id o9mr22833209edc.164.1612258935515; Tue, 02 Feb 2021 01:42:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612258935; cv=none; d=google.com; s=arc-20160816; b=LVYMWLzc2T73S/C5Cij4q1QUFGG28yOCqYVe/UyJ66LrnaWzfKs4VeNC9ipF/HIZDQ h4UZQWAJrxPbksG3GN29BKHWxs7SimoaFE+A8mujnQYzYR4btQlryW6X3XmfL20s5g3X REAWgqroAbKkijIo33RUImGPKFrJKyMiTplGOYcdiJ6ZEcK8ruJBCX3wFWvWSzVaASLg olcLawBefdgl/7+iZMYuymoPWxxUlo5eSDcVm7mTEUu9K7xAfwVQnrsK45YNrGdn+Byl GZThU853IPH5la9i7BQ5LBAwNkTYOsOTAKqal+YaJu1JybFO7+kC7gIRt+zixeLzhkPM FGJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=dUmYo+i9Y52nCah86q3Rs8ybGgrYM0WWRYANG/BUZ1o=; b=D1vu6oeTkCAxcdDpUQI7FsG0gLGza087y0A3+mqc6ImWhbeDsou9ySE8FQgxp6e+Jv vLHGVb+ZihuRNCZ+VpzxRgnrrEFpRFNnzahHmNOOT4cCtBgdnhI2hZmd5KQnEaZvYUPh tyZg8By0MvBbb4/Fw2KQGXL9shbduFEuFjiKZxo8Ao1ZTZWbdk8XULouBeWsmlQNDmdn 2UWdjpoUe0+RT6G5DxXsYufMftSuXguypwTbwUh39wXi9pklyUKDh87IVO9jmjClCLFO 0W2YYLBZkoNYKGdCjcKpoOL8n99oSfTfVGuTQxtRzXhuM9G+ijFImEg3ZNFEpWaFMGGt CmSg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=iafXMRDz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y10si12516514edm.261.2021.02.02.01.41.50; Tue, 02 Feb 2021 01:42:15 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=iafXMRDz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233114AbhBBJjr (ORCPT + 99 others); Tue, 2 Feb 2021 04:39:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49020 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230064AbhBBJhY (ORCPT ); Tue, 2 Feb 2021 04:37:24 -0500 Received: from mail-pg1-x530.google.com (mail-pg1-x530.google.com [IPv6:2607:f8b0:4864:20::530]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 48701C061793; Tue, 2 Feb 2021 01:36:59 -0800 (PST) Received: by mail-pg1-x530.google.com with SMTP id t25so14549335pga.2; Tue, 02 Feb 2021 01:36:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=dUmYo+i9Y52nCah86q3Rs8ybGgrYM0WWRYANG/BUZ1o=; b=iafXMRDzualY8p0SjI/m/BtR7KFJ/DLJ3EeyhCuqXmHTQDrSia0hOyb3uJq4e8fSEO XiZYYq8foXyc1e7B4SUMGKnygcW0I8M4Z52JvudjoRBhrZ+3QRlm9tvb8Q4Mm4Pon6FM ewHctegqB8KZ0rpJuCI33EeaZD1Eu+Gs17MtBM1No0+7FXODMO9S7XBRM6f83jahKBf2 tQ6pegJJt3Znf3SClhEKiDwrV+dg4e8AbPvED1OKm0Z5CKLIpx1aBsixVVNkua61SNzA Rl026xTnyDiP1WRWuz1KgZJv9k34P6SliVPe8QIKJ5BDBziD8kzFrKSdxj0BHNukw5hl CiOw== 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:mime-version :content-transfer-encoding; bh=dUmYo+i9Y52nCah86q3Rs8ybGgrYM0WWRYANG/BUZ1o=; b=DlntnvTps5z0j/VpOL1IIME7m14ge3PmDL0PfTp6BFF1+eq3lR0QB4H9k3O9SZP8Bh Zf0AE3fL3LgUVXoAe64FTC0dP2w3iTF3CynXTsNdD4SmKHp2C5Z1jDcmvVWygpJNz81U y3UuG0S7ix81iusl4vSrmWbDhFR3HyjZ/7P9Eg30FqVqrHITRICfjJEGlt605etYItJS zptT/INkwjDw0hEEGaErwA/pFIo+7ZZnpNypdFT1wNH23c6UJRdhvfWhSlPq/2zsX5j4 SfOSCMZMaTMQQqlrE9hLIO869wvxSGlIzNijhzbZH9+vnW+TnfXSDHs4azS6czTZ/9zc laEA== X-Gm-Message-State: AOAM533BbJ6JL27OosWXJEIj9FNcaZl22lgo2EIURPRsYaS2s8sYC2eh AlXCs//kxHlsgxSxJp6QJ8stnoIysmY= X-Received: by 2002:a63:5309:: with SMTP id h9mr20887966pgb.19.1612258618605; Tue, 02 Feb 2021 01:36:58 -0800 (PST) Received: from bj10918pcu.spreadtrum.com ([117.18.48.82]) by smtp.gmail.com with ESMTPSA id e21sm20595596pgv.74.2021.02.02.01.36.56 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 02 Feb 2021 01:36:57 -0800 (PST) From: Xuewen Yan To: rjw@rjwysocki.net, viresh.kumar@linaro.org Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, xuewyan@foxmail.com, Xuewen.Yan@unisoc.com Subject: [PATCH] cpufreq: Judging new_policy before update related_cpus Date: Tue, 2 Feb 2021 17:36:19 +0800 Message-Id: <20210202093619.543-1-xuewen.yan94@gmail.com> X-Mailer: git-send-email 2.29.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Xuewen Yan When the policy->related_cpus are all offline, and then bring up one cpu, this time, if the ->online is NULL, the code would update the ->related_cpus with ->cpus, and now ->cpus is only one online cpu, as a result, the ->related_cpus is different from the origion ->related_cpus. Signed-off-by: Xuewen Yan --- drivers/cpufreq/cpufreq.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index d0a3525ce27f..3d512ac463a5 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -1374,8 +1374,10 @@ static int cpufreq_online(unsigned int cpu) if (ret) goto out_exit_policy; - /* related_cpus should at least include policy->cpus. */ - cpumask_copy(policy->related_cpus, policy->cpus); + if (new_policy) { + /* related_cpus should at least include policy->cpus. */ + cpumask_copy(policy->related_cpus, policy->cpus); + } } down_write(&policy->rwsem); -- 2.29.0