Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 377247
b: refs/heads/master
c: 521921b
h: refs/heads/master
i:
  377245: f412c11
  377243: aed6311
  377239: c216282
  377231: 3fe4dc3
  377215: 8636674
v: v3
  • Loading branch information
Frederic Weisbecker authored and Ingo Molnar committed May 31, 2013
1 parent ab3be14 commit 7268ac0
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 38 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 45eacc692771bd2b1ea3d384e6345cab3da10861
refs/heads/master: 521921bad1192fb1b8f9b6a5aa673635848b8b5f
35 changes: 35 additions & 0 deletions trunk/include/linux/context_tracking.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#include <linux/sched.h>
#include <linux/percpu.h>
#include <linux/vtime.h>
#include <asm/ptrace.h>

struct context_tracking {
Expand All @@ -19,6 +20,26 @@ struct context_tracking {
} state;
};

static inline void __guest_enter(void)
{
/*
* This is running in ioctl context so we can avoid
* the call to vtime_account() with its unnecessary idle check.
*/
vtime_account_system(current);
current->flags |= PF_VCPU;
}

static inline void __guest_exit(void)
{
/*
* This is running in ioctl context so we can avoid
* the call to vtime_account() with its unnecessary idle check.
*/
vtime_account_system(current);
current->flags &= ~PF_VCPU;
}

#ifdef CONFIG_CONTEXT_TRACKING
DECLARE_PER_CPU(struct context_tracking, context_tracking);

Expand All @@ -35,6 +56,9 @@ static inline bool context_tracking_active(void)
extern void user_enter(void);
extern void user_exit(void);

extern void guest_enter(void);
extern void guest_exit(void);

static inline enum ctx_state exception_enter(void)
{
enum ctx_state prev_ctx;
Expand All @@ -57,6 +81,17 @@ extern void context_tracking_task_switch(struct task_struct *prev,
static inline bool context_tracking_in_user(void) { return false; }
static inline void user_enter(void) { }
static inline void user_exit(void) { }

static inline void guest_enter(void)
{
__guest_enter();
}

static inline void guest_exit(void)
{
__guest_exit();
}

static inline enum ctx_state exception_enter(void) { return 0; }
static inline void exception_exit(enum ctx_state prev_ctx) { }
static inline void context_tracking_task_switch(struct task_struct *prev,
Expand Down
37 changes: 1 addition & 36 deletions trunk/include/linux/kvm_host.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include <linux/ratelimit.h>
#include <linux/err.h>
#include <linux/irqflags.h>
#include <linux/context_tracking.h>
#include <asm/signal.h>

#include <linux/kvm.h>
Expand Down Expand Up @@ -760,42 +761,6 @@ static inline int kvm_iommu_unmap_guest(struct kvm *kvm)
}
#endif

static inline void __guest_enter(void)
{
/*
* This is running in ioctl context so we can avoid
* the call to vtime_account() with its unnecessary idle check.
*/
vtime_account_system(current);
current->flags |= PF_VCPU;
}

static inline void __guest_exit(void)
{
/*
* This is running in ioctl context so we can avoid
* the call to vtime_account() with its unnecessary idle check.
*/
vtime_account_system(current);
current->flags &= ~PF_VCPU;
}

#ifdef CONFIG_CONTEXT_TRACKING
extern void guest_enter(void);
extern void guest_exit(void);

#else /* !CONFIG_CONTEXT_TRACKING */
static inline void guest_enter(void)
{
__guest_enter();
}

static inline void guest_exit(void)
{
__guest_exit();
}
#endif /* !CONFIG_CONTEXT_TRACKING */

static inline void kvm_guest_enter(void)
{
unsigned long flags;
Expand Down
1 change: 0 additions & 1 deletion trunk/kernel/context_tracking.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
*/

#include <linux/context_tracking.h>
#include <linux/kvm_host.h>
#include <linux/rcupdate.h>
#include <linux/sched.h>
#include <linux/hardirq.h>
Expand Down

0 comments on commit 7268ac0

Please sign in to comment.