From nobody Sat Apr 4 07:50:07 2026 Received: from mail-pf1-f171.google.com (mail-pf1-f171.google.com [209.85.210.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 19AB135BDAF for ; Fri, 20 Mar 2026 09:24:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773998657; cv=none; b=XnnNQG5b9BVhSRlXGvqUFyZtKW0F2CUPbQJc5U4bQEnVZgzCRb25X0jcGB2Z0QbZrCcpiYB18Q4lFWdiopP8eZCzPqyC9rLikhVqljtIEggySZid/+ju+BKCFSciTnap9bMNpMJ0G9OIH46hyza5sG6as2ivHS+VEhIaFgns6MU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773998657; c=relaxed/simple; bh=ZldhROcxgvItdW8DHii9xckSpgyKxsjPPISMBoir5E0=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=aVSu3FwvLiKNCNakvTN4d5cAoTnkBzD9cweQPLYj/qyVFRN3tTJQIoSKZyECpz6yltqrmSxG1nhobw3gsFSwaS/9ph9r0TrpcV/zm2TJeFnh8zc0KgH5uhxd/yxO60LTeXZ2qBDOwHfQnjZWvLRWu5Ly3jhmr24vK8JbuTFQ6ZE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=oVlZ9DC9; arc=none smtp.client-ip=209.85.210.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="oVlZ9DC9" Received: by mail-pf1-f171.google.com with SMTP id d2e1a72fcca58-829781b2b01so1158785b3a.2 for ; Fri, 20 Mar 2026 02:24:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1773998655; x=1774603455; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=fTH4enOyPD7ukLVidlBJbbw31EgYfFEascXcBByaReA=; b=oVlZ9DC9wZKRL7teTCw/2DEYgTWKig0JnFmX0rI9yAz/Re3AbrSSIAeuL7jCK/AkSp TDNMMmKaQQPrUMEdiMnW/vTXr06UJkWQ/1tRMH896LqmQDWibmmH/hp/ASm/S6AxhHmN fkUjd/TTodSGYWWF16au3oCftnkGQbTwVQHqqTKjcr/6u/5gM30kAP55HI506g+k40W1 hmHNR90kRW9xi5h/0kge9bR97VG7wBxcx/F5B9qzn4QKyjvYFauR15Kt4rJvxavsuRAi D3JYkCsj6zHc/qerbkeHb9sIOybQw60qsytazT9uw9YnD9afvEwPRZbbQza8MpgDWXGn zbJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1773998655; x=1774603455; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=fTH4enOyPD7ukLVidlBJbbw31EgYfFEascXcBByaReA=; b=aWHgiwrAtTDudUT4yjXeuDiTT0i6R75UcVW6B5cfKgq8G4HW3p4xfV2CJrGfEhvcWb pdTcPtlKDGL8dkYS2mMK3wkFWWC+/Ac3rO6U/7OXH5CKuDZXJ+cEE58RIFg24Sk/RoLX faiM6v5M1QFVCoeWhyn+EE1EmKZZCwRTm25V/QRhHEI4nefZH05uQ8TIwUwPGWH6ByAY U7Da87NB7ahihk1NhXMIjWuFVfglx9mVF1SRJ+oEZB2XCH1i78i0yaTxKyAn1n/exhWx lY0mJgkt6myAnP04Nu/pKvM6f6I0OPqivpZDDdpnbMDy9rL9NRWi0qWmtlBoYhKsVvxw NmPA== X-Forwarded-Encrypted: i=1; AJvYcCUK43h6xZtgp/xOH8A3MkRJgLrGS1Vfbc2Hyh7EHHy47W8ECYIAmGmtHkpWhYNkfqgUcG0G+ezm+eC134o=@vger.kernel.org X-Gm-Message-State: AOJu0YxvO9itYstdxvvTynAhyzHWGPPDYxl2ZKuvYdT0xTmB1FaAF6Q1 6ksVW8Ri8qbGdtqM1uepsd4kXVj+8PzWvaxfQc1lhvQlaBu5Qu2m1Iti9ckEpJdsUus= X-Gm-Gg: ATEYQzzXPXLKwhEKvYLoo50jXm7/Ga1jEwamJPxhU+5blWHx4TF7SJLLqQDC4yZClcr CtBzEtOaYfcer+6lvV3Yw60joQzkMLXRFlBO+7iio+SOIU3w+O4ZYSbLL+djTuJCkdqm4xIfIAg 2bSAJbDln1nxHS8YtpbpZYRbg4DxvSMmM4WCqjrcxnQpj78Pc7sJWKl9sLI61FSNl/DQ27jBo1P FU/Ok67oRO2Q17hzr+AWWZzUBH47o7LAH/wJ+8rpAzieZMBfPWztw2NiO9SnaxUpxu76hD5JlDy WIZ5QTWUCkZu1h2ZYzn8PajAq+i/olE0rRC88bmoOT1rI1p3tgjUcdLl3OgarALInR6gzldXd9K qH1lKBLOicyBSmKtME+sFRXf/iLathWdZJOPrnAdMlbYF7PjbtGFptoNjA7LdMdv+adpDYodpPO yLnmv+eYi+Ga+1IK55KMYOrAYb X-Received: by 2002:a05:6a00:1949:b0:829:7b15:848 with SMTP id d2e1a72fcca58-82a8c3948a1mr1923634b3a.48.1773998655055; Fri, 20 Mar 2026 02:24:15 -0700 (PDT) Received: from localhost ([122.172.81.200]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-82b040d7e56sm1505256b3a.40.2026.03.20.02.24.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Mar 2026 02:24:13 -0700 (PDT) From: Viresh Kumar To: "Rafael J. Wysocki" , Viresh Kumar , Zihuan Zhang Cc: linux-pm@vger.kernel.org, Vincent Guittot , Sumit Semwal , Pierre Gondois , Lifeng Zheng , "Rafael J. Wysocki" , linux-kernel@vger.kernel.org Subject: [PATCH] cpufreq: Don't skip cpufreq_frequency_table_cpuinfo() Date: Fri, 20 Mar 2026 14:54:06 +0530 Message-Id: <65ba5c45749267c82e8a87af3dc788b37a0b3f48.1773998611.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.31.1.272.g89b43f80a514 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The commit 6db0f533d320 ("cpufreq: preserve freq_table_sorted across suspend/hibernate") unintentionally made a change where cpufreq_frequency_table_cpuinfo() isn't getting called anymore for old policies getting re-initialized. This leads to potentially invalid values of policy->max and policy->cpuinfo_max_freq. Fix the issue by reverting the original commit and adding the condition for just the sorting function. Fixes: 6db0f533d320 ("cpufreq: preserve freq_table_sorted across suspend/hi= bernate") Signed-off-by: Viresh Kumar --- drivers/cpufreq/cpufreq.c | 9 +++------ drivers/cpufreq/freq_table.c | 4 ++++ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 277884d91913..1f794524a1d9 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -1427,12 +1427,9 @@ static int cpufreq_policy_online(struct cpufreq_poli= cy *policy, * If there is a problem with its frequency table, take it * offline and drop it. */ - if (policy->freq_table_sorted !=3D CPUFREQ_TABLE_SORTED_ASCENDING && - policy->freq_table_sorted !=3D CPUFREQ_TABLE_SORTED_DESCENDING) { - ret =3D cpufreq_table_validate_and_sort(policy); - if (ret) - goto out_offline_policy; - } + ret =3D cpufreq_table_validate_and_sort(policy); + if (ret) + goto out_offline_policy; =20 /* related_cpus should at least include policy->cpus. */ cpumask_copy(policy->related_cpus, policy->cpus); diff --git a/drivers/cpufreq/freq_table.c b/drivers/cpufreq/freq_table.c index 7f251daf03ce..5b364d8da4f9 100644 --- a/drivers/cpufreq/freq_table.c +++ b/drivers/cpufreq/freq_table.c @@ -360,6 +360,10 @@ int cpufreq_table_validate_and_sort(struct cpufreq_pol= icy *policy) if (policy_has_boost_freq(policy)) policy->boost_supported =3D true; =20 + if (policy->freq_table_sorted =3D=3D CPUFREQ_TABLE_SORTED_ASCENDING || + policy->freq_table_sorted =3D=3D CPUFREQ_TABLE_SORTED_DESCENDING) + return 0; + return set_freq_table_sorted(policy); } =20 --=20 2.31.1.272.g89b43f80a514