Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4520532pxj; Wed, 12 May 2021 07:23:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwK2dznKnxRei4Km+ENTkMQzr5cjX/v2v6t4MzkIBn6h3TEIavNW03yKsc6pxAqVhe6L+Zq X-Received: by 2002:a05:6512:234c:: with SMTP id p12mr25308745lfu.6.1620829424425; Wed, 12 May 2021 07:23:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620829424; cv=none; d=google.com; s=arc-20160816; b=Xa8cqanDy8MmRgKycJUD4XoulyVFNs32qtDL55NqVHM8NkCe+LH17jmVbhbrRJlpk/ SEURMglHdtSRhPrcH75s+rlH8bCUj1Y3clHfLkpvLvlJIzMYRirmo0CFFdpv88SF0+ZM lN4PXSqfEut6JVNvR6Io9A28+kRVJ8n0z5IbNtOhulMEPhDwhQdLJFcv+t3y8wPF9d4p OHRbYAglOpJwK6pd+HGMpRpAyeO7pf8WdwK5zeTYti3ZTfttBdav4h9xG8w6nDEIOlrL VElskfN9+yaPUbUJIV4NpjTet6qi4O3ceN250gl9roFGTa+MLa/aQIAowZe3Prn22bsB chrQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=zPNO5/52EKPqxmXYhoyCtrM97see/nz3eZsZ5n3aq/E=; b=nwiIKQrYcB5zHgME9snO7I/AwfeauKhu7O4aSZqLhZmoT4A7OErpnThRUmvuY3BA8/ q+SdF84IndXi0poKvLN6ybmqfvlz1E9SCp8r0ScWlgwFNbtGOBCnq7S/tuT7LWNsBaUM OfRgjIbAtOv+aAjNBt0M12p4tFlm3p+iJ0vcMIN+F5U7RWulsAchPFCjEMGcOHedmWSq GhVoBAl891fsVepmJp2LpM1T74PpqC4Eu0+9jEPpHhHggvTIjFKxHkEZTtHIPNVl5++0 St25sLcuE9Of0ha6W2sI43gbsljVT3/3AFVHI8df6lh5C3DTXOP8dzAuSIWK3M1l0Sf6 CZQQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o4si26991697ljp.416.2021.05.12.07.23.13; Wed, 12 May 2021 07:23:44 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230395AbhELOXJ (ORCPT + 99 others); Wed, 12 May 2021 10:23:09 -0400 Received: from cloudserver094114.home.pl ([79.96.170.134]:56024 "EHLO cloudserver094114.home.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230483AbhELOXB (ORCPT ); Wed, 12 May 2021 10:23:01 -0400 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 2.0.5) id 1e1cd55b6afb28a8; Wed, 12 May 2021 16:21:49 +0200 Received: from kreacher.localnet (89-64-81-242.dynamic.chello.pl [89.64.81.242]) (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 v370.home.net.pl (Postfix) with ESMTPSA id 2CCC46695E9; Wed, 12 May 2021 16:21:49 +0200 (CEST) From: "Rafael J. Wysocki" To: Linux PM Cc: Linux ACPI , LKML , Len Brown , Chen Yu , Srinivas Pandruvada , Zhang Rui Subject: [PATCH 1/2] cpufreq: intel_pstate: hybrid: Avoid exposing two global attributes Date: Wed, 12 May 2021 16:15:48 +0200 Message-ID: <1798832.tdWV9SEqCh@kreacher> In-Reply-To: <2212930.ElGaqSPkdT@kreacher> References: <2212930.ElGaqSPkdT@kreacher> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="UTF-8" X-CLIENT-IP: 89.64.81.242 X-CLIENT-HOSTNAME: 89-64-81-242.dynamic.chello.pl X-VADE-SPAMSTATE: clean X-VADE-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgeduledrvdehvddgjedvucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecujffqoffgrffnpdggtffipffknecuuegrihhlohhuthemucduhedtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvffufffkjghfggfgtgesthfuredttddtjeenucfhrhhomhepfdftrghfrggvlhculfdrucghhihsohgtkhhifdcuoehrjhifsehrjhifhihsohgtkhhirdhnvghtqeenucggtffrrghtthgvrhhnpedvjeelgffhiedukedtleekkedvudfggefhgfegjefgueekjeelvefggfdvledutdenucfkphepkeelrdeigedrkedurddvgedvnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepkeelrdeigedrkedurddvgedvpdhhvghlohepkhhrvggrtghhvghrrdhlohgtrghlnhgvthdpmhgrihhlfhhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqpdhrtghpthhtoheplhhinhhugidqphhmsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheplhhinhhugidqrggtphhisehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheplhgvnhdrsghrohifnhesihhnthgvlhdrtghomhdprhgtphhtthhopeihuhdrtgdrtghhvghnsehinhhtvghlrdgt ohhmpdhrtghpthhtohepshhrihhnihhvrghsrdhprghnughruhhvrggurgeslhhinhhugidrihhnthgvlhdrtghomhdprhgtphhtthhopehruhhirdiihhgrnhhgsehinhhtvghlrdgtohhm X-DCC--Metrics: v370.home.net.pl 1024; Body=7 Fuz1=7 Fuz2=7 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Rafael J. Wysocki The turbo_pct and num_pstates sysfs attributes represent CPU properties that may be different for differenty types of CPUs in a hybrid processor, so avoid exposing them in that case. Signed-off-by: Rafael J. Wysocki --- Documentation/admin-guide/pm/intel_pstate.rst | 6 ++++++ drivers/cpufreq/intel_pstate.c | 15 +++++++++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) Index: linux-pm/Documentation/admin-guide/pm/intel_pstate.rst =================================================================== --- linux-pm.orig/Documentation/admin-guide/pm/intel_pstate.rst +++ linux-pm/Documentation/admin-guide/pm/intel_pstate.rst @@ -365,6 +365,9 @@ argument is passed to the kernel in the inclusive) including both turbo and non-turbo P-states (see `Turbo P-states Support`_). + This attribute is present only if the value exposed by it is the same + for all of the CPUs in the system. + The value of this attribute is not affected by the ``no_turbo`` setting described `below `_. @@ -374,6 +377,9 @@ argument is passed to the kernel in the Ratio of the `turbo range `_ size to the size of the entire range of supported P-states, in percent. + This attribute is present only if the value exposed by it is the same + for all of the CPUs in the system. + This attribute is read-only. .. _no_turbo_attr: Index: linux-pm/drivers/cpufreq/intel_pstate.c =================================================================== --- linux-pm.orig/drivers/cpufreq/intel_pstate.c +++ linux-pm/drivers/cpufreq/intel_pstate.c @@ -1365,8 +1365,6 @@ define_one_global_rw(energy_efficiency); static struct attribute *intel_pstate_attributes[] = { &status.attr, &no_turbo.attr, - &turbo_pct.attr, - &num_pstates.attr, NULL }; @@ -1391,6 +1389,14 @@ static void __init intel_pstate_sysfs_ex if (WARN_ON(rc)) return; + if (!boot_cpu_has(X86_FEATURE_HYBRID_CPU)) { + rc = sysfs_create_file(intel_pstate_kobject, &turbo_pct.attr); + WARN_ON(rc); + + rc = sysfs_create_file(intel_pstate_kobject, &num_pstates.attr); + WARN_ON(rc); + } + /* * If per cpu limits are enforced there are no global limits, so * return without creating max/min_perf_pct attributes @@ -1417,6 +1423,11 @@ static void __init intel_pstate_sysfs_re sysfs_remove_group(intel_pstate_kobject, &intel_pstate_attr_group); + if (!boot_cpu_has(X86_FEATURE_HYBRID_CPU)) { + sysfs_remove_file(intel_pstate_kobject, &num_pstates.attr); + sysfs_remove_file(intel_pstate_kobject, &turbo_pct.attr); + } + if (!per_cpu_limits) { sysfs_remove_file(intel_pstate_kobject, &max_perf_pct.attr); sysfs_remove_file(intel_pstate_kobject, &min_perf_pct.attr);