diff options
author | Luis R. Rodriguez <mcgrof@kernel.org> | 2016-06-03 12:36:00 -0700 |
---|---|---|
committer | Luis R. Rodriguez <mcgrof@kernel.org> | 2016-06-23 15:23:28 -0700 |
commit | 5cef6f4b348f0e1030c7e2523a6c7749897e191a (patch) | |
tree | 848c7176d2512ef9ebfdf70c8553aac96cc4e8ee | |
parent | 8a5a6aae52141d727ff51d24cc6bad4870976f57 (diff) | |
download | linker-tables-5cef6f4b348f0e1030c7e2523a6c7749897e191a.tar.gz |
mutex: move mutex calls to .sched.text
We move mutex calls to its own sub-section, underneath .text.
We'll next try to use the standard section work we've been doing
to see how this will fit as sub-sections within the framework.
readelf -S kernel/locking/mutex.o | grep sched
[ 6] .sched.text PROGBITS 0000000000000000 000000b0
[ 7] .rela.sched.text RELA 0000000000000000 00001368
When we run ./main:
Initializing x86 bare metal world
x86-init: Number of init entries: 7
Initializing kasan ...
Early init for Kasan...
Completed initializing kasan !
Initializing memory ...
Completed initializing memory !
Initializing kprobes ...
== OK: test_kprobe_0001 within range!
== OK: test_kprobe_0002 not in range as expected!
Completed initializing kprobes !
Initializing pci ...
PCI fixup size: 1
Demo: Using LINKTABLE_FOR_EACH
foo_fixup
Demo: Using LINKTABLE_RUN_ALL
foo_fixup
Completed initializing pci !
Initializing beta ...
Completed initializing beta !
Initializing alpha ...
Completed initializing alpha !
Booting bare metal
Calling start_kernel()...
ACME: Initializing ...
ACME: Finished init ... !
ACME: Running scheduled work
Signed-off-by: Luis R. Rodriguez <mcgrof@kernel.org>
-rw-r--r-- | arch/x86/kernel/vmlinux.lds.S | 1 | ||||
-rw-r--r-- | include/linux/mutex.h | 1 | ||||
-rw-r--r-- | include/linux/sched.h | 6 | ||||
-rw-r--r-- | kernel/locking/mutex.c | 8 |
4 files changed, 12 insertions, 4 deletions
diff --git a/arch/x86/kernel/vmlinux.lds.S b/arch/x86/kernel/vmlinux.lds.S index e7378cc..cd91080 100644 --- a/arch/x86/kernel/vmlinux.lds.S +++ b/arch/x86/kernel/vmlinux.lds.S @@ -66,6 +66,7 @@ SECTIONS *(SORT(SECTION_TBL_ALL(SECTION_INIT_CALL))) *(SORT(SECTION_TBL_ALL(SECTION_EXIT))) *(SORT(SECTION_TBL_ALL(SECTION_EXIT_CALL))) + *(.sched.text) *(.text .stub .text.* .gnu.linkonce.t.*) /* .gnu.warning sections are handled specially by elf32.em. */ *(.gnu.warning) diff --git a/include/linux/mutex.h b/include/linux/mutex.h index f8134ec..4d0bb0e 100644 --- a/include/linux/mutex.h +++ b/include/linux/mutex.h @@ -1,6 +1,7 @@ #ifndef __LINUX_MUTEX_H #define __LINUX_MUTEX_H +#include <linux/sched.h> #include <pthread.h> struct mutex { diff --git a/include/linux/sched.h b/include/linux/sched.h new file mode 100644 index 0000000..b98d955 --- /dev/null +++ b/include/linux/sched.h @@ -0,0 +1,6 @@ +#ifndef _LINUX_SCHED_H +#define _LINUX_SCHED_H + +#define __sched __attribute__((__section__(".sched.text"))) + +#endif /* _LINUX_SCHED_H */ diff --git a/kernel/locking/mutex.c b/kernel/locking/mutex.c index 21e6212..a97800e 100644 --- a/kernel/locking/mutex.c +++ b/kernel/locking/mutex.c @@ -1,7 +1,7 @@ #include <linux/kernel.h> #include <linux/mutex.h> -void mutex_init(struct mutex *lock) +void __sched mutex_init(struct mutex *lock) { int r; @@ -10,17 +10,17 @@ void mutex_init(struct mutex *lock) BUG_ON(r); } -void mutex_destroy(struct mutex *lock) +void __sched mutex_destroy(struct mutex *lock) { pthread_mutex_destroy(&lock->lock); } -void mutex_lock(struct mutex *lock) +void __sched mutex_lock(struct mutex *lock) { pthread_mutex_lock(&lock->lock); } -void mutex_unlock(struct mutex *lock) +void __sched mutex_unlock(struct mutex *lock) { pthread_mutex_unlock(&lock->lock); } |