Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp800464pxb; Tue, 3 Nov 2020 12:54:42 -0800 (PST) X-Google-Smtp-Source: ABdhPJw/zeMsd36QhnejEkxzFiIbXN/rXwqxLqSdVvmjzQdXOhapmiJ8EtY+lqMo8A20KY+ll98+ X-Received: by 2002:a17:906:950c:: with SMTP id u12mr13335879ejx.397.1604436881807; Tue, 03 Nov 2020 12:54:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604436881; cv=none; d=google.com; s=arc-20160816; b=pfddkz8hyZaRKR16y6jWAFKhgIglyubTMbYRgI/5VN0P5rbVAu0KZfUgaD/2QiEq3l c1zWHre8ICJ7jPFpKCKgnPxpMtJyRJMpvKqzBA0RfOv49eculjU3awcZwVkR7J3h/Alx O307hU3FKM2FVBgwOBvA9FsLdW9vfX8trH//Rbp4qtzoYRzHqZRPHXm0o1hbGMZ4mSIh 9JsK5iVFuZ8wr32ZNXZKCHdgZgGR2RHoNb+FnotuI9gzNxEhjb5sp7uwxmOix36jUTqc aLrjQl10rrsOEJlMA/USsz4hPzdJVkFnsSelObODqF2n4vSIXfxH2qvgiOg9MOt+5hsU 98Tw== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=DqarhOK35y6kSzn9cZHp2vGxRH2/tK+VT542IUylrhw=; b=HsNkeKgj+hIxvYMsIcZcobScko0LnWBHJXeS6tssAgVIUin/1yy9KQqxY2tFLqKqFG yqGeIz9R+Q0n7XJodb60B0VUA2umuUX7xBPps0/0VVL/C3F6SkSURGi0Y/8TCIvgwOXq JBU89YtbyC8d0xO3opQawpiEVYXYcier1uiYSEWoOxlQ7QQIFnUZ/HSxnL23hL5SK/PL 1pCl75FfRnBP+zP5LG7Cyz/gItYaW8jHKOENmplefuTJNGWooGtuKblaNGcRh8fyF3E0 x4TGuZmDtPfig/FTBTc99AKpQN79S9htopVuaVHdp2Mf35HCZmqx8w7RVGcPlafkZs/g K+BQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=f7jOY5UD; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g9si15085120edn.361.2020.11.03.12.54.18; Tue, 03 Nov 2020 12:54:41 -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=@kernel.org header.s=default header.b=f7jOY5UD; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731845AbgKCUuk (ORCPT + 99 others); Tue, 3 Nov 2020 15:50:40 -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: linux-kernel@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];