Commit 5b206d48 authored by Frederic Weisbecker's avatar Frederic Weisbecker

vtime: Update a few comments

Update a stale comment from the old vtime era and document some
locking that might be non obvious.
Signed-off-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Li Zhong <zhong@linux.vnet.ibm.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Kevin Hilman <khilman@linaro.org>
parent 2d854e57
...@@ -72,8 +72,9 @@ extern void guest_exit(void); ...@@ -72,8 +72,9 @@ extern void guest_exit(void);
static inline void guest_enter(void) static inline void guest_enter(void)
{ {
/* /*
* This is running in ioctl context so we can avoid * This is running in ioctl context so its safe
* the call to vtime_account() with its unnecessary idle check. * to assume that it's the stime pending cputime
* to flush.
*/ */
vtime_account_system(current); vtime_account_system(current);
current->flags |= PF_VCPU; current->flags |= PF_VCPU;
...@@ -81,10 +82,7 @@ static inline void guest_enter(void) ...@@ -81,10 +82,7 @@ static inline void guest_enter(void)
static inline void guest_exit(void) static inline void guest_exit(void)
{ {
/* /* Flush the guest cputime we spent on the guest */
* This is running in ioctl context so we can avoid
* the call to vtime_account() with its unnecessary idle check.
*/
vtime_account_system(current); vtime_account_system(current);
current->flags &= ~PF_VCPU; current->flags &= ~PF_VCPU;
} }
......
...@@ -712,6 +712,13 @@ void vtime_user_enter(struct task_struct *tsk) ...@@ -712,6 +712,13 @@ void vtime_user_enter(struct task_struct *tsk)
void vtime_guest_enter(struct task_struct *tsk) void vtime_guest_enter(struct task_struct *tsk)
{ {
/*
* The flags must be updated under the lock with
* the vtime_snap flush and update.
* That enforces a right ordering and update sequence
* synchronization against the reader (task_gtime())
* that can thus safely catch up with a tickless delta.
*/
write_seqlock(&tsk->vtime_seqlock); write_seqlock(&tsk->vtime_seqlock);
__vtime_account_system(tsk); __vtime_account_system(tsk);
current->flags |= PF_VCPU; current->flags |= PF_VCPU;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment