public inbox for linux-next@vger.kernel.org 
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis•org>
To: Stephen Rothwell <sfr@canb•auug.org.au>
Cc: linux-next@vger•kernel.org, linux-kernel@vger•kernel.org
Subject: Re: linux-next: build failure after merge of the ftrace tree
Date: Fri, 01 Mar 2013 21:45:18 -0500	[thread overview]
Message-ID: <1362192318.1231.67.camel@gandalf.local.home> (raw)
In-Reply-To: <20130301134738.ce925e1643a35b0a2c4ff275@canb.auug.org.au>

On Fri, 2013-03-01 at 13:47 +1100, Stephen Rothwell wrote:
> Hi Steven,
> 
> After merging the ftrace tree, today's linux-next build (x86_64
> allmodconfig) failed like this:
> 
> kernel/trace/trace_kdb.c: In function 'ftrace_dump_buf':
> kernel/trace/trace_kdb.c:29:33: error: invalid type argument of '->' (have 'struct trace_array_cpu')
> kernel/trace/trace_kdb.c:86:33: error: invalid type argument of '->' (have 'struct trace_array_cpu')
> 
> Caused by commit eaac1836c10e ("tracing: Replace the static global
> per_cpu arrays with allocated per_cpu").
> 
> I have used the ftrace tree from next-20130228 for today.

I rebased, and it should all be good now. I also fixed breakage to the
new snapshot feature. Here's my diff:

-- Steve

diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index af7be82..b36befa 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -4133,14 +4133,30 @@ static int tracing_clock_open(struct inode *inode, struct file *file)
 #ifdef CONFIG_TRACER_SNAPSHOT
 static int tracing_snapshot_open(struct inode *inode, struct file *file)
 {
+	struct trace_cpu *tc = inode->i_private;
 	struct trace_iterator *iter;
+	struct seq_file *m;
 	int ret = 0;
 
 	if (file->f_mode & FMODE_READ) {
 		iter = __tracing_open(inode, file, true);
 		if (IS_ERR(iter))
 			ret = PTR_ERR(iter);
+	} else {
+		/* Writes still need the seq_file to hold the private data */
+		m = kzalloc(sizeof(*m), GFP_KERNEL);
+		if (!m)
+			return -ENOMEM;
+		iter = kzalloc(sizeof(*iter), GFP_KERNEL);
+		if (!iter) {
+			kfree(m);
+			return -ENOMEM;
+		}
+		iter->tr = tc->tr;
+		m->private = iter;
+		file->private_data = m;
 	}
+
 	return ret;
 }
 
@@ -4148,7 +4164,9 @@ static ssize_t
 tracing_snapshot_write(struct file *filp, const char __user *ubuf, size_t cnt,
 		       loff_t *ppos)
 {
-	struct trace_array *tr = filp->private_data;
+	struct seq_file *m = filp->private_data;
+	struct trace_iterator *iter = m->private;
+	struct trace_array *tr = iter->tr;
 	unsigned long val;
 	int ret;
 
@@ -4209,6 +4227,22 @@ out:
 	mutex_unlock(&trace_types_lock);
 	return ret;
 }
+
+static int tracing_snapshot_release(struct inode *inode, struct file *file)
+{
+	struct seq_file *m = file->private_data;
+
+	if (file->f_mode & FMODE_READ)
+		return tracing_release(inode, file);
+
+	/* If write only, the seq_file is just a stub */
+	if (m)
+		kfree(m->private);
+	kfree(m);
+
+	return 0;
+}
+
 #endif /* CONFIG_TRACER_SNAPSHOT */
 
 
@@ -4273,7 +4307,7 @@ static const struct file_operations snapshot_fops = {
 	.read		= seq_read,
 	.write		= tracing_snapshot_write,
 	.llseek		= tracing_seek,
-	.release	= tracing_release,
+	.release	= tracing_snapshot_release,
 };
 #endif /* CONFIG_TRACER_SNAPSHOT */
 
@@ -5284,7 +5318,7 @@ static __init int tracer_init_debugfs(void)
 
 #ifdef CONFIG_TRACER_SNAPSHOT
 	trace_create_file("snapshot", 0644, d_tracer,
-			  (void *) RING_BUFFER_ALL_CPUS, &snapshot_fops);
+			  (void *)&global_trace.trace_cpu, &snapshot_fops);
 #endif
 
 	create_trace_instances(d_tracer);
diff --git a/kernel/trace/trace_kdb.c b/kernel/trace/trace_kdb.c
index cc1dbdc..349f694 100644
--- a/kernel/trace/trace_kdb.c
+++ b/kernel/trace/trace_kdb.c
@@ -26,7 +26,7 @@ static void ftrace_dump_buf(int skip_lines, long cpu_file)
 	trace_init_global_iter(&iter);
 
 	for_each_tracing_cpu(cpu) {
-		atomic_inc(&iter.tr->data[cpu]->disabled);
+		atomic_inc(&per_cpu_ptr(iter.tr->data, cpu)->disabled);
 	}
 
 	old_userobj = trace_flags;
