Received: by 2002:ab2:7903:0:b0:1fb:b500:807b with SMTP id a3csp1365571lqj; Mon, 3 Jun 2024 21:31:35 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX7rOSQxytMcCKNQfNDyggxUVEydN4yAksuZYtmXLczw3zM54dP0hQBzvPaSEKTpwIOWcG0l3PKMkITLxxV5omOYJw12W71f3saB22tvA== X-Google-Smtp-Source: AGHT+IFes8wdI2JhkwANw8P7qZf485jnja/Q7WMAgjryvgwGqu2sX6St4s48pqJSq3xWGKkskLnu X-Received: by 2002:a05:622a:18a7:b0:43a:c494:a048 with SMTP id d75a77b69052e-43ff527f9d9mr128069141cf.30.1717475495093; Mon, 03 Jun 2024 21:31:35 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717475495; cv=pass; d=google.com; s=arc-20160816; b=tu7RPcsBhEqnXGuT7AjUj08K4fA4PvqkNLYlcYomGSK1Zu/3SGcgeZb46/hf9wDA7p S5qjZd/yRXei5jYEuf4UCvkcXv9QcEdpPVD1+IFir/L4dFtJjgLZWXvLGNGYhEnFm3oB PxBmzOkxSIpePFz4etSfXA/h9u6X0TJVCJUKtTgoUuE4EZ5tLZ2ScQA0GiQWcWzkVzwW RuZzzCq5JkDPesSekwlenjvKGrb6BRTL107nuhR9OM1/vBjJuRhvRfs7qVjbXxCkVhjj +91tkcw7Fv6CJ/R/GI7TIVQvP1d/e8isGsEib/QtjScwAtHes0FgXZy9+vv/JNVvRU6y RKUw== 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=ZOIhYMK45qMAdlxWSgbaH5uMu9B2w0q6QufDWFxPaYo=; fh=4f6o5JR6kIQnno1S9z7eD9toLWzVQEhUjxBoHQRdeEk=; b=I4wXzoHeDN7s2UQ3aG5nwxyDuwuwPlk1s0l88EarB0AJiKa219sc5yCIMiGNbSC343 JfNErKyKUrKT11Of8J5R4eW0N/ebnxc+yR64qZjQu7mkMguVVBW6kMwSXsHmZUROJZsg pxc7Mp3O3GxUXIFih9bcPf0/nwwCe/ef0smDvCrwQlga1ThSWahYhPQY0OxNYxEwG6b8 nEXxCXQbQv3tBrOEmxDseiBwwk4Ro118k3gcFPwClQtePvt9soUm+0za4pkM1JDtJDG5 YQAfWabA3tj3xMquSTikcoDKeIF80Yvh7nhNzqE3CA/BM0R161bAl1rBy1peCh6Vxri8 RKOA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=mdMAT8XX; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-200017-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-200017-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id d75a77b69052e-43ff25b95e8si1558871cf.766.2024.06.03.21.31.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Jun 2024 21:31:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-200017-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=mdMAT8XX; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-200017-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-200017-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id C20181C21F8C for ; Tue, 4 Jun 2024 04:31:34 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6E8C213D897; Tue, 4 Jun 2024 04:31:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="mdMAT8XX" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.14]) (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 2F3104C6E; Tue, 4 Jun 2024 04:31:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.14 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717475486; cv=none; b=UUoaf7jJqCEiK51aSfcJ/vEOqFoT2ify4z6Iiq8HqGYSRcJoDZMm0oLI7w9RtJCVGJS/NAnAd/zLEXcd9OywTXeIcE56JXX8ejpWFeVdXDyRp+WGs4qbjK/oOMzTYel212DtVYLYXoJVj8bLaroO+joBssN/eBHUYDM8c0ywEOI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717475486; c=relaxed/simple; bh=ZOIhYMK45qMAdlxWSgbaH5uMu9B2w0q6QufDWFxPaYo=; h=Message-ID:Subject:From:To:Cc:Date:In-Reply-To:References: Content-Type:MIME-Version; b=BLVVHCIGlV8dWgQbNMUa88Hr1F98NqOgVpeaKQIxBnygHf4a7sSrH78QuAXTI2AlYhRYiSktfeCt52v5ObwnwjALFn7YffsnaFHitlBBWGqW54Pm1EZJwe9D75W14EI445odXbCnwPTDHjXzZnkX8g4EoVR7lpnjv5pqXH0QVnM= 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=mdMAT8XX; arc=none smtp.client-ip=198.175.65.14 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=1717475485; x=1749011485; h=message-id:subject:from:to:cc:date:in-reply-to: references:mime-version; bh=ZOIhYMK45qMAdlxWSgbaH5uMu9B2w0q6QufDWFxPaYo=; b=mdMAT8XXdixP6su3nn77gqzdO2TB0h6dTEvIN8eGFXs/RNbDOPTDnH2y SPWRegI2I3QwfNzSy3Oi6pY22d4RKQoHDb+urowp0ZkQPQgml0OLNiRnp 1MEpmO6tyXCZYxwdax6MOVtsVfJWUk7jxIjyTZuxkCUNCo76WwqXDedcx MKsZYopgXysdEiHwJc/XEo+qLhOah3keVuyP/IGCkYtzU6WsIBNHeEpKD 84XUshDXvvCIm+dVrfbslg6Ls9809ief9krHqjk8sutwqLzl2eWLSprBP l2NiMQPQIrrBbefgwI3oYPvSpxbwkzPMhTaGDq+7WyHDwAFQTM/q6WWrU A==; X-CSE-ConnectionGUID: kNg2+DwCQWWLGEePQS/lVw== X-CSE-MsgGUID: xzTL6kKfSCSNXRYEh0N9+w== X-IronPort-AV: E=McAfee;i="6600,9927,11092"; a="17823698" X-IronPort-AV: E=Sophos;i="6.08,213,1712646000"; d="diff'?scan'208";a="17823698" Received: from orviesa005.jf.intel.com ([10.64.159.145]) by orvoesa106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Jun 2024 21:31:24 -0700 X-CSE-ConnectionGUID: jHw8XOoWT56vplntm1N45Q== X-CSE-MsgGUID: AKzgQc4XQHm+3U/nPmkM1w== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,213,1712646000"; d="diff'?scan'208";a="42039354" Received: from lduvvuri-mobl4.gar.corp.intel.com ([10.213.76.60]) by orviesa005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Jun 2024 21:31:15 -0700 Message-ID: <1da736da33a61de92314934ecf7fa0420d6d6b81.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:31:05 -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="=-1DKVhCk43lRzjNd4C31L" 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 --=-1DKVhCk43lRzjNd4C31L 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 Something like the attached which does same way as user space no_turbo update. 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 --=-1DKVhCk43lRzjNd4C31L 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 ZnJlcS9pbnRlbF9wc3RhdGUuYwppbmRleCA2NWQzZjc5MTA0YmQuLjhkNjFmZjI2MWM2MSAxMDA2 NDQKLS0tIGEvZHJpdmVycy9jcHVmcmVxL2ludGVsX3BzdGF0ZS5jCisrKyBiL2RyaXZlcnMvY3B1 ZnJlcS9pbnRlbF9wc3RhdGUuYwpAQCAtMT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