diff options
Diffstat (limited to 'kernel/module.c')
-rw-r--r-- | kernel/module.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/kernel/module.c b/kernel/module.c index 2d537186191f..05ce49ced8f6 100644 --- a/kernel/module.c +++ b/kernel/module.c | |||
@@ -55,6 +55,11 @@ | |||
55 | #include <linux/percpu.h> | 55 | #include <linux/percpu.h> |
56 | #include <linux/kmemleak.h> | 56 | #include <linux/kmemleak.h> |
57 | 57 | ||
58 | #define CREATE_TRACE_POINTS | ||
59 | #include <trace/events/module.h> | ||
60 | |||
61 | EXPORT_TRACEPOINT_SYMBOL(module_get); | ||
62 | |||
58 | #if 0 | 63 | #if 0 |
59 | #define DEBUGP printk | 64 | #define DEBUGP printk |
60 | #else | 65 | #else |
@@ -364,7 +369,7 @@ EXPORT_SYMBOL_GPL(find_module); | |||
364 | 369 | ||
365 | #ifdef CONFIG_SMP | 370 | #ifdef CONFIG_SMP |
366 | 371 | ||
367 | #ifdef CONFIG_HAVE_DYNAMIC_PER_CPU_AREA | 372 | #ifndef CONFIG_HAVE_LEGACY_PER_CPU_AREA |
368 | 373 | ||
369 | static void *percpu_modalloc(unsigned long size, unsigned long align, | 374 | static void *percpu_modalloc(unsigned long size, unsigned long align, |
370 | const char *name) | 375 | const char *name) |
@@ -389,7 +394,7 @@ static void percpu_modfree(void *freeme) | |||
389 | free_percpu(freeme); | 394 | free_percpu(freeme); |
390 | } | 395 | } |
391 | 396 | ||
392 | #else /* ... !CONFIG_HAVE_DYNAMIC_PER_CPU_AREA */ | 397 | #else /* ... CONFIG_HAVE_LEGACY_PER_CPU_AREA */ |
393 | 398 | ||
394 | /* Number of blocks used and allocated. */ | 399 | /* Number of blocks used and allocated. */ |
395 | static unsigned int pcpu_num_used, pcpu_num_allocated; | 400 | static unsigned int pcpu_num_used, pcpu_num_allocated; |
@@ -535,7 +540,7 @@ static int percpu_modinit(void) | |||
535 | } | 540 | } |
536 | __initcall(percpu_modinit); | 541 | __initcall(percpu_modinit); |
537 | 542 | ||
538 | #endif /* CONFIG_HAVE_DYNAMIC_PER_CPU_AREA */ | 543 | #endif /* CONFIG_HAVE_LEGACY_PER_CPU_AREA */ |
539 | 544 | ||
540 | static unsigned int find_pcpusec(Elf_Ehdr *hdr, | 545 | static unsigned int find_pcpusec(Elf_Ehdr *hdr, |
541 | Elf_Shdr *sechdrs, | 546 | Elf_Shdr *sechdrs, |
@@ -942,6 +947,8 @@ void module_put(struct module *module) | |||
942 | if (module) { | 947 | if (module) { |
943 | unsigned int cpu = get_cpu(); | 948 | unsigned int cpu = get_cpu(); |
944 | local_dec(__module_ref_addr(module, cpu)); | 949 | local_dec(__module_ref_addr(module, cpu)); |
950 | trace_module_put(module, _RET_IP_, | ||
951 | local_read(__module_ref_addr(module, cpu))); | ||
945 | /* Maybe they're waiting for us to drop reference? */ | 952 | /* Maybe they're waiting for us to drop reference? */ |
946 | if (unlikely(!module_is_live(module))) | 953 | if (unlikely(!module_is_live(module))) |
947 | wake_up_process(module->waiter); | 954 | wake_up_process(module->waiter); |
@@ -1497,6 +1504,8 @@ static int __unlink_module(void *_mod) | |||
1497 | /* Free a module, remove from lists, etc (must hold module_mutex). */ | 1504 | /* Free a module, remove from lists, etc (must hold module_mutex). */ |
1498 | static void free_module(struct module *mod) | 1505 | static void free_module(struct module *mod) |
1499 | { | 1506 | { |
1507 | trace_module_free(mod); | ||
1508 | |||
1500 | /* Delete from various lists */ | 1509 | /* Delete from various lists */ |
1501 | stop_machine(__unlink_module, mod, NULL); | 1510 | stop_machine(__unlink_module, mod, NULL); |
1502 | remove_notes_attrs(mod); | 1511 | remove_notes_attrs(mod); |
@@ -2364,6 +2373,8 @@ static noinline struct module *load_module(void __user *umod, | |||
2364 | /* Get rid of temporary copy */ | 2373 | /* Get rid of temporary copy */ |
2365 | vfree(hdr); | 2374 | vfree(hdr); |
2366 | 2375 | ||
2376 | trace_module_load(mod); | ||
2377 | |||
2367 | /* Done! */ | 2378 | /* Done! */ |
2368 | return mod; | 2379 | return mod; |
2369 | 2380 | ||