Messages in this thread Patch in this message | | | From | "Rafael J. Wysocki" <> | Subject | Re: [PATCH 2/2] PM / arch: x86: MSR_IA32_ENERGY_PERF_BIAS sysfs interface | Date | Thu, 09 May 2019 19:18:28 +0200 |
| |
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:
| |