All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH -v3 0/6] rcu,nohz,kvm: use RCU extended quiescent state when running KVM guest
@ 2015-02-09 16:04 riel
  2015-02-09 16:04 ` [PATCH 1/6] rcu,nohz: add state parameter to context_tracking_user_enter/exit riel
                   ` (6 more replies)
  0 siblings, 7 replies; 16+ messages in thread
From: riel @ 2015-02-09 16:04 UTC (permalink / raw)
  To: paulmck
  Cc: linux-kernel, catalin.marinas, will.deacon, fweisbec, kvm,
	mtosatti, borntraeger, mingo, oleg, lcapitulino, pbonzini

When running a KVM guest on a system with NOHZ_FULL enabled, and the
KVM guest running with idle=poll mode, we still get wakeups of the
rcuos/N threads.

This problem has already been solved for user space by telling the
RCU subsystem that the CPU is in an extended quiescent state while
running user space code.

This patch series extends that code a little bit to make it usable
to track KVM guest space, too.

I tested the code by booting a KVM guest with idle=poll, on a system
with NOHZ_FULL enabled on most CPUs, and a VCPU thread bound to a
CPU. In a 10 second interval, rcuos/N threads on other CPUs got woken
up several times, while the rcuos thread on the CPU running the bound
and alwasy running VCPU thread never got woken up once.

Thanks to Christian Borntraeger and Paul McKenney for reviewing the
first version of this patch series, and helping optimize patch 4/5.
Thanks to Frederic Weisbecker for further enhancements.

Apologies to Catalin and Will for not fixing up ARM. I am not
familiar with ARM assembly, and not sure how to pass a constant
argument to a function from assembly code on ARM :)


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH 1/6] rcu,nohz: add state parameter to context_tracking_user_enter/exit
  2015-02-09 16:04 [PATCH -v3 0/6] rcu,nohz,kvm: use RCU extended quiescent state when running KVM guest riel
@ 2015-02-09 16:04 ` riel
  2015-02-09 16:04 ` [PATCH 2/6] rcu,nohz: rename context_tracking_enter & _exit riel
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 16+ messages in thread
From: riel @ 2015-02-09 16:04 UTC (permalink / raw)
  To: paulmck
  Cc: linux-kernel, catalin.marinas, will.deacon, fweisbec, kvm,
	mtosatti, borntraeger, mingo, oleg, lcapitulino, pbonzini,
	Rik van Riel

From: Rik van Riel <riel@redhat.com>

Add the expected ctx_state as a parameter to context_tracking_user_enter
and context_tracking_user_exit, allowing the same functions to not just
track kernel <> user space switching, but also kernel <> guest transitions.

Catalin, Will: this patch and the next one break ARM, entry.S needs to be
modified to add the IN_USER parameter to context_tracking_enter & _exit.

Cc: catalin.marinas@arm.com
Cc: will.deacon@arm.com
Signed-off-by: Rik van Riel <riel@redhat.com>
---
 include/linux/context_tracking.h | 12 ++++++------
 kernel/context_tracking.c        | 10 +++++-----
 2 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/include/linux/context_tracking.h b/include/linux/context_tracking.h
index 37b81bd51ec0..bd9f000fc98d 100644
--- a/include/linux/context_tracking.h
+++ b/include/linux/context_tracking.h
@@ -10,21 +10,21 @@
 #ifdef CONFIG_CONTEXT_TRACKING
 extern void context_tracking_cpu_set(int cpu);
 
-extern void context_tracking_user_enter(void);
-extern void context_tracking_user_exit(void);
+extern void context_tracking_user_enter(enum ctx_state state);
+extern void context_tracking_user_exit(enum ctx_state state);
 extern void __context_tracking_task_switch(struct task_struct *prev,
 					   struct task_struct *next);
 
 static inline void user_enter(void)
 {
 	if (context_tracking_is_enabled())
-		context_tracking_user_enter();
+		context_tracking_user_enter(IN_USER);
 
 }
 static inline void user_exit(void)
 {
 	if (context_tracking_is_enabled())
-		context_tracking_user_exit();
+		context_tracking_user_exit(IN_USER);
 }
 
 static inline enum ctx_state exception_enter(void)
@@ -35,7 +35,7 @@ static inline enum ctx_state exception_enter(void)
 		return 0;
 
 	prev_ctx = this_cpu_read(context_tracking.state);
-	context_tracking_user_exit();
+	context_tracking_user_exit(prev_ctx);
 
 	return prev_ctx;
 }
@@ -44,7 +44,7 @@ static inline void exception_exit(enum ctx_state prev_ctx)
 {
 	if (context_tracking_is_enabled()) {
 		if (prev_ctx == IN_USER)
-			context_tracking_user_enter();
+			context_tracking_user_enter(prev_ctx);
 	}
 }
 
diff --git a/kernel/context_tracking.c b/kernel/context_tracking.c
index 937ecdfdf258..4c010787c9ec 100644
--- a/kernel/context_tracking.c
+++ b/kernel/context_tracking.c
@@ -47,7 +47,7 @@ void context_tracking_cpu_set(int cpu)
  * to execute won't use any RCU read side critical section because this
  * function sets RCU in extended quiescent state.
  */
