Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp2849379lqp; Mon, 25 Mar 2024 10:57:55 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXbC24/lGFo4y04we0/m8i6hQKVBtYhgroaytRDvnJBu3e7WFclDjK1rpO+ihMHrLY8c+OOOYT2WRexFtPXiJhHQrsrIfrks++VuQuWqg== X-Google-Smtp-Source: AGHT+IH+NxkeLZd18LVZ3tYzA+TGgQnKlFY2FCflCft6qrgvqqkSPxIowW8tJ/dHxxeAj09vl35W X-Received: by 2002:a05:6512:1d0:b0:515:940f:b7af with SMTP id f16-20020a05651201d000b00515940fb7afmr5367390lfp.52.1711389475626; Mon, 25 Mar 2024 10:57:55 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711389475; cv=pass; d=google.com; s=arc-20160816; b=k6/Wt4RBoAJns9VwXWnRkyPtDZgq7Qzh7qnFletNmFrwsGipKRr0bmU3AUq5IhxrsC 4jc1iSvr+E7ZVPr/tPsH1r3mmxUf8X7gHafN5MAMW2gbPtsPJVYh+iZY2CkEzEtH8dWx DcF2qI2IfeMtDqPz/i2IklisviS3JcGMeYJTBTHRgNuedtEibHsOETylAure1oTKzaEV 4KUe/PAWSTZDgR4fVSrAl7BpOyM9Neue4qYqTFfUYBauhWrG+v7dye6HB8yA7Agg0YqU aTvDQWUHvtUyO15CliQ6Fp7+gRrbwYE8eVUVrssbclPtTJtwLbAQCqzjUpj4w9yF2ExC KX0A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=GSajnlwWrqE+p7NlosQIl9nO0bwgqStfgwiwvKUF4Po=; fh=ioMWnWtowhk3HBvhCOjNmK8xJXWkeaWr8of6U42MhKE=; b=DZhxXBg9dpN7lP5m0maLn4EI3987tIaeVJucKTtJjlzMttNxv5M1/kiUIQb+9zQ60x Hre7Qcyru9F+8Z+LBkRXFTsan4kDdjhTQ1lzAlwaKTdJkBREmjfpLUFQq2/B0489bkTh Pd5Ys2WdmfivQvs9vR2MmQFI8xLa6ZnF1xc+ZbYqnINvSPZqjAALsbvGOi/hKIzwqZ+o zsN0IwIE6TtNBXU3TSRHciPXWSxl7X5wG8+nfLPUoiFmxriv3J/0yH2xQ9crYrwpXACk u2cLYHse7WOOWFV4wTKJOtZoFyczdHLo+p0IoVPg4nUPsm7zQJz1xoOpuFzW254bUUEf 0AEg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@rjwysocki.net header.s=dkim header.b="ll/4bPUp"; arc=pass (i=1 spf=pass spfdomain=rjwysocki.net dkim=pass dkdomain=rjwysocki.net); spf=pass (google.com: domain of linux-kernel+bounces-117543-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-117543-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id j23-20020a170906255700b00a4669ed3b1fsi2633667ejb.1039.2024.03.25.10.57.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Mar 2024 10:57:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-117543-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@rjwysocki.net header.s=dkim header.b="ll/4bPUp"; arc=pass (i=1 spf=pass spfdomain=rjwysocki.net dkim=pass dkdomain=rjwysocki.net); spf=pass (google.com: domain of linux-kernel+bounces-117543-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-117543-linux.lists.archive=gmail.com@vger.kernel.org" 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 am.mirrors.kernel.org (Postfix) with ESMTPS id 210331FA20BF for ; Mon, 25 Mar 2024 17:51:39 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4BD7C12CDBA; Mon, 25 Mar 2024 17:06:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=rjwysocki.net header.i=@rjwysocki.net header.b="ll/4bPUp" Received: from cloudserver094114.home.pl (cloudserver094114.home.pl [79.96.170.134]) (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 5804B839E6; Mon, 25 Mar 2024 17:06:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=79.96.170.134 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711386394; cv=none; b=PMqr5uQt7Sl0g8MBIVTuBaRjK4MSGPAhRVnT135whyvd5B+8Jq84TLBlU9Y5r8RdxwCTorSaKoQaoOeb5GD/pBeqO0KEuXY25bB3iI7Enaf81v64QN8vXMgW5Mh8tE2srvJhoDh+pUmxkD6DXDVWcSURvpmxkpbpB6ugkhAKvpw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711386394; c=relaxed/simple; bh=GSajnlwWrqE+p7NlosQIl9nO0bwgqStfgwiwvKUF4Po=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type; b=LlMjPsUpqIXhqfXiktAtacYhTfEDiQrKudC+ZjfJ1IiqW8D8RUdW+SJUWdiqbRwn1VXgeOnTva0rwFKo6japGCqPE/G0NX3x3Wlb3PxGjFZvME3whFdyq1ZBVbMZX1wuEyyx9CdGUo6U21ymRyHE+j5FcC5rurgv8UdV+4W/elQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=rjwysocki.net; spf=pass smtp.mailfrom=rjwysocki.net; dkim=pass (2048-bit key) header.d=rjwysocki.net header.i=@rjwysocki.net header.b=ll/4bPUp; arc=none smtp.client-ip=79.96.170.134 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=rjwysocki.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=rjwysocki.net Received: from localhost (127.0.0.1) (HELO v370.home.net.pl) by /usr/run/smtp (/usr/run/postfix/private/idea_relay_lmtp) via UNIX with SMTP (IdeaSmtpServer 5.4.0) id 47c27d20224fbfad; Mon, 25 Mar 2024 18:06:30 +0100 Received: from kreacher.localnet (unknown [195.136.19.94]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by cloudserver094114.home.pl (Postfix) with ESMTPSA id CBC0266BCFE; Mon, 25 Mar 2024 18:06:29 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=rjwysocki.net; s=dkim; t=1711386390; bh=GSajnlwWrqE+p7NlosQIl9nO0bwgqStfgwiwvKUF4Po=; h=From:To:Cc:Subject:Date; b=ll/4bPUprboo9BWu6U3lYYSuvA2WNlvCupNif2Kxtne/ziT6D+78kXluhF1wIxMHe PYzhMdZTGKdnC+6qqTGqLeQe046uKdZKKZNo7MOXcyxBIAoMU2DGx4LumBDNpbP5Zc yUhNQ0r34P90UU/u6Cj5ldDJ9XGObC4TMLv8CRNFUoDs3VZTOmilWzdLn3za4dPLNN ylcG/RNQ9Btji0+w1wcgpQoTaKGbNw+ehCPY7AorfcnLFd+20eMoIHMrUdXiI6JuxR 6PQMk5ZF65WT7AncT+HZDOaW4DG2LtUhy/WikHJ9GCZeTxN4oJhTY6atLkYPKrTt6B ODpP/nLjZEtEw== From: "Rafael J. Wysocki" To: Linux PM Cc: LKML , Srinivas Pandruvada Subject: [PATCH v1 0/6] intel_pstate: Turbo disabled handling rework Date: Mon, 25 Mar 2024 18:00:45 +0100 Message-ID: <13494237.uLZWGnKmhe@kreacher> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="UTF-8" X-CLIENT-IP: 195.136.19.94 X-CLIENT-HOSTNAME: 195.136.19.94 X-VADE-SPAMSTATE: clean X-VADE-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvledrudduuddgfeehucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecujffqoffgrffnpdggtffipffknecuuegrihhlohhuthemucduhedtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvfevufffkfgggfgtsehtufertddttdejnecuhfhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqnecuggftrfgrthhtvghrnhepgeffhfdujeelhfdtgeffkeetudfhtefhhfeiteethfekvefgvdfgfeeikeeigfehnecuffhomhgrihhnpehkvghrnhgvlhdrohhrghenucfkphepudelhedrudefiedrudelrdelgeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpeduleehrddufeeirdduledrleegpdhhvghlohepkhhrvggrtghhvghrrdhlohgtrghlnhgvthdpmhgrihhlfhhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqpdhnsggprhgtphhtthhopeefpdhrtghpthhtoheplhhinhhugidqphhmsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtohepshhrihhnihhvrghsrdhprghnughruhhvrggurgeslhhinhhugidrihhnthgvlhdrtghomh X-DCC--Metrics: v370.home.net.pl 1024; Body=3 Fuz1=3 Fuz2=3 Hi Everyone, This series reworks the handling of disabling turbo in intel_pstate on top of the previous series of cleanups https://lore.kernel.org/linux-pm/12409658.O9o76ZdvQC@kreacher/ The underlying problem is that disabling turbo is handled quite consistently in intel_pstate and basically it can get disabled at any time (through MSR_IA32_MISC_ENABLE_TURBO_DISABLE) without much coordination with the cpufreq core or anything else. Disabling turbo through the "no_turbo" sysfs attribute is more consistent, but it has issues too (for example, if turbo is disabled via "no_turbo", the frequency-invariance code gets notified on the turbo status change, but the actual maximum frequency of the CPU is only updated if the MSR_IA32_MISC_ENABLE_TURBO_DISABLE value changes either, which need not happen at the same time or even at all). The first patch is not really related to the rest of the series, it's just a cleanup and can be applied separately. Patch [2/6] uses the observation that it should be necessary to read MSR_IA32_MISC_ENABLE_TURBO_DISABLE after driver initialization to remove in-flight reads on that MSR and turbo state updates related to them. Patch [3/6] builds on top of the previous one to adjust the "no_turbo" attribute "store" and "show" callbacks. Patch [4/6] adds READ_ONCE() annotations to global.no_turbo accesses and makes some related simplifications. Patch [5/6] replaces the cached MSR_IA32_MISC_ENABLE_TURBO_DISABLE value in some checks with global.no_turbo for consistency. Patch [6/6] makes all of the code paths where the maximum CPU frequency can change to do that consistently by using the same set of functions. Details are described in the individual patch changelogs. Thanks!