diff mbox series

[1/3] x86/mce/therm_throt: remove unused platform_thermal_notify function pointer

Message ID 20200407063345.4484-1-Jason@zx2c4.com (mailing list archive)
State New, archived
Headers show
Series [1/3] x86/mce/therm_throt: remove unused platform_thermal_notify function pointer | expand

Commit Message

Jason A. Donenfeld April 7, 2020, 6:33 a.m. UTC
A long time ago platform_thermal_notify was added as some generic
mechanism for platform drivers to hook thermal events. It seems as
though this has been entirely superseded, and nothing uses it. Remove
the plumbing for this, since this code runs in an interrupt hot path.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
---
 arch/x86/include/asm/mce.h            |  3 ---
 arch/x86/kernel/cpu/mce/therm_throt.c | 25 -------------------------
 2 files changed, 28 deletions(-)

Comments

Jason A. Donenfeld April 13, 2020, 9:09 p.m. UTC | #1
Hi Srinivas & Co,

Could you have a look at this three part series please? Friendly poke.

Jason
Srinivas Pandruvada April 14, 2020, 3:55 a.m. UTC | #2
On Tue, 2020-04-07 at 00:33 -0600, Jason A. Donenfeld wrote:
> A long time ago platform_thermal_notify was added as some generic
> mechanism for platform drivers to hook thermal events. It seems as
> though this has been entirely superseded, and nothing uses it. Remove
> the plumbing for this, since this code runs in an interrupt hot path.
Good idea.

Thanks,
Srinivas

