From patchwork Fri Sep 19 20:14:09 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 344 Return-Path: X-Original-To: u-boot-concept@u-boot.org Delivered-To: u-boot-concept@u-boot.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758312944; bh=IHz2vK9eh8EyeoekIXfyfwNebjS8jxKIOdpwxd6uOio=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=lOWjkRyiZaMTkF1wmLtqtjfLK4IHf1PpZgTFK3LLQfBhlo/v+lV9VcW6VR0132Plc Smi+Sx6BUwa3efFBEg21PVL5sjP0Y7oYj8cc81eEA5BbFNpAxBZFjeFh/hO8IiRJZf UgNuixXTs2Pq6EJx+qXjU3vH3+iq+XJTGMa9P6NhJ+rk8+K6/IxIz4DrCCdD9hLdfj fl393uY/fQd7B/WMYy0rASuKTtVW1QR19DxnDqKEdlqNZ3GQPx5o4Nh3rdBpVqQRR4 YuZ3E1/DVnW7oKJkz5arnoeVoqkZgs+8deDS5GOzFiXGiQGYad6mOwtA423dqFQo83 q4KCKGm+sy6Bg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 5312967BFC for ; Fri, 19 Sep 2025 14:15:44 -0600 (MDT) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id CuWVLepcv9Wf for ; Fri, 19 Sep 2025 14:15:44 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758312944; bh=IHz2vK9eh8EyeoekIXfyfwNebjS8jxKIOdpwxd6uOio=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=lOWjkRyiZaMTkF1wmLtqtjfLK4IHf1PpZgTFK3LLQfBhlo/v+lV9VcW6VR0132Plc Smi+Sx6BUwa3efFBEg21PVL5sjP0Y7oYj8cc81eEA5BbFNpAxBZFjeFh/hO8IiRJZf UgNuixXTs2Pq6EJx+qXjU3vH3+iq+XJTGMa9P6NhJ+rk8+K6/IxIz4DrCCdD9hLdfj fl393uY/fQd7B/WMYy0rASuKTtVW1QR19DxnDqKEdlqNZ3GQPx5o4Nh3rdBpVqQRR4 YuZ3E1/DVnW7oKJkz5arnoeVoqkZgs+8deDS5GOzFiXGiQGYad6mOwtA423dqFQo83 q4KCKGm+sy6Bg== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 3F85667C06 for ; Fri, 19 Sep 2025 14:15:44 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758312942; bh=q8QHb/FJlb55t7ZVQL1YXQJbWxJJqkDK7XYSc2OvWHA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=n52slgeXd1pYNkU/zOUWJAkDBR9Cwe6qJMhh7qM3s6mXlWiSEoGRtZQqe9SSZiR2g KhnjLwAxfonIU5uzNfD8foFzydJEhpwxnAtxrgA+AKno2rsoK9lOHdFMRytJhi88Za P8qTIbGffORTtBGugGnnUg2j5PekoG6o5TejNrkOmH2oq6M3sQQMBVbAh16OOHNHnl EQAC0iWY4f1NCa8yiLsy12ZOqQHxW7pex/GPOSe7fhpT5daqEz29YtP5bv5OxcxzuW rtDlLRgybMQMogUo9IUTMwAjrwOWpQ+ug2pqu4huIbvnt5cXRYzCUIgiUZQcwYyjGe c4gFwVWmajq5g== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 441BB67BFC; Fri, 19 Sep 2025 14:15:42 -0600 (MDT) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10026) with ESMTP id eQE6hx86kMlW; Fri, 19 Sep 2025 14:15:42 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758312937; bh=XixsUCbldU8GBH0NdipIikK9IHUPxh94FZPNUKH7/rk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uRCZSgSrwPTc2EKxwEYdmi3ClRLvseOQFqdks88FXdEHbaYp7hvRPC3MkziacBu9m /HzA3sijkpvd9PmWBynzZJbwWYDZTEMKUOsuPr8+b71iYZanuACHcjqi6FVYcEpC/v hnZ7/upd6kmg+pdhs6bfFXA6/bztxxahYY2r4cKNGIqM7gMbCuOBN2Yr/fZ7lxJEH4 Ml/WceJvrvvZ8U2DUJdiZHdada5Ytw5QKlSq8u+qEmcrv6/3Ua/7bDrRnE94JRelWB 7OHoS7WcLkj2QwvRE3stdlytTuV9BJwnTFEY+VUZLigf5QlOsuo7OElC7liAFDYtWT QaCXmYNElyrTw== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id E563667B3B; Fri, 19 Sep 2025 14:15:36 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Fri, 19 Sep 2025 14:14:09 -0600 Message-ID: <20250919201507.4024144-3-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250919201507.4024144-1-sjg@u-boot.org> References: <20250919201507.4024144-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: UASD4SI3QAQ733DCTVV6T5CZHKVLFFDK X-Message-ID-Hash: UASD4SI3QAQ733DCTVV6T5CZHKVLFFDK X-MailFrom: sjg@u-boot.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Heinrich Schuchardt , Simon Glass X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 02/42] cyclic: Avoid showing messages when debugging List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass When using a debugger it is common to single step through functions. If one of those functions happens to be called from a cyclic function, then a warning messages is shown. When debugging the console itself, this can mess up the session. Add a Kconfig to control whether the message is shown. Disable it by default if CONFIG_CC_OPTIMIZE_FOR_DEBUG is enabled. Signed-off-by: Simon Glass --- common/Kconfig | 9 +++++++++ common/cyclic.c | 5 +++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/common/Kconfig b/common/Kconfig index 55e9bcdfa2b..3bd11f44c51 100644 --- a/common/Kconfig +++ b/common/Kconfig @@ -666,6 +666,15 @@ config CYCLIC_MAX_CPU_TIME_US takes longer than this duration this function will get unregistered automatically. +config CYCLIC_WARN_LATE + bool "Warn if a cyclic function takes too long" + default y if !CC_OPTIMIZE_FOR_DEBUG + help + Show a warning on the console if a cyclic function goes over the + alotted maximum time. The message is of the form: + + cyclic_run() cyclic function took too long: x vs y max + endif # CYCLIC config EVENT diff --git a/common/cyclic.c b/common/cyclic.c index 196797fd61e..e5a2ad302af 100644 --- a/common/cyclic.c +++ b/common/cyclic.c @@ -71,8 +71,9 @@ static void cyclic_run(void) cyclic->cpu_time_us += cpu_time; /* Check if cpu-time exceeds max allowed time */ - if ((cpu_time > CONFIG_CYCLIC_MAX_CPU_TIME_US) && - (!cyclic->already_warned)) { + if (IS_ENABLED(CONFIG_CYCLIC_WARN_LATE) && + cpu_time > CONFIG_CYCLIC_MAX_CPU_TIME_US && + !cyclic->already_warned) { pr_err("cyclic function %s took too long: %lldus vs %dus max\n", cyclic->name, cpu_time, CONFIG_CYCLIC_MAX_CPU_TIME_US);