Re: [RFC PATCH] Fix abnormal rcu dynticks_nesting values related to async page fault

2012-11-27 Thread Frederic Weisbecker
2012/11/27 Frederic Weisbecker : > 2012/11/27 Gleb Natapov : >> What is the semantics of enter_idle()/exit_idle(), what are they used for? > > It's used by drivers/idle/i7300_idle.c for some tracking. I don't know much > the details. > > enter_idle() is called right before the CPU is set to lower p

Re: [RFC PATCH] Fix abnormal rcu dynticks_nesting values related to async page fault

2012-11-27 Thread Frederic Weisbecker
2012/11/27 Gleb Natapov : > What is the semantics of enter_idle()/exit_idle(), what are they used for? It's used by drivers/idle/i7300_idle.c for some tracking. I don't know much the details. enter_idle() is called right before the CPU is set to lower power mode: hlt() exit_idle() is called anyt

Re: [RFC PATCH] Fix abnormal rcu dynticks_nesting values related to async page fault

2012-11-27 Thread Gleb Natapov
On Tue, Nov 27, 2012 at 07:12:40PM +0100, Frederic Weisbecker wrote: > 2012/11/27 Gleb Natapov : > > On Tue, Nov 27, 2012 at 06:30:32PM +0100, Frederic Weisbecker wrote: > >> 2012/11/27 Gleb Natapov : > >> > diff --git a/arch/x86/kernel/kvm.c b/arch/x86/kernel/kvm.c > >> > index 4180a87..636800d 10

Re: [RFC PATCH] Fix abnormal rcu dynticks_nesting values related to async page fault

2012-11-27 Thread Frederic Weisbecker
2012/11/27 Gleb Natapov : > On Tue, Nov 27, 2012 at 06:30:32PM +0100, Frederic Weisbecker wrote: >> 2012/11/27 Gleb Natapov : >> > diff --git a/arch/x86/kernel/kvm.c b/arch/x86/kernel/kvm.c >> > index 4180a87..636800d 100644 >> > --- a/arch/x86/kernel/kvm.c >> > +++ b/arch/x86/kernel/kvm.c >> > @@

Re: [RFC PATCH] Fix abnormal rcu dynticks_nesting values related to async page fault

2012-11-27 Thread Gleb Natapov
On Tue, Nov 27, 2012 at 06:30:32PM +0100, Frederic Weisbecker wrote: > 2012/11/27 Gleb Natapov : > > diff --git a/arch/x86/kernel/kvm.c b/arch/x86/kernel/kvm.c > > index 4180a87..636800d 100644 > > --- a/arch/x86/kernel/kvm.c > > +++ b/arch/x86/kernel/kvm.c > > @@ -113,7 +113,7 @@ void kvm_async_pf

Re: [RFC PATCH] Fix abnormal rcu dynticks_nesting values related to async page fault

2012-11-27 Thread Frederic Weisbecker
2012/11/27 Gleb Natapov : > diff --git a/arch/x86/kernel/kvm.c b/arch/x86/kernel/kvm.c > index 4180a87..636800d 100644 > --- a/arch/x86/kernel/kvm.c > +++ b/arch/x86/kernel/kvm.c > @@ -113,7 +113,7 @@ void kvm_async_pf_task_wait(u32 token) > int cpu, idle; > > cpu = get_cpu(); > -

Re: [RFC PATCH] Fix abnormal rcu dynticks_nesting values related to async page fault

2012-11-27 Thread Gleb Natapov
On Tue, Nov 27, 2012 at 05:51:12PM +0100, Frederic Weisbecker wrote: > 2012/11/27 Gleb Natapov : > > On Tue, Nov 27, 2012 at 04:56:30PM +0100, Frederic Weisbecker wrote: > >> 2012/11/27 Gleb Natapov : > >> > For KVM_PV_REASON_PAGE_NOT_PRESENT it behaves like an exception. > >> > >> Ok. > >> There s

Re: [RFC PATCH] Fix abnormal rcu dynticks_nesting values related to async page fault

2012-11-27 Thread Paul E. McKenney
On Tue, Nov 27, 2012 at 05:48:18PM +0100, Frederic Weisbecker wrote: > 2012/11/27 Paul E. McKenney : > > On Tue, Nov 27, 2012 at 04:56:30PM +0100, Frederic Weisbecker wrote: > >> 2012/11/27 Gleb Natapov : > >> > For KVM_PV_REASON_PAGE_NOT_PRESENT it behaves like an exception. > >> > >> Ok. > >> The