> 
> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
> ---
>  arch/x86/include/asm/mce.h            |  3 ---
>  arch/x86/kernel/cpu/mce/therm_throt.c | 25 -------------------------
>  2 files changed, 28 deletions(-)
> 
> diff --git a/arch/x86/include/asm/mce.h b/arch/x86/include/asm/mce.h
> index 4359b955e0b7..ee30cb60ad36 100644
> --- a/arch/x86/include/asm/mce.h
> +++ b/arch/x86/include/asm/mce.h
> @@ -257,9 +257,6 @@ extern void (*deferred_error_int_vector)(void);
>  
>  void intel_init_thermal(struct cpuinfo_x86 *c);
>  
> -/* Interrupt Handler for core thermal thresholds */
> -extern int (*platform_thermal_notify)(__u64 msr_val);
> -
>  /* Interrupt Handler for package thermal thresholds */
>  extern int (*platform_thermal_package_notify)(__u64 msr_val);
>  
> diff --git a/arch/x86/kernel/cpu/mce/therm_throt.c
> b/arch/x86/kernel/cpu/mce/therm_throt.c
> index f36dc0742085..f904e85eb68f 100644
> --- a/arch/x86/kernel/cpu/mce/therm_throt.c
> +++ b/arch/x86/kernel/cpu/mce/therm_throt.c
> @@ -105,10 +105,6 @@ struct thermal_state {
>  	struct _thermal_state pkg_thresh1;
>  };
>  
> -/* Callback to handle core threshold interrupts */
> -int (*platform_thermal_notify)(__u64 msr_val);
> -EXPORT_SYMBOL(platform_thermal_notify);
> -
>  /* Callback to handle core package threshold_interrupts */
>  int (*platform_thermal_package_notify)(__u64 msr_val);
>  EXPORT_SYMBOL_GPL(platform_thermal_package_notify);
> @@ -551,24 +547,6 @@ static void notify_package_thresholds(__u64
> msr_val)
>  		platform_thermal_package_notify(msr_val);
>  }
>  
> -static void notify_thresholds(__u64 msr_val)
> -{
> -	/* check whether the interrupt handler is defined;
> -	 * otherwise simply return
> -	 */
> -	if (!platform_thermal_notify)
> -		return;
> -
> -	/* lower threshold reached */
> -	if ((msr_val & THERM_LOG_THRESHOLD0) &&
> -			thresh_event_valid(CORE_LEVEL, 0))
> -		platform_thermal_notify(msr_val);
> -	/* higher threshold reached */
> -	if ((msr_val & THERM_LOG_THRESHOLD1) &&
> -			thresh_event_valid(CORE_LEVEL, 1))
> -		platform_thermal_notify(msr_val);
> -}
> -
>  /* Thermal transition interrupt handler */
>  static void intel_thermal_interrupt(void)
>  {
> @@ -579,9 +557,6 @@ static void intel_thermal_interrupt(void)
>  
>  	rdmsrl(MSR_IA32_THERM_STATUS, msr_val);
>  
> -	/* Check for violation of core thermal thresholds*/
> -	notify_thresholds(msr_val);
> -
>  	therm_throt_process(msr_val & THERM_STATUS_PROCHOT,
>  			    THERMAL_THROTTLING_EVENT,
>  			    CORE_LEVEL);
Jason A. Donenfeld April 14, 2020, 4:21 a.m. UTC | #3
On Mon, Apr 13, 2020 at 9:56 PM Srinivas Pandruvada
<srinivas.pandruvada@linux.intel.com> wrote:
>
> On Tue, 2020-04-07 at 00:33 -0600, Jason A. Donenfeld wrote:
> > A long time ago platform_thermal_notify was added as some generic
> > mechanism for platform drivers to hook thermal events. It seems as
> > though this has been entirely superseded, and nothing uses it. Remove
> > the plumbing for this, since this code runs in an interrupt hot path.
> Good idea.

Will you take this into your tree? If not, how do your thermal patches
usually go in? A reviewed-by might be useful in that case.

Jason
Srinivas Pandruvada April 14, 2020, 2:49 p.m. UTC | #4
On Mon, 2020-04-13 at 22:21 -0600, Jason A. Donenfeld wrote:
> On Mon, Apr 13, 2020 at 9:56 PM Srinivas Pandruvada
> <srinivas.pandruvada@linux.intel.com> wrote:
> > On Tue, 2020-04-07 at 00:33 -0600, Jason A. Donenfeld wrote:
> > > A long time ago platform_thermal_notify was added as some generic
> > > mechanism for platform drivers to hook thermal events. It seems
> > > as
> > > though this has been entirely superseded, and nothing uses it.
> > > Remove
> > > the plumbing for this, since this code runs in an interrupt hot
> > > path.
> > Good idea.
> 
> Will you take this into your tree?
I am not the maintainer of this tree. So I don't decide this. I can
just give my opinion.

>  If not, how do your thermal patches
> usually go in? A reviewed-by might be useful in that case.
For this patch:

Reviewed-by: Pandruvada, Srinivas <srinivas.pandruvada@linux.intel.com>

> 
> Jason
diff mbox series

Patch

diff --git a/arch/x86/include/asm/mce.h b/arch/x86/include/asm/mce.h
index 4359b955e0b7..ee30cb60ad36 100644
--- a/arch/x86/include/asm/mce.h
+++ b/arch/x86/include/asm/mce.h
@@ -257,9 +257,6 @@  extern void (*deferred_error_int_vector)(void);
 
 void intel_init_thermal(struct cpuinfo_x86 *c);
 
-/* Interrupt Handler for core thermal thresholds */
-extern int (*platform_thermal_notify)(__u64 msr_val);
-
 /* Interrupt Handler for package thermal thresholds */
 extern int (*platform_thermal_package_notify)(__u64 msr_val);
 
diff --git a/arch/x86/kernel/cpu/mce/therm_throt.c b/arch/x86/kernel/cpu/mce/therm_throt.c
index f36dc0742085..f904e85eb68f 100644
--- a/arch/x86/kernel/cpu/mce/therm_throt.c
+++ b/arch/x86/kernel/cpu/mce/therm_throt.c
@@ -105,10 +105,6 @@  struct thermal_state {
 	struct _thermal_state pkg_thresh1;
 };
 
-/* Callback to handle core threshold interrupts */
-int (*platform_thermal_notify)(__u64 msr_val);
-EXPORT_SYMBOL(platform_thermal_notify);
-
 /* Callback to handle core package threshold_interrupts */
 int (*platform_thermal_package_notify)(__u64 msr_val);
 EXPORT_SYMBOL_GPL(platform_thermal_package_notify);
@@ -551,24 +547,6 @@  static void notify_package_thresholds(__u64 msr_val)
 		platform_thermal_package_notify(msr_val);
 }
 
-static void notify_thresholds(__u64 msr_val)
-{
-	/* check whether the interrupt handler is defined;
-	 * otherwise simply return
-	 */
-	if (!platform_thermal_notify)
-		return;
-
-	/* lower threshold reached */
-	if ((msr_val & THERM_LOG_THRESHOLD0) &&
-			thresh_event_valid(CORE_LEVEL, 0))
-		platform_thermal_notify(msr_val);
-	/* higher threshold reached */
-	if ((msr_val & THERM_LOG_THRESHOLD1) &&
-			thresh_event_valid(CORE_LEVEL, 1))
-		platform_thermal_notify(msr_val);
-}
-
 /* Thermal transition interrupt handler */
 static void intel_thermal_interrupt(void)
 {
@@ -579,9 +557,6 @@  static void intel_thermal_interrupt(void)
 
 	rdmsrl(MSR_IA32_THERM_STATUS, msr_val);
 
-	/* Check for violation of core thermal thresholds*/
-	notify_thresholds(msr_val);
-
 	therm_throt_process(msr_val & THERM_STATUS_PROCHOT,
 			    THERMAL_THROTTLING_EVENT,
 			    CORE_LEVEL);