From patchwork Thu Jan 25 20:16:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Ricardo B. Marliere" X-Patchwork-Id: 13531682 Received: from mail-pf1-f173.google.com (mail-pf1-f173.google.com [209.85.210.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7900913666F; Thu, 25 Jan 2024 20:16:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706213814; cv=none; b=mXbrMis1cEGLXgy1ulzp9nB17A2J9U+1boyt6uNcO9vmYswimbgZauaRQwn26El5KEe4qYgp18ePWVIr+tZ77QQsVweJ7GDx/0+DPuLCDFZc+eyiL5T8Xv9ke7Q/DlvtUunFMViwygTbgUU/BFAg5V+vqyh8NFXjvMcGZRAR0kI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706213814; c=relaxed/simple; bh=74ef5AhmdlYF282ZG4TR0JPMMsX1uSVb1MTrLasluss=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=AQVkP7GgFEWVzbb6SJxl8Bko/uOOU5MVdKfUks+El+l/wAuMz6vNIP8LOae7+CTJlPIfMrpBNaP75+IQjmqllMH5Z29aft6IzAIHIl4TSoAwrnsmwKrW0suSPSIVFmeLCsFzqJ18L2hS6RmY4Bcdw6T/+DlemOos553OkmravoQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=marliere.net; spf=pass smtp.mailfrom=gmail.com; dkim=fail (0-bit key) header.d=marliere.net header.i=@marliere.net header.b=jwRnSfJE reason="key not found in DNS"; arc=none smtp.client-ip=209.85.210.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=marliere.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=fail reason="key not found in DNS" (0-bit key) header.d=marliere.net header.i=@marliere.net header.b="jwRnSfJE" Received: by mail-pf1-f173.google.com with SMTP id d2e1a72fcca58-6dd85328325so2979023b3a.1; Thu, 25 Jan 2024 12:16:52 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706213812; x=1706818612; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:dkim-signature:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=pua2GdeNlVYlCNWXTNc+U/DW6OUtFinVxqhyQVDfePw=; b=i9LDaZCW0vWsK85M1tlw+02j3uuG/yRU5g4z+kKqdzBnFzXzIZ8pnFvFvBtWuSr/FX B+G+/izXMl1m955Cbes34z+qnL63ecCA4IhD14zggD9SaHH1MO375YqCe2vxyQGsQ0id TyAE4ujkNLyXnboYSNdV0iYnF6ERWj+NAirDccZOUtJuXoakWDe5NBwQtH8kNnNQBzaz Fb9su8yfKoFgWVIEFEBiH+78IPgsvPZOlbG2ubGTLAUnKAdAMECsy2OhkfUARpSiTzmA JWNaIYsz4irLrk1heqXgnfZSoVRnjkj0py4kCnwm9mZ5URtfmdaFazX4feQhqsA11e8z OhIA== X-Gm-Message-State: AOJu0Yx6vIYm/DCGTy3JhJgPxLm1tYN9fwhG19suManqFKO/jiLLH2AJ UgZeRzLifdjY5lac6VA2UTNMqZ/wQW/41RpDxs4aUhKJdtypx6yZcte6R1rvrtXkEw== X-Google-Smtp-Source: AGHT+IHOFhspplzdGaNolQLtBtYcC/IA4kRwXy+25r+hU0Xo+KszbMloBGxzHM5ArVMzW46YOMxnAg== X-Received: by 2002:a62:ab0a:0:b0:6dd:853c:21ca with SMTP id p10-20020a62ab0a000000b006dd853c21camr219959pff.64.1706213811684; Thu, 25 Jan 2024 12:16:51 -0800 (PST) Received: from mail.marliere.net ([24.199.118.162]) by smtp.gmail.com with ESMTPSA id z8-20020a056a00240800b006daa809584csm16165991pfh.182.2024.01.25.12.16.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Jan 2024 12:16:51 -0800 (PST) From: "Ricardo B. Marliere" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marliere.net; s=2023; t=1706213809; 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=pua2GdeNlVYlCNWXTNc+U/DW6OUtFinVxqhyQVDfePw=; b=jwRnSfJEbhUHKdi5IUCvad41tt3M08YRpJWiGVcq83VRTnIZLe7H1/hUwzW7nZmqIu+CTh KKTHb0dagm2pT6OKL0991yZ0Bglhd0cnW2SVrWx6JahRc6D685dyyfeDUC0meCp36tvdfv UmhHP3CCEWQ0wLMvvlOgwccKkD8w3v5BcY49m39WClTUXc+kqw8YO+aOSxuz9Lj59z9kJf d6zdJZmhXq7nhCDWQrbUAPMQ+M29l6df/6X0APf4AgxnlPPkPtlnjA9Jj+DNMXEmaFpJq3 bujlVBxOIvFDH4mRwB2G05aqXNhFShK/sIAbik2ehHAeNoBd4eEbGpWIoadrvQ== Authentication-Results: ORIGINATING; auth=pass smtp.auth=ricardo@marliere.net smtp.mailfrom=ricardo@marliere.net To: Steven Rostedt , Masami Hiramatsu , Mathieu Desnoyers Cc: "Ricardo B. Marliere" , linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org Subject: [PATCH v2 1/3] tracing: add trace_seq_reset function Date: Thu, 25 Jan 2024 17:16:20 -0300 Message-ID: <20240125201621.143968-3-ricardo@marliere.net> In-Reply-To: <20240125201621.143968-1-ricardo@marliere.net> References: <20240125201621.143968-1-ricardo@marliere.net> Precedence: bulk X-Mailing-List: linux-trace-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Currently, trace_seq_init may be called many times with the intent of resetting the buffer. Add a function trace_seq_reset that does that and replace the relevant occurrences to use it instead. Suggested-by: Steven Rostedt Signed-off-by: Ricardo B. Marliere --- include/linux/trace_seq.h | 11 +++++++++++ include/trace/trace_events.h | 2 +- kernel/trace/trace.c | 10 +++++----- kernel/trace/trace_output.c | 2 +- kernel/trace/trace_seq.c | 2 +- 5 files changed, 19 insertions(+), 8 deletions(-) diff --git a/include/linux/trace_seq.h b/include/linux/trace_seq.h index 9ec229dfddaa..d3fa41001813 100644 --- a/include/linux/trace_seq.h +++ b/include/linux/trace_seq.h @@ -29,6 +29,17 @@ trace_seq_init(struct trace_seq *s) s->readpos = 0; } +static inline void +trace_seq_reset(struct trace_seq *s) +{ + if (WARN_ON_ONCE(!s->seq.size)) + seq_buf_init(&s->seq, s->buffer, TRACE_SEQ_BUFFER_SIZE); + else + seq_buf_clear(&s->seq); + s->full = 0; + s->readpos = 0; +} + /** * trace_seq_used - amount of actual data written to buffer * @s: trace sequence descriptor diff --git a/include/trace/trace_events.h b/include/trace/trace_events.h index c2f9cabf154d..2bc79998e5ab 100644 --- a/include/trace/trace_events.h +++ b/include/trace/trace_events.h @@ -227,7 +227,7 @@ trace_raw_output_##call(struct trace_iterator *iter, int flags, \ \ field = (typeof(field))entry; \ \ - trace_seq_init(p); \ + trace_seq_reset(p); \ return trace_output_call(iter, #call, print); \ } \ static struct trace_event_functions trace_event_type_funcs_##call = { \ diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index 46dbe22121e9..d4c55d3e21c2 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c @@ -2928,7 +2928,7 @@ static void output_printk(struct trace_event_buffer *fbuffer) event = &fbuffer->trace_file->event_call->event; raw_spin_lock_irqsave(&tracepoint_iter_lock, flags); - trace_seq_init(&iter->seq); + trace_seq_reset(&iter->seq); iter->ent = fbuffer->entry; event_call->event.funcs->trace(iter, 0, event); trace_seq_putc(&iter->seq, 0); @@ -6921,7 +6921,7 @@ tracing_read_pipe(struct file *filp, char __user *ubuf, if (sret != -EBUSY) goto out; - trace_seq_init(&iter->seq); + trace_seq_reset(&iter->seq); if (iter->trace->read) { sret = iter->trace->read(iter, filp, ubuf, cnt, ppos); @@ -6993,7 +6993,7 @@ tracing_read_pipe(struct file *filp, char __user *ubuf, /* Now copy what we have to the user */ sret = trace_seq_to_user(&iter->seq, ubuf, cnt); if (iter->seq.readpos >= trace_seq_used(&iter->seq)) - trace_seq_init(&iter->seq); + trace_seq_reset(&iter->seq); /* * If there was nothing to send to user, in spite of consuming trace @@ -7125,7 +7125,7 @@ static ssize_t tracing_splice_read_pipe(struct file *filp, spd.partial[i].offset = 0; spd.partial[i].len = trace_seq_used(&iter->seq); - trace_seq_init(&iter->seq); + trace_seq_reset(&iter->seq); } trace_access_unlock(iter->cpu_file); @@ -10274,7 +10274,7 @@ trace_printk_seq(struct trace_seq *s) printk(KERN_TRACE "%s", s->buffer); - trace_seq_init(s); + trace_seq_reset(s); } void trace_init_global_iter(struct trace_iterator *iter) diff --git a/kernel/trace/trace_output.c b/kernel/trace/trace_output.c index 3e7fa44dc2b2..c949e7736618 100644 --- a/kernel/trace/trace_output.c +++ b/kernel/trace/trace_output.c @@ -308,7 +308,7 @@ int trace_raw_output_prep(struct trace_iterator *iter, return TRACE_TYPE_UNHANDLED; } - trace_seq_init(p); + trace_seq_reset(p); trace_seq_printf(s, "%s: ", trace_event_name(event)); return trace_handle_return(s); diff --git a/kernel/trace/trace_seq.c b/kernel/trace/trace_seq.c index c158d65a8a88..741b2f3d76c0 100644 --- a/kernel/trace/trace_seq.c +++ b/kernel/trace/trace_seq.c @@ -59,7 +59,7 @@ int trace_print_seq(struct seq_file *m, struct trace_seq *s) * do something else with the contents. */ if (!ret) - trace_seq_init(s); + trace_seq_reset(s); return ret; } From patchwork Thu Jan 25 20:16:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Ricardo B. Marliere" X-Patchwork-Id: 13531683 Received: from mail-il1-f175.google.com (mail-il1-f175.google.com [209.85.166.175]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AB55C137C42; Thu, 25 Jan 2024 20:16:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.175 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706213819; cv=none; b=G8uJUZzvEoAic1bYY9bk2SIrYETGLW5j/vAB5/wRT6Nlag3B3XAvV7ILWmUuzifm5nN58nJz4MwU8ssjrwgcNx0M37ud2SiHfEUirCk1zMFnXT3194/4LMDikvuNOJcj3yxrBS1qrSv8sduOIVPWV3gcXjMaxrDP3KqLTgbAlrA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706213819; c=relaxed/simple; bh=bUC7wyAgivclMQ53sl3hjWtohebYjP39JimGx9hzbzI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ErJ9x4kggXDcEj2eOQ44CYM1PrhefkE3nM4zIHi3HhmZx0A9vv0SJqPl7raBmxDta3AEK72R9a2nEzPm2G72feZhIT6pevbLDC6UDU8y9JKnrBnTcIUtyyQBQLUqnPF6erGovwUvjt00/zn9719e0+rMA9yH20FlcG7pKcRxWF8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=marliere.net; spf=pass smtp.mailfrom=gmail.com; dkim=fail (0-bit key) header.d=marliere.net header.i=@marliere.net header.b=JnG9IdGv reason="key not found in DNS"; arc=none smtp.client-ip=209.85.166.175 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=marliere.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=fail reason="key not found in DNS" (0-bit key) header.d=marliere.net header.i=@marliere.net header.b="JnG9IdGv" Received: by mail-il1-f175.google.com with SMTP id e9e14a558f8ab-3627e9f1b40so22520355ab.1; Thu, 25 Jan 2024 12:16:57 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706213817; x=1706818617; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:dkim-signature:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=4lXJi825m4f68imkzUKNal9jGMB6ZOcMBV2RPTE0aQ8=; b=Y1XAOkuSm6Trs7lPpcH0j3OzLpUSYgUj9odPDk1MgcZEuRtK/iiGKZUA7Y/0Ik30fX No3qGQPK7BNAYIQUvDmr7OXB2zhDehN/NJKBnHvAHZ54own6ecp9tqXJeLnZNzBEWhCI j9mcKRsgPcgYqV1XVoPspEDcW9GrXCDuMZqfNdCtaaP9eSQMlzs0y22OoKCKUtz/U+l+ 8ARYKzmKF6XQIemt4iBzJVwv2ktg7xZBcuYPviIAwBIuk/dOAQZl3sHU3OXnXoKmWeJX 8mLOAJ62j5mJklpXIiD6h2fVg4PpOXKnCFkVkGPAbHNqyQhQt/4pDk3O3qGZeo1GiwgX OrQw== X-Gm-Message-State: AOJu0Yw2Ox1/5467yr7cOIfL2OpqhKMwjDEr4pSqG8+Wuy26jwwPiId8 GI2vO79kHC8ylNSbwewHrYium1vmJegEypB3gTrIL6sGxpbqYZJ7 X-Google-Smtp-Source: AGHT+IEtmgXxYwx90DkfcMBP+S63sONRUblk1q3rlngbHS8JQ9GXtYHHH621NokSNz97aXjCQO+A7A== X-Received: by 2002:a05:6e02:1d9a:b0:361:981f:5b32 with SMTP id h26-20020a056e021d9a00b00361981f5b32mr326684ila.123.1706213816831; Thu, 25 Jan 2024 12:16:56 -0800 (PST) Received: from mail.marliere.net ([24.199.118.162]) by smtp.gmail.com with ESMTPSA id n35-20020a634d63000000b005ce998b9391sm13571667pgl.67.2024.01.25.12.16.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Jan 2024 12:16:56 -0800 (PST) From: "Ricardo B. Marliere" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marliere.net; s=2023; t=1706213815; 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=4lXJi825m4f68imkzUKNal9jGMB6ZOcMBV2RPTE0aQ8=; b=JnG9IdGvJBXvZaCHCHTUiueXrJlDuAboaFm/elVcTYWDFW4bg36T/iKjl5Z0aHVSWNHJ46 /y/EdkrM9pzzFn5r/Slhl4Jk0LmKSOq7zDaIUizyXHFF0fceCSfHohc88VzrhXZq1dymGr njjrJEGIQY6YRylqzUjxNH5jUIaoQ8AXdA4b10HSu8qEi07CjsGp6VHiQ0oB+mhc4ELmwi kK/BaeAsx+WqqAJPgkr4nfuyolTwD4fAvVf/bVXxRUAXRUeEseA33X9LyBZPiqRJ3K6Nlz 3Er5vgILUjCAARZ32ek48At6SQcfrm3j8NwT4SlQdjK3xnNmhgMx2HytjgRPUA== Authentication-Results: ORIGINATING; auth=pass smtp.auth=ricardo@marliere.net smtp.mailfrom=ricardo@marliere.net To: Steven Rostedt , Masami Hiramatsu , Mathieu Desnoyers Cc: "Ricardo B. Marliere" , linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org Subject: [PATCH v2 2/3] tracing: initialize trace_seq buffers Date: Thu, 25 Jan 2024 17:16:21 -0300 Message-ID: <20240125201621.143968-4-ricardo@marliere.net> In-Reply-To: <20240125201621.143968-1-ricardo@marliere.net> References: <20240125201621.143968-1-ricardo@marliere.net> Precedence: bulk X-Mailing-List: linux-trace-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Now that trace_seq_reset have been created, correct the places where the buffers need to be initialized. Suggested-by: Steven Rostedt Signed-off-by: Ricardo B. Marliere --- kernel/trace/trace.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index d4c55d3e21c2..9827700d0164 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c @@ -4889,6 +4889,9 @@ __tracing_open(struct inode *inode, struct file *file, bool snapshot) mutex_unlock(&trace_types_lock); + trace_seq_init(&iter->seq); + trace_seq_init(&iter->tmp_seq); + return iter; fail: @@ -6770,6 +6773,7 @@ static int tracing_open_pipe(struct inode *inode, struct file *filp) } trace_seq_init(&iter->seq); + trace_seq_init(&iter->tmp_seq); iter->trace = tr->current_trace; if (!alloc_cpumask_var(&iter->started, GFP_KERNEL)) { @@ -6947,6 +6951,7 @@ tracing_read_pipe(struct file *filp, char __user *ubuf, trace_iterator_reset(iter); cpumask_clear(iter->started); trace_seq_init(&iter->seq); + trace_seq_init(&iter->tmp_seq); trace_event_read_lock(); trace_access_lock(iter->cpu_file); @@ -8277,6 +8282,9 @@ static int tracing_buffers_open(struct inode *inode, struct file *filp) if (ret < 0) trace_array_put(tr); + trace_seq_init(&info->iter.seq); + trace_seq_init(&info->iter.tmp_seq); + return ret; } @@ -10300,6 +10308,9 @@ void trace_init_global_iter(struct trace_iterator *iter) iter->temp_size = STATIC_TEMP_BUF_SIZE; iter->fmt = static_fmt_buf; iter->fmt_size = STATIC_FMT_BUF_SIZE; + + trace_seq_init(&iter->seq); + trace_seq_init(&iter->tmp_seq); } void ftrace_dump(enum ftrace_dump_mode oops_dump_mode) @@ -10712,6 +10723,9 @@ void __init early_trace_init(void) tracepoint_printk = 0; else static_key_enable(&tracepoint_printk_key.key); + + trace_seq_init(&tracepoint_print_iter->seq); + trace_seq_init(&tracepoint_print_iter->tmp_seq); } tracer_alloc_buffers(); From patchwork Thu Jan 25 20:16:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Ricardo B. Marliere" X-Patchwork-Id: 13531684 Received: from mail-pl1-f172.google.com (mail-pl1-f172.google.com [209.85.214.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 045DF136678; Thu, 25 Jan 2024 20:17:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706213823; cv=none; b=n0L45ZjGACfNAi+NJKhzjP6XnKwFPBBzYP7O4xr2b6M++hQRRPNCpRYQj/y2cFytdymu0YvfjCohmIiu9tvMvh315B3KPyjHMPB2jFDMVfU9DXlsq1iRorkEVNTWD57IHyXx8Y9WU47lszJvYocepoWTdHE2uMncBOebkmJVcqM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706213823; c=relaxed/simple; bh=pZG/NmciLFvh2pEfMgXU9dRYMsDzwNU1T8h5FuZA04Q=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=TgWuGDePcfm2g0pZal+kJGuZa2/SCj7idsuRVTBpLMQdZS24fvftehWicimIg7KMpaIdOaWZjwUU8pA3jdZE2oUr+VszG1IB+0BYJfRO3ECaccvmPxdZxeWrnKdFd7+fZPHBjw3XmfDV3latHO13vxvkh1m/594qo8ZQw2oHoHM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=marliere.net; spf=pass smtp.mailfrom=gmail.com; dkim=fail (0-bit key) header.d=marliere.net header.i=@marliere.net header.b=neuDlV4q reason="key not found in DNS"; arc=none smtp.client-ip=209.85.214.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=marliere.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=fail reason="key not found in DNS" (0-bit key) header.d=marliere.net header.i=@marliere.net header.b="neuDlV4q" Received: by mail-pl1-f172.google.com with SMTP id d9443c01a7336-1d89518d3b1so4480795ad.0; Thu, 25 Jan 2024 12:17:01 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706213821; x=1706818621; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:dkim-signature:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=QSIlTHL+Q/oYMZeLntckVZudLDzYKGhiQvMbHnxJsCQ=; b=XOC+JzpejlApgCNcfRsmBKSCkHjtEsC1n64xhGmEABMA9cN17AZulC4Mw3MrEliTrG p56OTt2s205Spx/Ce//BhbgDl2/gUGiiv6drKc0ts/Cus5V3tSOFulcmJBecN1I56mnC omJZf+FITqm500uDYNp282nn/W2mYOIrgc6JR7uWNSvTk6XFU84ZwJcKZdIQQGqw03h+ 1bklHhWNF3pbgaKqcTcEbPKFJZpbGLdoiG5MGw6ciic5xA/7wxujU9zkw44vruSZt+iK bNmBUjeAvL9/lqs2ue2/ymAbiQCuXAAaZAsuzBKG1xb23tJEPvK4S5HhHPv88ONDYDE5 WY0g== X-Gm-Message-State: AOJu0Yz360TH6EXHFIVQ3I4lInYc7QvtvTOTwBxCGMedYfgIUj396vJn +7ZtkBWQvTEksolbzL266ZLVGgKbpx1eQo0sfox8QSu0mBMatBJl49QJFLwST68MwQ== X-Google-Smtp-Source: AGHT+IFYmhYcZHYIbnJnRbgo+R0zRc5xVyWzypUYEYOu3U9FL1Y4iVCHVZ/+EhIBq6eLXL00CbdWeg== X-Received: by 2002:a17:902:d4cf:b0:1d7:1f2d:8536 with SMTP id o15-20020a170902d4cf00b001d71f2d8536mr154424plg.21.1706213821173; Thu, 25 Jan 2024 12:17:01 -0800 (PST) Received: from mail.marliere.net ([24.199.118.162]) by smtp.gmail.com with ESMTPSA id d4-20020a170902c18400b001d71649bf9asm11117952pld.252.2024.01.25.12.17.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Jan 2024 12:17:00 -0800 (PST) From: "Ricardo B. Marliere" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marliere.net; s=2023; t=1706213819; 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=QSIlTHL+Q/oYMZeLntckVZudLDzYKGhiQvMbHnxJsCQ=; b=neuDlV4qgsWMT5b8ZHLOjBGdVFKfFUm3hI3aAjxlPj+eQOcYSJf+zNrCoD1KM3Yn9jWvXA +pGQdrsAm8NxQ8qfqFTglg41ALxVJKrPkTZyFuKWTekeOohKE9SEiwd+ON7/7lraB/ZKR+ 2sF/Q3YMyxWqUISxY0OQBuN3r+uyDUD2Kl9f6jkaZ6EGCl0ccW9jO9hibyuM1i/m9VsoE1 cmpfLtQWpcFgAcqlImgzgMK5YTFWidUm8XZjs/j92uuUq3BgDT4KAZxLsrASe3Zlm/RexI AhVewUIYdHw04HHanpr/uqG0iP8nIlU8VnJr6DlmYcoInrgchTztErjSRxBRPQ== Authentication-Results: ORIGINATING; auth=pass smtp.auth=ricardo@marliere.net smtp.mailfrom=ricardo@marliere.net To: Steven Rostedt , Masami Hiramatsu , Mathieu Desnoyers Cc: "Ricardo B. Marliere" , linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org Subject: [PATCH v2 3/3] tracing: convert __trace_seq_init to use WARN_ON_ONCE Date: Thu, 25 Jan 2024 17:16:22 -0300 Message-ID: <20240125201621.143968-5-ricardo@marliere.net> In-Reply-To: <20240125201621.143968-1-ricardo@marliere.net> References: <20240125201621.143968-1-ricardo@marliere.net> Precedence: bulk X-Mailing-List: linux-trace-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The initialization of trace_seq buffers are done elsewhere and therefore __trace_seq_init should yield a warning if it has to actually initialize the buffer. Suggested-by: Steven Rostedt Signed-off-by: Ricardo B. Marliere --- kernel/trace/trace_seq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/trace/trace_seq.c b/kernel/trace/trace_seq.c index 741b2f3d76c0..3c7a7d903b54 100644 --- a/kernel/trace/trace_seq.c +++ b/kernel/trace/trace_seq.c @@ -32,7 +32,7 @@ */ static inline void __trace_seq_init(struct trace_seq *s) { - if (unlikely(!s->seq.size)) + if (WARN_ON_ONCE(!s->seq.size)) trace_seq_init(s); }