Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1086262ybt; Wed, 8 Jul 2020 20:58:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwIRCgSz6HCs/xApD49lS/fj2BLK3GNkVP2D6wxtE10xMTylPj2CyXXIalwH8S5UZd8fMQR X-Received: by 2002:aa7:d8c2:: with SMTP id k2mr68829823eds.346.1594267098588; Wed, 08 Jul 2020 20:58:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594267098; cv=none; d=google.com; s=arc-20160816; b=REvLuxwoYSOl+0vtyWdWDvfzh6y3wAjDpWbrgnaxLNyaLB3wW/5vk4Zt9qFVSMJymh rfhDQd9MeiGPQg2cH5YYF0eNNRaqjI71zvQ3BwLLkMS5D4iV9CCtKrEBuV/pEORP6NEX tRwoIBebIiROSzscdxVcC/37w2Tc8BWSUVdqk0Q30tg08bkPMlYw1nI6MVSQk45tV4jq 1rwXs86eTMjtOMzsOYueJzXABJM+bGFOD5ol14unWZDNx/dKTs/Aq9EiH22ai2x57mz4 vwCwaAwmbsBTn0CwU7ZqV2mF0ZPK2OsOMNy3XrHy0ILS6kwf2pcSpC2zYMRZCv4awMPK 8UCQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=vcobly+gKmabh7QKdwVf3zAgXq9b3+j9ZuzdCjl3doA=; b=DH4N6ynOo4ScWqCSs2gP6HIUeStAzbKuq7dQ/qKLy5+cPSn6sAY7nVnnUuKD447sed I+KwOMcPh7yXgKuSSxGAjGQNQj4oJMLVvrZjyIKc11iJvZvs9v+KSe/GD4PX+2s81LYF FN4zCxSCeERhZoKS6RFoAX+xvcSiq67bbhzhiGBKmkri/bK7yZUfIjvN3vgTfipZlpBW HA6K7wEVjB5oyah+lTKxs1JyI7aigmEDh6aKSS9jYA6oKF4HKEJNnJED9nxd24AIvbXA 1csUHuoChQjb1iZEeU2WmFddljPRN7xQ0t36eILR3p67oJsi06DXDo2i1Xf8bc/vfmtF RmUg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r14si1202551eds.270.2020.07.08.20.57.56; Wed, 08 Jul 2020 20:58:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726305AbgGIDzl (ORCPT + 99 others); Wed, 8 Jul 2020 23:55:41 -0400 Received: from mail.loongson.cn ([114.242.206.163]:49390 "EHLO loongson.cn" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726245AbgGIDzi (ORCPT ); Wed, 8 Jul 2020 23:55:38 -0400 Received: from linux.localdomain (unknown [113.200.148.30]) by mail.loongson.cn (Coremail) with SMTP id AQAAf9CxqdQplQZfXJUAAA--.714S4; Thu, 09 Jul 2020 11:55:34 +0800 (CST) From: Zhi Li 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 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 Message-Id: <1594266921-28971-3-git-send-email-lizhi01@loongson.cn> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1594266921-28971-1-git-send-email-lizhi01@loongson.cn> References: <1594266921-28971-1-git-send-email-lizhi01@loongson.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IYs7 xG6r1j6r1xMIIF0xvEx4A2jsIE14v26r1j6r4UMIIF0xvEx4A2jsIEc7CjxVAFwI0_Gr0_ Gr1UYxBIdaVFxhVjvjDU0xZFpf9x0pRhXoxUUUUU= X-CM-SenderInfo: xol2xxqqr6z05rqj20fqof0/ Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Tiezhu Yang 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 Signed-off-by: Zhi Li --- 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