@@ -83,7 +83,7 @@ out:
 	trace_flags = old_userobj;
 
 	for_each_tracing_cpu(cpu) {
-		atomic_dec(&iter.tr->data[cpu]->disabled);
+		atomic_dec(&per_cpu_ptr(iter.tr->data, cpu)->disabled);
 	}
 
 	for_each_tracing_cpu(cpu)

  parent reply	other threads:[~2013-03-02  2:45 UTC|newest]

Thread overview: 66+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-01  2:47 linux-next: build failure after merge of the ftrace tree Stephen Rothwell
2013-03-01  3:06 ` Steven Rostedt
2013-03-02  2:45 ` Steven Rostedt [this message]
2013-03-02  3:42   ` Stephen Rothwell
2013-03-02  3:55     ` Steven Rostedt
2013-03-02  4:17       ` Stephen Rothwell
2013-03-02  4:22         ` Steven Rostedt
2013-03-02  4:55           ` Stephen Rothwell
  -- strict thread matches above, loose matches on Subject: below --
2014-11-21  7:32 Stephen Rothwell
2014-11-21 10:50 ` Jiri Kosina
2014-11-21 14:20   ` Steven Rostedt
2014-11-21 14:23     ` Jiri Kosina
2014-11-21 14:27     ` Steven Rostedt
2014-11-21 12:43 ` Steven Rostedt
2020-06-03  7:42 Stephen Rothwell
2020-06-03 15:10 ` Tom Zanussi
2020-06-03 15:22 ` Steven Rostedt
2020-06-03 15:24   ` Tom Zanussi
2020-06-03 15:30     ` Steven Rostedt
2020-06-03 21:49       ` Stephen Rothwell
2021-06-10  8:08 Stephen Rothwell
2021-06-10  8:26 ` Peter Zijlstra
2021-06-10 15:06   ` Steven Rostedt
2021-06-15  6:51     ` Mark-PK Tsai
2022-01-12  0:31 Stephen Rothwell
2022-01-14  1:02 ` Stephen Rothwell
2022-01-14  1:04   ` Steven Rostedt
2022-01-14  2:16   ` Steven Rostedt
2022-01-14  2:58     ` Stephen Rothwell
2022-01-14  3:02       ` Stephen Rothwell
2022-01-14  3:25         ` Steven Rostedt
2022-01-14  3:34           ` Stephen Rothwell
2022-01-14  3:50             ` Steven Rostedt
2022-01-14  5:12               ` Yinan Liu
2022-01-14  6:42               ` Stephen Rothwell
2023-10-23  2:30 Stephen Rothwell
2023-10-23  3:32 ` Matthew Wilcox
2023-10-23 13:41   ` Steven Rostedt
2023-10-26  1:18 ` Stephen Rothwell
2023-10-26  1:21   ` Steven Rostedt
2024-10-10  2:46 Stephen Rothwell
2024-10-10  3:13 ` Donglin Peng
2024-10-10 13:27 ` Steven Rostedt
2024-10-10 14:08   ` Donglin Peng
2024-10-10 15:04     ` Steven Rostedt
2024-10-10 15:58     ` Steven Rostedt
2024-11-06  3:04 Stephen Rothwell
2024-11-06 15:02 ` Steven Rostedt
2024-11-06 17:47   ` Linus Torvalds
2024-11-20 23:27 ` Stephen Rothwell
2024-11-08  4:21 Stephen Rothwell
2024-11-08 14:59 ` Steven Rostedt
2024-11-08 15:09   ` Alice Ryhl
2024-11-08 20:35     ` Steven Rostedt
2024-11-08 21:05       ` Miguel Ojeda
2024-11-08 21:53         ` Miguel Ojeda
2024-11-09 11:09           ` Steven Rostedt
2024-11-09 11:55             ` Miguel Ojeda
2024-11-09 13:03               ` Steven Rostedt
2024-11-09 16:57                 ` Miguel Ojeda
2025-03-11  5:27 Stephen Rothwell
2025-03-11 13:22 ` Steven Rostedt
2025-10-02 15:50 Mark Brown
2025-10-06  0:31 ` Masami Hiramatsu
2025-11-06  1:33 Stephen Rothwell
2025-11-06  2:01 ` Steven Rostedt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1362192318.1231.67.camel@gandalf.local.home \
    --to=rostedt@goodmis$(echo .)org \
    --cc=linux-kernel@vger$(echo .)kernel.org \
    --cc=linux-next@vger$(echo .)kernel.org \
    --cc=sfr@canb$(echo .)auug.org.au \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox