From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B1F6BC2D0A3 for ; Tue, 3 Nov 2020 20:50:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6565522409 for ; Tue, 3 Nov 2020 20:50:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604436637; bh=5st3HmEUuVyb2esr98GZDzB8tLM/xbdUSP4xACTT7cI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=HjcfMAtwh41MchSBsVC69zkkz34uGoyHTsY1/hzWTVw4etQd43j0lBvMY14urLbVU pY5Yw/+SNF9lPS20P1t9kHxUQFzCkWVcC0IqCqUondWoXWimGdPWce9yrA5SAHWiM8 pBbd1eL2vC+ns4lqZp2k3HMR5yuhpz1DXsPg9M6I= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731813AbgKCUug (ORCPT ); Tue, 3 Nov 2020 15:50:36 -0500 Received: from mail.kernel.org ([198.145.29.99]:44756 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731828AbgKCUuf (ORCPT ); Tue, 3 Nov 2020 15:50:35 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (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 B7AF920719; Tue, 3 Nov 2020 20:50:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604436635; bh=5st3HmEUuVyb2esr98GZDzB8tLM/xbdUSP4xACTT7cI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=f7jOY5UDcE8/t7KGLXq5tPwiYdXfYcoZRhKsRQGzrEW0GMVuSz7krLLqjzfdfIZtz rlplt3rZj3fxUaHv0hKJxxwEoPC3CSBBhH9dHPwnpMpJpuV5f88tLvJaoOA86pt+LB UcLt4DaLjtrU88vWertTs7QQjGu9bWoW3uPx2w/c= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pengfei Xu , Chen Yu , "Rafael J. Wysocki" Subject: [PATCH 5.9 335/391] intel_idle: Fix max_cstate for processor models without C-state tables Date: Tue, 3 Nov 2020 21:36:26 +0100 Message-Id: <20201103203409.731879412@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201103203348.153465465@linuxfoundation.org> References: <20201103203348.153465465@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Chen Yu commit 4e0ba5577dba686f96c1c10ef4166380667fdec7 upstream. Currently intel_idle driver gets the c-state information from ACPI _CST if the processor model is not recognized by it. However the c-state in _CST starts with index 1 which is different from the index in intel_idle driver's internal c-state table. While intel_idle_max_cstate_reached() was previously introduced to deal with intel_idle driver's internal c-state table, re-using this function directly on _CST is incorrect. Fix this by subtracting 1 from the index when checking max_cstate in the _CST case. For example, append intel_idle.max_cstate=1 in boot command line, Before the patch: grep . /sys/devices/system/cpu/cpu0/cpuidle/state*/name POLL After the patch: grep . /sys/devices/system/cpu/cpu0/cpuidle/state*/name /sys/devices/system/cpu/cpu0/cpuidle/state0/name:POLL /sys/devices/system/cpu/cpu0/cpuidle/state1/name:C1_ACPI Fixes: 18734958e9bf ("intel_idle: Use ACPI _CST for processor models without C-state tables") Reported-by: Pengfei Xu Cc: 5.6+ # 5.6+ Signed-off-by: Chen Yu [ rjw: Changelog edits ] Signed-off-by: Rafael J. Wysocki Signed-off-by: Greg Kroah-Hartman --- drivers/idle/intel_idle.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/idle/intel_idle.c +++ b/drivers/idle/intel_idle.c @@ -1235,7 +1235,7 @@ static void __init intel_idle_init_cstat struct acpi_processor_cx *cx; struct cpuidle_state *state; - if (intel_idle_max_cstate_reached(cstate)) + if (intel_idle_max_cstate_reached(cstate - 1)) break; cx = &acpi_state_table.states[cstate];