Skip to contentSkip to conversation

tracing: Updates for 6.7

PATCH New Steven Rostedt 1 participant 5 messages Oct 26, 2023

Subsystems (2)
lore
Share & tools
lore

Steven Rostedt

author maintainer
#0 lore raw

cover tracing: Updates for 6.7

git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace.git
trace/for-next

Head SHA1: 29e06c10702e81a7d0b75020ca514d2f2962704a

Christophe JAILLET (1):
tracing/histograms: Simplify last_cmd_set()

Matthew Wilcox (Oracle) (1):
powerpc: Remove initialisation of readpos

Steven Rostedt (Google) (2):
eventfs: Fix WARN_ON() in create_file_dentry()
eventfs: Fix typo in eventfs_inode union comment

----

 arch/powerpc/kernel/setup-common.c |  1 -
 fs/tracefs/event_inode.c           |  3 ++-
 fs/tracefs/internal.h              |  2 +-
 kernel/trace/trace_events_hist.c   | 11 ++---------
 4 files changed, 5 insertions(+), 12 deletions(-)
author maintainer
#1 lore raw

PATCH 1/4 tracing/histograms: Simplify last_cmd_set()

From: Christophe JAILLET <[email protected]>

Turn a kzalloc()+strcpy()+strncat() into an equivalent and less verbose kasprintf().

---
 kernel/trace/trace_events_hist.c | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)
kernel/trace/trace_events_hist.c +2 -9
index d06938ae0717..1abc07fba1b9 100644
@@ -774,23 +774,16 @@ static void last_cmd_set(struct trace_event_file *file, char *str)
 {
 	const char *system = NULL, *name = NULL;
 	struct trace_event_call *call;
-	int len;
 
 	if (!str)
 		return;
 
-	/* sizeof() contains the nul byte */
-	len = sizeof(HIST_PREFIX) + strlen(str);
 	kfree(last_cmd);
-	last_cmd = kzalloc(len, GFP_KERNEL);
+
+	last_cmd = kasprintf(GFP_KERNEL, HIST_PREFIX "%s", str);
 	if (!last_cmd)
 		return;
 
-	strcpy(last_cmd, HIST_PREFIX);
-	/* Again, sizeof() contains the nul byte */
-	len -= sizeof(HIST_PREFIX);
-	strncat(last_cmd, str, len);
-
 	if (file) {
 		call = file->event_call;
 		system = call->class->system;
Signature · 1 line
2.42.0
author maintainer
#2 lore raw

PATCH 2/4 powerpc: Remove initialisation of readpos

In reply to Steven Rostedt

From: "Matthew Wilcox (Oracle)" <[email protected]>

While powerpc doesn't use the seq_buf readpos, it did explicitly initialise it for no good reason.

Cc Christoph Hellwig <[email protected]>
Cc Justin Stitt <[email protected]>
Cc Kent Overstreet <[email protected]>
Cc Petr Mladek <[email protected]>
Cc Andy Shevchenko <[email protected]>
Cc Rasmus Villemoes <[email protected]>
Cc Sergey Senozhatsky <[email protected]>
Cc Michael Ellerman <[email protected]>
Fixes d0ed46b60396 ("tracing: Move readpos from seq_buf to trace_seq")
---
 arch/powerpc/kernel/setup-common.c | 1 -
 1 file changed, 1 deletion(-)
arch/powerpc/kernel/setup-common.c +0 -1
index 2f1026fba00d..34975532e44c 100644
@@ -601,7 +601,6 @@ struct seq_buf ppc_hw_desc __initdata = {
 	.buffer = ppc_hw_desc_buf,
 	.size = sizeof(ppc_hw_desc_buf),
 	.len = 0,
-	.readpos = 0,
 };
 
 static __init void probe_machine(void)
Signature · 1 line
2.42.0
author maintainer
#3 lore raw

PATCH 3/4 eventfs: Fix WARN_ON() in create_file_dentry()

In reply to Steven Rostedt

From: "Steven Rostedt (Google)" <[email protected]>

As the comment right above a WARN_ON() in create_file_dentry() states:

* Note, with the mutex held, the e_dentry cannot have content
* and the ei->is_freed be true at the same time.

But the WARN_ON() only has:

  WARN_ON_ONCE(ei->is_free);

Where to match the comment (and what it should actually do) is:

  dentry = *e_dentry;
  WARN_ON_ONCE(dentry && ei->is_free)

Also in that case, set dentry to NULL (although it should never happen).

Cc Masami Hiramatsu <[email protected]>
Cc Mark Rutland <[email protected]>
Fixes 5790b1fb3d672 ("eventfs: Remove eventfs_file and just use eventfs_inode")
---
 fs/tracefs/event_inode.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
fs/tracefs/event_inode.c +2 -1
index 09ab93357957..4d2da7480e5f 100644
@@ -264,8 +264,9 @@ create_file_dentry(struct eventfs_inode *ei, struct dentry **e_dentry,
 		 * Note, with the mutex held, the e_dentry cannot have content
 		 * and the ei->is_freed be true at the same time.
 		 */
-		WARN_ON_ONCE(ei->is_freed);
 		dentry = *e_dentry;
+		if (WARN_ON_ONCE(dentry && ei->is_freed))
+			dentry = NULL;
 		/* The lookup does not need to up the dentry refcount */
 		if (dentry && !lookup)
 			dget(dentry);
Signature · 1 line
2.42.0
author maintainer
#4 lore raw

PATCH 4/4 eventfs: Fix typo in eventfs_inode union comment

In reply to Steven Rostedt

From: "Steven Rostedt (Google)" <[email protected]>

It's eventfs_inode not eventfs_indoe. There's no deer involved!

Cc Masami Hiramatsu <[email protected]>
Cc Mark Rutland <[email protected]>
Fixes 5790b1fb3d672 ("eventfs: Remove eventfs_file and just use eventfs_inode")
---
 fs/tracefs/internal.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/tracefs/internal.h +1 -1
index 298d3ecaf621..64fde9490f52 100644
@@ -37,7 +37,7 @@ struct eventfs_inode {
 	/*
 	 * Union - used for deletion
 	 * @del_list:	list of eventfs_inode to delete
-	 * @rcu:	eventfs_indoe to delete in RCU
+	 * @rcu:	eventfs_inode to delete in RCU
 	 * @is_freed:	node is freed if one of the above is set
 	 */
 	union {
Signature · 1 line
2.42.0