-void context_tracking_user_enter(void)
+void context_tracking_user_enter(enum ctx_state state)
 {
 	unsigned long flags;
 
@@ -75,7 +75,7 @@ void context_tracking_user_enter(void)
 	WARN_ON_ONCE(!current->mm);
 
 	local_irq_save(flags);
-	if ( __this_cpu_read(context_tracking.state) != IN_USER) {
+	if ( __this_cpu_read(context_tracking.state) != state) {
 		if (__this_cpu_read(context_tracking.active)) {
 			trace_user_enter(0);
 			/*
@@ -101,7 +101,7 @@ void context_tracking_user_enter(void)
 		 * OTOH we can spare the calls to vtime and RCU when context_tracking.active
 		 * is false because we know that CPU is not tickless.
 		 */
-		__this_cpu_write(context_tracking.state, IN_USER);
+		__this_cpu_write(context_tracking.state, state);
 	}
 	local_irq_restore(flags);
 }
@@ -118,7 +118,7 @@ NOKPROBE_SYMBOL(context_tracking_user_enter);
  * This call supports re-entrancy. This way it can be called from any exception
  * handler without needing to know if we came from userspace or not.
  */
-void context_tracking_user_exit(void)
+void context_tracking_user_exit(enum ctx_state state)
 {
 	unsigned long flags;
 
@@ -129,7 +129,7 @@ void context_tracking_user_exit(void)
 		return;
 
 	local_irq_save(flags);
-	if (__this_cpu_read(context_tracking.state) == IN_USER) {
+	if (__this_cpu_read(context_tracking.state) == state) {
 		if (__this_cpu_read(context_tracking.active)) {
 			/*
 			 * We are going to run code that may use RCU. Inform
-- 
1.9.3


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 2/6] rcu,nohz: rename context_tracking_enter & _exit
  2015-02-09 16:04 [PATCH -v3 0/6] rcu,nohz,kvm: use RCU extended quiescent state when running KVM guest riel
  2015-02-09 16:04 ` [PATCH 1/6] rcu,nohz: add state parameter to context_tracking_user_enter/exit riel
@ 2015-02-09 16:04 ` riel
  2015-02-09 16:04 ` [PATCH 3/6] rcu,nohz: run vtime_user_enter/exit only when state == IN_USER riel
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 16+ messages in thread
From: riel @ 2015-02-09 16:04 UTC (permalink / raw)
  To: paulmck
  Cc: linux-kernel, catalin.marinas, will.deacon, fweisbec, kvm,
	mtosatti, borntraeger, mingo, oleg, lcapitulino, pbonzini,
	Rik van Riel

From: Rik van Riel <riel@redhat.com>

Rename context_tracking_user_enter & context_tracking_user_exit
to just context_tracking_enter & context_tracking_exit, since it
will be used to track guest state, too.

This also breaks ARM. The rest of the series does not look like
it impacts ARM.

Cc: will.deacon@arm.com
Cc: catalin.marinas@arm.com
Suggested-by: Frederic Weisbecker <fweisbec@redhat.com>
Signed-off-by: Rik van Riel <riel@redhat.com>
---
 include/linux/context_tracking.h | 12 ++++++------
 kernel/context_tracking.c        | 31 ++++++++++++++++---------------
 2 files changed, 22 insertions(+), 21 deletions(-)

diff --git a/include/linux/context_tracking.h b/include/linux/context_tracking.h
index bd9f000fc98d..29d7fecb365a 100644
--- a/include/linux/context_tracking.h
+++ b/include/linux/context_tracking.h
@@ -10,21 +10,21 @@
 #ifdef CONFIG_CONTEXT_TRACKING
 extern void context_tracking_cpu_set(int cpu);
 
-extern void context_tracking_user_enter(enum ctx_state state);
-extern void context_tracking_user_exit(enum ctx_state state);
+extern void context_tracking_enter(enum ctx_state state);
+extern void context_tracking_exit(enum ctx_state state);
 extern void __context_tracking_task_switch(struct task_struct *prev,
 					   struct task_struct *next);
 
 static inline void user_enter(void)
 {
 	if (context_tracking_is_enabled())
-		context_tracking_user_enter(IN_USER);
+		context_tracking_enter(IN_USER);
 
 }
 static inline void user_exit(void)
 {
 	if (context_tracking_is_enabled())
-		context_tracking_user_exit(IN_USER);
+		context_tracking_exit(IN_USER);
 }
 
 static inline enum ctx_state exception_enter(void)
@@ -35,7 +35,7 @@ static inline enum ctx_state exception_enter(void)
 		return 0;
 
 	prev_ctx = this_cpu_read(context_tracking.state);
-	context_tracking_user_exit(prev_ctx);
+	context_tracking_exit(prev_ctx);
 
 	return prev_ctx;
 }
@@ -44,7 +44,7 @@ static inline void exception_exit(enum ctx_state prev_ctx)
 {
 	if (context_tracking_is_enabled()) {
 		if (prev_ctx == IN_USER)
-			context_tracking_user_enter(prev_ctx);
+			context_tracking_enter(prev_ctx);
 	}
 }
 
diff --git a/kernel/context_tracking.c b/kernel/context_tracking.c
index 4c010787c9ec..e031e8c0fb91 100644
--- a/kernel/context_tracking.c
+++ b/kernel/context_tracking.c
@@ -39,15 +39,15 @@ void context_tracking_cpu_set(int cpu)
 }
 
 /**
- * context_tracking_user_enter - Inform the context tracking that the CPU is going to
- *                               enter userspace mode.
+ * context_tracking_enter - Inform the context tracking that the CPU is going
+ *                          to enter user or guest space mode.
  *
  * This function must be called right before we switch from the kernel
- * to userspace, when it's guaranteed the remaining kernel instructions
- * to execute won't use any RCU read side critical section because this
- * function sets RCU in extended quiescent state.
+ * to user or guest space, when it's guaranteed the remaining kernel
+ * instructions to execute won't use any RCU read side critical section
+ * because this function sets RCU in extended quiescent state.
  */
-void context_tracking_user_enter(enum ctx_state state)
+void context_tracking_enter(enum ctx_state state)
 {
 	unsigned long flags;
 
@@ -105,20 +105,21 @@ void context_tracking_user_enter(enum ctx_state state)
 	}
 	local_irq_restore(flags);
 }
-NOKPROBE_SYMBOL(context_tracking_user_enter);
+NOKPROBE_SYMBOL(context_tracking_enter);
 
 /**
- * context_tracking_user_exit - Inform the context tracking that the CPU is
- *                              exiting userspace mode and entering the kernel.
+ * context_tracking_exit - Inform the context tracking that the CPU is
+ *                         exiting user or guest mode and entering the kernel.
  *
- * This function must be called after we entered the kernel from userspace
- * before any use of RCU read side critical section. This potentially include
- * any high level kernel code like syscalls, exceptions, signal handling, etc...
+ * This function must be called after we entered the kernel from user or
+ * guest space before any use of RCU read side critical section. This
+ * potentially include any high level kernel code like syscalls, exceptions,
+ * signal handling, etc...
  *
  * This call supports re-entrancy. This way it can be called from any exception
- * handler without needing to know if we came from userspace or not.
+ * handler without needing to know if we came from user or guest space or not.
  */
-void context_tracking_user_exit(enum ctx_state state)
+void context_tracking_exit(enum ctx_state state)
 {
 	unsigned long flags;
 
@@ -143,7 +144,7 @@ void context_tracking_user_exit(enum ctx_state state)
 	}
 	local_irq_restore(flags);
 }
-NOKPROBE_SYMBOL(context_tracking_user_exit);
+NOKPROBE_SYMBOL(context_tracking_exit);
 
 /**
  * __context_tracking_task_switch - context switch the syscall callbacks
-- 
1.9.3


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 3/6] rcu,nohz: run vtime_user_enter/exit only when state == IN_USER
  2015-02-09 16:04 [PATCH -v3 0/6] rcu,nohz,kvm: use RCU extended quiescent state when running KVM guest riel
  2015-02-09 16:04 ` [PATCH 1/6] rcu,nohz: add state parameter to context_tracking_user_enter/exit riel
  2015-02-09 16:04 ` [PATCH 2/6] rcu,nohz: rename context_tracking_enter & _exit riel
@ 2015-02-09 16:04 ` riel
  2015-02-09 16:04 ` [PATCH 4/6] nohz,kvm: export context_tracking_user_enter/exit riel
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 16+ messages in thread
From: riel @ 2015-02-09 16:04 UTC (permalink / raw)
  To: paulmck
  Cc: linux-kernel, catalin.marinas, will.deacon, fweisbec, kvm,
	mtosatti, borntraeger, mingo, oleg, lcapitulino, pbonzini,
	Rik van Riel

From: Rik van Riel <riel@redhat.com>

Only run vtime_user_enter, vtime_user_exit, and the user enter & exit
trace points when we are entering or exiting user state, respectively.

The RCU code only distinguishes between "idle" and "not idle or kernel".
There should be no need to add an additional (unused) state there.

Signed-off-by: Rik van Riel <riel@redhat.com>
---
 kernel/context_tracking.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/kernel/context_tracking.c b/kernel/context_tracking.c
index e031e8c0fb91..2d94147c07b2 100644
--- a/kernel/context_tracking.c
+++ b/kernel/context_tracking.c
@@ -77,7 +77,6 @@ void context_tracking_enter(enum ctx_state state)
 	local_irq_save(flags);
 	if ( __this_cpu_read(context_tracking.state) != state) {
 		if (__this_cpu_read(context_tracking.active)) {
-			trace_user_enter(0);
 			/*
 			 * At this stage, only low level arch entry code remains and
 			 * then we'll run in userspace. We can assume there won't be
@@ -85,7 +84,10 @@ void context_tracking_enter(enum ctx_state state)
 			 * user_exit() or rcu_irq_enter(). Let's remove RCU's dependency
 			 * on the tick.
 			 */
-			vtime_user_enter(current);
+			if (state == IN_USER) {
+				trace_user_enter(0);
+				vtime_user_enter(current);
+			}
 			rcu_user_enter();
 		}
 		/*
@@ -137,8 +139,10 @@ void context_tracking_exit(enum ctx_state state)
 			 * RCU core about that (ie: we may need the tick again).
 			 */
 			rcu_user_exit();
-			vtime_user_exit(current);
-			trace_user_exit(0);
+			if (state == IN_USER) {
+				vtime_user_exit(current);
+				trace_user_exit(0);
+			}
 		}
 		__this_cpu_write(context_tracking.state, IN_KERNEL);
 	}
-- 
1.9.3


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 4/6] nohz,kvm: export context_tracking_user_enter/exit
  2015-02-09 16:04 [PATCH -v3 0/6] rcu,nohz,kvm: use RCU extended quiescent state when running KVM guest riel
                   ` (2 preceding siblings ...)
  2015-02-09 16:04 ` [PATCH 3/6] rcu,nohz: run vtime_user_enter/exit only when state == IN_USER riel