Re: [RFC PATCH] Fix abnormal rcu dynticks_nesting values related to async page fault

2012-11-27 Thread Frederic Weisbecker
2012/11/27 Gleb Natapov : > On Tue, Nov 27, 2012 at 04:56:30PM +0100, Frederic Weisbecker wrote: >> 2012/11/27 Gleb Natapov : >> > For KVM_PV_REASON_PAGE_NOT_PRESENT it behaves like an exception. >> >> Ok. >> There seem to be a bug in kvm_async_pf_task_wait(). Using >> idle_cpu(cpu) to find out if

Re: [RFC PATCH] Fix abnormal rcu dynticks_nesting values related to async page fault

2012-11-27 Thread Frederic Weisbecker
2012/11/27 Paul E. McKenney : > On Tue, Nov 27, 2012 at 04:56:30PM +0100, Frederic Weisbecker wrote: >> 2012/11/27 Gleb Natapov : >> > For KVM_PV_REASON_PAGE_NOT_PRESENT it behaves like an exception. >> >> Ok. >> There seem to be a bug in kvm_async_pf_task_wait(). Using >> idle_cpu(cpu) to find out

Re: [RFC PATCH] Fix abnormal rcu dynticks_nesting values related to async page fault

2012-11-27 Thread Frederic Weisbecker
2012/11/27 Li Zhong : > I noticed some warnings complaining about dynticks_nesting value, like > > [ 267.545032] [ cut here ] > [ 267.545032] WARNING: at kernel/rcutree.c:382 rcu_eqs_enter+0xab/0xc0() > [ 267.545032] Hardware name: Bochs > [ 267.545032] Modules linked in

Re: [RFC PATCH] Fix abnormal rcu dynticks_nesting values related to async page fault

2012-11-27 Thread Gleb Natapov
On Tue, Nov 27, 2012 at 04:56:30PM +0100, Frederic Weisbecker wrote: > 2012/11/27 Gleb Natapov : > > For KVM_PV_REASON_PAGE_NOT_PRESENT it behaves like an exception. > > Ok. > There seem to be a bug in kvm_async_pf_task_wait(). Using > idle_cpu(cpu) to find out if the current task is the idle task

Re: [RFC PATCH] Fix abnormal rcu dynticks_nesting values related to async page fault

2012-11-27 Thread Paul E. McKenney
On Tue, Nov 27, 2012 at 04:56:30PM +0100, Frederic Weisbecker wrote: > 2012/11/27 Gleb Natapov : > > For KVM_PV_REASON_PAGE_NOT_PRESENT it behaves like an exception. > > Ok. > There seem to be a bug in kvm_async_pf_task_wait(). Using > idle_cpu(cpu) to find out if the current task is the idle task

Re: [RFC PATCH] Fix abnormal rcu dynticks_nesting values related to async page fault

2012-11-27 Thread Frederic Weisbecker
2012/11/27 Paul E. McKenney : > It is OK to call rcu_irq_exit() without a matching rcu_irq_enter() -only- > if you have also called rcu_idle_exit() since the last rcu_idle_enter(). > There will be a similar rule for rcu_user_exit(). > > More generally, it is OK to call rcu_irq_exit() without a matc

Re: [RFC PATCH] Fix abnormal rcu dynticks_nesting values related to async page fault

2012-11-27 Thread Frederic Weisbecker
2012/11/27 Li Zhong : > @@ -247,10 +247,17 @@ do_async_page_fault(struct pt_regs *regs, unsigned long > error_code) > break; > case KVM_PV_REASON_PAGE_NOT_PRESENT: > /* page is swapped out by the host. */ > - rcu_irq_enter(); > +

Re: [RFC PATCH] Fix abnormal rcu dynticks_nesting values related to async page fault

2012-11-27 Thread Paul E. McKenney
On Tue, Nov 27, 2012 at 04:39:59PM +0100, Frederic Weisbecker wrote: > 2012/11/27 Li Zhong : > > I noticed some warnings complaining about dynticks_nesting value, like > > > > [ 267.545032] [ cut here ] > > [ 267.545032] WARNING: at kernel/rcutree.c:382 rcu_eqs_enter+0xab/

Re: [RFC PATCH] Fix abnormal rcu dynticks_nesting values related to async page fault

