From patchwork Thu Jan 25 22:28:16 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: 13531791 Received: from mail-il1-f179.google.com (mail-il1-f179.google.com [209.85.166.179]) (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 3862E13B7B0; Thu, 25 Jan 2024 22:28:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.179 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706221700; cv=none; b=riYG1UKNsh3IxVNAZNNXNgNq3IUrFlwIjo+AFD42StfoTQu+6no4wHdRID1dwhKTOBmSYyMUkUgy6TL7GtRut3ZHCUvnIVA9t/TteS9Qq4+fqY5ZhawEcK4tbYJ1Bt/AFWgaDTx/PlCkkVmUS2qk/zaeM844tB8Um+HA9KSVCpE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706221700; c=relaxed/simple; bh=BDlXG3c0J0T+En79/etmwn+EYeWR9j0CmyCStkkKD7U=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=LvsMtWC10ojgz2CjubAHZo5H6i8clRlcNEAncYrc8isIzbHlycsN8MqbjgMDpRRoVFY5vu4/rC5G2AmgIscgJdw9nxuj4fe3kIlATL/Rgn4eU7jnOTkJTBf6s61mHW43sEbQWgd06m+ydF49qVGFTpq/2KGXRyvYpVQnrHD4XKU= 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=N0YGdjpo reason="key not found in DNS"; arc=none smtp.client-ip=209.85.166.179 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="N0YGdjpo" Received: by mail-il1-f179.google.com with SMTP id e9e14a558f8ab-362772f69d4so19627805ab.0; Thu, 25 Jan 2024 14:28:18 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706221698; x=1706826498; 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=O2ZD3+aoo+Utnt8CTZ9mJNz1Zl9RCYEYU+BKPe3vFV8=; b=faaxP7buL1I8FgkWADYArm766M8CXh9iIXw+4cicVxc2mjDK/DB7ETO0xVYFkpD84J 1zP5a6dqPnL/Tlc57AA2+qCD65CtfOJrM0gimDC8x6tdQ4ogfadF9niVQJAzMVPja91b dSE8C0L9xougM2784DGlgtF6CZH+pAkQEhgPPhBwo9cy+iUQEq13KEDhbwzSl8itmnTC 1cQ6m5U3vmVEy7/J25qf0R6L4xKl/0kH+SFdX0qVycKi228m7Frk9bUSPBUkh/H8F13e ZGBnT3xX8U6FgsUYUB7kJvJsB46YSFu/oClF9kYiKnghB3E669KmFUsDxJTUn5khN2eW eAlA== X-Gm-Message-State: AOJu0YwnOM8jHVxaa+TZ8d2iKYrkCOpSr+1SJKuBjok0jAq0HMpdVRNK UoraxCuM0oyGO9wYQdvSWj8MBP7LfZHMaEuI4KeivWQhKStq+0OyeIbKbWKSfUue+w== X-Google-Smtp-Source: AGHT+IHnG0oHP7OL1T7+nkuXYzExVgTM8ZYEUIE1kUvG6C+IWGSMRFckU9CNyZLePla8l3v1/03Eaw== X-Received: by 2002:a05:6e02:218d:b0:360:95e8:e6e4 with SMTP id j13-20020a056e02218d00b0036095e8e6e4mr577219ila.24.1706221698205; Thu, 25 Jan 2024 14:28:18 -0800 (PST) Received: from mail.marliere.net ([24.199.118.162]) by smtp.gmail.com with ESMTPSA id e11-20020a63f54b000000b005b92e60cf57sm14066275pgk.56.2024.01.25.14.28.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Jan 2024 14:28:17 -0800 (PST) From: "Ricardo B. Marliere" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marliere.net; s=2023; t=1706221696; 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=O2ZD3+aoo+Utnt8CTZ9mJNz1Zl9RCYEYU+BKPe3vFV8=; b=N0YGdjpoaG8looDM+z7fXZ/9OXhrkhFSRBHfYvoC1hE1Dkt0pZ+P61ZaVOuXN0qDmExIDj zKri3aGvBlcniWkW4X93tF3zdAGQfmDO4wnm9ho6suS2WwiQ/ovTj1k8mW/lXzgnXbheJh VABOIxqZJanHzOcVYsx0L12BoGVxYMfJRZE3hMuJ1t0uw11Nwuk0uBlxFc5ivb++4MEO1k yHf9HyvC9oKGTO9zWHD0FX/OJpxgM4aPpKhxsbelxGx0c60+0sgA4L1m8ddZky/wUECpoF uGeQuNDmGmemO6r+lImz7kD6dHBrEGLBzaNKXp2sjo411jxNnM/nXXU8RRFqAg== 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 v3 1/3] tracing: initialize trace_seq buffers Date: Thu, 25 Jan 2024 19:28:16 -0300 Message-ID: <20240125222818.7425-2-ricardo@marliere.net> In-Reply-To: <20240125222818.7425-1-ricardo@marliere.net> References: <20240125222818.7425-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 In order to extend trace_seq into being dynamic, the struct trace_seq will no longer be valid if simply set to zero. Call trace_seq_init() for all trace_seq when they are first created. 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 46dbe22121e9..9eddf8168df2 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 22:28:17 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: 13531792 Received: from mail-pl1-f175.google.com (mail-pl1-f175.google.com [209.85.214.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 D756313BE90; Thu, 25 Jan 2024 22:28:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.175 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706221704; cv=none; b=ERUii2rArOSv6f7BiUVbA6P9OwfFT60c9zkljJmR2DpVKDzAYchgMbhwJFRlETUJiXJ+SDc4RiKyOMH/zpJP3378Ni1AVGusjCw3NZutmofm2iPBke2mvAqZnUkyL8D5thDXiObTBrGn0vLK7ShMuvXcfMUcw1w2ruwJ6gDilJs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706221704; c=relaxed/simple; bh=vNU05Zjo3R+G6zvl8sanGcOm5meVontJ7j8XC+o8p64=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=RDrNrBKvtCSIjPPaIZ0Aetcm9atjUcJK5ZzCukn8xhHgJV+KzH/pFN3csJzHHqiIC3XWpUfwMq2QwutJ3FUZzuMnMQ8qqY6iGOK6ibVmko5sP8lJSlv6O6fIDyjX2eBaWyzFrZ/cOhQ+rNkKe3K+6E1hbd2dq7xRa0J924n008M= 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=oq95TGEE reason="key not found in DNS"; arc=none smtp.client-ip=209.85.214.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="oq95TGEE" Received: by mail-pl1-f175.google.com with SMTP id d9443c01a7336-1d76943baafso33652715ad.2; Thu, 25 Jan 2024 14:28:22 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706221702; x=1706826502; 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=vVemG1xSmTlI+/Xl67czlHkKz/1wYWhxJxFXHUV270g=; b=f7OaZf/TMJ980DNZ7oCGh/rz8/saBfzlznqLGyK/iJgzyMZmI/+HyrimtT/DwQH3FA ANfnOKkEC1gvMZSHY+eN9iVO9GhzXaz7xuqAcwphoqa+QjgJvsBeiM558JWpHOsET3oV OBZl/UYIJFzbXvdfwoF4cybdKLC1h9t6TfvecaR2KWxaCzcqP7WFAxdUINovLGibfzGA yKciixeqoWh6S4t1qRVnZ1xetuZynPjMLzkhFUxN/h7p7IA1wCVk5MiA/iHqQNNE5Med isOvYCkXVlOw6CJOLtwN0oenQA2BLiuMBnWMRmenZ/0weMaA1dPh0VlWC2cK/M8OEWnc +Tpg== X-Gm-Message-State: AOJu0YwYa25oojBFeraxOXI2f5IvW0RuJgvEu4Jb3cntwpwMN07U2NnG En7+GVG8v+Z0QRe2ebuJHr0XtZkmsQY94/MhAXLzRg/2WeneE9Xd X-Google-Smtp-Source: AGHT+IEG5cSUbcX6yE2SpZ4z6mqwkMEPDzhwaiEG7ecf/Z3As5WsIjx1xAlqHYIOxwN7IsNQmmR/Pw== X-Received: by 2002:a17:902:7081:b0:1d5:36e9:3a0d with SMTP id z1-20020a170902708100b001d536e93a0dmr343755plk.56.1706221702229; Thu, 25 Jan 2024 14:28:22 -0800 (PST) Received: from mail.marliere.net ([24.199.118.162]) by smtp.gmail.com with ESMTPSA id e2-20020a170902f1c200b001d7313140b1sm8979279plc.202.2024.01.25.14.28.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Jan 2024 14:28:21 -0800 (PST) From: "Ricardo B. Marliere" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marliere.net; s=2023; t=1706221700; 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=vVemG1xSmTlI+/Xl67czlHkKz/1wYWhxJxFXHUV270g=; b=oq95TGEEyjE5mkqWQTBAis/I92xZ3Hjja5simJoc67sJ01gIF7zrwWAI5gyBIo+6BpT/sM HODeTR9TOkfCIL2VKtEAh4uhmEEqeHmQtF1escfEtlfMGyH4abGLKvRS71f7NC4qPNWKyw 1JH5T/eU1QVtDAY9EYW/rDpECZFHc9CpGQurWuO5ROW33+uP2P/fLJrJzh/sYC0HvqxGmk W3MDboZd0bgXnY7Bm63LtF+u5rRflhhGPZTbam26T7pR6Xvo92w0K6b2fxyaZxZwYdfHCO dwGup4lxs6U17FQwpeY0To+HA61ppOI1LJ18XdblZ42j18dQl9nDLInugkd3yA== 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 v3 2/3] tracing: add trace_seq_reset function Date: Thu, 25 Jan 2024 19:28:17 -0300 Message-ID: <20240125222818.7425-3-ricardo@marliere.net> In-Reply-To: <20240125222818.7425-1-ricardo@marliere.net> References: <20240125222818.7425-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 9eddf8168df2..9827700d0164 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); @@ -6925,7 +6925,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); @@ -6998,7 +6998,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 @@ -7130,7 +7130,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); @@ -10282,7 +10282,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 22:28:18 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: 13531793 Received: from mail-pl1-f169.google.com (mail-pl1-f169.google.com [209.85.214.169]) (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 275CF13BEA9; Thu, 25 Jan 2024 22:28:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.169 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706221708; cv=none; b=kbj7MLpnFs3j3XzvFKSKJTDet7tv6QiLGfcPFXFqprHZcUDoaxvm0tCzEZnQUFQ2yA5P00lY/7jhNJRxSj82wLI8Zk3ye8ujXmVhj7oGEDZEsZAdKRVQW3fMkyS9olpJW+PIVMSEhtqtGE4XFf+joyvU19p8UX44VPFfGSFTIZM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706221708; c=relaxed/simple; bh=/btpYBoKltilJcMDCCj8DktuiKGbFPJxfILScVQXwpg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=q2e3wdg9+nMvtJrQVANfRAMi36P5HOeAap/9iEgLRUIKmSb8XSQrnDRXc4GKkBoSvMi/NNSrzwvdCegDeUlDSaCuBnqEOepcjTCqMD8RUBWyBIRBUc/0xVMe9yrg7p2f0WrCi9Dpu2VyLRVMIlbWCq+RQ581L6nCsdF5yTDixHs= 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=PHxPYs25 reason="key not found in DNS"; arc=none smtp.client-ip=209.85.214.169 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="PHxPYs25" Received: by mail-pl1-f169.google.com with SMTP id d9443c01a7336-1d74045c463so38808175ad.3; Thu, 25 Jan 2024 14:28:26 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706221706; x=1706826506; 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=w0VO8GupOllM8NGeaQ3SXOm5cCjSBeKcpIn0k9PNzAU=; b=s87xSAtj5alVl0U40m7C5r+nEwWA1Gk+hTaveXR3M9XHD1gTGe0IRTJfZ7lAMWXarj BBqhiLFY6IRp+dW9YwPcbGxRuD8o6U5TDoCNeXc/cZfa1G4WZvAGpY/B4u0HRujqxjDT dUi9ZCxDDJW+PsM+7jJQu6BLlpaxoJ/YwoZunu64orIu98y7zwsCDSiHTS2CgY5w2gI5 Tqc6fJ8ZLke9ibPw7uhfvjwep+0dkcjGv5Zj46kBdyglglG0ejnGap8n3AtxzL5fxq28 QerL+QJLE/lbKYkiWgj7y54XZ1ktHT9VnXtWzGDedwGZv9qojO/pkpxceBqnsvfhRx5f DjTg== X-Gm-Message-State: AOJu0YwSMgR/aeGtl5+ZZI1Clf3tWN1XLM/PCMLJept7LLo8YCaHsd05 SIBMxTtnvd7ekfS3MAcz8cLATz1ylqv2T3BUSOeAkTLP/GfM1oSE X-Google-Smtp-Source: AGHT+IFNOXfnnvhHGC8+oB5mPATdahjM+3HbqL4zKH68OivYtDySAlGqXK5aO5Do5NcyOuo2bzXbhA== X-Received: by 2002:a17:903:3284:b0:1d7:c16:338a with SMTP id jh4-20020a170903328400b001d70c16338amr315873plb.104.1706221706354; Thu, 25 Jan 2024 14:28:26 -0800 (PST) Received: from mail.marliere.net ([24.199.118.162]) by smtp.gmail.com with ESMTPSA id q23-20020a170902789700b001d3a371cd24sm12359167pll.53.2024.01.25.14.28.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Jan 2024 14:28:25 -0800 (PST) From: "Ricardo B. Marliere" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marliere.net; s=2023; t=1706221704; 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=w0VO8GupOllM8NGeaQ3SXOm5cCjSBeKcpIn0k9PNzAU=; b=PHxPYs25pYGlDrgOuO+bliSKAY8BF+njzgSrr/lF9ZohInEGlcWMK2W1tJL98GfjmpwBNG NfmStxhT71YD+mxW48nIzYf9HLLNgIErhBAk8Su5aAuwtYjOYzgnnw8HEzZxJMOYQc5PDt CJXwU6Dvmiod++Gnw/mqdZ1/jbDQ/bt7PqRWZ2DStUu61fRrzn4OuaRIGtx5v7Su09ijWm HQXHg8gZ1MDhmEoXv9QzllfaYiKpPhwCwcxXIQj603wJf7YLrQ7NLOxGuTmYZiksJB5dtp s0ZXpq9U+t/TAtzHGc6YdPywEOeJMCxQfyjpsPd8GQfcW45Z39WRqAY9/2whFg== 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 v3 3/3] tracing: convert __trace_seq_init to use WARN_ON_ONCE Date: Thu, 25 Jan 2024 19:28:18 -0300 Message-ID: <20240125222818.7425-4-ricardo@marliere.net> In-Reply-To: <20240125222818.7425-1-ricardo@marliere.net> References: <20240125222818.7425-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 is 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); }