@ 2015-02-09 16:04 ` riel
  2015-02-09 17:05   ` Paolo Bonzini
  2015-02-09 16:04 ` [PATCH 5/6] kvm,rcu,nohz: use RCU extended quiescent state when running KVM guest riel
                   ` (2 subsequent siblings)
  6 siblings, 1 reply; 16+ messages in thread
From: riel @ 2015-02-09 16:04 UTC (permalink / raw)
  To: paulmck
  Cc: linux-kernel, catalin.marinas, will.deacon, fweisbec, kvm,
	mtosatti, borntraeger, mingo, oleg, lcapitulino, pbonzini,
	Rik van Riel

From: Rik van Riel <riel@redhat.com>

Export context_tracking_user_enter/exit so it can be used by KVM.

Signed-off-by: Rik van Riel <riel@redhat.com>
---
 kernel/context_tracking.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/kernel/context_tracking.c b/kernel/context_tracking.c
index 2d94147c07b2..8c5f2e939eee 100644
--- a/kernel/context_tracking.c
+++ b/kernel/context_tracking.c
@@ -108,6 +108,7 @@ void context_tracking_enter(enum ctx_state state)
 	local_irq_restore(flags);
 }
 NOKPROBE_SYMBOL(context_tracking_enter);
+EXPORT_SYMBOL_GPL(context_tracking_enter);
 
 /**
  * context_tracking_exit - Inform the context tracking that the CPU is
@@ -149,6 +150,7 @@ void context_tracking_exit(enum ctx_state state)
 	local_irq_restore(flags);
 }
 NOKPROBE_SYMBOL(context_tracking_exit);
+EXPORT_SYMBOL_GPL(context_tracking_exit);
 
 /**
  * __context_tracking_task_switch - context switch the syscall callbacks
-- 
1.9.3


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 5/6] kvm,rcu,nohz: use RCU extended quiescent state when running KVM guest
  2015-02-09 16:04 [PATCH -v3 0/6] rcu,nohz,kvm: use RCU extended quiescent state when running KVM guest riel
                   ` (3 preceding siblings ...)
  2015-02-09 16:04 ` [PATCH 4/6] nohz,kvm: export context_tracking_user_enter/exit riel
@ 2015-02-09 16:04 ` riel
  2015-02-09 16:04 ` [PATCH 6/6] nohz: add stub context_tracking_is_enabled riel
  2015-02-10  1:15 ` [PATCH -v3 0/6] rcu,nohz,kvm: use RCU extended quiescent state when running KVM guest Will Deacon
  6 siblings, 0 replies; 16+ messages in thread
From: riel @ 2015-02-09 16:04 UTC (permalink / raw)
  To: paulmck
  Cc: linux-kernel, catalin.marinas, will.deacon, fweisbec, kvm,
	mtosatti, borntraeger, mingo, oleg, lcapitulino, pbonzini,
	Rik van Riel

From: Rik van Riel <riel@redhat.com>

The host kernel is not doing anything while the CPU is executing
a KVM guest VCPU, so it can be marked as being in an extended
quiescent state, identical to that used when running user space
code.

The only exception to that rule is when the host handles an
interrupt, which is already handled by the irq code, which
calls rcu_irq_enter and rcu_irq_exit.

The guest_enter and guest_exit functions already switch vtime
accounting independent of context tracking, so leave those calls
where they are, instead of moving them into the context tracking
code.

Signed-off-by: Rik van Riel <riel@redhat.com>
---
 include/linux/context_tracking.h       | 8 +++++++-
 include/linux/context_tracking_state.h | 1 +
 include/linux/kvm_host.h               | 3 ++-
 3 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/include/linux/context_tracking.h b/include/linux/context_tracking.h
index 29d7fecb365a..c70d7e760061 100644
--- a/include/linux/context_tracking.h
+++ b/include/linux/context_tracking.h
@@ -43,7 +43,7 @@ static inline enum ctx_state exception_enter(void)
 static inline void exception_exit(enum ctx_state prev_ctx)
 {
 	if (context_tracking_is_enabled()) {
-		if (prev_ctx == IN_USER)
+		if (prev_ctx != IN_KERNEL)
 			context_tracking_enter(prev_ctx);
 	}
 }
@@ -74,6 +74,9 @@ static inline void context_tracking_init(void) { }
 #ifdef CONFIG_VIRT_CPU_ACCOUNTING_GEN
 static inline void guest_enter(void)
 {
+	if (context_tracking_is_enabled())
+		context_tracking_enter(IN_GUEST);
+
 	if (vtime_accounting_enabled())
 		vtime_guest_enter(current);
 	else
@@ -86,6 +89,9 @@ static inline void guest_exit(void)
 		vtime_guest_exit(current);
 	else
 		current->flags &= ~PF_VCPU;
+
+	if (context_tracking_is_enabled())
+		context_tracking_exit(IN_GUEST);
 }
 
 #else
diff --git a/include/linux/context_tracking_state.h b/include/linux/context_tracking_state.h
index 97a81225d037..f3ef027af749 100644
--- a/include/linux/context_tracking_state.h
+++ b/include/linux/context_tracking_state.h
@@ -15,6 +15,7 @@ struct context_tracking {
 	enum ctx_state {
 		IN_KERNEL = 0,
 		IN_USER,
+		IN_GUEST,
 	} state;
 };
 
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index 26f106022c88..c7828a6a9614 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -772,7 +772,8 @@ static inline void kvm_guest_enter(void)
 	 * one time slice). Lets treat guest mode as quiescent state, just like
 	 * we do with user-mode execution.
 	 */
-	rcu_virt_note_context_switch(smp_processor_id());
+	if (!context_tracking_cpu_is_enabled())
+		rcu_virt_note_context_switch(smp_processor_id());
 }
 
 static inline void kvm_guest_exit(void)
-- 
1.9.3


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 6/6] nohz: add stub context_tracking_is_enabled
  2015-02-09 16:04 [PATCH -v3 0/6] rcu,nohz,kvm: use RCU extended quiescent state when running KVM guest riel
                   ` (4 preceding siblings ...)
  2015-02-09 16:04 ` [PATCH 5/6] kvm,rcu,nohz: use RCU extended quiescent state when running KVM guest riel
@ 2015-02-09 16:04 ` riel
  2015-02-09 17:07   ` Paolo Bonzini
  2015-02-10  1:15 ` [PATCH -v3 0/6] rcu,nohz,kvm: use RCU extended quiescent state when running KVM guest Will Deacon
  6 siblings, 1 reply; 16+ messages in thread
From: riel @ 2015-02-09 16:04 UTC (permalink / raw)
  To: paulmck
  Cc: linux-kernel, catalin.marinas, will.deacon, fweisbec, kvm,
	mtosatti, borntraeger, mingo, oleg, lcapitulino, pbonzini,
	Rik van Riel

From: Rik van Riel <riel@redhat.com>

With code elsewhere doing something conditional on whether or not
context tracking is enabled, we want a stub function that tells us
context tracking is not enabled, when CONFIG_CONTEXT_TRACKING is
not set.

Signed-off-by: Rik van Riel <riel@redhat.com>
---
 include/linux/context_tracking_state.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/linux/context_tracking_state.h b/include/linux/context_tracking_state.h
index f3ef027af749..90a7bab8779e 100644
--- a/include/linux/context_tracking_state.h
+++ b/include/linux/context_tracking_state.h
@@ -40,6 +40,8 @@ static inline bool context_tracking_in_user(void)
 #else
 static inline bool context_tracking_in_user(void) { return false; }
 static inline bool context_tracking_active(void) { return false; }
+static inline bool context_tracking_is_enabled(void) { return false; }
+static inline bool context_tracking_cpu_is_enabled(void) { return false; }
 #endif /* CONFIG_CONTEXT_TRACKING */
 
 #endif
-- 
1.9.3


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* Re: [PATCH 4/6] nohz,kvm: export context_tracking_user_enter/exit
  2015-02-09 16:04 ` [PATCH 4/6] nohz,kvm: export context_tracking_user_enter/exit riel