2012-11-27 Thread Frederic Weisbecker
2012/11/27 Gleb Natapov : > For KVM_PV_REASON_PAGE_NOT_PRESENT it behaves like an exception. Ok. There seem to be a bug in kvm_async_pf_task_wait(). Using idle_cpu(cpu) to find out if the current task is the idle task may not work if there is pending wake up. Me may schedule another task but when

Re: [RFC PATCH] Fix abnormal rcu dynticks_nesting values related to async page fault

2012-11-27 Thread Gleb Natapov
On Tue, Nov 27, 2012 at 03:38:14PM +0100, Frederic Weisbecker wrote: > 2012/11/27 Li Zhong : > > I noticed some warnings complaining about dynticks_nesting value, like > > > > [ 267.545032] [ cut here ] > > [ 267.545032] WARNING: at kernel/rcutree.c:382 rcu_eqs_enter+0xab/

Re: [RFC PATCH] Fix abnormal rcu dynticks_nesting values related to async page fault

2012-11-27 Thread Frederic Weisbecker
2012/11/27 Li Zhong : > I noticed some warnings complaining about dynticks_nesting value, like > > [ 267.545032] [ cut here ] > [ 267.545032] WARNING: at kernel/rcutree.c:382 rcu_eqs_enter+0xab/0xc0() > [ 267.545032] Hardware name: Bochs > [ 267.545032] Modules linked in

Re: [RFC PATCH] Fix abnormal rcu dynticks_nesting values related to async page fault

2012-11-27 Thread Frederic Weisbecker
2012/11/27 Gleb Natapov : > On Tue, Nov 27, 2012 at 01:15:25PM +0800, Li Zhong wrote: >> @@ -247,10 +247,17 @@ do_async_page_fault(struct pt_regs *regs, unsigned >> long error_code) >> break; >> case KVM_PV_REASON_PAGE_NOT_PRESENT: >> /* page is swapped out by the

Re: [RFC PATCH] Fix abnormal rcu dynticks_nesting values related to async page fault

2012-11-27 Thread Paul E. McKenney
On Tue, Nov 27, 2012 at 09:01:33AM -0500, Sasha Levin wrote: > On 11/27/2012 08:07 AM, Gleb Natapov wrote: > > Those rcu_irq_enter()/rcu_irq_exit() were introduced by commit > > c5e015d4949aa665 "KVM guest: exit idleness when handling > > KVM_PV_REASON_PAGE_NOT_PRESENT", but now I am starting to qu

Re: [RFC PATCH] Fix abnormal rcu dynticks_nesting values related to async page fault

2012-11-27 Thread Frederic Weisbecker
2012/11/27 Li Zhong : > I noticed some warnings complaining about dynticks_nesting value, like > > [ 267.545032] [ cut here ] > [ 267.545032] WARNING: at kernel/rcutree.c:382 rcu_eqs_enter+0xab/0xc0() > [ 267.545032] Hardware name: Bochs > [ 267.545032] Modules linked in

Re: [RFC PATCH] Fix abnormal rcu dynticks_nesting values related to async page fault

2012-11-27 Thread Sasha Levin
On 11/27/2012 08:07 AM, Gleb Natapov wrote: > Those rcu_irq_enter()/rcu_irq_exit() were introduced by commit > c5e015d4949aa665 "KVM guest: exit idleness when handling > KVM_PV_REASON_PAGE_NOT_PRESENT", but now I am starting to question this > commit. KVM_PV_REASON_PAGE_NOT_PRESENT should not kick

Re: [RFC PATCH] Fix abnormal rcu dynticks_nesting values related to async page fault

2012-11-27 Thread Gleb Natapov
On Tue, Nov 27, 2012 at 01:15:25PM +0800, Li Zhong wrote: > I noticed some warnings complaining about dynticks_nesting value, like > > [ 267.545032] [ cut here ] > [ 267.545032] WARNING: at kernel/rcutree.c:382 rcu_eqs_enter+0xab/0xc0() > [ 267.545032] Hardware name: Bo

[RFC PATCH] Fix abnormal rcu dynticks_nesting values related to async page fault

2012-11-26 Thread Li Zhong
I noticed some warnings complaining about dynticks_nesting value, like [ 267.545032] [ cut here ] [ 267.545032] WARNING: at kernel/rcutree.c:382 rcu_eqs_enter+0xab/0xc0() [ 267.545032] Hardware name: Bochs [ 267.545032] Modules linked in: [ 267.545032] Pid: 0, comm: s