diff mbox

suspicious RCU usage

Message ID 87ebb08e-944d-6305-c60e-2f062f1876ef@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Paolo Bonzini Feb. 28, 2017, 11:06 a.m. UTC
On 25/02/2017 04:44, Ross Zwisler wrote:
> During Crystal Ridge testing in KVM virtual machines we have occasionally seen
> "suspicious RCU usage" messages.  They don't seem to be tied to any one
> specific test, and my guess is that we are occasionally just losing a race.

I think it's just a trivial ordering bug:



because the async page fault code checks for preempt_disable() already,
and kmap_atomic already does preempt_disable outside pagefault_disable.

Let me know if the above is enough to fix it for you.

Paolo

Comments

Ross Zwisler March 6, 2017, 9:04 p.m. UTC | #1
On Tue, Feb 28, 2017 at 12:06:21PM +0100, Paolo Bonzini wrote:
> I think it's just a trivial ordering bug:
> 
> diff --git a/arch/x86/kernel/kvm.c b/arch/x86/kernel/kvm.c
> index 14f65a5f938e..5215629ad692 100644
> --- a/arch/x86/kernel/kvm.c
> +++ b/arch/x86/kernel/kvm.c
> @@ -161,8 +161,8 @@ void kvm_async_pf_task_wait(u32 token)
>  			 */
>  			rcu_irq_exit();
>  			native_safe_halt();
> -			rcu_irq_enter();
>  			local_irq_disable();
> +			rcu_irq_enter();
>  		}
>  	}
>  	if (!n.halted)
> 
> 
> because the async page fault code checks for preempt_disable() already,
> and kmap_atomic already does preempt_disable outside pagefault_disable.
> 
> Let me know if the above is enough to fix it for you.

Well, unfortunately I can't reproduce the issue with enough reliability to say
whether or not the fix is making a difference. :(

FWIW, I did re-run my tests with this fix applied, and no new errors cropped
up.

- Ross
diff mbox

Patch

diff --git a/arch/x86/kernel/kvm.c b/arch/x86/kernel/kvm.c
index 14f65a5f938e..5215629ad692 100644
--- a/arch/x86/kernel/kvm.c
+++ b/arch/x86/kernel/kvm.c
@@ -161,8 +161,8 @@  void kvm_async_pf_task_wait(u32 token)
 			 */
 			rcu_irq_exit();
 			native_safe_halt();
-			rcu_irq_enter();
 			local_irq_disable();
+			rcu_irq_enter();
 		}
 	}
 	if (!n.halted)