@ 2015-02-09 17:05   ` Paolo Bonzini
  2015-02-09 20:02     ` Rik van Riel
  0 siblings, 1 reply; 16+ messages in thread
From: Paolo Bonzini @ 2015-02-09 17:05 UTC (permalink / raw)
  To: riel, paulmck
  Cc: linux-kernel, catalin.marinas, will.deacon, fweisbec, kvm,
	mtosatti, borntraeger, mingo, oleg, lcapitulino



On 09/02/2015 17:04, riel@redhat.com wrote:
> From: Rik van Riel <riel@redhat.com>
> 
> Export context_tracking_user_enter/exit so it can be used by KVM.

Wrong function name in the commit message...

Paolo

> Signed-off-by: Rik van Riel <riel@redhat.com>
> ---
>  kernel/context_tracking.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/kernel/context_tracking.c b/kernel/context_tracking.c
> index 2d94147c07b2..8c5f2e939eee 100644
> --- a/kernel/context_tracking.c
> +++ b/kernel/context_tracking.c
> @@ -108,6 +108,7 @@ void context_tracking_enter(enum ctx_state state)
>  	local_irq_restore(flags);
>  }
>  NOKPROBE_SYMBOL(context_tracking_enter);
> +EXPORT_SYMBOL_GPL(context_tracking_enter);
>  
>  /**
>   * context_tracking_exit - Inform the context tracking that the CPU is
> @@ -149,6 +150,7 @@ void context_tracking_exit(enum ctx_state state)
>  	local_irq_restore(flags);
>  }
>  NOKPROBE_SYMBOL(context_tracking_exit);
> +EXPORT_SYMBOL_GPL(context_tracking_exit);
>  
>  /**
>   * __context_tracking_task_switch - context switch the syscall callbacks
> 

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 6/6] nohz: add stub context_tracking_is_enabled
  2015-02-09 16:04 ` [PATCH 6/6] nohz: add stub context_tracking_is_enabled riel
@ 2015-02-09 17:07   ` Paolo Bonzini
  0 siblings, 0 replies; 16+ messages in thread
From: Paolo Bonzini @ 2015-02-09 17:07 UTC (permalink / raw)
  To: riel, paulmck
  Cc: linux-kernel, catalin.marinas, will.deacon, fweisbec, kvm,
	mtosatti, borntraeger, mingo, oleg, lcapitulino



On 09/02/2015 17:04, riel@redhat.com wrote:
> From: Rik van Riel <riel@redhat.com>
> 
> With code elsewhere doing something conditional on whether or not
> context tracking is enabled, we want a stub function that tells us
> context tracking is not enabled, when CONFIG_CONTEXT_TRACKING is
> not set.
> 
> Signed-off-by: Rik van Riel <riel@redhat.com>
> ---
>  include/linux/context_tracking_state.h | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/include/linux/context_tracking_state.h b/include/linux/context_tracking_state.h
> index f3ef027af749..90a7bab8779e 100644
> --- a/include/linux/context_tracking_state.h
> +++ b/include/linux/context_tracking_state.h
> @@ -40,6 +40,8 @@ static inline bool context_tracking_in_user(void)
>  #else
>  static inline bool context_tracking_in_user(void) { return false; }
>  static inline bool context_tracking_active(void) { return false; }
> +static inline bool context_tracking_is_enabled(void) { return false; }
> +static inline bool context_tracking_cpu_is_enabled(void) { return false; }
>  #endif /* CONFIG_CONTEXT_TRACKING */
>  
>  #endif
> 

