Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2152229iof; Tue, 7 Jun 2022 21:30:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz2ZTvJPZNBcNf3RHPdAPxjTz4BLkCN5IihOLcV5EE95t3Bsa8uffb1XwxbIY2emkZh7wAb X-Received: by 2002:a17:90a:4413:b0:1cd:2d00:9d0b with SMTP id s19-20020a17090a441300b001cd2d009d0bmr35510454pjg.81.1654662624187; Tue, 07 Jun 2022 21:30:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654662624; cv=none; d=google.com; s=arc-20160816; b=cI9VQThHb3g7Gw+UorKjn674dDWYWYy4eqGIFmMfLe3N/wZrrwoU9xPOSWauBZLWqB kLcpPXZbfwkWpnUQUjUAqI7uLXh9h3MArP/PI4VWIovHj0cU1RAWGdZfzRQFl4xkEhXw /8Tjq7V4bPWqELTEqGZTSjqDQWmKvgbL4QewEP6UmGzPi9FRL55gGFwZyJ2qISgH1Sh/ ImXaRdBrszpeMw8uNxB9nEW4NFJZWuO38dQoktM4XrUC3d0y+w4G6WD0OcQtHUytPztq dpPmwioOQ/O4ran79n1bW1IjIXX3Up6Aw00CaIkr38Ehp6zh2W7CZyjVgcPutXZu9+ll NvLQ== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=hmUaVfPDomZi7ZMg93uU2SxXtjy3LXR21ss51hwfnh0=; b=nvyIV2u/8s5tvAMk4XA0fIYGF1a7iR6hDDedPO/nTqJZyKn0/ZbG5SzLeh8JyoeYtk bYkSkpAlr1+5F8+f0b2TMc8Ld82emZ5lor0fP+oyHOKqg4YrCNIgWA7glJ31EiCOLabY LYNHX+SR/nDZrrb+4v97VkwaWzUqXvM80Ae3120PYYEB6iVHclHZyVekSHj7PUE7tDQc vy3SGW/90HF9newKW/IXqNdOE8mPhm+AVYIJjH3QGeSDYi/jTTPutYNsxI1nI6ry1IDN iGCGyhId3uzHygXxHpuUXAkEU6+anPLxL6ox56l3jjBXg1LMl/gI9HvyUZAyrokw0aLk pRpg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=eEwliN9h; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id n3-20020a170902d2c300b00163852a9881si32708076plc.343.2022.06.07.21.30.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 21:30:24 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=eEwliN9h; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 52CED3E5C81; Tue, 7 Jun 2022 20:59:48 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351777AbiFGVgg (ORCPT + 99 others); Tue, 7 Jun 2022 17:36:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57288 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376930AbiFGUks (ORCPT ); Tue, 7 Jun 2022 16:40:48 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0315C1EE6FA; Tue, 7 Jun 2022 11:38:29 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 816D1B8233E; Tue, 7 Jun 2022 18:38:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F2769C385A2; Tue, 7 Jun 2022 18:38:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627108; bh=qgIarFfVi30ywsrZa61GfYB3RcK1JjLpu8nUPCGSHOs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eEwliN9hiDgfHoWfJPuQZNdPVDoxuUzbyHcioYj7sxOfPVrNSZJR7z+LxB/+4xyhv FX7UzIfGw2n1uBHqCidtBs6IRxLto933vYBCNHo5eadArCKHEPssVS05wIWIfE6YeO xzKKsUkySDBt22lNKZZmPVsrO37namT9f0JQl60o= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Juri Lelli , Ingo Molnar , Clark Williams , Daniel Bristot de Oliveira , "Steven Rostedt (Google)" , Sasha Levin Subject: [PATCH 5.17 603/772] tracing/timerlat: Notify IRQ new max latency only if stop tracing is set Date: Tue, 7 Jun 2022 19:03:15 +0200 Message-Id: <20220607165006.709755739@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607164948.980838585@linuxfoundation.org> References: <20220607164948.980838585@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 From: Daniel Bristot de Oliveira [ Upstream commit aa748949b4e665f473bc5abdc5f66029cb5f5522 ] Currently, the notification of a new max latency is sent from timerlat's IRQ handler anytime a new max latency is found. While this behavior is not wrong, the send IPI overhead itself will increase the thread latency and that is not the desired effect (tracing overhead). Moreover, the thread will notify a new max latency again because the thread latency as it is always higher than the IRQ latency that woke it up. The only case in which it is helpful to notify a new max latency from IRQ is when stop tracing (for the IRQ) is set, as in this case, the thread will not be dispatched. Notify a new max latency from the IRQ handler only if stop tracing is set for the IRQ handler. Link: https://lkml.kernel.org/r/2c2d9a56c0886c8402ba320de32856cbbb10c2bb.1652175637.git.bristot@kernel.org Cc: Juri Lelli Cc: Ingo Molnar Reported-by: Clark Williams Fixes: a955d7eac177 ("trace: Add timerlat tracer") Signed-off-by: Daniel Bristot de Oliveira Signed-off-by: Steven Rostedt (Google) Signed-off-by: Sasha Levin --- kernel/trace/trace_osnoise.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/kernel/trace/trace_osnoise.c b/kernel/trace/trace_osnoise.c index 5e3c62a08fc0..61c3fff488bf 100644 --- a/kernel/trace/trace_osnoise.c +++ b/kernel/trace/trace_osnoise.c @@ -1576,11 +1576,12 @@ static enum hrtimer_restart timerlat_irq(struct hrtimer *timer) trace_timerlat_sample(&s); - notify_new_max_latency(diff); - - if (osnoise_data.stop_tracing) - if (time_to_us(diff) >= osnoise_data.stop_tracing) + if (osnoise_data.stop_tracing) { + if (time_to_us(diff) >= osnoise_data.stop_tracing) { osnoise_stop_tracing(); + notify_new_max_latency(diff); + } + } wake_up_process(tlat->kthread); -- 2.35.1