Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp1077645yba; Thu, 9 May 2019 10:20:54 -0700 (PDT) X-Google-Smtp-Source: APXvYqyrdpXRD0/BOPp0d9Qx+sdArnWvsyF19nVSCL/7BjxiiFKge3xReB1I3sS44za9La3FgrJB X-Received: by 2002:a63:5166:: with SMTP id r38mr7226576pgl.429.1557422454411; Thu, 09 May 2019 10:20:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557422454; cv=none; d=google.com; s=arc-20160816; b=Mn7Dl17cHJo4EaZaie/tHppYDi5KYydc/qUokPsPUPNHAFhTiman5CEhqQPU1ljQqz vT0QRoLqN8qDPw2M1Irml7FORB7dQ7ZP0hwEEWFx8lCcIfwibB/c0ULfo2wsntjJ3qrt fl39+sOn4mY094GOtRc0dubbLEpNhnd/BJl8E4peKsV0/pK9Rqfkpz32zfq0CrNeklaP 8nYxznSaoKCsMyqidwlsv5EqPl2AQbNQVKsX3Axzk0Ka3eMzDro3ufTEe5S2QtZPxI2V QZ1wWeJhGgUyyQEWJ9ISRWsvynmVKhgsC2N4Ahe6HtO2krnFaDxGbxFjphqYdI11Wo9t 4qtw== 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=KACmACUcRyeNCntR0jryfxfs4DDnDCROqYhU3rtszp4=; b=anquQIkTBVtkuq37d+9Ni/Cut7Rs2oh591VCVxa+eYnb2azRF0TMCnox1Yl6JwqE+s S5x4mUxtpcP/a2RV+gV3UkOxDQTsEFFv5N8I8JVl8MfNomAK2QPNYPx6+7vTG95gSCfB XTGNwN5Wa848FplCMTDg/GQWiXNIPA9ercjXyON1XMproTqxq5TFxSmJAnJ2DmUcAYcV +kssy2T/aNYj/N0lL+eAuTdMtVL+rBfFXANQLQ7uzeDfupCjHRsFKAlZ7tZeA4e2Oa9j 4GaIgC6xnQPKWPYozolpdPwLV6EroEiwvnkp6Cwpy3IaTyJWv9ARSsxNWvUxkRm/ZXfX 1dqA== 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 g15si3801746pfg.284.2019.05.09.10.20.38; Thu, 09 May 2019 10:20:54 -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 S1726811AbfEIRSc (ORCPT + 99 others); Thu, 9 May 2019 13:18:32 -0400 Received: from cloudserver094114.home.pl ([79.96.170.134]:44037 "EHLO cloudserver094114.home.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726620AbfEIRSc (ORCPT ); Thu, 9 May 2019 13:18:32 -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 dde0ba7bd4127124; Thu, 9 May 2019 19:18:29 +0200 From: "Rafael J. Wysocki" To: Ido Schimmel Cc: x86 , LKML , Len Brown , Linux PM , Srinivas Pandruvada , Laura Abbott , Thomas Gleixner , Peter Zijlstra , Ingo Molnar , Simon Schricker , Borislav Petkov , Hannes Reinecke Subject: Re: [PATCH 2/2] PM / arch: x86: MSR_IA32_ENERGY_PERF_BIAS sysfs interface Date: Thu, 09 May 2019 19:18:28 +0200 Message-ID: <1627338.1fd8ofggM8@kreacher> In-Reply-To: <20190509102315.GA31824@splinter> References: <1637073.gl2OfxWTjI@aspire.rjw.lan> <1762575.ER2xjzr9E1@aspire.rjw.lan> <20190509102315.GA31824@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 On Thursday, May 9, 2019 12:23:15 PM CEST Ido Schimmel wrote: > On Thu, Mar 21, 2019 at 11:20:17PM +0100, Rafael J. Wysocki wrote: > > +static struct attribute *intel_epb_attrs[] = { > > + &dev_attr_energy_perf_bias.attr, > > + NULL > > +}; > > + > > +static const struct attribute_group intel_epb_attr_group = { > > + .name = power_group_name, > > + .attrs = intel_epb_attrs > > +}; > > + > > static int intel_epb_online(unsigned int cpu) > > { > > + struct device *cpu_dev = get_cpu_device(cpu); > > + > > intel_epb_restore(); > > + if (!cpuhp_tasks_frozen) > > + sysfs_merge_group(&cpu_dev->kobj, &intel_epb_attr_group); > > + > > return 0; > > } > > > > static int intel_epb_offline(unsigned int cpu) > > { > > - return intel_epb_save(); > > + struct device *cpu_dev = get_cpu_device(cpu); > > + > > + if (!cpuhp_tasks_frozen) > > + sysfs_unmerge_group(&cpu_dev->kobj, &intel_epb_attr_group); > > + > > + intel_epb_save(); > > + return 0; > > } > > Hi, > > I just booted net-next and got the following NULL pointer dereference > [1] during boot. I believe it is caused by this patch. I think you're right, sorry about this. > CONFIG_PM is disabled in my config which means 'power_group_name' is > defined as NULL. When I enable CONFIG_PM the issue is not reproduced. So does the patch below fix it for you? --- 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: