Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp955220rwb; Sun, 6 Nov 2022 16:53:12 -0800 (PST) X-Google-Smtp-Source: AMsMyM7kGNHvrOxN/dKSU8Tn12wK+wzu6nXHS5hipscy4YPzSao2i1L2rI48y8C13Wto/402UA9O X-Received: by 2002:a17:903:2343:b0:188:5f62:8e15 with SMTP id c3-20020a170903234300b001885f628e15mr17323651plh.5.1667782392102; Sun, 06 Nov 2022 16:53:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667782392; cv=none; d=google.com; s=arc-20160816; b=MN9ODctoxtxvYWaevTa5lkh/uRl7pZUsP45hBCpOJ1Wg37eyEYdZzrV87dIQCzFSlF UuDgHOL9tC8pcCNtgP7rRj0a801fmxJkrGcitRlxAbhUrKN7F4HUV3TS699FD4+WO8UV fi66gjpUPjPMGhdk8DfBj4dwIc788gfPtMF606hha/G81waoysdK4AlTOBXQ7W3DK/iR GSZq/VtNkyb8s2w5/HqzsdIy2wvV6+xM8LKCWxvxVUYggh2Q0re9FX0EDWjRIba721k9 2T/RROjkJAGYH7x+VRgDmNvxm8upZXWJEOUdEvdT0W2hj/6bbI3Hya1A/ilg3kw1JDS4 hr0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=eAF2CyvpSUgGJ5R56L3uEWchVIKQOcL1UbUrRbS9aOM=; b=kOIOO7hsX//Awl6qHiXtzrR0Xy/RUsWyxzekmph9J0B1Kcm7RADN3f9QS33qGVHTWo HG13z/XDvLB6Er02inrZGXEDl8vKLn8KeLeXHMIui/Hv5I6G+708VJi+XvwBDR0H5x1m dJcWXPfrKvB/jK3BhjosurZ4c3Uo8O697ZOIxBkuLFUYKj9ZOHmEakAdMLEh4w0QvoEm ppVZmE0K9vp3Jb/IB9YftRfTGCpNH5TQkhiPH2mCk62heMJQKhpZOY6gyNe2rUOLaFNF kqAFvz12dQYx5p3dOPqForRFSs+JfDw/Mmuj2hBrTeMcJA45JsNOVpKCN923zOZl80KN N6+g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=fujitsu.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r72-20020a632b4b000000b0046fcd2d2befsi7960974pgr.768.2022.11.06.16.52.54; Sun, 06 Nov 2022 16:53:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=fujitsu.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230163AbiKGAqY (ORCPT + 97 others); Sun, 6 Nov 2022 19:46:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56162 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229782AbiKGAqX (ORCPT ); Sun, 6 Nov 2022 19:46:23 -0500 Received: from esa7.hc1455-7.c3s2.iphmx.com (esa7.hc1455-7.c3s2.iphmx.com [139.138.61.252]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4A9F1BF42 for ; Sun, 6 Nov 2022 16:46:21 -0800 (PST) X-IronPort-AV: E=McAfee;i="6500,9779,10523"; a="73766662" X-IronPort-AV: E=Sophos;i="5.96,143,1665414000"; d="scan'208";a="73766662" Received: from unknown (HELO yto-r3.gw.nic.fujitsu.com) ([218.44.52.219]) by esa7.hc1455-7.c3s2.iphmx.com with ESMTP; 07 Nov 2022 09:46:18 +0900 Received: from yto-m3.gw.nic.fujitsu.com (yto-nat-yto-m3.gw.nic.fujitsu.com [192.168.83.66]) by yto-r3.gw.nic.fujitsu.com (Postfix) with ESMTP id 05CCDE8524 for ; Mon, 7 Nov 2022 09:46:18 +0900 (JST) Received: from m3003.s.css.fujitsu.com (m3003.s.css.fujitsu.com [10.128.233.114]) by yto-m3.gw.nic.fujitsu.com (Postfix) with ESMTP id 51A05D39C2 for ; Mon, 7 Nov 2022 09:46:17 +0900 (JST) Received: from localhost.localdomain (unknown [10.125.5.220]) by m3003.s.css.fujitsu.com (Postfix) with ESMTP id 34C5E2026135; Mon, 7 Nov 2022 09:46:17 +0900 (JST) From: Rei Yamamoto To: tglx@linutronix.de Cc: geert+renesas@glider.be, linux-kernel@vger.kernel.org, yamamoto.rei@jp.fujitsu.com Subject: Re: [PATCH] hrtimer: CPU and entry_time is added to a warning message in hrtimer_interrupt() Date: Mon, 7 Nov 2022 09:20:44 +0900 Message-Id: <20221107002044.95213-1-yamamoto.rei@jp.fujitsu.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20220909052211.2415-1-yamamoto.rei@jp.fujitsu.com> References: <20220909052211.2415-1-yamamoto.rei@jp.fujitsu.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, Thomas Gleixner. On Fri, 9 Sep 2022 14:22:11, Rei Yamamoto wrote: > On Fri, 24 Jun 2022 16:00:11, Rei Yamamoto wrote: >> A warning message in hrtimer_interrupt() is output up to 5 times >> by default, and CPU and entry_time are also shown. >> These changes are helpful that the function spending a lot of time is clear >> by using ftrace: >> ----- >> dmesg >> : >> [ 1462.836971] start repro_hrtimer_interrupt >> [ 1462.836976] test_handler = test_handler [repro] 0xffff9788f7bb3048 >> : >> [ 1462.879117] hrtimer: CPU 7, entry_time = 1462807264840, interrupt took >> 60048886 ns ^^^^^ ^^^^^^^^^^^^^ >> >> cat /sys/kernel/debug/tracing/trace >> : >> -0 [007] d.h1. 1462.838075: hrtimer_expire_entry: >> ^^^^^ >> hrtimer=0000000041fcee42 function=test_handler [repro] now=1462807264840 >> ^^^^^^^^^^^^^ >> ----- >> >> Signed-off-by: Rei Yamamoto >> --- >> include/linux/hrtimer.h | 1 + >> kernel/sysctl.c | 10 ++++++++++ >> kernel/time/hrtimer.c | 16 +++++++++++++++- >> 3 files changed, 26 insertions(+), 1 deletion(-) >> >> diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h >> index 0ee140176f10..1a6e03b3015b 100644 >> --- a/include/linux/hrtimer.h >> +++ b/include/linux/hrtimer.h >> @@ -317,6 +317,7 @@ static inline int hrtimer_is_hres_active(struct hrtimer *timer) >> struct clock_event_device; >> >> extern void hrtimer_interrupt(struct clock_event_device *dev); >> +extern int sysctl_hrtimer_interrupt_warnings; >> >> extern unsigned int hrtimer_resolution; >> >> diff --git a/kernel/sysctl.c b/kernel/sysctl.c >> index e52b6e372c60..b0420d60cec9 100644 >> --- a/kernel/sysctl.c >> +++ b/kernel/sysctl.c >> @@ -64,6 +64,7 @@ >> #include >> #include >> #include >> +#include >> >> #include "../lib/kstrtox.h" >> >> @@ -2038,6 +2039,15 @@ static struct ctl_table kern_table[] = { >> .extra1 = SYSCTL_ONE, >> .extra2 = SYSCTL_INT_MAX, >> }, >> +#endif >> +#ifdef CONFIG_HIGH_RES_TIMERS >> + { >> + .procname = "hrtimer_interrupt_warnings", >> + .data = &sysctl_hrtimer_interrupt_warnings, >> + .maxlen = sizeof(int), >> + .mode = 0644, >> + .proc_handler = proc_dointvec, >> + }, >> #endif >> { } >> }; >> diff --git a/kernel/time/hrtimer.c b/kernel/time/hrtimer.c >> index 0ea8702eb516..19adcbcf92e4 100644 >> --- a/kernel/time/hrtimer.c >> +++ b/kernel/time/hrtimer.c >> @@ -1773,6 +1773,7 @@ static __latent_entropy void hrtimer_run_softirq(struct softirq_action *h) >> } >> >> #ifdef CONFIG_HIGH_RES_TIMERS >> +int sysctl_hrtimer_interrupt_warnings = 5; >> >> /* >> * High resolution timer interrupt >> @@ -1866,7 +1867,20 @@ void hrtimer_interrupt(struct clock_event_device *dev) >> else >> expires_next = ktime_add(now, delta); >> tick_program_event(expires_next, 1); >> - pr_warn_once("hrtimer: interrupt took %llu ns\n", ktime_to_ns(delta)); >> + >> + /* >> + * If a message is output many times, the delayed funciton >> + * may be identified by resetting sysctl_hrtimer_interrupt_warnings >> + * and enabling ftrace. >> + */ >> + if (sysctl_hrtimer_interrupt_warnings) { >> + if (sysctl_hrtimer_interrupt_warnings > 0) >> + sysctl_hrtimer_interrupt_warnings--; >> + pr_warn("hrtimer: CPU %d, entry_time = %llu, " >> + "interrupt took %llu ns\n", >> + cpu_base->cpu, entry_time, >> + ktime_to_ns(delta)); >> + } >> } >> >> /* called with interrupts disabled */ > > Could you pick this patch up? Do you have any comments? Thanks, Rei