Message ID | 20171010155248.11602-1-jeremy.linton@arm.com |
---|---|
State | New |
Headers | show |
Series | locktorture: Fix Oops when reader/writer count is 0 | expand |
Hi, On 10/10/2017 10:52 AM, Jeremy Linton wrote: > If nwriters_stress=0 is passed to the lock torture test > it will panic in: Ping? Has anyone had a chance to look at this? Thanks, > > Internal error: Oops: 96000005 [#1] SMP > ... > [<ffff000000b7022c>] __torture_print_stats+0x2c/0x1c8 [locktorture] > [<ffff000000b7070c>] lock_torture_stats_print+0x74/0x120 [locktorture] > [<ffff000000b707f8>] lock_torture_stats+0x40/0xa8 [locktorture] > [<ffff0000080f3570>] kthread+0x108/0x138 > [<ffff000008084b90>] ret_from_fork+0x10/0x18 > > This is caused by the deference to a null statp. Fix that by > checking the n_stress for non zero count before referencing statp. > > Signed-off-by: Jeremy Linton <jeremy.linton@arm.com> > --- > kernel/locking/locktorture.c | 6 +++++- > 1 file changed, 5 insertions(+), 1 deletion(-) > > diff --git a/kernel/locking/locktorture.c b/kernel/locking/locktorture.c > index f24582d4dad3..8229ba7147e5 100644 > --- a/kernel/locking/locktorture.c > +++ b/kernel/locking/locktorture.c > @@ -716,10 +716,14 @@ static void __torture_print_stats(char *page, > bool fail = 0; > int i, n_stress; > long max = 0; > - long min = statp[0].n_lock_acquired; > + long min = 0; > long long sum = 0; > > n_stress = write ? cxt.nrealwriters_stress : cxt.nrealreaders_stress; > + > + if (n_stress) > + min = statp[0].n_lock_acquired; > + > for (i = 0; i < n_stress; i++) { > if (statp[i].n_lock_fail) > fail = true; >
On Tue, Nov 07, 2017 at 02:01:58PM -0600, Jeremy Linton wrote: > Hi, > > On 10/10/2017 10:52 AM, Jeremy Linton wrote: > >If nwriters_stress=0 is passed to the lock torture test > >it will panic in: > > Ping? > > Has anyone had a chance to look at this? Helps if you Cc the people actually working on this stuff of course... > > > > >Internal error: Oops: 96000005 [#1] SMP > >... > >[<ffff000000b7022c>] __torture_print_stats+0x2c/0x1c8 [locktorture] > >[<ffff000000b7070c>] lock_torture_stats_print+0x74/0x120 [locktorture] > >[<ffff000000b707f8>] lock_torture_stats+0x40/0xa8 [locktorture] > >[<ffff0000080f3570>] kthread+0x108/0x138 > >[<ffff000008084b90>] ret_from_fork+0x10/0x18 > > > >This is caused by the deference to a null statp. Fix that by > >checking the n_stress for non zero count before referencing statp. > > > >Signed-off-by: Jeremy Linton <jeremy.linton@arm.com> > >--- > > kernel/locking/locktorture.c | 6 +++++- > > 1 file changed, 5 insertions(+), 1 deletion(-) > > > >diff --git a/kernel/locking/locktorture.c b/kernel/locking/locktorture.c > >index f24582d4dad3..8229ba7147e5 100644 > >--- a/kernel/locking/locktorture.c > >+++ b/kernel/locking/locktorture.c > >@@ -716,10 +716,14 @@ static void __torture_print_stats(char *page, > > bool fail = 0; > > int i, n_stress; > > long max = 0; > >- long min = statp[0].n_lock_acquired; > >+ long min = 0; > > long long sum = 0; > > n_stress = write ? cxt.nrealwriters_stress : cxt.nrealreaders_stress; > >+ > >+ if (n_stress) > >+ min = statp[0].n_lock_acquired; > >+ > > for (i = 0; i < n_stress; i++) { > > if (statp[i].n_lock_fail) > > fail = true; > > >
On Tue, Nov 07, 2017 at 10:07:48PM +0100, Peter Zijlstra wrote: > On Tue, Nov 07, 2017 at 02:01:58PM -0600, Jeremy Linton wrote: > > Hi, > > > > On 10/10/2017 10:52 AM, Jeremy Linton wrote: > > >If nwriters_stress=0 is passed to the lock torture test > > >it will panic in: > > > > Ping? > > > > Has anyone had a chance to look at this? > > Helps if you Cc the people actually working on this stuff of course... Thank you for the forward, Peter, I have queued Jeremy's patch for testing and review. But Jeremy's list of email addresses is what you would expect from looking at MAINTAINERS, so how about the following patch? Thanx, Paul ------------------------------------------------------------------------ commit 58322063498c8f5a3cc88f95bee237a0ce81f70a Author: Paul E. McKenney <paulmck@linux.vnet.ibm.com> Date: Tue Nov 7 14:10:03 2017 -0800 torture: Place all torture-test modules in one MAINTAINERS group There is some confusion about where patches to kernel/torture.c and kernel/locking/locktorture.c should be sent. This commit therefore updates MAINTAINERS appropriately. Reported-by: Peter Zijlstra <peterz@infradead.org> Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com> diff --git a/MAINTAINERS b/MAINTAINERS index 2d3d750b19c0..eab868adedc6 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -8091,6 +8091,7 @@ F: arch/*/include/asm/rwsem.h F: include/linux/seqlock.h F: lib/locking*.[ch] F: kernel/locking/ +X: kernel/locking/locktorture.c LOGICAL DISK MANAGER SUPPORT (LDM, Windows 2000/XP/Vista Dynamic Disks) M: "Richard Russon (FlatCap)" <ldm@flatcap.org> @@ -11318,15 +11319,6 @@ L: linux-wireless@vger.kernel.org S: Orphan F: drivers/net/wireless/ray* -RCUTORTURE MODULE -M: Josh Triplett <josh@joshtriplett.org> -M: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> -L: linux-kernel@vger.kernel.org -S: Supported -T: git git://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git -F: Documentation/RCU/torture.txt -F: kernel/rcu/rcutorture.c - RCUTORTURE TEST FRAMEWORK M: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> M: Josh Triplett <josh@joshtriplett.org> @@ -13558,6 +13550,18 @@ L: platform-driver-x86@vger.kernel.org S: Maintained F: drivers/platform/x86/topstar-laptop.c +TORTURE-TEST MODULES +M: Davidlohr Bueso <dave@stgolabs.net> +M: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> +M: Josh Triplett <josh@joshtriplett.org> +L: linux-kernel@vger.kernel.org +S: Supported +T: git git://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git +F: Documentation/RCU/torture.txt +F: kernel/torture.c +F: kernel/rcu/rcutorture.c +F: kernel/locking/locktorture.c + TOSHIBA ACPI EXTRAS DRIVER M: Azael Avalos <coproscefalo@gmail.com> L: platform-driver-x86@vger.kernel.org
On Tue, Nov 07, 2017 at 02:15:55PM -0800, Paul E. McKenney wrote: > But Jeremy's list of email addresses is what you would expect from > looking at MAINTAINERS, so how about the following patch? True; I tend to also look at git history (as goes get_maintainers.pl IIRC). > commit 58322063498c8f5a3cc88f95bee237a0ce81f70a > Author: Paul E. McKenney <paulmck@linux.vnet.ibm.com> > Date: Tue Nov 7 14:10:03 2017 -0800 > > torture: Place all torture-test modules in one MAINTAINERS group > > There is some confusion about where patches to kernel/torture.c > and kernel/locking/locktorture.c should be sent. This commit > therefore updates MAINTAINERS appropriately. > > Reported-by: Peter Zijlstra <peterz@infradead.org> > Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com> Seems fair; Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org> > diff --git a/MAINTAINERS b/MAINTAINERS > index 2d3d750b19c0..eab868adedc6 100644 > --- a/MAINTAINERS > +++ b/MAINTAINERS > @@ -8091,6 +8091,7 @@ F: arch/*/include/asm/rwsem.h > F: include/linux/seqlock.h > F: lib/locking*.[ch] > F: kernel/locking/ > +X: kernel/locking/locktorture.c > > LOGICAL DISK MANAGER SUPPORT (LDM, Windows 2000/XP/Vista Dynamic Disks) > M: "Richard Russon (FlatCap)" <ldm@flatcap.org> > @@ -11318,15 +11319,6 @@ L: linux-wireless@vger.kernel.org > S: Orphan > F: drivers/net/wireless/ray* > > -RCUTORTURE MODULE > -M: Josh Triplett <josh@joshtriplett.org> > -M: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> > -L: linux-kernel@vger.kernel.org > -S: Supported > -T: git git://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git > -F: Documentation/RCU/torture.txt > -F: kernel/rcu/rcutorture.c > - > RCUTORTURE TEST FRAMEWORK > M: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> > M: Josh Triplett <josh@joshtriplett.org> > @@ -13558,6 +13550,18 @@ L: platform-driver-x86@vger.kernel.org > S: Maintained > F: drivers/platform/x86/topstar-laptop.c > > +TORTURE-TEST MODULES > +M: Davidlohr Bueso <dave@stgolabs.net> > +M: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> > +M: Josh Triplett <josh@joshtriplett.org> > +L: linux-kernel@vger.kernel.org > +S: Supported > +T: git git://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git > +F: Documentation/RCU/torture.txt > +F: kernel/torture.c > +F: kernel/rcu/rcutorture.c > +F: kernel/locking/locktorture.c > + > TOSHIBA ACPI EXTRAS DRIVER > M: Azael Avalos <coproscefalo@gmail.com> > L: platform-driver-x86@vger.kernel.org >
On Wed, Nov 08, 2017 at 09:27:50AM +0100, Peter Zijlstra wrote: > On Tue, Nov 07, 2017 at 02:15:55PM -0800, Paul E. McKenney wrote: > > But Jeremy's list of email addresses is what you would expect from > > looking at MAINTAINERS, so how about the following patch? > > True; I tend to also look at git history (as goes get_maintainers.pl > IIRC). Me too, and that certainly is best practice. > > commit 58322063498c8f5a3cc88f95bee237a0ce81f70a > > Author: Paul E. McKenney <paulmck@linux.vnet.ibm.com> > > Date: Tue Nov 7 14:10:03 2017 -0800 > > > > torture: Place all torture-test modules in one MAINTAINERS group > > > > There is some confusion about where patches to kernel/torture.c > > and kernel/locking/locktorture.c should be sent. This commit > > therefore updates MAINTAINERS appropriately. > > > > Reported-by: Peter Zijlstra <peterz@infradead.org> > > Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com> > > Seems fair; > > Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org> Applied, thank you! Thanx, Paul > > diff --git a/MAINTAINERS b/MAINTAINERS > > index 2d3d750b19c0..eab868adedc6 100644 > > --- a/MAINTAINERS > > +++ b/MAINTAINERS > > @@ -8091,6 +8091,7 @@ F: arch/*/include/asm/rwsem.h > > F: include/linux/seqlock.h > > F: lib/locking*.[ch] > > F: kernel/locking/ > > +X: kernel/locking/locktorture.c > > > > LOGICAL DISK MANAGER SUPPORT (LDM, Windows 2000/XP/Vista Dynamic Disks) > > M: "Richard Russon (FlatCap)" <ldm@flatcap.org> > > @@ -11318,15 +11319,6 @@ L: linux-wireless@vger.kernel.org > > S: Orphan > > F: drivers/net/wireless/ray* > > > > -RCUTORTURE MODULE > > -M: Josh Triplett <josh@joshtriplett.org> > > -M: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> > > -L: linux-kernel@vger.kernel.org > > -S: Supported > > -T: git git://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git > > -F: Documentation/RCU/torture.txt > > -F: kernel/rcu/rcutorture.c > > - > > RCUTORTURE TEST FRAMEWORK > > M: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> > > M: Josh Triplett <josh@joshtriplett.org> > > @@ -13558,6 +13550,18 @@ L: platform-driver-x86@vger.kernel.org > > S: Maintained > > F: drivers/platform/x86/topstar-laptop.c > > > > +TORTURE-TEST MODULES > > +M: Davidlohr Bueso <dave@stgolabs.net> > > +M: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> > > +M: Josh Triplett <josh@joshtriplett.org> > > +L: linux-kernel@vger.kernel.org > > +S: Supported > > +T: git git://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git > > +F: Documentation/RCU/torture.txt > > +F: kernel/torture.c > > +F: kernel/rcu/rcutorture.c > > +F: kernel/locking/locktorture.c > > + > > TOSHIBA ACPI EXTRAS DRIVER > > M: Azael Avalos <coproscefalo@gmail.com> > > L: platform-driver-x86@vger.kernel.org > > >
On Tue, 07 Nov 2017, Paul E. McKenney wrote: >On Tue, Nov 07, 2017 at 10:07:48PM +0100, Peter Zijlstra wrote: >> On Tue, Nov 07, 2017 at 02:01:58PM -0600, Jeremy Linton wrote: >> > Hi, >> > >> > On 10/10/2017 10:52 AM, Jeremy Linton wrote: >> > >If nwriters_stress=0 is passed to the lock torture test >> > >it will panic in: >> > >> > Ping? >> > >> > Has anyone had a chance to look at this? >> >> Helps if you Cc the people actually working on this stuff of course... > >Thank you for the forward, Peter, I have queued Jeremy's patch for >testing and review. fyi I had proposed the following a while back, which I think is more complete than this patch: https://lkml.org/lkml/2017/5/15/201 Ah, there's also this (unrelated) fix: https://lkml.org/lkml/2017/5/15/203 > >But Jeremy's list of email addresses is what you would expect from >looking at MAINTAINERS, so how about the following patch? > > Thanx, Paul > >------------------------------------------------------------------------ > >commit 58322063498c8f5a3cc88f95bee237a0ce81f70a >Author: Paul E. McKenney <paulmck@linux.vnet.ibm.com> >Date: Tue Nov 7 14:10:03 2017 -0800 > > torture: Place all torture-test modules in one MAINTAINERS group > > There is some confusion about where patches to kernel/torture.c > and kernel/locking/locktorture.c should be sent. This commit > therefore updates MAINTAINERS appropriately. > > Reported-by: Peter Zijlstra <peterz@infradead.org> > Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com> > >diff --git a/MAINTAINERS b/MAINTAINERS >index 2d3d750b19c0..eab868adedc6 100644 >--- a/MAINTAINERS >+++ b/MAINTAINERS >@@ -8091,6 +8091,7 @@ F: arch/*/include/asm/rwsem.h > F: include/linux/seqlock.h > F: lib/locking*.[ch] > F: kernel/locking/ >+X: kernel/locking/locktorture.c > > LOGICAL DISK MANAGER SUPPORT (LDM, Windows 2000/XP/Vista Dynamic Disks) > M: "Richard Russon (FlatCap)" <ldm@flatcap.org> >@@ -11318,15 +11319,6 @@ L: linux-wireless@vger.kernel.org > S: Orphan > F: drivers/net/wireless/ray* > >-RCUTORTURE MODULE >-M: Josh Triplett <josh@joshtriplett.org> >-M: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> >-L: linux-kernel@vger.kernel.org >-S: Supported >-T: git git://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git >-F: Documentation/RCU/torture.txt >-F: kernel/rcu/rcutorture.c >- > RCUTORTURE TEST FRAMEWORK > M: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> > M: Josh Triplett <josh@joshtriplett.org> >@@ -13558,6 +13550,18 @@ L: platform-driver-x86@vger.kernel.org > S: Maintained > F: drivers/platform/x86/topstar-laptop.c > >+TORTURE-TEST MODULES >+M: Davidlohr Bueso <dave@stgolabs.net> >+M: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> >+M: Josh Triplett <josh@joshtriplett.org> >+L: linux-kernel@vger.kernel.org >+S: Supported >+T: git git://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git >+F: Documentation/RCU/torture.txt >+F: kernel/torture.c >+F: kernel/rcu/rcutorture.c >+F: kernel/locking/locktorture.c Sure, if you think this is the best way to go, I have no problem. Thanks, Davidlohr
On Wed, Nov 08, 2017 at 06:45:23AM -0800, Davidlohr Bueso wrote: > On Tue, 07 Nov 2017, Paul E. McKenney wrote: > > >On Tue, Nov 07, 2017 at 10:07:48PM +0100, Peter Zijlstra wrote: > >>On Tue, Nov 07, 2017 at 02:01:58PM -0600, Jeremy Linton wrote: > >>> Hi, > >>> > >>> On 10/10/2017 10:52 AM, Jeremy Linton wrote: > >>> >If nwriters_stress=0 is passed to the lock torture test > >>> >it will panic in: > >>> > >>> Ping? > >>> > >>> Has anyone had a chance to look at this? > >> > >>Helps if you Cc the people actually working on this stuff of course... > > > >Thank you for the forward, Peter, I have queued Jeremy's patch for > >testing and review. > > fyi I had proposed the following a while back, which I think is more > complete than this patch: > > https://lkml.org/lkml/2017/5/15/201 > > Ah, there's also this (unrelated) fix: > https://lkml.org/lkml/2017/5/15/203 > > >But Jeremy's list of email addresses is what you would expect from > >looking at MAINTAINERS, so how about the following patch? And it looks like Jeremy was not alone -- I was not CCed on either of those patches, either. Dave's patch does look more complete, and it certainly was submitted first. Let's see if it still applies... And they both do. Jeremy, could you please test Dave's patches and make sure that they work for you? That way I can apply your Tested-by. Dave, any objection to my adding Jeremy's Reported-by to your /201 patch? Thanx, Paul > >------------------------------------------------------------------------ > > > >commit 58322063498c8f5a3cc88f95bee237a0ce81f70a > >Author: Paul E. McKenney <paulmck@linux.vnet.ibm.com> > >Date: Tue Nov 7 14:10:03 2017 -0800 > > > > torture: Place all torture-test modules in one MAINTAINERS group > > > > There is some confusion about where patches to kernel/torture.c > > and kernel/locking/locktorture.c should be sent. This commit > > therefore updates MAINTAINERS appropriately. > > > > Reported-by: Peter Zijlstra <peterz@infradead.org> > > Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com> > > > >diff --git a/MAINTAINERS b/MAINTAINERS > >index 2d3d750b19c0..eab868adedc6 100644 > >--- a/MAINTAINERS > >+++ b/MAINTAINERS > >@@ -8091,6 +8091,7 @@ F: arch/*/include/asm/rwsem.h > >F: include/linux/seqlock.h > >F: lib/locking*.[ch] > >F: kernel/locking/ > >+X: kernel/locking/locktorture.c > > > >LOGICAL DISK MANAGER SUPPORT (LDM, Windows 2000/XP/Vista Dynamic Disks) > >M: "Richard Russon (FlatCap)" <ldm@flatcap.org> > >@@ -11318,15 +11319,6 @@ L: linux-wireless@vger.kernel.org > >S: Orphan > >F: drivers/net/wireless/ray* > > > >-RCUTORTURE MODULE > >-M: Josh Triplett <josh@joshtriplett.org> > >-M: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> > >-L: linux-kernel@vger.kernel.org > >-S: Supported > >-T: git git://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git > >-F: Documentation/RCU/torture.txt > >-F: kernel/rcu/rcutorture.c > >- > >RCUTORTURE TEST FRAMEWORK > >M: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> > >M: Josh Triplett <josh@joshtriplett.org> > >@@ -13558,6 +13550,18 @@ L: platform-driver-x86@vger.kernel.org > >S: Maintained > >F: drivers/platform/x86/topstar-laptop.c > > > >+TORTURE-TEST MODULES > >+M: Davidlohr Bueso <dave@stgolabs.net> > >+M: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> > >+M: Josh Triplett <josh@joshtriplett.org> > >+L: linux-kernel@vger.kernel.org > >+S: Supported > >+T: git git://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git > >+F: Documentation/RCU/torture.txt > >+F: kernel/torture.c > >+F: kernel/rcu/rcutorture.c > >+F: kernel/locking/locktorture.c > > Sure, if you think this is the best way to go, I have no problem. > > Thanks, > Davidlohr >
On 11/08/2017 10:48 AM, Paul E. McKenney wrote: > On Wed, Nov 08, 2017 at 06:45:23AM -0800, Davidlohr Bueso wrote: >> On Tue, 07 Nov 2017, Paul E. McKenney wrote: >> >>> On Tue, Nov 07, 2017 at 10:07:48PM +0100, Peter Zijlstra wrote: >>>> On Tue, Nov 07, 2017 at 02:01:58PM -0600, Jeremy Linton wrote: >>>>> Hi, >>>>> >>>>> On 10/10/2017 10:52 AM, Jeremy Linton wrote: >>>>>> If nwriters_stress=0 is passed to the lock torture test >>>>>> it will panic in: >>>>> >>>>> Ping? >>>>> >>>>> Has anyone had a chance to look at this? >>>> >>>> Helps if you Cc the people actually working on this stuff of course... >>> >>> Thank you for the forward, Peter, I have queued Jeremy's patch for >>> testing and review. >> >> fyi I had proposed the following a while back, which I think is more >> complete than this patch: >> >> https://lkml.org/lkml/2017/5/15/201 >> >> Ah, there's also this (unrelated) fix: >> https://lkml.org/lkml/2017/5/15/203 >> >>> But Jeremy's list of email addresses is what you would expect from >>> looking at MAINTAINERS, so how about the following patch? > > And it looks like Jeremy was not alone -- I was not CCed on either > of those patches, either. > > Dave's patch does look more complete, and it certainly was submitted > first. Let's see if it still applies... And they both do. Yes, avoiding the zero length allocations is probably a good plan, and complaining if both the reader and writer are zero is doesn't hurt either. So, I'm good with that patch too.. Reviewed-by: Jeremy Linton <jeremy.linton@arm.com> > > Jeremy, could you please test Dave's patches and make sure that they > work for you? That way I can apply your Tested-by. Dave, any objection > to my adding Jeremy's Reported-by to your /201 patch? I will give it a spin.. > > Thanx, Paul > >>> ------------------------------------------------------------------------ >>> >>> commit 58322063498c8f5a3cc88f95bee237a0ce81f70a >>> Author: Paul E. McKenney <paulmck@linux.vnet.ibm.com> >>> Date: Tue Nov 7 14:10:03 2017 -0800 >>> >>> torture: Place all torture-test modules in one MAINTAINERS group >>> >>> There is some confusion about where patches to kernel/torture.c >>> and kernel/locking/locktorture.c should be sent. This commit >>> therefore updates MAINTAINERS appropriately. >>> >>> Reported-by: Peter Zijlstra <peterz@infradead.org> >>> Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com> >>> >>> diff --git a/MAINTAINERS b/MAINTAINERS >>> index 2d3d750b19c0..eab868adedc6 100644 >>> --- a/MAINTAINERS >>> +++ b/MAINTAINERS >>> @@ -8091,6 +8091,7 @@ F: arch/*/include/asm/rwsem.h >>> F: include/linux/seqlock.h >>> F: lib/locking*.[ch] >>> F: kernel/locking/ >>> +X: kernel/locking/locktorture.c >>> >>> LOGICAL DISK MANAGER SUPPORT (LDM, Windows 2000/XP/Vista Dynamic Disks) >>> M: "Richard Russon (FlatCap)" <ldm@flatcap.org> >>> @@ -11318,15 +11319,6 @@ L: linux-wireless@vger.kernel.org >>> S: Orphan >>> F: drivers/net/wireless/ray* >>> >>> -RCUTORTURE MODULE >>> -M: Josh Triplett <josh@joshtriplett.org> >>> -M: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> >>> -L: linux-kernel@vger.kernel.org >>> -S: Supported >>> -T: git git://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git >>> -F: Documentation/RCU/torture.txt >>> -F: kernel/rcu/rcutorture.c >>> - >>> RCUTORTURE TEST FRAMEWORK >>> M: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> >>> M: Josh Triplett <josh@joshtriplett.org> >>> @@ -13558,6 +13550,18 @@ L: platform-driver-x86@vger.kernel.org >>> S: Maintained >>> F: drivers/platform/x86/topstar-laptop.c >>> >>> +TORTURE-TEST MODULES >>> +M: Davidlohr Bueso <dave@stgolabs.net> >>> +M: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> >>> +M: Josh Triplett <josh@joshtriplett.org> >>> +L: linux-kernel@vger.kernel.org >>> +S: Supported >>> +T: git git://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git >>> +F: Documentation/RCU/torture.txt >>> +F: kernel/torture.c >>> +F: kernel/rcu/rcutorture.c >>> +F: kernel/locking/locktorture.c >> >> Sure, if you think this is the best way to go, I have no problem. >> >> Thanks, >> Davidlohr >> >
On Wed, Nov 08, 2017 at 10:57:07AM -0600, Jeremy Linton wrote: > On 11/08/2017 10:48 AM, Paul E. McKenney wrote: > >On Wed, Nov 08, 2017 at 06:45:23AM -0800, Davidlohr Bueso wrote: > >>On Tue, 07 Nov 2017, Paul E. McKenney wrote: > >> > >>>On Tue, Nov 07, 2017 at 10:07:48PM +0100, Peter Zijlstra wrote: > >>>>On Tue, Nov 07, 2017 at 02:01:58PM -0600, Jeremy Linton wrote: > >>>>>Hi, > >>>>> > >>>>>On 10/10/2017 10:52 AM, Jeremy Linton wrote: > >>>>>>If nwriters_stress=0 is passed to the lock torture test > >>>>>>it will panic in: > >>>>> > >>>>>Ping? > >>>>> > >>>>>Has anyone had a chance to look at this? > >>>> > >>>>Helps if you Cc the people actually working on this stuff of course... > >>> > >>>Thank you for the forward, Peter, I have queued Jeremy's patch for > >>>testing and review. > >> > >>fyi I had proposed the following a while back, which I think is more > >>complete than this patch: > >> > >>https://lkml.org/lkml/2017/5/15/201 > >> > >>Ah, there's also this (unrelated) fix: > >>https://lkml.org/lkml/2017/5/15/203 > >> > >>>But Jeremy's list of email addresses is what you would expect from > >>>looking at MAINTAINERS, so how about the following patch? > > > >And it looks like Jeremy was not alone -- I was not CCed on either > >of those patches, either. > > > >Dave's patch does look more complete, and it certainly was submitted > >first. Let's see if it still applies... And they both do. > > Yes, avoiding the zero length allocations is probably a good plan, > and complaining if both the reader and writer are zero is doesn't > hurt either. > > So, I'm good with that patch too.. > > Reviewed-by: Jeremy Linton <jeremy.linton@arm.com> Thank you! > >Jeremy, could you please test Dave's patches and make sure that they > >work for you? That way I can apply your Tested-by. Dave, any objection > >to my adding Jeremy's Reported-by to your /201 patch? > > I will give it a spin.. Very good! Looking forward to seeing the results. Thanx, Paul > >>>------------------------------------------------------------------------ > >>> > >>>commit 58322063498c8f5a3cc88f95bee237a0ce81f70a > >>>Author: Paul E. McKenney <paulmck@linux.vnet.ibm.com> > >>>Date: Tue Nov 7 14:10:03 2017 -0800 > >>> > >>> torture: Place all torture-test modules in one MAINTAINERS group > >>> > >>> There is some confusion about where patches to kernel/torture.c > >>> and kernel/locking/locktorture.c should be sent. This commit > >>> therefore updates MAINTAINERS appropriately. > >>> > >>> Reported-by: Peter Zijlstra <peterz@infradead.org> > >>> Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com> > >>> > >>>diff --git a/MAINTAINERS b/MAINTAINERS > >>>index 2d3d750b19c0..eab868adedc6 100644 > >>>--- a/MAINTAINERS > >>>+++ b/MAINTAINERS > >>>@@ -8091,6 +8091,7 @@ F: arch/*/include/asm/rwsem.h > >>>F: include/linux/seqlock.h > >>>F: lib/locking*.[ch] > >>>F: kernel/locking/ > >>>+X: kernel/locking/locktorture.c > >>> > >>>LOGICAL DISK MANAGER SUPPORT (LDM, Windows 2000/XP/Vista Dynamic Disks) > >>>M: "Richard Russon (FlatCap)" <ldm@flatcap.org> > >>>@@ -11318,15 +11319,6 @@ L: linux-wireless@vger.kernel.org > >>>S: Orphan > >>>F: drivers/net/wireless/ray* > >>> > >>>-RCUTORTURE MODULE > >>>-M: Josh Triplett <josh@joshtriplett.org> > >>>-M: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> > >>>-L: linux-kernel@vger.kernel.org > >>>-S: Supported > >>>-T: git git://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git > >>>-F: Documentation/RCU/torture.txt > >>>-F: kernel/rcu/rcutorture.c > >>>- > >>>RCUTORTURE TEST FRAMEWORK > >>>M: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> > >>>M: Josh Triplett <josh@joshtriplett.org> > >>>@@ -13558,6 +13550,18 @@ L: platform-driver-x86@vger.kernel.org > >>>S: Maintained > >>>F: drivers/platform/x86/topstar-laptop.c > >>> > >>>+TORTURE-TEST MODULES > >>>+M: Davidlohr Bueso <dave@stgolabs.net> > >>>+M: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> > >>>+M: Josh Triplett <josh@joshtriplett.org> > >>>+L: linux-kernel@vger.kernel.org > >>>+S: Supported > >>>+T: git git://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git > >>>+F: Documentation/RCU/torture.txt > >>>+F: kernel/torture.c > >>>+F: kernel/rcu/rcutorture.c > >>>+F: kernel/locking/locktorture.c > >> > >>Sure, if you think this is the best way to go, I have no problem. > >> > >>Thanks, > >>Davidlohr > >> > > >
Hi, On 11/08/2017 11:44 AM, Paul E. McKenney wrote: > On Wed, Nov 08, 2017 at 10:57:07AM -0600, Jeremy Linton wrote: >> On 11/08/2017 10:48 AM, Paul E. McKenney wrote: >>> On Wed, Nov 08, 2017 at 06:45:23AM -0800, Davidlohr Bueso wrote: >>>> On Tue, 07 Nov 2017, Paul E. McKenney wrote: >>>> >>>>> On Tue, Nov 07, 2017 at 10:07:48PM +0100, Peter Zijlstra wrote: >>>>>> On Tue, Nov 07, 2017 at 02:01:58PM -0600, Jeremy Linton wrote: >>>>>>> Hi, >>>>>>> >>>>>>> On 10/10/2017 10:52 AM, Jeremy Linton wrote: >>>>>>>> If nwriters_stress=0 is passed to the lock torture test >>>>>>>> it will panic in: >>>>>>> >>>>>>> Ping? >>>>>>> >>>>>>> Has anyone had a chance to look at this? >>>>>> >>>>>> Helps if you Cc the people actually working on this stuff of course... >>>>> >>>>> Thank you for the forward, Peter, I have queued Jeremy's patch for >>>>> testing and review. >>>> >>>> fyi I had proposed the following a while back, which I think is more >>>> complete than this patch: >>>> >>>> https://lkml.org/lkml/2017/5/15/201 >>>> >>>> Ah, there's also this (unrelated) fix: >>>> https://lkml.org/lkml/2017/5/15/203 >>>> >>>>> But Jeremy's list of email addresses is what you would expect from >>>>> looking at MAINTAINERS, so how about the following patch? >>> >>> And it looks like Jeremy was not alone -- I was not CCed on either >>> of those patches, either. >>> >>> Dave's patch does look more complete, and it certainly was submitted >>> first. Let's see if it still applies... And they both do. >> >> Yes, avoiding the zero length allocations is probably a good plan, >> and complaining if both the reader and writer are zero is doesn't >> hurt either. >> >> So, I'm good with that patch too.. >> >> Reviewed-by: Jeremy Linton <jeremy.linton@arm.com> > > Thank you! > >>> Jeremy, could you please test Dave's patches and make sure that they >>> work for you? That way I can apply your Tested-by. Dave, any objection >>> to my adding Jeremy's Reported-by to your /201 patch? >> >> I will give it a spin.. > > Very good! Looking forward to seeing the results. I've been testing it on arm64 machines and it appears to work as expected. Tested-by: Jeremy Linton <jeremy.linton@arm.com> Thanks, > > Thanx, Paul > >>>>> ------------------------------------------------------------------------ >>>>> >>>>> commit 58322063498c8f5a3cc88f95bee237a0ce81f70a >>>>> Author: Paul E. McKenney <paulmck@linux.vnet.ibm.com> >>>>> Date: Tue Nov 7 14:10:03 2017 -0800 >>>>> >>>>> torture: Place all torture-test modules in one MAINTAINERS group >>>>> >>>>> There is some confusion about where patches to kernel/torture.c >>>>> and kernel/locking/locktorture.c should be sent. This commit >>>>> therefore updates MAINTAINERS appropriately. >>>>> >>>>> Reported-by: Peter Zijlstra <peterz@infradead.org> >>>>> Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com> >>>>> >>>>> diff --git a/MAINTAINERS b/MAINTAINERS >>>>> index 2d3d750b19c0..eab868adedc6 100644 >>>>> --- a/MAINTAINERS >>>>> +++ b/MAINTAINERS >>>>> @@ -8091,6 +8091,7 @@ F: arch/*/include/asm/rwsem.h >>>>> F: include/linux/seqlock.h >>>>> F: lib/locking*.[ch] >>>>> F: kernel/locking/ >>>>> +X: kernel/locking/locktorture.c >>>>> >>>>> LOGICAL DISK MANAGER SUPPORT (LDM, Windows 2000/XP/Vista Dynamic Disks) >>>>> M: "Richard Russon (FlatCap)" <ldm@flatcap.org> >>>>> @@ -11318,15 +11319,6 @@ L: linux-wireless@vger.kernel.org >>>>> S: Orphan >>>>> F: drivers/net/wireless/ray* >>>>> >>>>> -RCUTORTURE MODULE >>>>> -M: Josh Triplett <josh@joshtriplett.org> >>>>> -M: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> >>>>> -L: linux-kernel@vger.kernel.org >>>>> -S: Supported >>>>> -T: git git://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git >>>>> -F: Documentation/RCU/torture.txt >>>>> -F: kernel/rcu/rcutorture.c >>>>> - >>>>> RCUTORTURE TEST FRAMEWORK >>>>> M: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> >>>>> M: Josh Triplett <josh@joshtriplett.org> >>>>> @@ -13558,6 +13550,18 @@ L: platform-driver-x86@vger.kernel.org >>>>> S: Maintained >>>>> F: drivers/platform/x86/topstar-laptop.c >>>>> >>>>> +TORTURE-TEST MODULES >>>>> +M: Davidlohr Bueso <dave@stgolabs.net> >>>>> +M: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> >>>>> +M: Josh Triplett <josh@joshtriplett.org> >>>>> +L: linux-kernel@vger.kernel.org >>>>> +S: Supported >>>>> +T: git git://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git >>>>> +F: Documentation/RCU/torture.txt >>>>> +F: kernel/torture.c >>>>> +F: kernel/rcu/rcutorture.c >>>>> +F: kernel/locking/locktorture.c >>>> >>>> Sure, if you think this is the best way to go, I have no problem. >>>> >>>> Thanks, >>>> Davidlohr >>>> >>> >> >
On Wed, 08 Nov 2017, Paul E. McKenney wrote: >Jeremy, could you please test Dave's patches and make sure that they >work for you? That way I can apply your Tested-by. Dave, any objection >to my adding Jeremy's Reported-by to your /201 patch? No, feel free. Thanks, Davidlohr
On Thu, Nov 09, 2017 at 08:19:25AM -0800, Davidlohr Bueso wrote: > On Wed, 08 Nov 2017, Paul E. McKenney wrote: > > >Jeremy, could you please test Dave's patches and make sure that they > >work for you? That way I can apply your Tested-by. Dave, any objection > >to my adding Jeremy's Reported-by to your /201 patch? > > No, feel free. Applied and pushed, thank you both! Thanx, Paul
diff --git a/kernel/locking/locktorture.c b/kernel/locking/locktorture.c index f24582d4dad3..8229ba7147e5 100644 --- a/kernel/locking/locktorture.c +++ b/kernel/locking/locktorture.c @@ -716,10 +716,14 @@ static void __torture_print_stats(char *page, bool fail = 0; int i, n_stress; long max = 0; - long min = statp[0].n_lock_acquired; + long min = 0; long long sum = 0; n_stress = write ? cxt.nrealwriters_stress : cxt.nrealreaders_stress; + + if (n_stress) + min = statp[0].n_lock_acquired; + for (i = 0; i < n_stress; i++) { if (statp[i].n_lock_fail) fail = true;
If nwriters_stress=0 is passed to the lock torture test it will panic in: Internal error: Oops: 96000005 [#1] SMP ... [<ffff000000b7022c>] __torture_print_stats+0x2c/0x1c8 [locktorture] [<ffff000000b7070c>] lock_torture_stats_print+0x74/0x120 [locktorture] [<ffff000000b707f8>] lock_torture_stats+0x40/0xa8 [locktorture] [<ffff0000080f3570>] kthread+0x108/0x138 [<ffff000008084b90>] ret_from_fork+0x10/0x18 This is caused by the deference to a null statp. Fix that by checking the n_stress for non zero count before referencing statp. Signed-off-by: Jeremy Linton <jeremy.linton@arm.com> --- kernel/locking/locktorture.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) -- 2.13.5