From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754313AbdLDNtC (ORCPT ); Mon, 4 Dec 2017 08:49:02 -0500 Received: from mail-pg0-f68.google.com ([74.125.83.68]:46907 "EHLO mail-pg0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754106AbdLDNs4 (ORCPT ); Mon, 4 Dec 2017 08:48:56 -0500 X-Google-Smtp-Source: AGs4zMYE2lMrQUCwXgs/u61itAmw2o40A5fkHUNlMjaj8FDqT0ELEg9eYVlV74y16aI9gUfvfQKuiw== From: Sergey Senozhatsky To: Steven Rostedt , Petr Mladek Cc: Jan Kara , Andrew Morton , Peter Zijlstra , Rafael Wysocki , Pavel Machek , Tetsuo Handa , Tejun Heo , linux-kernel@vger.kernel.org, Sergey Senozhatsky , Sergey Senozhatsky Subject: [RFC][PATCHv6 03/12] printk: consider watchdogs thresholds for offloading Date: Mon, 4 Dec 2017 22:48:16 +0900 Message-Id: <20171204134825.7822-4-sergey.senozhatsky@gmail.com> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20171204134825.7822-1-sergey.senozhatsky@gmail.com> References: <20171204134825.7822-1-sergey.senozhatsky@gmail.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org There are several watchdogs, using different timeout values, so we need to set printk offloading threshold appropriately. This patch set extends offloading_threshold() to take RCU, softlockup and hardlockup timeouts into consideration. Signed-off-by: Sergey Senozhatsky --- kernel/printk/printk.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c index f4e84f83bff5..3d4df3f02854 100644 --- a/kernel/printk/printk.c +++ b/kernel/printk/printk.c @@ -492,10 +492,29 @@ void printk_emergency_end(void) } EXPORT_SYMBOL_GPL(printk_emergency_end); +/* + * Adjust max timeout value in the following order: + * a) 1/2 of RCU stall timeout - it is usually the largest + * b) 1/2 of hardlockup threshold (if enabled) - lower than softlockup + * c) 1/2 of softlockup threshold (if enabled) + * e) default value - 10 seconds + */ static inline int offloading_threshold(void) { + int timeout = CONFIG_RCU_CPU_STALL_TIMEOUT / 2 + 1; + +#ifdef CONFIG_LOCKUP_DETECTOR + /* Hardlockup detector has a sample_period of `watchdog_thresh'. */ + if ((watchdog_enabled & NMI_WATCHDOG_ENABLED) && watchdog_thresh) + return min(timeout, watchdog_thresh / 2) + 1; + + /* Softlockup uses '2 * watchdog_thresh' as a threshold value. */ + if ((watchdog_enabled & SOFT_WATCHDOG_ENABLED) && watchdog_thresh) + return min(timeout, watchdog_thresh) + 1; +#endif + /* Default threshold value is 10 seconds */ - return 10; + return min(10, timeout); } /* -- 2.15.1