diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2015-04-14 16:58:48 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-04-14 16:58:48 -0400 |
| commit | e95e7f627062be5e6ce971ce873e6234c91ffc50 (patch) | |
| tree | c00c00f2afb284037d4acc301f3be8a35a858acd /include/linux/context_tracking.h | |
| parent | 078838d56574694d0a4815d9c1b7f28e8844638b (diff) | |
| parent | 1524b745406a85ba201cb25df72110c1ccac0f72 (diff) | |
Merge branch 'timers-nohz-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull NOHZ changes from Ingo Molnar:
"This tree adds full dynticks support to KVM guests (support the
disabling of the timer tick on the guest). The main missing piece was
the recognition of guest execution as RCU extended quiescent state and
related changes"
* 'timers-nohz-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
kvm,rcu,nohz: use RCU extended quiescent state when running KVM guest
context_tracking: Export context_tracking_user_enter/exit
context_tracking: Run vtime_user_enter/exit only when state == CONTEXT_USER
context_tracking: Add stub context_tracking_is_enabled
context_tracking: Generalize context tracking APIs to support user and guest
context_tracking: Rename context symbols to prepare for transition state
ppc: Remove unused cpp symbols in kvm headers
Diffstat (limited to 'include/linux/context_tracking.h')
| -rw-r--r-- | include/linux/context_tracking.h | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/include/linux/context_tracking.h b/include/linux/context_tracking.h index 37b81bd51ec0..2821838256b4 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 == IN_USER) | 49 | if (prev_ctx != CONTEXT_KERNEL) |
| 47 | context_tracking_user_enter(); | 50 | context_tracking_enter(prev_ctx); |
| 48 | } | 51 | } |
| 49 | } | 52 | } |
| 50 | 53 | ||
| @@ -78,10 +81,16 @@ static inline void guest_enter(void) | |||
| 78 | vtime_guest_enter(current); | 81 | vtime_guest_enter(current); |
| 79 | else | 82 | else |
| 80 | current->flags |= PF_VCPU; | 83 | current->flags |= PF_VCPU; |
| 84 | |||
| 85 | if (context_tracking_is_enabled()) | ||
| 86 | context_tracking_enter(CONTEXT_GUEST); | ||
| 81 | } | 87 | } |
| 82 | 88 | ||
| 83 | static inline void guest_exit(void) | 89 | static inline void guest_exit(void) |
| 84 | { | 90 | { |
| 91 | if (context_tracking_is_enabled()) | ||
| 92 | context_tracking_exit(CONTEXT_GUEST); | ||
| 93 | |||
| 85 | if (vtime_accounting_enabled()) | 94 | if (vtime_accounting_enabled()) |
| 86 | vtime_guest_exit(current); | 95 | vtime_guest_exit(current); |
| 87 | else | 96 | else |
