Received: by 2002:a17:90a:2044:0:0:0:0 with SMTP id n62csp1131359pjc; Thu, 9 May 2019 14:29:55 -0700 (PDT) X-Google-Smtp-Source: APXvYqxiUo2KNP6e7dpTaxSkWv0qZz/HDJQ0ClmZelws5ZFzAgWGkqOt66g2y0fzLi6ifKLGpzT+ X-Received: by 2002:a17:902:2ba9:: with SMTP id l38mr8231196plb.220.1557437395719; Thu, 09 May 2019 14:29:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557437395; cv=none; d=google.com; s=arc-20160816; b=Nmr/J0JeTbtd4eWJ8C7AD2HAvvztMs4D4SJqnfWNVkiF/Ss4MpPbSU+3Dvpa30uaq5 vuU/c7N9JQH0iNlu5nfuB+zxUpm6dY6AJGBc6Efw4Lz4NIkkmBimYAZWe1EhLIP1SWId zzv5dKMe6nrOR9wWbyDnsQ9PHkMl3b19fd80fbSE88GReJYBHrHnqN3Qx9DBXnLQv8By 6j6C6/IlemskqOvFnjwz97w71HXqsqi5pxgs3y1puNhdArMk3vgcl4vrH0Ky/7SlsxlE 2k5NRLZZn/eF1WGoMZXwyeBG+OS9guN5BmMUhJimK2L0ug0TebNauh297/8o8Ij6S7cu C33A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=/fZkFffxk3x3xSDbJu6HeNCWvENyzKJv3KEQG0bXoU8=; b=aAImf+X8uBsMAOUczHl9rrX9VX3QPlxIB2SmmfilOMQRLKMvcss05H4R1P5htfvnkU VUzUhUHpfR17n/t7en8Iz9Lg1FsU2hOyAvx2o1eQEvSl76S+pzgtpK0CfT1V75nYaLqb sCBpUcVSzneQEh+PUfrY1IKtBxbXH0esJXndR2iz24QbTjpA4kpeAHfzCg49CJRYJ9yY mXywJrhWmyYjO5zpVJUfi1bgJjJwUbwEw1pYgbPdaNcYz5p1DsleCbfX97uCBybIwVs/ Vqe09yih3xgF9JZQttM8oQdyjHacEcYWXfyQVWC1H69sLjdfQ0qC4+bJQSsnHVKqycaC KOZQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n3si5232279pgh.53.2019.05.09.14.29.38; Thu, 09 May 2019 14:29:55 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726869AbfEIV2p (ORCPT + 99 others); Thu, 9 May 2019 17:28:45 -0400 Received: from cloudserver094114.home.pl ([79.96.170.134]:45726 "EHLO cloudserver094114.home.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726219AbfEIV2o (ORCPT ); Thu, 9 May 2019 17:28:44 -0400 Received: from 79.184.254.161.ipv4.supernova.orange.pl (79.184.254.161) (HELO kreacher.localnet) by serwer1319399.home.pl (79.96.170.134) with SMTP (IdeaSmtpServer 0.83.213) id 37c162ea729ea0f2; Thu, 9 May 2019 23:28:42 +0200 From: "Rafael J. Wysocki" To: Linux PM Cc: Ido Schimmel , x86 , LKML , Len Brown , Srinivas Pandruvada , Laura Abbott , Thomas Gleixner , Peter Zijlstra , Ingo Molnar , Simon Schricker , Borislav Petkov , Hannes Reinecke Subject: [PATCH] x86: intel_epb: Take CONFIG_PM into account Date: Thu, 09 May 2019 23:28:41 +0200 Message-ID: <3431308.1mSSVdqTRr@kreacher> In-Reply-To: <20190509174338.GA24432@splinter> References: <1637073.gl2OfxWTjI@aspire.rjw.lan> <1627338.1fd8ofggM8@kreacher> <20190509174338.GA24432@splinter> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Rafael J. Wysocki Commit b9c273babce7 (PM / arch: x86: MSR_IA32_ENERGY_PERF_BIAS sysfs interface) caused kernels built with CONFIG_PM unset to crash on systems supporting the Performance and Energy Bias Hint (EPB), because it attempts to add files to sysfs directories that don't exist on those systems. Prevent that from happening by taking CONFIG_PM into account so that the code depending on it is not compiled at all when it is not set. Fixes: b9c273babce7 (PM / arch: x86: MSR_IA32_ENERGY_PERF_BIAS sysfs interface) Reported-by: Ido Schimmel Tested-by: Ido Schimmel Signed-off-by: Rafael J. Wysocki --- arch/x86/kernel/cpu/intel_epb.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) Index: linux-pm/arch/x86/kernel/cpu/intel_epb.c =================================================================== --- linux-pm.orig/arch/x86/kernel/cpu/intel_epb.c +++ linux-pm/arch/x86/kernel/cpu/intel_epb.c @@ -97,6 +97,7 @@ static void intel_epb_restore(void) wrmsrl(MSR_IA32_ENERGY_PERF_BIAS, (epb & ~EPB_MASK) | val); } +#ifdef CONFIG_PM static struct syscore_ops intel_epb_syscore_ops = { .suspend = intel_epb_save, .resume = intel_epb_restore, @@ -193,6 +194,25 @@ static int intel_epb_offline(unsigned in return 0; } +static inline void register_intel_ebp_syscore_ops(void) +{ + register_syscore_ops(&intel_epb_syscore_ops); +} +#else /* !CONFIG_PM */ +static int intel_epb_online(unsigned int cpu) +{ + intel_epb_restore(); + return 0; +} + +static int intel_epb_offline(unsigned int cpu) +{ + return intel_epb_save(); +} + +static inline void register_intel_ebp_syscore_ops(void) {} +#endif + static __init int intel_epb_init(void) { int ret; @@ -206,7 +226,7 @@ static __init int intel_epb_init(void) if (ret < 0) goto err_out_online; - register_syscore_ops(&intel_epb_syscore_ops); + register_intel_ebp_syscore_ops(); return 0; err_out_online: