Received: by 2002:ab2:7903:0:b0:1fb:b500:807b with SMTP id a3csp1381283lqj; Mon, 3 Jun 2024 22:26:33 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWlI8rnyubZ/mdy3GtPgo0JTyeDMcIEUzDMd+D5k1ti18QCmALbvbDqf8fovWehneenoWDdlEzZOYBdzwu1piPEXllMoAtcapD94P4yog== X-Google-Smtp-Source: AGHT+IGBYJmUfdvTXsEobJFEJxmPrJNRlV31/n4TFAa4juFnDhm7NHKNDmOKneYZMaQ2yCj+ykdJ X-Received: by 2002:a54:4683:0:b0:3d1:d4df:66f3 with SMTP id 5614622812f47-3d1e34956bdmr9574227b6e.23.1717478793184; Mon, 03 Jun 2024 22:26:33 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717478793; cv=pass; d=google.com; s=arc-20160816; b=B3DwKQ5nm15ubUHVmAnTopB27Y9S8odqjwCaYfn//1fos2mebkqlpUq/wDi8LPWqFS 0VmHmNszJUhn4aLWw0K2tXv53/1ZORe5/wUcBadjuIEPTw6F3B4FUQuIxA9wNpMPvZBb ntgkF0i2Rxf9MVoHm+/pdTbCSpQq2R3d5xRw7YuCj41eSmjexGRAlSsA8AvA9PxBeAP/ LeK7Um2BAyH3g9d4geNw/N5Ts3yIzskYwatQAz+3v//s4+jxiFh8LW0thrFmtOZM9J+j Z0fKxgg+RdFC8GJngIotYud4wnpVvRyMUZNlcBSjIpjkc5Uf7X2dRS+T926yJQXFCwWP XU4w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id:dkim-signature; bh=V4KluvoWkwV2P4uaGIEl7A5QHSvGKNicvM2NHo8q6Wo=; fh=4f6o5JR6kIQnno1S9z7eD9toLWzVQEhUjxBoHQRdeEk=; b=JEXepnfS7ye4eVVH6UWp5rk8CqQx7MlgeX55EeNPgKBlOds3S18Ke5pwbh3Fldzat7 AdORhfXpWeknzm4aKWGtwmqY/zL7UNVsOq4NMQBgLO4+sDJuJsXJD1785cGX8zIwtPjb Ny9V84SqmyUq0ur3qlKWwDLAz73I2pk3l9cjuIDAOVGQ70inio8Mkhx7ifKgZvQLSKQb /KbvEs9+MWmBYFzxGlsbagzuGj9v9X4fm5npKmAUvureRiowj1p6Ff+I9liAlpm9bCiY nMOAvDWjN/pIdpkKCahB4rMq1tKMKsh0vdvF2p1IJ4LlTcMF+NcQoP2Wgs1Iv9Z3gpGW pOMg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=mDaeMHzc; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-200002-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-200002-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id 41be03b00d2f7-6c35b40c02esi7283599a12.537.2024.06.03.22.26.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Jun 2024 22:26:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-200002-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=mDaeMHzc; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-200002-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-200002-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 5D7D328A435 for ; Tue, 4 Jun 2024 04:11:08 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 831A813D882; Tue, 4 Jun 2024 04:11:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="mDaeMHzc" Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AC88638B; Tue, 4 Jun 2024 04:11:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717474262; cv=none; b=M7ltltlPhSEVXHgiqr91ieod25rgPEaV83r74VLDyVf4yHvw5n5iaO/sZfXNaE2HnE7v83eCbN5GIXlDzr0HeKegbIzWzxULRDr39Z/MrMt+GNly/RIyQoi/WetwDZxzOmBWC3z8I7ebBdWyJsrZnD0XdcaucKN85rqLpBrjLg8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717474262; c=relaxed/simple; bh=V4KluvoWkwV2P4uaGIEl7A5QHSvGKNicvM2NHo8q6Wo=; h=Message-ID:Subject:From:To:Cc:Date:In-Reply-To:References: Content-Type:MIME-Version; b=VE69VzVFDc51VBN4uU88J3A8AFRHsqzT53fr3AsHttjIBeuiO5V5FtvUElG4JUXNk8LYsm3hMd+GJ/psvwjysEKGXYFWlxYo/0nXozcxcMp/W3fq8WA7kQ+jliP7EoOxnJDkowPeDBKYMPuZkCcQ+XO8Qglf5VftXwDTioKFEh4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=mDaeMHzc; arc=none smtp.client-ip=192.198.163.18 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1717474260; x=1749010260; h=message-id:subject:from:to:cc:date:in-reply-to: references:mime-version; bh=V4KluvoWkwV2P4uaGIEl7A5QHSvGKNicvM2NHo8q6Wo=; b=mDaeMHzcRSKiyV3ZMCq4Znp/oZBr41AaQXwERojr7wFL9VAlFTtDlpvw oFNU+/IEJJDmgH4lvZMrj0xlVJ5Xnm7/jmNPxYE7LR06BgSDtFHhotUUZ OynGYg4Yg+TKiFgnqMMxYg6woMJow0ppqk7dIRwS3fkm+lrn69acFmCiU iJzQalCj3iVIjJsTJAPCD39B7yalN/3AzLN6vr6lAG1TipUIkI/XbA80U wTO7CsOC6JJKzUXFuqJb5VIYSRtP3dX9rAipg4XoFzYgl543Kq/lHyvtf yrWf5TBnQhwyLonFCArJWWIYtQBEMLLiWQNuI9iDaUzSgRAG5ppOH1VuB A==; X-CSE-ConnectionGUID: JyLduJcbTIyhydBGr+e52g== X-CSE-MsgGUID: GfdPJbhKQ52i5GXI8hu0Wg== X-IronPort-AV: E=McAfee;i="6600,9927,11092"; a="13745901" X-IronPort-AV: E=Sophos;i="6.08,213,1712646000"; d="diff'?scan'208";a="13745901" Received: from orviesa004.jf.intel.com ([10.64.159.144]) by fmvoesa112.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Jun 2024 21:10:59 -0700 X-CSE-ConnectionGUID: gvVzj0xYSHaordRM41UEIw== X-CSE-MsgGUID: 3ND538SvSgGxEQ7O0M+T1g== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,213,1712646000"; d="diff'?scan'208";a="42178678" Received: from lduvvuri-mobl4.gar.corp.intel.com ([10.213.76.60]) by orviesa004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Jun 2024 21:10:52 -0700 Message-ID: <96e2cf88d11233c8e6fdc5378fc18956584e5692.camel@linux.intel.com> Subject: Re: [PATCH v1 2/6] cpufreq: intel_pstate: Do not update global.turbo_disabled after initialization From: srinivas pandruvada To: "Rafael J. Wysocki" , Xi Ruoyao Cc: "Rafael J. Wysocki" , Linux PM , LKML Date: Mon, 03 Jun 2024 21:10:36 -0700 In-Reply-To: References: <13494237.uLZWGnKmhe@kreacher> <8366982.T7Z3S40VBb@kreacher> <6d5ee74605bd9574baa5ed111cb54e959414437a.camel@linux.intel.com> <6ebadacd8aaa307a5766cdb1b4d4a5c69acd87ac.camel@xry111.site> <30a30c5107a47a2cc3fd39306728f70dd649d7fe.camel@linux.intel.com> <29d69252dcdc398f147c9139a8666d09e7bd831d.camel@linux.intel.com> <0324bc3a88654855719cd48a5ed69a34eea31037.camel@xry111.site> <48eba83030e155f703b4248e9c1ae65aa44b1a83.camel@xry111.site> Content-Type: multipart/mixed; boundary="=-RZpSQ4b5F/nRSN0sX4ln" User-Agent: Evolution 3.50.0-1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 --=-RZpSQ4b5F/nRSN0sX4ln Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Mon, 2024-06-03 at 11:47 -0700, srinivas pandruvada wrote: > On Mon, 2024-06-03 at 20:32 +0200, Rafael J. Wysocki wrote: > > On Mon, Jun 3, 2024 at 7:44=E2=80=AFPM Xi Ruoyao > > wrote: > > >=20 > > > On Mon, 2024-06-03 at 10:11 -0700, srinivas pandruvada wrote: > > > > On Mon, 2024-06-03 at 21:12 +0800, Xi Ruoyao wrote: > > > > > On Sun, 2024-06-02 at 16:11 -0700, srinivas pandruvada wrote: > > > > >=20 > > > > > /* snip */ > > > > >=20 > > > > > > What is the output of: > > > > > > grep . /sys/devices/system/cpu/intel_pstate/* > > > > > >=20 > > > > > > Also > > > > > > rdmsr 0x771 > > > > > > rdmsr 0x774 > > > > > >=20 > > > > > >=20 > > > > > > Try these three patches. Don't worry about the commit > > > > > > description > > > > > > for > > > > > > this issue. > > > > >=20 > > > > > Unfortunately they still do not fix the issue for me. > > > > >=20 > > > > > The outputs of grep and rdmsr commands are initially: > > > > >=20 > > > > > /sys/devices/system/cpu/intel_pstate/hwp_dynamic_boost:0 > > > > > /sys/devices/system/cpu/intel_pstate/max_perf_pct:100 > > > > > /sys/devices/system/cpu/intel_pstate/min_perf_pct:9 > > > > > /sys/devices/system/cpu/intel_pstate/no_turbo:1 > > > > > /sys/devices/system/cpu/intel_pstate/num_pstates:41 > > > > > /sys/devices/system/cpu/intel_pstate/status:active > > > > > /sys/devices/system/cpu/intel_pstate/turbo_pct:33 > > > > > rdmsr 0x771: 10d1f2c > > > > > rdmsr 0x774: 1f04 > > > > >=20 > > > > > But it then changes to: > > > > >=20 > > > > > /sys/devices/system/cpu/intel_pstate/hwp_dynamic_boost:0 > > > > > /sys/devices/system/cpu/intel_pstate/max_perf_pct:100 > > > > > /sys/devices/system/cpu/intel_pstate/min_perf_pct:9 > > > > > /sys/devices/system/cpu/intel_pstate/no_turbo:1 > > > > > /sys/devices/system/cpu/intel_pstate/num_pstates:41 > > > > > /sys/devices/system/cpu/intel_pstate/status:active > > > > > /sys/devices/system/cpu/intel_pstate/turbo_pct:33 > > > > > rdmsr 0x771: 10c1f2c > > > > > rdmsr 0x774: 1f04 > > > > >=20 > > > > > It seems only the output of rdmsr 0x771 has changed.=C2=A0 And if > > > > > I > > > > > read > > > > > the > > > > > SDM correctly it's a "Most_Efficient_Performance" change. > > > > That is fine. > > > >=20 > > > > We don't have any notifications either via ACPI or via HWP > > > > interrupt. > > > > I think it was working by chance before this change as by the > > > > cpufreq > > > > core is trying to set policy, the turbo is enabled by the > > > > firmware. > > > >=20 > > > > What is this laptop make and model? > > >=20 > > > It's a Hasee X5-2021S5H. > > >=20 > > > Hasee is known for producing some laptops very cheap but often > > > having > > > "minor" issues.=C2=A0 So I guess the firmware is doing some stupid > > > thing. > > >=20 > > > But turbo works just fine on Windows 11 so it'd be better if we > > > could > > > make it work for Linux too. > >=20 > > In principle, there are two things that can be done about this. > >=20 > > First, MSR_IA32_MISC_ENABLE_TURBO_DISABLE on this system can be > > ignored altogether, but that would require adding a quirk. > >=20 > > Second, a delayed work can be added to check the MSR long enough > > after > > initialization and update global.turbo_disabled if it is 1.=C2=A0 > > However, > > that would require some code surgery. >=20 Try the attached diff for this case. Thanks, Srinivas > I was about to send this suggestion. >=20 > For the first one we can always program the HWP_REQ.max to > HWP_CAP.max > and=C2=A0 let hardware do the clipping. But this is not friendly to > passive > mode. But display of scalig_max_freq still should reflect the > reality. >=20 >=20 > Thanks, > Srinivas >=20 > >=20 >=20 >=20 --=-RZpSQ4b5F/nRSN0sX4ln Content-Disposition: attachment; filename="delayed_turbo_check.diff" Content-Type: text/x-patch; name="delayed_turbo_check.diff"; charset="UTF-8" Content-Transfer-Encoding: base64 ZGlmZiAtLWdpdCBhL2RyaXZlcnMvY3B1ZnJlcS9pbnRlbF9wc3RhdGUuYyBiL2RyaXZlcnMvY3B1 ZnJlcS9pbnRlbF9wc3RhdGUuYwppbmRleCA2NWQzZjc5MTA0YmQuLjQwYThmOWQ4NmI1OSAxMDA2 NDQKLS0tIGEvZHJpdmVycy9jcHVmcmVxL2ludGVsX3BzdGF0ZS5jCisrKyBiL2RyaXZlcnMvY3B1 ZnJlcS9pbnRlbF9wc3RhdGUuYwpAQCAtMzEwMiw2ICszMTAyLDIwIEBA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