aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/context_tracking.h
diff options
context:
space:
mode:
authorDaniel Vetter <daniel.vetter@ffwll.ch>2013-05-21 03:52:16 -0400
committerDaniel Vetter <daniel.vetter@ffwll.ch>2013-05-21 03:52:16 -0400
commite1b73cba13a0cc68dd4f746eced15bd6bb24cda4 (patch)
treeb1c9e10730724024a700031ad56c20419dabb500 /include/linux/context_tracking.h
parent98304ad186296dc1e655399e28d5973c21db6a73 (diff)
parentc7788792a5e7b0d5d7f96d0766b4cb6112d47d75 (diff)
Merge tag 'v3.10-rc2' into drm-intel-next-queued
Backmerge Linux 3.10-rc2 since the various (rather trivial) conflicts grew a bit out of hand. intel_dp.c has the only real functional conflict since the logic changed while dev_priv->edp.bpp was moved around. Also squash in a whitespace fixup from Ben Widawsky for i915_gem_gtt.c, git seems to do something pretty strange in there (which I don't fully understand tbh). Conflicts: drivers/gpu/drm/i915/i915_reg.h drivers/gpu/drm/i915/intel_dp.c Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'include/linux/context_tracking.h')
-rw-r--r--include/linux/context_tracking.h24
1 files changed, 22 insertions, 2 deletions
diff --git a/include/linux/context_tracking.h b/include/linux/context_tracking.h
index b28d161c1091..365f4a61bf04 100644
--- a/include/linux/context_tracking.h
+++ b/include/linux/context_tracking.h
@@ -1,9 +1,9 @@
1#ifndef _LINUX_CONTEXT_TRACKING_H 1#ifndef _LINUX_CONTEXT_TRACKING_H
2#define _LINUX_CONTEXT_TRACKING_H 2#define _LINUX_CONTEXT_TRACKING_H
3 3
4#ifdef CONFIG_CONTEXT_TRACKING
5#include <linux/sched.h> 4#include <linux/sched.h>
6#include <linux/percpu.h> 5#include <linux/percpu.h>
6#include <asm/ptrace.h>
7 7
8struct context_tracking { 8struct context_tracking {
9 /* 9 /*
@@ -13,12 +13,13 @@ struct context_tracking {
13 * may be further optimized using static keys. 13 * may be further optimized using static keys.
14 */ 14 */
15 bool active; 15 bool active;
16 enum { 16 enum ctx_state {
17 IN_KERNEL = 0, 17 IN_KERNEL = 0,
18 IN_USER, 18 IN_USER,
19 } state; 19 } state;
20}; 20};
21 21
22#ifdef CONFIG_CONTEXT_TRACKING
22DECLARE_PER_CPU(struct context_tracking, context_tracking); 23DECLARE_PER_CPU(struct context_tracking, context_tracking);
23 24
24static inline bool context_tracking_in_user(void) 25static inline bool context_tracking_in_user(void)
@@ -33,12 +34,31 @@ static inline bool context_tracking_active(void)
33 34
34extern void user_enter(void); 35extern void user_enter(void);
35extern void user_exit(void); 36extern void user_exit(void);
37
38static inline enum ctx_state exception_enter(void)
39{
40 enum ctx_state prev_ctx;
41
42 prev_ctx = this_cpu_read(context_tracking.state);
43 user_exit();
44
45 return prev_ctx;
46}
47
48static inline void exception_exit(enum ctx_state prev_ctx)
49{
50 if (prev_ctx == IN_USER)
51 user_enter();
52}
53
36extern void context_tracking_task_switch(struct task_struct *prev, 54extern void context_tracking_task_switch(struct task_struct *prev,
37 struct task_struct *next); 55 struct task_struct *next);
38#else 56#else
39static inline bool context_tracking_in_user(void) { return false; } 57static inline bool context_tracking_in_user(void) { return false; }
40static inline void user_enter(void) { } 58static inline void user_enter(void) { }
41static inline void user_exit(void) { } 59static inline void user_exit(void) { }
60static inline enum ctx_state exception_enter(void) { return 0; }
61static inline void exception_exit(enum ctx_state prev_ctx) { }
42static inline void context_tracking_task_switch(struct task_struct *prev, 62static inline void context_tracking_task_switch(struct task_struct *prev,
43 struct task_struct *next) { } 63 struct task_struct *next) { }
44#endif /* !CONFIG_CONTEXT_TRACKING */ 64#endif /* !CONFIG_CONTEXT_TRACKING */