From patchwork Mon Feb 13 18:48:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tip-bot2 for Thomas Gleixner X-Patchwork-Id: 56450 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2513310wrn; Mon, 13 Feb 2023 10:53:53 -0800 (PST) X-Google-Smtp-Source: AK7set8v4z+M/m0VNTSdI3pGD6iZnbcfCGKP5oweQ6q0bqaW+PRCW4fxReXpRoh5Q/kXUOgk/gV7 X-Received: by 2002:a17:906:db0b:b0:8ae:80d5:7385 with SMTP id xj11-20020a170906db0b00b008ae80d57385mr25217421ejb.10.1676314433748; Mon, 13 Feb 2023 10:53:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676314433; cv=none; d=google.com; s=arc-20160816; b=leNZXD1HdUcEFhbtxyCnHtoMYi/JJZkZT7HiS7O26Rr70br/ohqmKCNYsQyZxqRtqc 49my0SDGDjrGyCjJXy+U/8/NAkEhIPwIti8D+lPkW8Am8DQs9wzdksIAHBOpQikT29Pc Itzn7fZ4KZDKsFxc02IvsWOxc5ocBobz4YIO8EkD7iJkomCV11Ik05p/ZQmGXP2SDWNn IKq6jxvny0TYQdZ6zORXv2yeEGiQrZ+sK3qxPDtLNrJSnieJH61cZu6GWzZOUMrzHMpR yIEccQs3M/w7TiO3t6uy+zW+xshqslZAeEDT+ZmPI2xonfV7QUN+Ajr/WziODIwktreh JrOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:cc:subject:to:reply-to:sender:from :dkim-signature:dkim-signature:date; bh=9gBKdjlSTAABDh+Tqq2iFzBMT5CiqULyiZe+8Xzhd+4=; b=nWIzBsbv/uNLtISqpv1ICcUCBU11lBmU0VzJQezZaXn6cePfpJxSmv4f8nomEiGYIe cDJDOaNVepJK3e4tkpbJWY9YGo01sq1dVX5NEIUBlAfHq6qUl/IbZww9d8lLGKc04u2W bmZcR2z3x+9sDAMS+Qlos4WZ4FJuW4+aH2M9I7XbMabzf5kB2+yPe+/TLVnb4uIzfsiX SapKONShCYV2xUY5SI8jHWkfV7ZyaxgbJNanNS73KSA2caP/eSOkIoKbrH5kqsG+emTV d4E95lFSFrgzRRdtjem5XGWPGdJMzw+RYWYTZ/qoK7uu9YKyN9Naq9iU+IkO9Nc4J7iI uNTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=h9iUCx9r; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=bRGzLeX8; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c22-20020a17090620d600b008b1294c6862si240046ejc.533.2023.02.13.10.53.30; Mon, 13 Feb 2023 10:53:53 -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; dkim=pass header.i=@linutronix.de header.s=2020 header.b=h9iUCx9r; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=bRGzLeX8; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230012AbjBMSs4 (ORCPT + 99 others); Mon, 13 Feb 2023 13:48:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42368 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229810AbjBMSsg (ORCPT ); Mon, 13 Feb 2023 13:48:36 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E18951CAE9; Mon, 13 Feb 2023 10:48:34 -0800 (PST) Date: Mon, 13 Feb 2023 18:48:33 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1676314113; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=9gBKdjlSTAABDh+Tqq2iFzBMT5CiqULyiZe+8Xzhd+4=; b=h9iUCx9rOkdwGAVmkVWAoYPw1ZpOjodJdnCQFGNV5AabEI03uQ8eQvbAEJybquYjT8uxWy YqeYrLAJIu8xAUY8OHvYSh+pog036AmZgcRAYE4KCJOWyLchfZXspGSQ1YsS/pHauFM70K MBU4NiEUZtGfCIIwJte+dYVnBCwdkIVH4jNCmPQK2+WVp/sCl7Dx5xVTc2KAcbEEzl5I7h 71neGWFJYdYAIQjWkcDV8LRJpK1aNvjmuWPB3CwQrCsqcuv2Z1GhEce/tmXpiBEyWPHQ0T P+FHcr0rvUvGTiUXwdrlXnKFFkFs7rXi0TxXBY9LujchOh8/Nqk0iCL2qZ8oCw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1676314113; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=9gBKdjlSTAABDh+Tqq2iFzBMT5CiqULyiZe+8Xzhd+4=; b=bRGzLeX8RE58rGsyMOcpK3X5J8WzvYB7lv727skzMNZ+4C4+UHUHNhKOhRLYlfSy1UwRDs jGPWStpeM5UjyiAg== From: "tip-bot2 for Paul E. McKenney" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: timers/core] clocksource: Improve "skew is too large" messages Cc: "Paul E. McKenney" , John Stultz , Thomas Gleixner , Stephen Boyd , Feng Tang , x86@kernel.org, linux-kernel@vger.kernel.org MIME-Version: 1.0 Message-ID: <167631411316.4906.13551838694214324654.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757743083896617169?= X-GMAIL-MSGID: =?utf-8?q?1757743083896617169?= The following commit has been merged into the timers/core branch of tip: Commit-ID: dd029269947a32047b8ce1f8513b0b3b13f0df32 Gitweb: https://git.kernel.org/tip/dd029269947a32047b8ce1f8513b0b3b13f0df32 Author: Paul E. McKenney AuthorDate: Tue, 13 Dec 2022 16:42:15 -08:00 Committer: Paul E. McKenney CommitterDate: Thu, 05 Jan 2023 12:33:11 -08:00 clocksource: Improve "skew is too large" messages When clocksource_watchdog() detects excessive clocksource skew compared to the watchdog clocksource, it marks the clocksource under test as unstable and prints several lines worth of message. But that message is unclear to anyone unfamiliar with the code: clocksource: timekeeping watchdog on CPU2: Marking clocksource 'wdtest-ktime' as unstable because the skew is too large: clocksource: 'kvm-clock' wd_nsec: 400744390 wd_now: 612625c2c wd_last: 5fa7f7c66 mask: ffffffffffffffff clocksource: 'wdtest-ktime' cs_nsec: 600744034 cs_now: 173081397a292d4f cs_last: 17308139565a8ced mask: ffffffffffffffff clocksource: 'kvm-clock' (not 'wdtest-ktime') is current clocksource. Therefore, add the following line near the end of that message: Clocksource 'wdtest-ktime' skewed 199999644 ns (199 ms) over watchdog 'kvm-clock' interval of 400744390 ns (400 ms) This new line clearly indicates the amount of skew between the two clocksources, along with the duration of the time interval over which the skew occurred, both in nanoseconds and milliseconds. Signed-off-by: Paul E. McKenney Cc: John Stultz Cc: Thomas Gleixner Cc: Stephen Boyd Cc: Feng Tang --- kernel/time/clocksource.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/kernel/time/clocksource.c b/kernel/time/clocksource.c index b599149..fc486cd 100644 --- a/kernel/time/clocksource.c +++ b/kernel/time/clocksource.c @@ -446,12 +446,20 @@ static void clocksource_watchdog(struct timer_list *unused) /* Check the deviation from the watchdog clocksource. */ md = cs->uncertainty_margin + watchdog->uncertainty_margin; if (abs(cs_nsec - wd_nsec) > md) { + u64 cs_wd_msec; + u64 wd_msec; + u32 wd_rem; + pr_warn("timekeeping watchdog on CPU%d: Marking clocksource '%s' as unstable because the skew is too large:\n", smp_processor_id(), cs->name); pr_warn(" '%s' wd_nsec: %lld wd_now: %llx wd_last: %llx mask: %llx\n", watchdog->name, wd_nsec, wdnow, wdlast, watchdog->mask); pr_warn(" '%s' cs_nsec: %lld cs_now: %llx cs_last: %llx mask: %llx\n", cs->name, cs_nsec, csnow, cslast, cs->mask); + cs_wd_msec = div_u64_rem(cs_nsec - wd_nsec, 1000U * 1000U, &wd_rem); + wd_msec = div_u64_rem(wd_nsec, 1000U * 1000U, &wd_rem); + pr_warn(" Clocksource '%s' skewed %lld ns (%lld ms) over watchdog '%s' interval of %lld ns (%lld ms)\n", + cs->name, cs_nsec - wd_nsec, cs_wd_msec, watchdog->name, wd_nsec, wd_msec); if (curr_clocksource == cs) pr_warn(" '%s' is current clocksource.\n", cs->name); else if (curr_clocksource)