RE: [Fwd: Commit 555c45fe0d0 ("int340X/processor_thermal_device: add support for MMIO RAPL") boot failure]

Zhang, Rui
2019-07-19T12:33:38Z

> -----Original Message-----
> From: linux-pm-owner@vger.kernel.org [mailto:linux-pm-
> owner@vger.kernel.org] On Behalf Of Zhang, Rui
> Sent: Friday, July 19, 2019 7:28 PM
> To: Rafael J. Wysocki <rjw@rjwysocki.net>; Kenneth R. Crudup
> <kenny@panix.com>
> Cc: Linux PM list <linux-pm@vger.kernel.org>; Srinivas Pandruvada
> <srinivas.pandruvada@linux.intel.com>
> Subject: RE: [Fwd: Commit 555c45fe0d0 ("int340X/processor_thermal_device:
> add support for MMIO RAPL") boot failure]
>
>
>
> > -----Original Message-----
> > From: linux-pm-owner@vger.kernel.org [mailto:linux-pm-
> > owner@vger.kernel.org] On Behalf Of Rafael J. Wysocki
> > Sent: Friday, July 19, 2019 4:30 PM
> > To: Kenneth R. Crudup <kenny@panix.com>
> > Cc: Zhang, Rui <rui.zhang@intel.com>; Linux PM list <linux-
> > pm@vger.kernel.org>; Srinivas Pandruvada
> > <srinivas.pandruvada@linux.intel.com>
> > Subject: Re: [Fwd: Commit 555c45fe0d0
> ("int340X/processor_thermal_device:
> > add support for MMIO RAPL") boot failure]
> > Importance: High
> >
> > On Friday, July 19, 2019 8:13:22 AM CEST Kenneth R. Crudup wrote:
> > >
> > > On Fri, 19 Jul 2019, Zhang Rui wrote:
> > >
> > > > Are you using the latest Linus' tree today?
> > >
> > > Yeah, Linus' master tree, as of the time of this E-mail (no new
> > > commits since mid-afternoon Thursday PDT).
> > >
> > > "lspci --vvnn" is attached.
> >
> > Also please let me know if the appended patch helps.
> >
> I can reproduce the issue with the config attached, and this patch does not
> help.
> I'm still working on it.
>
This is an ordering issue, MMIO RAPL interface driver is registered before powercap sysfs class initialized.
I'm working at a fix now.

Thanks,
rui
> Thanks,
> rui
> > ---
> > drivers/thermal/intel/int340x_thermal/processor_thermal_device.c | 4
> > ++++
> > 1 file changed, 4 insertions(+)
> >
> > Index: linux-
> > pm/drivers/thermal/intel/int340x_thermal/processor_thermal_device.c
> >
> ================================================================
> > ===
> > --- linux-
> > pm.orig/drivers/thermal/intel/int340x_thermal/processor_thermal_device
> > .c
> > +++ linux-
> > pm/drivers/thermal/intel/int340x_thermal/processor_thermal_dev
> > +++ ice.c
> > @@ -487,6 +487,7 @@ static int proc_thermal_rapl_add(struct
> > rapl_mmio_cpu_online,
> > rapl_mmio_cpu_down_prep);
> > if (ret < 0) {
> >
> > powercap_unregister_control_type(rapl_mmio_priv.control_type);
> > + rapl_mmio_priv.control_type = NULL:
> > return ret;
> > }
> > rapl_mmio_priv.pcap_rapl_online = ret; @@ -496,6 +497,9 @@
> static
> > int proc_thermal_rapl_add(struct
> >
> > static void proc_thermal_rapl_remove(void) {
> > + if (IS_ERR_OR_NULL(rapl_mmio_priv.control_type))
> > + return;
> > +
> > cpuhp_remove_state(rapl_mmio_priv.pcap_rapl_online);
> > powercap_unregister_control_type(rapl_mmio_priv.control_type);
> > }
> >
> >