diff options
author | Rik van Riel <riel@redhat.com> | 2015-02-10 15:27:50 -0500 |
---|---|---|
committer | Frederic Weisbecker <fweisbec@gmail.com> | 2015-03-09 10:42:52 -0400 |
commit | 3aab4f50bff89bdea5066a05d4f3c5fa25bc37c7 (patch) | |
tree | bb83901091481a72fbd5327718e8cbb079a91d3e /include/linux/context_tracking.h | |
parent | c467ea763fd5d8795b7d1b5a78eb94b6ad8f66ad (diff) |
context_tracking: Generalize context tracking APIs to support user and guest
Generalize the context tracking APIs to support various nature of
contexts. This is performed by splitting out the mechanism from
context_tracking_user_enter and context_tracking_user_exit into
context_tracking_enter and context_tracking_exit.
The nature of the context we track is now detailed in a ctx_state
parameter pushed to these APIs, allowing the same functions to not just
track kernel <> user space switching, but also kernel <> guest transitions.
But leave the old functions in order to avoid breaking ARM, which calls
these functions from assembler code, and cannot easily use C enum
parameters.
Reviewed-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Signed-off-by: Rik van Riel <riel@redhat.com>
Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Will deacon <will.deacon@arm.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Christian Borntraeger <borntraeger@de.ibm.com>
Cc: Luiz Capitulino <lcapitulino@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Diffstat (limited to 'include/linux/context_tracking.h')
-rw-r--r-- | include/linux/context_tracking.h | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/include/linux/context_tracking.h b/include/linux/context_tracking.h index 427b056dfd3d..7f1810a3b5a4 100644 --- a/include/linux/context_tracking.h +++ b/include/linux/context_tracking.h | |||
@@ -10,6 +10,8 @@ | |||
10 | #ifdef CONFIG_CONTEXT_TRACKING | 10 | #ifdef CONFIG_CONTEXT_TRACKING |
11 | extern void context_tracking_cpu_set(int cpu); | 11 | extern void context_tracking_cpu_set(int cpu); |
12 | 12 | ||
13 | extern void context_tracking_enter(enum ctx_state state); | ||
14 | extern void context_tracking_exit(enum ctx_state state); | ||
13 | extern void context_tracking_user_enter(void); | 15 | extern void context_tracking_user_enter(void); |
14 | extern void context_tracking_user_exit(void); | 16 | extern void context_tracking_user_exit(void); |
15 | extern void __context_tracking_task_switch(struct task_struct *prev, | 17 | extern void __context_tracking_task_switch(struct task_struct *prev, |
@@ -35,7 +37,8 @@ static inline enum ctx_state exception_enter(void) | |||
35 | return 0; | 37 | return 0; |
36 | 38 | ||
37 | prev_ctx = this_cpu_read(context_tracking.state); | 39 | prev_ctx = this_cpu_read(context_tracking.state); |
38 | context_tracking_user_exit(); | 40 | if (prev_ctx != CONTEXT_KERNEL) |
41 | context_tracking_exit(prev_ctx); | ||
39 | 42 | ||
40 | return prev_ctx; | 43 | return prev_ctx; |
41 | } | 44 | } |
@@ -43,8 +46,8 @@ static inline enum ctx_state exception_enter(void) | |||
43 | static inline void exception_exit(enum ctx_state prev_ctx) | 46 | static inline void exception_exit(enum ctx_state prev_ctx) |
44 | { | 47 | { |
45 | if (context_tracking_is_enabled()) { | 48 | if (context_tracking_is_enabled()) { |
46 | if (prev_ctx == CONTEXT_USER) | 49 | if (prev_ctx != CONTEXT_KERNEL) |
47 | context_tracking_user_enter(); | 50 | context_tracking_enter(prev_ctx); |
48 | } | 51 | } |
49 | } | 52 | } |
50 | 53 | ||