This should have gone before patch 5.

Paolo

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 4/6] nohz,kvm: export context_tracking_user_enter/exit
  2015-02-09 17:05   ` Paolo Bonzini
@ 2015-02-09 20:02     ` Rik van Riel
  0 siblings, 0 replies; 16+ messages in thread
From: Rik van Riel @ 2015-02-09 20:02 UTC (permalink / raw)
  To: Paolo Bonzini, paulmck
  Cc: linux-kernel, catalin.marinas, will.deacon, fweisbec, kvm,
	mtosatti, borntraeger, mingo, oleg, lcapitulino

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 02/09/2015 12:05 PM, Paolo Bonzini wrote:
> 
> 
> On 09/02/2015 17:04, riel@redhat.com wrote:
>> From: Rik van Riel <riel@redhat.com>
>> 
>> Export context_tracking_user_enter/exit so it can be used by
>> KVM.
> 
> Wrong function name in the commit message...

Oops, indeed.

Paul, could I convince you to fix up the changelog and reorder
patches 5 & 6, if you choose to apply these patches? :)

- -- 
All rights reversed
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iQEcBAEBAgAGBQJU2RJAAAoJEM553pKExN6DvmAIAJPx/Y66UTOn1009Ware7w7g
SyqsJvZBFGnJAYvbioQVDjJYA8hjnghffsj2AGiSc/WMkZTMFbhVoJuZKX9mOuE4
kJKkWZP74JGjYY5+uZqk1q+y83bqvvlUAdCGdWictWZJNTErFoXmBGaw4Qd4tiTe
8e4ltRHjGUpjwiBBO1H2vRjqkW4di35JXslUGEI5Os2cvGC+eYorz/7hEA3IX5hO
Oe07iGfgOa5SuLy3pIg8I5Y8S5Cy6ixGK5h5+qmvetTHz3KdUfx30Beyrz9Zbv2l
EF55sKIosMbGtlUBu2F7nhQL2aTiVf/pPuNokJH9tuv0eUbay/Tyosa9vTK7PiQ=
=rMEH
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH -v3 0/6] rcu,nohz,kvm: use RCU extended quiescent state when running KVM guest
  2015-02-09 16:04 [PATCH -v3 0/6] rcu,nohz,kvm: use RCU extended quiescent state when running KVM guest riel
                   ` (5 preceding siblings ...)
  2015-02-09 16:04 ` [PATCH 6/6] nohz: add stub context_tracking_is_enabled riel
@ 2015-02-10  1:15 ` Will Deacon
  2015-02-10  1:22   ` Rik van Riel
  6 siblings, 1 reply; 16+ messages in thread
From: Will Deacon @ 2015-02-10  1:15 UTC (permalink / raw)
  To: riel
  Cc: paulmck, linux-kernel, Catalin Marinas, fweisbec, kvm, mtosatti,
	borntraeger, mingo, oleg, lcapitulino, pbonzini

Hi Rik,

On Mon, Feb 09, 2015 at 04:04:38PM +0000, riel@redhat.com wrote:
> Apologies to Catalin and Will for not fixing up ARM. I am not
> familiar with ARM assembly, and not sure how to pass a constant
> argument to a function from assembly code on ARM :)

It's a bit of a faff getting enum values into asm -- we actually have to
duplicate the definitions using #defines to get at the constants. Perhaps it
would be cleaner to leave context_tracking_user_{enter,exit} intact as C
wrappers around context_tracking_{enter,exit} passing the appropriate
constant? That way we don't actually need to change the arch code at all.

Will

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH -v3 0/6] rcu,nohz,kvm: use RCU extended quiescent state when running KVM guest
  2015-02-10  1:15 ` [PATCH -v3 0/6] rcu,nohz,kvm: use RCU extended quiescent state when running KVM guest Will Deacon
@ 2015-02-10  1:22   ` Rik van Riel
  2015-02-10  1:44     ` Frederic Weisbecker
  0 siblings, 1 reply; 16+ messages in thread
From: Rik van Riel @ 2015-02-10  1:22 UTC (permalink / raw)
  To: Will Deacon
  Cc: paulmck, linux-kernel, Catalin Marinas, fweisbec, kvm, mtosatti,
	borntraeger, mingo, oleg, lcapitulino, pbonzini

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 02/09/2015 08:15 PM, Will Deacon wrote:
> Hi Rik,
> 
> On Mon, Feb 09, 2015 at 04:04:38PM +0000, riel@redhat.com wrote:
>> Apologies to Catalin and Will for not fixing up ARM. I am not 
>> familiar with ARM assembly, and not sure how to pass a constant 
>> argument to a function from assembly code on ARM :)
> 
> It's a bit of a faff getting enum values into asm -- we actually
> have to duplicate the definitions using #defines to get at the
> constants. Perhaps it would be cleaner to leave
> context_tracking_user_{enter,exit} intact as C wrappers around
> context_tracking_{enter,exit} passing the appropriate constant?
> That way we don't actually need to change the arch code at all.

If Paul and Frederic have no objections, I would be happy to do that.

Paul, Frederic?

- -- 
All rights reversed
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iQEcBAEBAgAGBQJU2V1zAAoJEM553pKExN6D6g0IALbbBouimRFvTEvET5mspC7i
DDn9AZJ8lMfbtgeMQsNFsJqfXu0lM8lwczPMKoAz/op31p0pdPlykYIm9fmCdqik
rNFTIRRd8fPD3JJVjNu8lpmVsae9VQuaDX7/36OK5d36bIpPfZ1yj6dxOdL4p5oI
xYcnw1Re1rUmtykQo3i6V6379EPz8azSqxFRcP+Kf9kq3FLzHwzs+TwkOprGSWE4
B4wNVQMn+bLir/vQlS0+0NYcYXDyMllGQWm0Z8mBhUhjvHhP0rQ0UplHQk+zDOaN
slEOKAIEtfikAm9ugv25cylCJ6ko+DOrP1aZ994BQ7E9AxmBnzz0EN6i5NAIJ1s=
=msX3
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH -v3 0/6] rcu,nohz,kvm: use RCU extended quiescent state when running KVM guest
  2015-02-10  1:22   ` Rik van Riel
