Message ID | 20231212190422.1eaf224f@gandalf.local.home |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp8079347vqy; Tue, 12 Dec 2023 16:03:49 -0800 (PST) X-Google-Smtp-Source: AGHT+IHxfnHIemUaQmzyn6yt/a7nN6OpCQDOFisq6LABZbkw5IVWV3P2ltl+xw7n13ydRflv2+m6 X-Received: by 2002:a05:6a20:244f:b0:190:cbe:9ee7 with SMTP id t15-20020a056a20244f00b001900cbe9ee7mr8470385pzc.77.1702425829514; Tue, 12 Dec 2023 16:03:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702425829; cv=none; d=google.com; s=arc-20160816; b=SEGFf7hPMmuliRw5CZWm7rPWMHbAV/PAbDlaOhYqI//2WZW3SCtXRa5EFdx8ls/e3R Gyb+qfZfgyrnwwovAhUqNrSRVJQquOVuZim7X7HncvYZhdWiv9RCnqadg3yeu1OZcRNF qqIdL4Zk0YrbBENCH5MJ6b0Auwl2Fn/cRRjepfI53eDuyZ2r0ZzOUvy8QTciTpBelphv ORQwnvAStcj73idKgaOAMHPzJaBqLzabONIIjqg/cbx2tRErpeo+gzAGPDoNBvSt8OyP M8jvtCRbARmtOlhiH4MaQLMVGzx4LWqC+sz1wM16fvUKhQm1W/9yHzzE8LNwCvo2t/Zv 3nYw== 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 :message-id:subject:cc:to:from:date; bh=o5s3csM7EsYWFsVqOq0qY1rzMW8NZ2PpFt2N00VHXLY=; fh=R8JZsVKDlS7lXIAvTNV55bsjlDBI0i4sqiOYXO4tZQA=; b=KmI9UrNOoXkaKIdPJxL/Hs58ZuwI2a2aJeYwTduZ/zug7SFBwMDzhBDLtRJf4yjRnZ GbC0RDtz6n1QhmWGT482K97B9ENfdxeOXrC/4ywjonmbPNiS/fLDJqS5QBtokmURc0L4 RUhLs03rcreFFBPpqo7PaxX6uxyEhZSkA8sAdipWfavxY3e7Av4uHnAhI4FLSwpj+gze kgzC6R69Gqw8YmMUP5Z/nz9yGfgAzDoGIyPkwsDIdPOCXjrCy5rvvzg7hJ32eWiQ+ePk 6gJDfVkpo/AGo2m2O8y4Nbsnhf/ERlE0as9dc1AWvafvWzGqdDv/DVvm8v0Isr+BcucX gURg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id j26-20020a63fc1a000000b005c624eec079si2313346pgi.724.2023.12.12.16.03.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Dec 2023 16:03:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 38308801B83F; Tue, 12 Dec 2023 16:03:44 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377626AbjLMADf (ORCPT <rfc822;dexuan.linux@gmail.com> + 99 others); Tue, 12 Dec 2023 19:03:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39258 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232536AbjLMADe (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 12 Dec 2023 19:03:34 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0D878B3 for <linux-kernel@vger.kernel.org>; Tue, 12 Dec 2023 16:03:41 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 110CAC433C7; Wed, 13 Dec 2023 00:03:39 +0000 (UTC) Date: Tue, 12 Dec 2023 19:04:22 -0500 From: Steven Rostedt <rostedt@goodmis.org> To: LKML <linux-kernel@vger.kernel.org>, Linux Trace Kernel <linux-trace-kernel@vger.kernel.org> Cc: Masami Hiramatsu <mhiramat@kernel.org>, Mark Rutland <mark.rutland@arm.com>, Mathieu Desnoyers <mathieu.desnoyers@efficios.com> Subject: [PATCH] tracing: Have trace_marker break up by lines by size of trace_seq Message-ID: <20231212190422.1eaf224f@gandalf.local.home> X-Mailer: Claws Mail 3.19.1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,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 pete.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Tue, 12 Dec 2023 16:03:44 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785122866630808904 X-GMAIL-MSGID: 1785122866630808904 |
Series |
tracing: Have trace_marker break up by lines by size of trace_seq
|
|
Commit Message
Steven Rostedt
Dec. 13, 2023, 12:04 a.m. UTC
From: "Steven Rostedt (Google)" <rostedt@goodmis.org> If a trace_marker write is bigger than what trace_seq can hold, then it will print "LINE TOO BIG" message and not what was written. Instead, if check if the write is bigger than the trace_seq and break it up by that size. Ideally, we could make the trace_seq dynamic that could hold this. But that's for another time. Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org> --- kernel/trace/trace.c | 5 +++++ 1 file changed, 5 insertions(+)
Comments
On Tue, 12 Dec 2023 19:04:22 -0500 Steven Rostedt <rostedt@goodmis.org> wrote: > From: "Steven Rostedt (Google)" <rostedt@goodmis.org> > > If a trace_marker write is bigger than what trace_seq can hold, then it > will print "LINE TOO BIG" message and not what was written. > > Instead, if check if the write is bigger than the trace_seq and break it Instead, check if ... ? > up by that size. > > Ideally, we could make the trace_seq dynamic that could hold this. But > that's for another time. I think this is OK, but if possible it is better to be merged with the "LINE TOO BIG" patch (by updating the version). Reviewed-by: Masami Hiramatsu (Google) <mhiramat@kernel.org> Thank you, > > Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org> > --- > kernel/trace/trace.c | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c > index 893e749713d3..2a21bc840fe7 100644 > --- a/kernel/trace/trace.c > +++ b/kernel/trace/trace.c > @@ -7298,6 +7298,11 @@ tracing_mark_write(struct file *filp, const char __user *ubuf, > if (cnt < FAULTED_SIZE) > size += FAULTED_SIZE - cnt; > > + if (size > TRACE_SEQ_BUFFER_SIZE) { > + cnt -= size - TRACE_SEQ_BUFFER_SIZE; > + goto again; > + } > + > buffer = tr->array_buffer.buffer; > event = __trace_buffer_lock_reserve(buffer, TRACE_PRINT, size, > tracing_gen_ctx()); > -- > 2.42.0 >
On Wed, 13 Dec 2023 09:19:33 +0900 Masami Hiramatsu (Google) <mhiramat@kernel.org> wrote: > On Tue, 12 Dec 2023 19:04:22 -0500 > Steven Rostedt <rostedt@goodmis.org> wrote: > > > From: "Steven Rostedt (Google)" <rostedt@goodmis.org> > > > > If a trace_marker write is bigger than what trace_seq can hold, then it > > will print "LINE TOO BIG" message and not what was written. > > > > Instead, if check if the write is bigger than the trace_seq and break it > > Instead, check if ... ? Ah yes, thank you. > > > up by that size. > > > > Ideally, we could make the trace_seq dynamic that could hold this. But > > that's for another time. > > I think this is OK, but if possible it is better to be merged with the > "LINE TOO BIG" patch (by updating the version). What do you mean by "updating the version"? Note, the LINE TOO BIG doesn't happen today. It only happens when applying the sub buffer resize change, and then when I run the tests, it breaks when the subbuffer is bigger than the trace_seq. > > Reviewed-by: Masami Hiramatsu (Google) <mhiramat@kernel.org> Thanks! -- Steve
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index 893e749713d3..2a21bc840fe7 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c @@ -7298,6 +7298,11 @@ tracing_mark_write(struct file *filp, const char __user *ubuf, if (cnt < FAULTED_SIZE) size += FAULTED_SIZE - cnt; + if (size > TRACE_SEQ_BUFFER_SIZE) { + cnt -= size - TRACE_SEQ_BUFFER_SIZE; + goto again; + } + buffer = tr->array_buffer.buffer; event = __trace_buffer_lock_reserve(buffer, TRACE_PRINT, size, tracing_gen_ctx());