From: Zhi Li <lizhi01@loongson.cn>
To: chenhc@lemote.com, jiaxun.yang@flygoat.com,
tsbogend@alpha.franken.de, lixuefeng@loongson.cn
Cc: linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org,
Tiezhu Yang <yangtiezhu@loongson.cn>
Subject: [PATCH v3 2/3] MIPS: Loongson: Reduce possible loop times and add log in do_thermal_timer()
Date: Thu, 9 Jul 2020 11:55:20 +0800 [thread overview]
Message-ID: <1594266921-28971-3-git-send-email-lizhi01@loongson.cn> (raw)
In-Reply-To: <1594266921-28971-1-git-send-email-lizhi01@loongson.cn>
From: Tiezhu Yang <yangtiezhu@loongson.cn>
Once the temperature of any CPUs is too high, it can power off immediately,
no need to check the rest of CPUs, and it is better to print a log before
power off, this is useful when analysis the abnormal issues.
Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
Signed-off-by: Zhi Li <lizhi01@loongson.cn>
---
drivers/platform/mips/cpu_hwmon.c | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/drivers/platform/mips/cpu_hwmon.c b/drivers/platform/mips/cpu_hwmon.c
index fa42b13..c9f35e5 100644
--- a/drivers/platform/mips/cpu_hwmon.c
+++ b/drivers/platform/mips/cpu_hwmon.c
@@ -153,18 +153,17 @@ static struct delayed_work thermal_work;
static void do_thermal_timer(struct work_struct *work)
{
- int i, value, temp_max = 0;
+ int i, value;
for (i = 0; i < nr_packages; i++) {
value = loongson3_cpu_temp(i);
- if (value > temp_max)
- temp_max = value;
+ if (value > CPU_THERMAL_THRESHOLD) {
+ pr_emerg("Power off due to high temp: %d\n", value);
+ orderly_poweroff(true);
+ }
}
- if (temp_max <= CPU_THERMAL_THRESHOLD)
- schedule_delayed_work(&thermal_work, msecs_to_jiffies(5000));
- else
- orderly_poweroff(true);
+ schedule_delayed_work(&thermal_work, msecs_to_jiffies(5000));
}
static int __init loongson_hwmon_init(void)
--
2.1.0
next prev parent reply other threads:[~2020-07-09 3:55 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-09 3:55 [PATCH v3 0/3] MIPS: Loongson: Fix some issues of cpu_hwmon.c Zhi Li
2020-07-09 3:55 ` [PATCH v3 1/3] MIPS: Loongson: Cleanup cpu_hwmon.c Zhi Li
2020-07-09 3:55 ` Zhi Li [this message]
2020-07-09 3:55 ` [PATCH v3 3/3] MIPS: Loongson: Fix boot warning about hwmon_device_register() Zhi Li
2020-07-16 9:45 ` [PATCH v3 0/3] MIPS: Loongson: Fix some issues of cpu_hwmon.c Thomas Bogendoerfer
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=1594266921-28971-3-git-send-email-lizhi01@loongson.cn \
--to=lizhi01@loongson.cn \
--cc=chenhc@lemote.com \
--cc=jiaxun.yang@flygoat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@vger.kernel.org \
--cc=lixuefeng@loongson.cn \
--cc=tsbogend@alpha.franken.de \
--cc=yangtiezhu@loongson.cn \
/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).