@ 2015-02-10  1:44     ` Frederic Weisbecker
  2015-02-10  3:01       ` Paul E. McKenney
  0 siblings, 1 reply; 16+ messages in thread
From: Frederic Weisbecker @ 2015-02-10  1:44 UTC (permalink / raw)
  To: Rik van Riel
  Cc: Will Deacon, paulmck, linux-kernel, Catalin Marinas, kvm,
	mtosatti, borntraeger, mingo, oleg, lcapitulino, pbonzini

On Mon, Feb 09, 2015 at 08:22:59PM -0500, Rik van Riel wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> On 02/09/2015 08:15 PM, Will Deacon wrote:
> > Hi Rik,
> > 
> > On Mon, Feb 09, 2015 at 04:04:38PM +0000, riel@redhat.com wrote:
> >> Apologies to Catalin and Will for not fixing up ARM. I am not 
> >> familiar with ARM assembly, and not sure how to pass a constant 
> >> argument to a function from assembly code on ARM :)
> > 
> > It's a bit of a faff getting enum values into asm -- we actually
> > have to duplicate the definitions using #defines to get at the
> > constants. Perhaps it would be cleaner to leave
> > context_tracking_user_{enter,exit} intact as C wrappers around
> > context_tracking_{enter,exit} passing the appropriate constant?
> > That way we don't actually need to change the arch code at all.
> 
> If Paul and Frederic have no objections, I would be happy to do that.
> 
> Paul, Frederic?

Sure, that's fine by me.

Thanks.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH -v3 0/6] rcu,nohz,kvm: use RCU extended quiescent state when running KVM guest
  2015-02-10  1:44     ` Frederic Weisbecker
@ 2015-02-10  3:01       ` Paul E. McKenney
  2015-02-10  3:03         ` Rik van Riel
  0 siblings, 1 reply; 16+ messages in thread
From: Paul E. McKenney @ 2015-02-10  3:01 UTC (permalink / raw)
  To: Frederic Weisbecker
  Cc: Rik van Riel, Will Deacon, linux-kernel, Catalin Marinas, kvm,
	mtosatti, borntraeger, mingo, oleg, lcapitulino, pbonzini

On Tue, Feb 10, 2015 at 02:44:17AM +0100, Frederic Weisbecker wrote:
> On Mon, Feb 09, 2015 at 08:22:59PM -0500, Rik van Riel wrote:
> > -----BEGIN PGP SIGNED MESSAGE-----
> > Hash: SHA1
> > 
> > On 02/09/2015 08:15 PM, Will Deacon wrote:
> > > Hi Rik,
> > > 
> > > On Mon, Feb 09, 2015 at 04:04:38PM +0000, riel@redhat.com wrote:
> > >> Apologies to Catalin and Will for not fixing up ARM. I am not 
> > >> familiar with ARM assembly, and not sure how to pass a constant 
> > >> argument to a function from assembly code on ARM :)
> > > 
> > > It's a bit of a faff getting enum values into asm -- we actually
> > > have to duplicate the definitions using #defines to get at the
> > > constants. Perhaps it would be cleaner to leave
> > > context_tracking_user_{enter,exit} intact as C wrappers around
> > > context_tracking_{enter,exit} passing the appropriate constant?
> > > That way we don't actually need to change the arch code at all.
> > 
> > If Paul and Frederic have no objections, I would be happy to do that.
> > 
> > Paul, Frederic?
> 
> Sure, that's fine by me.

And if it is fine by Frederic, it is fine by me!

							Thanx, Paul


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH -v3 0/6] rcu,nohz,kvm: use RCU extended quiescent state when running KVM guest
  2015-02-10  3:01       ` Paul E. McKenney
@ 2015-02-10  3:03         ` Rik van Riel
  2015-02-10  3:13           ` Paul E. McKenney
  0 siblings, 1 reply; 16+ messages in thread
From: Rik van Riel @ 2015-02-10  3:03 UTC (permalink / raw)
  To: paulmck, Frederic Weisbecker
  Cc: Will Deacon, linux-kernel, Catalin Marinas, kvm, mtosatti,
	borntraeger, mingo, oleg, lcapitulino, pbonzini

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 02/09/2015 10:01 PM, Paul E. McKenney wrote:
> On Tue, Feb 10, 2015 at 02:44:17AM +0100, Frederic Weisbecker
> wrote:
>> On Mon, Feb 09, 2015 at 08:22:59PM -0500, Rik van Riel wrote:
>>> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
>>> 
>>> On 02/09/2015 08:15 PM, Will Deacon wrote:
>>>> Hi Rik,
>>>> 
>>>> On Mon, Feb 09, 2015 at 04:04:38PM +0000, riel@redhat.com
>>>> wrote:
>>>>> Apologies to Catalin and Will for not fixing up ARM. I am
>>>>> not familiar with ARM assembly, and not sure how to pass a
>>>>> constant argument to a function from assembly code on ARM
>>>>> :)
>>>> 
>>>> It's a bit of a faff getting enum values into asm -- we
>>>> actually have to duplicate the definitions using #defines to
>>>> get at the constants. Perhaps it would be cleaner to leave 
>>>> context_tracking_user_{enter,exit} intact as C wrappers
>>>> around context_tracking_{enter,exit} passing the appropriate
>>>> constant? That way we don't actually need to change the arch
>>>> code at all.
>>> 
>>> If Paul and Frederic have no objections, I would be happy to do
>>> that.
>>> 
>>> Paul, Frederic?
>> 
>> Sure, that's fine by me.
> 
> And if it is fine by Frederic, it is fine by me!

