From patchwork Fri Oct 9 03:30:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chen Yu X-Patchwork-Id: 11824909 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 22E57109B for ; Fri, 9 Oct 2020 03:29:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 144492222D for ; Fri, 9 Oct 2020 03:29:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727247AbgJID3T (ORCPT ); Thu, 8 Oct 2020 23:29:19 -0400 Received: from mga05.intel.com ([192.55.52.43]:44241 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725852AbgJID3S (ORCPT ); Thu, 8 Oct 2020 23:29:18 -0400 IronPort-SDR: aHCfDFZMHpVPbDeacdqyoa2jiH7IqLthMipOEaxh4y+d3q0g46VjzGsP8rb41Epb8JqIXNTxhN byEL1M1J99UQ== X-IronPort-AV: E=McAfee;i="6000,8403,9768"; a="250132281" X-IronPort-AV: E=Sophos;i="5.77,353,1596524400"; d="scan'208";a="250132281" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Oct 2020 20:29:18 -0700 IronPort-SDR: Sf53ALl94+IwaR67cbc0mSNm0XFAkt30+MfErZGKG32nAe/wjl6gi3dfADAmxfAdkvL0PwA5Wr 6aMsR5tDFLew== X-IronPort-AV: E=Sophos;i="5.77,353,1596524400"; d="scan'208";a="528751366" Received: from chenyu-office.sh.intel.com ([10.239.158.173]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Oct 2020 20:29:16 -0700 From: Chen Yu To: Srinivas Pandruvada , Len Brown , "Rafael J. Wysocki" , Viresh Kumar Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Chen Yu Subject: [RFC][PATCH] cpufreq: intel_pstate: Delete intel_pstate sysfs if failed to register the driver Date: Fri, 9 Oct 2020 11:30:38 +0800 Message-Id: <20201009033038.23157-1-yu.c.chen@intel.com> X-Mailer: git-send-email 2.17.1 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org There is a corner case that if the intel_pstate driver failed to be registered(might be due to invalid MSR access) and with the acpi_cpufreq loaded, the intel_pstate sysfs might still be created, which makes the user confusing(turbostat for example): grep . /sys/devices/system/cpu/cpu0/cpufreq/scaling_driver acpi-cpufreq grep . /sys/devices/system/cpu/intel_pstate/* /sys/devices/system/cpu/intel_pstate/max_perf_pct:0 /sys/devices/system/cpu/intel_pstate/min_perf_pct:0 grep: /sys/devices/system/cpu/intel_pstate/no_turbo: Resource temporarily unavailable grep: /sys/devices/system/cpu/intel_pstate/num_pstates: Resource temporarily unavailable /sys/devices/system/cpu/intel_pstate/status:off grep: /sys/devices/system/cpu/intel_pstate/turbo_pct: Resource temporarily unavailable The existing of intel_pstate sysfs does not mean that the intel_pstate driver has been successfully loaded(for example, echo off to status), but the intel_pstate sysfs should not co-exist when acpi-cpufreq is also present. Fix this issue by deleting the intel_pstate sysfs if the driver failed to be loaded during bootup. Reported-by: Wendy Wang Suggested-by: Zhang Rui Signed-off-by: Chen Yu Acked-by: Srinivas Pandruvada