Skip to content

Commit ae832d1

Browse files
Li Zefanrostedt
authored andcommitted
tracing: Remove side effect from module tracepoints that caused a GPF
Remove the @refcnt argument, because it has side-effects, and arguments with side-effects are not skipped by the jump over disabled instrumentation and are executed even when the tracepoint is disabled. This was also causing a GPF as found by Randy Dunlap: Subject: 2.6.33 GP fault only when built with tracing LKML-Reference: <4BA2B69D.3000309@oracle.com> Note, the current 2.6.34-rc has a fix for the actual cause of the GPF, but this fixes one of its triggers. Tested-by: Randy Dunlap <randy.dunlap@oracle.com> Acked-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> Signed-off-by: Li Zefan <lizf@cn.fujitsu.com> LKML-Reference: <4BA97FA7.6040406@cn.fujitsu.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
1 parent 50354a8 commit ae832d1

3 files changed

Lines changed: 10 additions & 13 deletions

File tree

‎include/linux/module.h‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -460,8 +460,7 @@ static inline void __module_get(struct module *module)
460460
if (module) {
461461
preempt_disable();
462462
__this_cpu_inc(module->refptr->count);
463-
trace_module_get(module, _THIS_IP_,
464-
__this_cpu_read(module->refptr->count));
463+
trace_module_get(module, _THIS_IP_);
465464
preempt_enable();
466465
}
467466
}
@@ -475,8 +474,7 @@ static inline int try_module_get(struct module *module)
475474

476475
if (likely(module_is_live(module))) {
477476
__this_cpu_inc(module->refptr->count);
478-
trace_module_get(module, _THIS_IP_,
479-
__this_cpu_read(module->refptr->count));
477+
trace_module_get(module, _THIS_IP_);
480478
}
481479
else
482480
ret = 0;

‎include/trace/events/module.h‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,9 @@ TRACE_EVENT(module_free,
5353

5454
DECLARE_EVENT_CLASS(module_refcnt,
5555

56-
TP_PROTO(struct module *mod, unsigned long ip, int refcnt),
56+
TP_PROTO(struct module *mod, unsigned long ip),
5757

58-
TP_ARGS(mod, ip, refcnt),
58+
TP_ARGS(mod, ip),
5959

6060
TP_STRUCT__entry(
6161
__field( unsigned long, ip )
@@ -65,7 +65,7 @@ DECLARE_EVENT_CLASS(module_refcnt,
6565

6666
TP_fast_assign(
6767
__entry->ip = ip;
68-
__entry->refcnt = refcnt;
68+
__entry->refcnt = __this_cpu_read(mod->refptr->count);
6969
__assign_str(name, mod->name);
7070
),
7171

@@ -75,16 +75,16 @@ DECLARE_EVENT_CLASS(module_refcnt,
7575

7676
DEFINE_EVENT(module_refcnt, module_get,
7777

78-
TP_PROTO(struct module *mod, unsigned long ip, int refcnt),
78+
TP_PROTO(struct module *mod, unsigned long ip),
7979

80-
TP_ARGS(mod, ip, refcnt)
80+
TP_ARGS(mod, ip)
8181
);
8282

8383
DEFINE_EVENT(module_refcnt, module_put,
8484

85-
TP_PROTO(struct module *mod, unsigned long ip, int refcnt),
85+
TP_PROTO(struct module *mod, unsigned long ip),
8686

87-
TP_ARGS(mod, ip, refcnt)
87+
TP_ARGS(mod, ip)
8888
);
8989

9090
TRACE_EVENT(module_request,

‎kernel/module.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -800,8 +800,7 @@ void module_put(struct module *module)
800800
preempt_disable();
801801
__this_cpu_dec(module->refptr->count);
802802

803-
trace_module_put(module, _RET_IP_,
804-
__this_cpu_read(module->refptr->count));
803+
trace_module_put(module, _RET_IP_);
805804
/* Maybe they're waiting for us to drop reference? */
806805
if (unlikely(!module_is_live(module)))
807806
wake_up_process(module->waiter);

0 commit comments

Comments
 (0)