linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Borislav Petkov <bp@alien8.de>
To: X86 ML <x86@kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Amit Kucheria <amitk@kernel.org>,
	Daniel Lezcano <daniel.lezcano@linaro.org>,
	Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>,
	Tony Luck <tony.luck@intel.com>, Zhang Rui <rui.zhang@intel.com>,
	linux-pm@vger.kernel.org
Subject: [PATCH v3 0/2] Move ...mce/therm_throt.c to drivers/thermal/
Date: Mon,  1 Feb 2021 15:27:02 +0100	[thread overview]
Message-ID: <20210201142704.12495-1-bp@alien8.de> (raw)

From: Borislav Petkov <bp@suse.de>

Hi,

I know I already committed those but

https://lkml.kernel.org/r/20210201032427.GB12524@xsang-OptiPlex-9020

made me look at the IRQ handler registration. And it does happen per CPU
which is particularly daft and unneeded. And it used to do that before
that change too, for some unknown reason.

So I decided to not have a handler registration but simply call the
thermal interrupt handler if all is setup and before that issue the
message about the unexpected IRQ.

I did test it by sending bogus thermal interrupts before and after
registration - see hunk below - and it looks good:

[    0.136608] 0: Sending thermal IRQ
[    0.136760] CPU0: Unexpected LVT thermal interrupt!
[    0.136917] CPU0: Thermal monitoring enabled (TM1)
[    0.137071] 1: Sending thermal IRQ
[    0.043243] 0: Sending thermal IRQ
[    0.043243] 1: Sending thermal IRQ
[    0.043243] 0: Sending thermal IRQ
[    0.043243] 1: Sending thermal IRQ
[    0.043243] 0: Sending thermal IRQ
[    0.043243] 1: Sending thermal IRQ
[    0.043243] 0: Sending thermal IRQ
[    0.043243] 1: Sending thermal IRQ
[    0.043243] 0: Sending thermal IRQ
[    0.043243] 1: Sending thermal IRQ
[    0.149436] thermal_sys: Registered thermal governor 'fair_share'
[    0.149437] thermal_sys: Registered thermal governor 'bang_bang'
[    0.149595] thermal_sys: Registered thermal governor 'step_wise'
[    0.149753] thermal_sys: Registered thermal governor 'user_space'
[    0.445717] ACPI: \_SB_.PR00: _OSC native thermal LVT Acked
[    0.707539] thermal LNXTHERM:00: registered as thermal_zone0

Logic in patch 1 got a bit simplified too.

Thx.

---
diff --git a/drivers/thermal/intel/therm_throt.c b/drivers/thermal/intel/therm_throt.c
index 6221f0f418f7..e544f04eac8c 100644
--- a/drivers/thermal/intel/therm_throt.c
+++ b/drivers/thermal/intel/therm_throt.c
@@ -705,6 +705,11 @@ void intel_init_thermal(struct cpuinfo_x86 *c)
                                | PACKAGE_THERM_INT_HIGH_ENABLE), h);
        }
 
+       pr_info("0: Sending thermal IRQ\n");
+
+       apic->send_IPI(0, THERMAL_APIC_VECTOR);
+       apic->send_IPI(3, THERMAL_APIC_VECTOR);
+
        rdmsr(MSR_IA32_MISC_ENABLE, l, h);
        wrmsr(MSR_IA32_MISC_ENABLE, l | MSR_IA32_MISC_ENABLE_TM1, h);
 
@@ -713,4 +718,8 @@ void intel_init_thermal(struct cpuinfo_x86 *c)
 
        /* enable thermal throttle processing */
        atomic_set(&therm_throt_en, 1);
+
+       pr_info("1: Sending thermal IRQ\n");
+       apic->send_IPI(0, THERMAL_APIC_VECTOR);
+       apic->send_IPI(3, THERMAL_APIC_VECTOR);
 }

Changelog:
==========

here's v2 which addresses peterz's comments to patch 2.

@thermal folks, lemme know if you have any objections otherwise I'll
route this through the tip tree.

v1:

so this has come up a bunch of times in the past and PeterZ is right
- that thing doesn't have anything to do with the MCE glue so move it
where it belongs.

Thx.

Borislav Petkov (2):
  x86/mce: Get rid of mcheck_intel_therm_init()
  thermal: Move therm_throt there from x86/mce

 arch/x86/Kconfig                              |  4 --
 arch/x86/include/asm/mce.h                    | 22 ----------
 arch/x86/include/asm/thermal.h                | 24 +++++++++++
 arch/x86/kernel/cpu/intel.c                   |  3 ++
 arch/x86/kernel/cpu/mce/Makefile              |  2 -
 arch/x86/kernel/cpu/mce/core.c                |  1 -
 arch/x86/kernel/cpu/mce/intel.c               |  1 -
 arch/x86/kernel/irq.c                         | 21 ++++++++++
 drivers/thermal/intel/Kconfig                 |  4 ++
 drivers/thermal/intel/Makefile                |  1 +
 .../thermal/intel}/therm_throt.c              | 41 ++++---------------
 drivers/thermal/intel/x86_pkg_temp_thermal.c  |  3 +-
 12 files changed, 64 insertions(+), 63 deletions(-)
 create mode 100644 arch/x86/include/asm/thermal.h
 rename {arch/x86/kernel/cpu/mce => drivers/thermal/intel}/therm_throt.c (96%)

2nd:rc6-therm_throt

-- 
2.29.2


             reply	other threads:[~2021-02-01 14:28 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-01 14:27 Borislav Petkov [this message]
2021-02-01 14:27 ` [PATCH v3 1/2] x86/mce: Get rid of mcheck_intel_therm_init() Borislav Petkov
2021-02-01 14:27 ` [PATCH v3 2/2] thermal: Move therm_throt there from x86/mce Borislav Petkov
2021-02-01 19:10   ` Srinivas Pandruvada
2021-02-02 12:10     ` Borislav Petkov
2021-02-02 18:13       ` Srinivas Pandruvada
2021-02-01 19:10 ` [PATCH v3 0/2] Move ...mce/therm_throt.c to drivers/thermal/ Srinivas Pandruvada

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210201142704.12495-1-bp@alien8.de \
    --to=bp@alien8.de \
    --cc=amitk@kernel.org \
    --cc=daniel.lezcano@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=rui.zhang@intel.com \
    --cc=srinivas.pandruvada@linux.intel.com \
    --cc=tony.luck@intel.com \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).