I'll send a new series tomorrow that addresses Will's concern,
as well as Paulo's latest suggestions.

- -- 
All rights reversed
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iQEcBAEBAgAGBQJU2XTsAAoJEM553pKExN6D2ZcH/R7KIkJLpaWwxM2Iy0iEy+9r
CA2Tem1wXiDRMLzvDEKQHGlX8ea2o/VWNwjSMeRzDJbd3D9wsfPBMROXOXuji3Cc
FI2XBrC+fax43vWaIcKDb/GrQanffed2VZ1klL2twTShUOaSBPXFofZ1DISvrySP
//QOe7DbgYpqYJZ2KC+KohclvIkepAbo3AuiZKj97staw4IzP4kVJi1zAk0qbDDQ
6m7X4hvHnkfiSx0YLNRJ54j3i9/py5/rbUlnNP9LAxdQzOQQCFUSUKnn9zIMBZ03
e1W77VAQLI9+URXgeuSn7928PE+eqQQJwwdLzt0ckVojJL3i8J5SfoxTMr1sZh0=
=ft08
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH -v3 0/6] rcu,nohz,kvm: use RCU extended quiescent state when running KVM guest
  2015-02-10  3:03         ` Rik van Riel
@ 2015-02-10  3:13           ` Paul E. McKenney
  0 siblings, 0 replies; 16+ messages in thread
From: Paul E. McKenney @ 2015-02-10  3:13 UTC (permalink / raw)
  To: Rik van Riel
  Cc: Frederic Weisbecker, Will Deacon, linux-kernel, Catalin Marinas,
	kvm, mtosatti, borntraeger, mingo, oleg, lcapitulino, pbonzini

On Mon, Feb 09, 2015 at 10:03:08PM -0500, Rik van Riel wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> On 02/09/2015 10:01 PM, Paul E. McKenney wrote:
> > On Tue, Feb 10, 2015 at 02:44:17AM +0100, Frederic Weisbecker
> > wrote:
> >> On Mon, Feb 09, 2015 at 08:22:59PM -0500, Rik van Riel wrote:
> >>> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
> >>> 
> >>> On 02/09/2015 08:15 PM, Will Deacon wrote:
> >>>> Hi Rik,
> >>>> 
> >>>> On Mon, Feb 09, 2015 at 04:04:38PM +0000, riel@redhat.com
> >>>> wrote:
> >>>>> Apologies to Catalin and Will for not fixing up ARM. I am
> >>>>> not familiar with ARM assembly, and not sure how to pass a
> >>>>> constant argument to a function from assembly code on ARM
> >>>>> :)
> >>>> 
> >>>> It's a bit of a faff getting enum values into asm -- we
> >>>> actually have to duplicate the definitions using #defines to
> >>>> get at the constants. Perhaps it would be cleaner to leave 
> >>>> context_tracking_user_{enter,exit} intact as C wrappers
> >>>> around context_tracking_{enter,exit} passing the appropriate
> >>>> constant? That way we don't actually need to change the arch
> >>>> code at all.
> >>> 
> >>> If Paul and Frederic have no objections, I would be happy to do
> >>> that.
> >>> 
> >>> Paul, Frederic?
> >> 
> >> Sure, that's fine by me.
> > 
> > And if it is fine by Frederic, it is fine by me!
> 
> I'll send a new series tomorrow that addresses Will's concern,
> as well as Paulo's latest suggestions.

Very good, thank you!

							Thanx, Paul


^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2015-02-10  3:13 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-09 16:04 [PATCH -v3 0/6] rcu,nohz,kvm: use RCU extended quiescent state when running KVM guest riel
2015-02-09 16:04 ` [PATCH 1/6] rcu,nohz: add state parameter to context_tracking_user_enter/exit riel
2015-02-09 16:04 ` [PATCH 2/6] rcu,nohz: rename context_tracking_enter & _exit riel
2015-02-09 16:04 ` [PATCH 3/6] rcu,nohz: run vtime_user_enter/exit only when state == IN_USER riel
2015-02-09 16:04 ` [PATCH 4/6] nohz,kvm: export context_tracking_user_enter/exit riel
2015-02-09 17:05   ` Paolo Bonzini
2015-02-09 20:02     ` Rik van Riel
2015-02-09 16:04 ` [PATCH 5/6] kvm,rcu,nohz: use RCU extended quiescent state when running KVM guest riel
2015-02-09 16:04 ` [PATCH 6/6] nohz: add stub context_tracking_is_enabled riel
2015-02-09 17:07   ` Paolo Bonzini
2015-02-10  1:15 ` [PATCH -v3 0/6] rcu,nohz,kvm: use RCU extended quiescent state when running KVM guest Will Deacon
2015-02-10  1:22   ` Rik van Riel
2015-02-10  1:44     ` Frederic Weisbecker
2015-02-10  3:01       ` Paul E. McKenney
2015-02-10  3:03         ` Rik van Riel
2015-02-10  3:13           ` Paul E. McKenney

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.