From patchwork Thu Jan 16 14:49:27 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomas Glozar X-Patchwork-Id: 13941792 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B613C22D4D2 for ; Thu, 16 Jan 2025 14:50:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737039002; cv=none; b=beW3DrIrYOoZP8MDBcCLLwXi8glq/iv/lKnZovK9vO0Z1p9CjBY6OXDrepDwbABD+bjqbq69jP03lgip83hOpZhI4bEpbCNWvhbUg9z8zjH8hSbtcTdELT4TUGPasYm2SiSnFUJjPBljVk/Q3T3h0YZlcWjz276nSGQXnrNJPDk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737039002; c=relaxed/simple; bh=eXU4eDJAiamJRuR+6S2I3SUCuOJ+Y2hxbM89zmDUtO4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=SNuh2Sc8tpaBtxOwSjTs0RqULIhZ5jVX3Esw2EN09VImOkJtF7HkdO8vQiGmninuymr6CFtRaO5U9HTGtUpFxH474Pv4wHFjlUHSHNSnnw/1mghz9mVDX35d7DkgiCzupDRr000wbA8H+2O2OOe/7UA7Bi23P3f/uYxG5n2g7go= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=iXik5zNa; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="iXik5zNa" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1737038999; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2OV9Fq3atwZdfSKyP9etV+P8SOmdjLcTXf5dOUOGY3Q=; b=iXik5zNaKESsIPKG/dWSWQ/eGfNmXobWoqPdnHJu0NW2TwEmxoZjRSpZcyPl6/0sLXh6E2 cM4rNYdjGl1CQ90ph53MurgTRgSLf/Pc5f4w6so7XdRxsSFa5WDZxFAajc1Oyoa9b89pv/ Z4ZLy1Yuz0MlfyfA9i1gPBB1WJtvQFY= Received: from mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-554-wmE4v85sP2mkLXJZRI6S9A-1; Thu, 16 Jan 2025 09:49:58 -0500 X-MC-Unique: wmE4v85sP2mkLXJZRI6S9A-1 X-Mimecast-MFC-AGG-ID: wmE4v85sP2mkLXJZRI6S9A Received: from mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.40]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 2F7911955DCD; Thu, 16 Jan 2025 14:49:57 +0000 (UTC) Received: from fedora.brq.redhat.com (unknown [10.43.17.159]) by mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 9485819560BF; Thu, 16 Jan 2025 14:49:54 +0000 (UTC) From: Tomas Glozar To: Steven Rostedt Cc: linux-trace-kernel@vger.kernel.org, linux-kernel@vger.kernel.org, John Kacur , Luis Goncalves , Gabriele Monaco , Tomas Glozar Subject: [PATCH 1/5] rtla: Add trace_instance_stop Date: Thu, 16 Jan 2025 15:49:27 +0100 Message-ID: <20250116144931.649593-2-tglozar@redhat.com> In-Reply-To: <20250116144931.649593-1-tglozar@redhat.com> References: <20250116144931.649593-1-tglozar@redhat.com> Precedence: bulk X-Mailing-List: linux-trace-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.40 Support not only turning trace on for thet timerlat tracer, but also turning it off. This will be used in subsequent patches to stop the timerlat tracer without also wiping the trace buffer. Cc: stable@vger.kernel.org Signed-off-by: Tomas Glozar --- tools/tracing/rtla/src/trace.c | 8 ++++++++ tools/tracing/rtla/src/trace.h | 1 + 2 files changed, 9 insertions(+) diff --git a/tools/tracing/rtla/src/trace.c b/tools/tracing/rtla/src/trace.c index 170a706248ab..440323a997c6 100644 --- a/tools/tracing/rtla/src/trace.c +++ b/tools/tracing/rtla/src/trace.c @@ -196,6 +196,14 @@ int trace_instance_start(struct trace_instance *trace) return tracefs_trace_on(trace->inst); } +/* + * trace_instance_stop - stop tracing a given rtla instance + */ +int trace_instance_stop(struct trace_instance *trace) +{ + return tracefs_trace_off(trace->inst); +} + /* * trace_events_free - free a list of trace events */ diff --git a/tools/tracing/rtla/src/trace.h b/tools/tracing/rtla/src/trace.h index c7c92dc9a18a..76e1b77291ba 100644 --- a/tools/tracing/rtla/src/trace.h +++ b/tools/tracing/rtla/src/trace.h @@ -21,6 +21,7 @@ struct trace_instance { int trace_instance_init(struct trace_instance *trace, char *tool_name); int trace_instance_start(struct trace_instance *trace); +int trace_instance_stop(struct trace_instance *trace); void trace_instance_destroy(struct trace_instance *trace); struct trace_seq *get_trace_seq(void); From patchwork Thu Jan 16 14:49:28 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomas Glozar X-Patchwork-Id: 13941793 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F336922D4E2 for ; Thu, 16 Jan 2025 14:50:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737039006; cv=none; b=TJeQKnnglUsFUWXmuZwwofWm1Vk735l/AqA03Gn5U+tyRCrw90ySeZHVVZ8B76leqN4vNd9keZ68Nw887g3w9XK8WsaYoZ5TN1UrWBR3Y6DK5tEIzA+vfvryVawwcwN0oQIsT0CEReC3dood1yTMdxVEqPr3NOoD24qx9iC6vjA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737039006; c=relaxed/simple; bh=wf0Yzqz5ici9UpjGB9ZFAGQJNcWiDwzF7KV5jzve4Bw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=VnEsgUPEWy5YXmxjvzIkRNeu6FgU84ZtDKZr+RGKtbyhFOnFoGx6r1mFUBDWQCW7J3QUrkNRe7tR06aT2UDELBPp+54gflaPC7FIHpqVm+gFulPJo9QY+ZxuOAZ6dApi6+pAbhi4q+r/AvY9BA2p2bHACH58FljWFsuDYSrNU64= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=An/eOyIB; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="An/eOyIB" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1737039003; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1pZRM52y0zcwLVV6w0FfhCCVSvfl6V2hE3PVHsUhNsA=; b=An/eOyIBWxifN6MLGT1zqpMPw7tJ16oTK4cdAZPsuFUNCJFcSfEKAyEK6GGBpa7PpkSvIZ PR9R/kUUuDfztXXmikqWXIF0NKmm8A4KXyK5RHHdMjeO4XmaDGMHGFLs2P2CF5GZWf3BFi xm4UvK7TSoXCgl/lv+28mG7nj4yS7Kg= Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-167-G3CsaHnJOTCjhEi5RzH4UQ-1; Thu, 16 Jan 2025 09:50:02 -0500 X-MC-Unique: G3CsaHnJOTCjhEi5RzH4UQ-1 X-Mimecast-MFC-AGG-ID: G3CsaHnJOTCjhEi5RzH4UQ Received: from mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.40]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 962DD195605E; Thu, 16 Jan 2025 14:49:59 +0000 (UTC) Received: from fedora.brq.redhat.com (unknown [10.43.17.159]) by mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 9111C195605F; Thu, 16 Jan 2025 14:49:57 +0000 (UTC) From: Tomas Glozar To: Steven Rostedt Cc: linux-trace-kernel@vger.kernel.org, linux-kernel@vger.kernel.org, John Kacur , Luis Goncalves , Gabriele Monaco , Tomas Glozar Subject: [PATCH 2/5] rtla/timerlat_hist: Stop timerlat tracer on signal Date: Thu, 16 Jan 2025 15:49:28 +0100 Message-ID: <20250116144931.649593-3-tglozar@redhat.com> In-Reply-To: <20250116144931.649593-1-tglozar@redhat.com> References: <20250116144931.649593-1-tglozar@redhat.com> Precedence: bulk X-Mailing-List: linux-trace-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.40 Currently, when either SIGINT from the user or SIGALRM from the duration timer is caught by rtla-timerlat, stop_tracing is set to break out of the main loop. This is not sufficient for cases where the timerlat tracer is producing more data than rtla can consume, since in that case, rtla is looping indefinitely inside tracefs_iterate_raw_events, never reaches the check of stop_tracing and hangs. In addition to setting stop_tracing, also stop the timerlat tracer on received signal (SIGINT or SIGALRM). This will stop new samples so that the existing samples may be processed and tracefs_iterate_raw_events eventually exits. Cc: stable@vger.kernel.org Fixes: 1eeb6328e8b3 ("rtla/timerlat: Add timerlat hist mode") Signed-off-by: Tomas Glozar --- tools/tracing/rtla/src/timerlat_hist.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/tools/tracing/rtla/src/timerlat_hist.c b/tools/tracing/rtla/src/timerlat_hist.c index 4403cc4eba30..e8d249e22251 100644 --- a/tools/tracing/rtla/src/timerlat_hist.c +++ b/tools/tracing/rtla/src/timerlat_hist.c @@ -1146,9 +1146,12 @@ static struct osnoise_tool } static int stop_tracing; +static struct trace_instance *hist_inst = NULL; static void stop_hist(int sig) { stop_tracing = 1; + if (hist_inst) + trace_instance_stop(hist_inst); } /* @@ -1195,6 +1198,12 @@ int timerlat_hist_main(int argc, char *argv[]) } trace = &tool->trace; + /* + * Save trace instance into global variable so that SIGINT can stop + * the timerlat tracer. + * Otherwise, rtla could loop indefinitely when overloaded. + */ + hist_inst = trace; retval = enable_timerlat(trace); if (retval) { @@ -1363,7 +1372,7 @@ int timerlat_hist_main(int argc, char *argv[]) return_value = 0; - if (trace_is_off(&tool->trace, &record->trace)) { + if (trace_is_off(&tool->trace, &record->trace) && !stop_tracing) { printf("rtla timerlat hit stop tracing\n"); if (!params->no_aa) From patchwork Thu Jan 16 14:49:29 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomas Glozar X-Patchwork-Id: 13941794 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B030422D4ED for ; Thu, 16 Jan 2025 14:50:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737039007; cv=none; b=ro/ylg6RZ/WAIM5EVMyWUQRRe/ETojM0/fkuvJ7ESVmhb7Q3++lmt0vL7Cxdlm9WvgIEllxFoBoFHXkwPrNLdLQOmk9TXHEHF8gNmHBDP4MUF6X/59VU8Ragqef01hbyH4Y36b5CnNCx7L4Im5FcoaWiY0lJviPcnU6cyttxgaQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737039007; c=relaxed/simple; bh=A/5D10Fllz96oPHpGvT/TuptR7u0MOT1Hwu39XGkH9w=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=uDTri1wYUT3DR7GocstL6EXCTmR8onVq9ePb1+FJAuYbpPcXze53GUMO/CZq1wq0XxvBp1mEF5VL2kJh7qnGvu6U0LsnvVleb7q54UJXQvH1A0o3V9JkTb5MuAWLfo7RMOrWRl1ysAX4aBn9sH1OuFxGXtybFAacTulBJ18D/LY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=FwNiD0I3; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="FwNiD0I3" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1737039004; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=YLbwaIE4YYMMLPUgRIKU+v4dj0toIq/Nz1ySdXkHNA0=; b=FwNiD0I3OCzy2tpRu9Vvo5Gclf6g31CmP8y5ck0D/9ENxZPJT1xNVDUqU/lFPdHcELtj3T hFiMcWOGfJibSvPlfuAAgcGB0nS82LLAGbeJwj5Kg+B87aVW1qzPENAbljlvy65zc4k3O7 vIiHXH4Km8YsBC0s9VWeyk8s9AvzB/I= Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-33--muiw-PoPlC8OACL3rH4bw-1; Thu, 16 Jan 2025 09:50:03 -0500 X-MC-Unique: -muiw-PoPlC8OACL3rH4bw-1 X-Mimecast-MFC-AGG-ID: -muiw-PoPlC8OACL3rH4bw Received: from mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.40]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 1DB7A1955DC0; Thu, 16 Jan 2025 14:50:02 +0000 (UTC) Received: from fedora.brq.redhat.com (unknown [10.43.17.159]) by mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 1595619560BF; Thu, 16 Jan 2025 14:49:59 +0000 (UTC) From: Tomas Glozar To: Steven Rostedt Cc: linux-trace-kernel@vger.kernel.org, linux-kernel@vger.kernel.org, John Kacur , Luis Goncalves , Gabriele Monaco , Tomas Glozar Subject: [PATCH 3/5] rtla/timerlat_top: Stop timerlat tracer on signal Date: Thu, 16 Jan 2025 15:49:29 +0100 Message-ID: <20250116144931.649593-4-tglozar@redhat.com> In-Reply-To: <20250116144931.649593-1-tglozar@redhat.com> References: <20250116144931.649593-1-tglozar@redhat.com> Precedence: bulk X-Mailing-List: linux-trace-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.40 Apply the changes from the previous patch also to timerlat-top. Cc: stable@vger.kernel.org Fixes: a828cd18bc4a ("rtla: Add timerlat tool and timelart top mode") Signed-off-by: Tomas Glozar --- tools/tracing/rtla/src/timerlat_top.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/tools/tracing/rtla/src/timerlat_top.c b/tools/tracing/rtla/src/timerlat_top.c index 059b468981e4..d21a21053917 100644 --- a/tools/tracing/rtla/src/timerlat_top.c +++ b/tools/tracing/rtla/src/timerlat_top.c @@ -900,9 +900,12 @@ static struct osnoise_tool } static int stop_tracing; +static struct trace_instance *top_inst = NULL; static void stop_top(int sig) { stop_tracing = 1; + if (top_inst) + trace_instance_stop(top_inst); } /* @@ -950,6 +953,13 @@ int timerlat_top_main(int argc, char *argv[]) } trace = &top->trace; + /* + * Save trace instance into global variable so that SIGINT can stop + * the timerlat tracer. + * Otherwise, rtla could loop indefinitely when overloaded. + */ + top_inst = trace; + retval = enable_timerlat(trace); if (retval) { @@ -1131,7 +1141,7 @@ int timerlat_top_main(int argc, char *argv[]) return_value = 0; - if (trace_is_off(&top->trace, &record->trace)) { + if (trace_is_off(&top->trace, &record->trace) && !stop_tracing) { printf("rtla timerlat hit stop tracing\n"); if (!params->no_aa) From patchwork Thu Jan 16 14:49:30 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomas Glozar X-Patchwork-Id: 13941795 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E370722D4E0 for ; Thu, 16 Jan 2025 14:50:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737039011; cv=none; b=dxvJyZ3nXOPKofFyadmiMktyDkA4r+9wH73oawK7bxhqx9Tdm2XVR2/Il8CF4Uql2tXuFnRe/QJb/pZrsSbVhUrku1OcODVtHdPLXRFe6+uQcZ390aQ4kaBWEMSWQH/y0zF1Z5WjPa4Jwg+RmLEwqgmsN+LS8Sy0Etw4OCqPj+w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737039011; c=relaxed/simple; bh=/8oqNUub/kB+/ikfHWiRq+qTvh0v5LgE8EDv7wxu0Vg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=FO/HIShh2XZGdAoPdWI5U0FGobL6U7zQ1AG3Gkd2EHpLHeTvJQoffMzicwG/XKRKAYtVy5xNCPmPHS85js+eZzWCVXwsWz8sajCnbStAxmcNXcpkjtH/E6Li1fyaE53QVhF4cuNuaEa++Sqh2iL2+iH2m6YqL+LV4g6YEyk0Uac= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=OdyLe9L0; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="OdyLe9L0" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1737039008; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1HCimhxo7sWsoxQRywXDbQS0XfhVCKH6Fu3920omuYA=; b=OdyLe9L0RI4DXeXuyNZbWb5TB6oa5ajo75CGl48hB11alRPIAeeit4RbPnwb5XuXhmuv+N wKwojsy+k7cXfVM8F2px4+V5G2BLYqLzZf/VC7+9t362SuttMGk51xkacOvxELjYsZiIw0 +xL3I2xM9f8KF2r9BGXNaK01v69BE5s= Received: from mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-609-wgX6pdY_N72aLuCF3ki2Yw-1; Thu, 16 Jan 2025 09:50:05 -0500 X-MC-Unique: wgX6pdY_N72aLuCF3ki2Yw-1 X-Mimecast-MFC-AGG-ID: wgX6pdY_N72aLuCF3ki2Yw Received: from mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.40]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id A28A919560A1; Thu, 16 Jan 2025 14:50:04 +0000 (UTC) Received: from fedora.brq.redhat.com (unknown [10.43.17.159]) by mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 91F1919560BF; Thu, 16 Jan 2025 14:50:02 +0000 (UTC) From: Tomas Glozar To: Steven Rostedt Cc: linux-trace-kernel@vger.kernel.org, linux-kernel@vger.kernel.org, John Kacur , Luis Goncalves , Gabriele Monaco , Tomas Glozar Subject: [PATCH 4/5] rtla/timerlat_hist: Abort event processing on second signal Date: Thu, 16 Jan 2025 15:49:30 +0100 Message-ID: <20250116144931.649593-5-tglozar@redhat.com> In-Reply-To: <20250116144931.649593-1-tglozar@redhat.com> References: <20250116144931.649593-1-tglozar@redhat.com> Precedence: bulk X-Mailing-List: linux-trace-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.40 If either SIGINT is received twice, or after a SIGALRM (that is, after timerlat was supposed to stop), abort processing events currently left in the tracefs buffer and exit immediately. This allows the user to exit rtla without waiting for processing all events, should that take longer than wanted, at the cost of not processing all samples. Signed-off-by: Tomas Glozar --- tools/tracing/rtla/src/timerlat_hist.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tools/tracing/rtla/src/timerlat_hist.c b/tools/tracing/rtla/src/timerlat_hist.c index e8d249e22251..d0a4d20b7196 100644 --- a/tools/tracing/rtla/src/timerlat_hist.c +++ b/tools/tracing/rtla/src/timerlat_hist.c @@ -1149,6 +1149,14 @@ static int stop_tracing; static struct trace_instance *hist_inst = NULL; static void stop_hist(int sig) { + if (stop_tracing) { + /* + * Stop requested twice in a row; abort event processing and + * exit immediately + */ + tracefs_iterate_stop(hist_inst->inst); + return; + } stop_tracing = 1; if (hist_inst) trace_instance_stop(hist_inst); From patchwork Thu Jan 16 14:49:31 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomas Glozar X-Patchwork-Id: 13941796 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B33EC236ECF for ; Thu, 16 Jan 2025 14:50:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737039015; cv=none; b=hDE27PgKPvAa0QE1E7wLt6jSSHLl+Al/UIT2SMMeL99mu9bTzF7DNE+BOqxkYodYPZhDJ/+vQjvrskzHuZ2tYm6+b8mugTyWz8jgxKCY8elNSB14nPxKHvYWt3enppOjvXpdIKBqf+OumpsJyMbZbSQeckxqzwbwHfhopMiS16E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737039015; c=relaxed/simple; bh=ZA0uznOxxOkReK0eBx1x1YFyXkxnbMJp2BWmAkgSaH8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Ao+0liYGpMxoqTeMwahfTGEpByGz+DjOxr9IFjNEHFaVA7TsWO3Ge10lhFQsehLsUt/PLuUbnnZDHX4o4o8Ro97Yg9g8h3IMEknNUiDvK9Ilp2GfdcY400QIdXa813fMobMkyDuaWFZg+eBli1JNWaDJ6q3o6iZ50jXV/QVIKIs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=PifGchPN; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="PifGchPN" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1737039012; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ljB/jTPeegmqKMNR9/yFI/zpZzn2PMwEe4k+JPxJfXk=; b=PifGchPNS8Eb0wDQn3SEgxdk0ZpEJTfqvhODX7q9Ue4q7Ds4WPfE81Is5m5Tsn/SOvbSyf dR4idVZReRIcPc7o3NFF0A8IfNzaWkoimFs2VSCCpqM72r+3mSKgOniu+qCAXgyGBWLSCV VFUsSFfhQc7UzM75yk9JpPuXpZvbJ6A= Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-3-snPktqXaNYGPrE2floSaGw-1; Thu, 16 Jan 2025 09:50:08 -0500 X-MC-Unique: snPktqXaNYGPrE2floSaGw-1 X-Mimecast-MFC-AGG-ID: snPktqXaNYGPrE2floSaGw Received: from mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.40]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 9DF351955F67; Thu, 16 Jan 2025 14:50:07 +0000 (UTC) Received: from fedora.brq.redhat.com (unknown [10.43.17.159]) by mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 234E319560BF; Thu, 16 Jan 2025 14:50:04 +0000 (UTC) From: Tomas Glozar To: Steven Rostedt Cc: linux-trace-kernel@vger.kernel.org, linux-kernel@vger.kernel.org, John Kacur , Luis Goncalves , Gabriele Monaco , Tomas Glozar Subject: [PATCH 5/5] rtla/timerlat_top: Abort event processing on second signal Date: Thu, 16 Jan 2025 15:49:31 +0100 Message-ID: <20250116144931.649593-6-tglozar@redhat.com> In-Reply-To: <20250116144931.649593-1-tglozar@redhat.com> References: <20250116144931.649593-1-tglozar@redhat.com> Precedence: bulk X-Mailing-List: linux-trace-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.40 Apply the changes from the previous patch also to timerlat-top. Signed-off-by: Tomas Glozar Tested-by: Gabriele Monaco --- tools/tracing/rtla/src/timerlat_top.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tools/tracing/rtla/src/timerlat_top.c b/tools/tracing/rtla/src/timerlat_top.c index d21a21053917..d358cd39f360 100644 --- a/tools/tracing/rtla/src/timerlat_top.c +++ b/tools/tracing/rtla/src/timerlat_top.c @@ -903,6 +903,14 @@ static int stop_tracing; static struct trace_instance *top_inst = NULL; static void stop_top(int sig) { + if (stop_tracing) { + /* + * Stop requested twice in a row; abort event processing and + * exit immediately + */ + tracefs_iterate_stop(top_inst->inst); + return; + } stop_tracing = 1; if (top_inst) trace_instance_stop(top_inst);