* [PATCH 1/2] kernel: Use CALLER_ADDR0 macro.
@ 2009-12-20 18:07 Thiago Farina
2009-12-20 18:07 ` [PATCH 2/2] gfs2: " Thiago Farina
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Thiago Farina @ 2009-12-20 18:07 UTC (permalink / raw)
To: linux-kernel
Cc: Ingo Molnar, Frederic Weisbecker, Andrew Morton, Andi Kleen,
Arjan van de Ven, Steven Rostedt, Paul E. McKenney, Yinghai Lu
Use CALLER_ADDR0 instead of (unsigned long)__builtin_return_address(0),
since this macro was created for this.
This patch was generated by:
sed -i "s/(unsigned long)__builtin_return_address(0)/CALLER_ADDR0/g" path/to/file
Signed-off-by: Thiago Farina <tfransosi@gmail.com>
---
kernel/panic.c | 2 +-
kernel/softirq.c | 8 ++++----
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/kernel/panic.c b/kernel/panic.c
index 5827f7b..55b0b71 100644
--- a/kernel/panic.c
+++ b/kernel/panic.c
@@ -129,7 +129,7 @@ NORET_TYPE void panic(const char * fmt, ...)
{
unsigned long caller;
- caller = (unsigned long)__builtin_return_address(0);
+ caller = CALLER_ADDR0;
disabled_wait(caller);
}
#endif
diff --git a/kernel/softirq.c b/kernel/softirq.c
index a09502e..979e029 100644
--- a/kernel/softirq.c
+++ b/kernel/softirq.c
@@ -116,7 +116,7 @@ static inline void __local_bh_disable(unsigned long ip)
void local_bh_disable(void)
{
- __local_bh_disable((unsigned long)__builtin_return_address(0));
+ __local_bh_disable(CALLER_ADDR0);
}
EXPORT_SYMBOL(local_bh_disable);
@@ -132,7 +132,7 @@ void _local_bh_enable(void)
WARN_ON_ONCE(!irqs_disabled());
if (softirq_count() == SOFTIRQ_OFFSET)
- trace_softirqs_on((unsigned long)__builtin_return_address(0));
+ trace_softirqs_on(CALLER_ADDR0);
sub_preempt_count(SOFTIRQ_OFFSET);
}
@@ -167,7 +167,7 @@ static inline void _local_bh_enable_ip(unsigned long ip)
void local_bh_enable(void)
{
- _local_bh_enable_ip((unsigned long)__builtin_return_address(0));
+ _local_bh_enable_ip(CALLER_ADDR0);
}
EXPORT_SYMBOL(local_bh_enable);
@@ -198,7 +198,7 @@ asmlinkage void __do_softirq(void)
pending = local_softirq_pending();
account_system_vtime(current);
- __local_bh_disable((unsigned long)__builtin_return_address(0));
+ __local_bh_disable(CALLER_ADDR0);
lockdep_softirq_enter();
cpu = smp_processor_id();
--
1.6.6.rc0.61.g41d5b
^ permalink raw reply related [flat|nested] 6+ messages in thread* [PATCH 2/2] gfs2: Use CALLER_ADDR0 macro. 2009-12-20 18:07 [PATCH 1/2] kernel: Use CALLER_ADDR0 macro Thiago Farina @ 2009-12-20 18:07 ` Thiago Farina 2009-12-21 9:22 ` Steven Whitehouse 2009-12-20 19:03 ` [PATCH 1/2] kernel: " Andi Kleen 2009-12-28 10:10 ` [tip:core/cleanups] " tip-bot for Thiago Farina 2 siblings, 1 reply; 6+ messages in thread From: Thiago Farina @ 2009-12-20 18:07 UTC (permalink / raw) To: linux-kernel Cc: Steven Whitehouse, Benjamin Marzinski, David Teigland, Thiago Farina, cluster-devel Use CALLER_ADDR0 instead of (unsigned long)__builtin_return_address(0), since this macro was created for this. This patch was generated by: sed -i "s/(unsigned long)__builtin_return_address(0)/CALLER_ADDR0/g" path/to/file Signed-off-by: Thiago Farina <tfransosi@gmail.com> --- fs/gfs2/glock.c | 5 +++-- fs/gfs2/glops.c | 3 ++- fs/gfs2/trans.c | 3 ++- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c index f455a03..216898d 100644 --- a/fs/gfs2/glock.c +++ b/fs/gfs2/glock.c @@ -27,6 +27,7 @@ #include <linux/freezer.h> #include <linux/workqueue.h> #include <linux/jiffies.h> +#include <linux/ftrace.h> #include "gfs2.h" #include "incore.h" @@ -831,7 +832,7 @@ void gfs2_holder_init(struct gfs2_glock *gl, unsigned int state, unsigned flags, { INIT_LIST_HEAD(&gh->gh_list); gh->gh_gl = gl; - gh->gh_ip = (unsigned long)__builtin_return_address(0); + gh->gh_ip = CALLER_ADDR0; gh->gh_owner_pid = get_pid(task_pid(current)); gh->gh_state = state; gh->gh_flags = flags; @@ -855,7 +856,7 @@ void gfs2_holder_reinit(unsigned int state, unsigned flags, struct gfs2_holder * gh->gh_state = state; gh->gh_flags = flags; gh->gh_iflags = 0; - gh->gh_ip = (unsigned long)__builtin_return_address(0); + gh->gh_ip = CALLER_ADDR0; } /** diff --git a/fs/gfs2/glops.c b/fs/gfs2/glops.c index 78554ac..b8331d8 100644 --- a/fs/gfs2/glops.c +++ b/fs/gfs2/glops.c @@ -14,6 +14,7 @@ #include <linux/gfs2_ondisk.h> #include <linux/bio.h> #include <linux/posix_acl.h> +#include <linux/ftrace.h> #include "gfs2.h" #include "incore.h" @@ -51,7 +52,7 @@ static void gfs2_ail_empty_gl(struct gfs2_glock *gl) /* A shortened, inline version of gfs2_trans_begin() */ tr.tr_reserved = 1 + gfs2_struct2blk(sdp, tr.tr_revokes, sizeof(u64)); - tr.tr_ip = (unsigned long)__builtin_return_address(0); + tr.tr_ip = CALLER_ADDR0; INIT_LIST_HEAD(&tr.tr_list_buf); gfs2_log_reserve(sdp, tr.tr_reserved); BUG_ON(current->journal_info); diff --git a/fs/gfs2/trans.c b/fs/gfs2/trans.c index 4ef0e9f..9355c73 100644 --- a/fs/gfs2/trans.c +++ b/fs/gfs2/trans.c @@ -14,6 +14,7 @@ #include <linux/buffer_head.h> #include <linux/kallsyms.h> #include <linux/gfs2_ondisk.h> +#include <linux/ftrace.h> #include "gfs2.h" #include "incore.h" @@ -40,7 +41,7 @@ int gfs2_trans_begin(struct gfs2_sbd *sdp, unsigned int blocks, if (!tr) return -ENOMEM; - tr->tr_ip = (unsigned long)__builtin_return_address(0); + tr->tr_ip = CALLER_ADDR0; tr->tr_blocks = blocks; tr->tr_revokes = revokes; tr->tr_reserved = 1; -- 1.6.6.rc0.61.g41d5b ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] gfs2: Use CALLER_ADDR0 macro. 2009-12-20 18:07 ` [PATCH 2/2] gfs2: " Thiago Farina @ 2009-12-21 9:22 ` Steven Whitehouse 2009-12-21 13:43 ` Christoph Hellwig 0 siblings, 1 reply; 6+ messages in thread From: Steven Whitehouse @ 2009-12-21 9:22 UTC (permalink / raw) To: Thiago Farina Cc: linux-kernel, Benjamin Marzinski, David Teigland, cluster-devel Hi, Looks fairly harmless, even though I don't entirely see the point. Do you want me to add this to me tree? Acked-by: Steven Whitehouse <swhiteho@redhat.com> Steve. On Sun, 2009-12-20 at 13:07 -0500, Thiago Farina wrote: > Use CALLER_ADDR0 instead of (unsigned long)__builtin_return_address(0), > since this macro was created for this. > > This patch was generated by: > sed -i "s/(unsigned long)__builtin_return_address(0)/CALLER_ADDR0/g" path/to/file > > Signed-off-by: Thiago Farina <tfransosi@gmail.com> > --- > fs/gfs2/glock.c | 5 +++-- > fs/gfs2/glops.c | 3 ++- > fs/gfs2/trans.c | 3 ++- > 3 files changed, 7 insertions(+), 4 deletions(-) > > diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c > index f455a03..216898d 100644 > --- a/fs/gfs2/glock.c > +++ b/fs/gfs2/glock.c > @@ -27,6 +27,7 @@ > #include <linux/freezer.h> > #include <linux/workqueue.h> > #include <linux/jiffies.h> > +#include <linux/ftrace.h> > > #include "gfs2.h" > #include "incore.h" > @@ -831,7 +832,7 @@ void gfs2_holder_init(struct gfs2_glock *gl, unsigned int state, unsigned flags, > { > INIT_LIST_HEAD(&gh->gh_list); > gh->gh_gl = gl; > - gh->gh_ip = (unsigned long)__builtin_return_address(0); > + gh->gh_ip = CALLER_ADDR0; > gh->gh_owner_pid = get_pid(task_pid(current)); > gh->gh_state = state; > gh->gh_flags = flags; > @@ -855,7 +856,7 @@ void gfs2_holder_reinit(unsigned int state, unsigned flags, struct gfs2_holder * > gh->gh_state = state; > gh->gh_flags = flags; > gh->gh_iflags = 0; > - gh->gh_ip = (unsigned long)__builtin_return_address(0); > + gh->gh_ip = CALLER_ADDR0; > } > > /** > diff --git a/fs/gfs2/glops.c b/fs/gfs2/glops.c > index 78554ac..b8331d8 100644 > --- a/fs/gfs2/glops.c > +++ b/fs/gfs2/glops.c > @@ -14,6 +14,7 @@ > #include <linux/gfs2_ondisk.h> > #include <linux/bio.h> > #include <linux/posix_acl.h> > +#include <linux/ftrace.h> > > #include "gfs2.h" > #include "incore.h" > @@ -51,7 +52,7 @@ static void gfs2_ail_empty_gl(struct gfs2_glock *gl) > > /* A shortened, inline version of gfs2_trans_begin() */ > tr.tr_reserved = 1 + gfs2_struct2blk(sdp, tr.tr_revokes, sizeof(u64)); > - tr.tr_ip = (unsigned long)__builtin_return_address(0); > + tr.tr_ip = CALLER_ADDR0; > INIT_LIST_HEAD(&tr.tr_list_buf); > gfs2_log_reserve(sdp, tr.tr_reserved); > BUG_ON(current->journal_info); > diff --git a/fs/gfs2/trans.c b/fs/gfs2/trans.c > index 4ef0e9f..9355c73 100644 > --- a/fs/gfs2/trans.c > +++ b/fs/gfs2/trans.c > @@ -14,6 +14,7 @@ > #include <linux/buffer_head.h> > #include <linux/kallsyms.h> > #include <linux/gfs2_ondisk.h> > +#include <linux/ftrace.h> > > #include "gfs2.h" > #include "incore.h" > @@ -40,7 +41,7 @@ int gfs2_trans_begin(struct gfs2_sbd *sdp, unsigned int blocks, > if (!tr) > return -ENOMEM; > > - tr->tr_ip = (unsigned long)__builtin_return_address(0); > + tr->tr_ip = CALLER_ADDR0; > tr->tr_blocks = blocks; > tr->tr_revokes = revokes; > tr->tr_reserved = 1; ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] gfs2: Use CALLER_ADDR0 macro. 2009-12-21 9:22 ` Steven Whitehouse @ 2009-12-21 13:43 ` Christoph Hellwig 0 siblings, 0 replies; 6+ messages in thread From: Christoph Hellwig @ 2009-12-21 13:43 UTC (permalink / raw) To: Steven Whitehouse Cc: Thiago Farina, linux-kernel, Benjamin Marzinski, David Teigland, cluster-devel On Mon, Dec 21, 2009 at 09:22:41AM +0000, Steven Whitehouse wrote: > Hi, > > Looks fairly harmless, even though I don't entirely see the point. Do > you want me to add this to me tree? We also have a _RET_IP_ macro that does the same and has a much more useful name. And given that we need the address as void pointer to print it using our printk extension both seem a bit supoptimal. Given that a lot of tracing code needs this a bit of standardization would be useful - more important for the type to store the address than just the macro name. ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] kernel: Use CALLER_ADDR0 macro. 2009-12-20 18:07 [PATCH 1/2] kernel: Use CALLER_ADDR0 macro Thiago Farina 2009-12-20 18:07 ` [PATCH 2/2] gfs2: " Thiago Farina @ 2009-12-20 19:03 ` Andi Kleen 2009-12-28 10:10 ` [tip:core/cleanups] " tip-bot for Thiago Farina 2 siblings, 0 replies; 6+ messages in thread From: Andi Kleen @ 2009-12-20 19:03 UTC (permalink / raw) To: Thiago Farina Cc: linux-kernel, Ingo Molnar, Frederic Weisbecker, Andrew Morton, Arjan van de Ven, Steven Rostedt, Paul E. McKenney, Yinghai Lu Thiago Farina wrote: > Use CALLER_ADDR0 instead of (unsigned long)__builtin_return_address(0), > since this macro was created for this. > > This patch was generated by: > sed -i "s/(unsigned long)__builtin_return_address(0)/CALLER_ADDR0/g" path/to/file The new macro looks more obfuscated than the old straight forward call. I fail to see the improvement. -Andi ^ permalink raw reply [flat|nested] 6+ messages in thread
* [tip:core/cleanups] kernel: Use CALLER_ADDR0 macro 2009-12-20 18:07 [PATCH 1/2] kernel: Use CALLER_ADDR0 macro Thiago Farina 2009-12-20 18:07 ` [PATCH 2/2] gfs2: " Thiago Farina 2009-12-20 19:03 ` [PATCH 1/2] kernel: " Andi Kleen @ 2009-12-28 10:10 ` tip-bot for Thiago Farina 2 siblings, 0 replies; 6+ messages in thread From: tip-bot for Thiago Farina @ 2009-12-28 10:10 UTC (permalink / raw) To: linux-tip-commits Cc: linux-kernel, hpa, mingo, yinghai, arjan, tfransosi, paulmck, fweisbec, rostedt, ak, tglx, mingo Commit-ID: eba3fe4416f3cc2ce043fb304b6c35a69dca3bdb Gitweb: http://git.kernel.org/tip/eba3fe4416f3cc2ce043fb304b6c35a69dca3bdb Author: Thiago Farina <tfransosi@gmail.com> AuthorDate: Sun, 20 Dec 2009 13:07:46 -0500 Committer: Ingo Molnar <mingo@elte.hu> CommitDate: Mon, 28 Dec 2009 10:49:18 +0100 kernel: Use CALLER_ADDR0 macro Use CALLER_ADDR0 instead of (unsigned long)__builtin_return_address(0), since this macro was created for this. This patch was generated by: sed -i "s/(unsigned long)__builtin_return_address(0)/CALLER_ADDR0/g" path/to/file Signed-off-by: Thiago Farina <tfransosi@gmail.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Andi Kleen <ak@linux.intel.com> Cc: Arjan van de Ven <arjan@linux.intel.com> Cc: Steven Rostedt <rostedt@goodmis.org> Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com> Cc: Yinghai Lu <yinghai@kernel.org> LKML-Reference: <1261332469-25298-1-git-send-email-tfransosi@gmail.com> Signed-off-by: Ingo Molnar <mingo@elte.hu> --- kernel/panic.c | 2 +- kernel/softirq.c | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/kernel/panic.c b/kernel/panic.c index 5827f7b..55b0b71 100644 --- a/kernel/panic.c +++ b/kernel/panic.c @@ -129,7 +129,7 @@ NORET_TYPE void panic(const char * fmt, ...) { unsigned long caller; - caller = (unsigned long)__builtin_return_address(0); + caller = CALLER_ADDR0; disabled_wait(caller); } #endif diff --git a/kernel/softirq.c b/kernel/softirq.c index a09502e..979e029 100644 --- a/kernel/softirq.c +++ b/kernel/softirq.c @@ -116,7 +116,7 @@ static inline void __local_bh_disable(unsigned long ip) void local_bh_disable(void) { - __local_bh_disable((unsigned long)__builtin_return_address(0)); + __local_bh_disable(CALLER_ADDR0); } EXPORT_SYMBOL(local_bh_disable); @@ -132,7 +132,7 @@ void _local_bh_enable(void) WARN_ON_ONCE(!irqs_disabled()); if (softirq_count() == SOFTIRQ_OFFSET) - trace_softirqs_on((unsigned long)__builtin_return_address(0)); + trace_softirqs_on(CALLER_ADDR0); sub_preempt_count(SOFTIRQ_OFFSET); } @@ -167,7 +167,7 @@ static inline void _local_bh_enable_ip(unsigned long ip) void local_bh_enable(void) { - _local_bh_enable_ip((unsigned long)__builtin_return_address(0)); + _local_bh_enable_ip(CALLER_ADDR0); } EXPORT_SYMBOL(local_bh_enable); @@ -198,7 +198,7 @@ asmlinkage void __do_softirq(void) pending = local_softirq_pending(); account_system_vtime(current); - __local_bh_disable((unsigned long)__builtin_return_address(0)); + __local_bh_disable(CALLER_ADDR0); lockdep_softirq_enter(); cpu = smp_processor_id(); ^ permalink raw reply related [flat|nested] 6+ messages in thread
end of thread, other threads:[~2009-12-28 10:13 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2009-12-20 18:07 [PATCH 1/2] kernel: Use CALLER_ADDR0 macro Thiago Farina 2009-12-20 18:07 ` [PATCH 2/2] gfs2: " Thiago Farina 2009-12-21 9:22 ` Steven Whitehouse 2009-12-21 13:43 ` Christoph Hellwig 2009-12-20 19:03 ` [PATCH 1/2] kernel: " Andi Kleen 2009-12-28 10:10 ` [tip:core/cleanups] " tip-bot for Thiago Farina
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox