Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751958AbdFPBGV (ORCPT ); Thu, 15 Jun 2017 21:06:21 -0400 Received: from mail-pf0-f195.google.com ([209.85.192.195]:35001 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751641AbdFPBGT (ORCPT ); Thu, 15 Jun 2017 21:06:19 -0400 Date: Fri, 16 Jun 2017 09:07:57 +0800 From: Boqun Feng To: "Paul E. McKenney" Cc: Krister Johansen , Steven Rostedt , Peter Zijlstra , Ingo Molnar , linux-kernel@vger.kernel.org, Paul Gortmaker , Thomas Gleixner Subject: Re: [PATCH tip/sched/core] Add comments to aid in safer usage of swake_up. Message-ID: <20170616010757.kegygn4ndivdb4wh@tardis> References: <20170609124554.GF3721@linux.vnet.ibm.com> <20170613192308.173dd86a@gandalf.local.home> <20170613234205.GD3721@linux.vnet.ibm.com> <20170613211547.49814d25@gandalf.local.home> <20170614035843.GI3721@linux.vnet.ibm.com> <20170614091015.01d7dc89@gandalf.local.home> <20170614110240.10abe2ed@gandalf.local.home> <20170614162558.GA2368@templeofstupid.com> <20170615041828.zk3a3sfyudm5p6nl@tardis> <20170615175629.GE3721@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="6exkrcuqtmy3iipr" Content-Disposition: inline In-Reply-To: <20170615175629.GE3721@linux.vnet.ibm.com> User-Agent: NeoMutt/20170225 (1.8.0) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2918 Lines: 81 --6exkrcuqtmy3iipr Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Jun 15, 2017 at 10:56:29AM -0700, Paul E. McKenney wrote: [...] > > >=20 > > > FWLIW, I agree. There was a smb_mb() in RT-linux's equivalent of > > > swait_activate(). > > >=20 > > > https://www.spinics.net/lists/linux-rt-users/msg10340.html > > >=20 > > > If the barrier goes in swait_active() then we don't have to require a= ll > > > of the callers of swait_active and swake_up to issue the barrier > > > instead. Handling this in swait_active is likely to be less error > > > prone. Though, we could also do something like wq_has_sleeper() and = use > > > that preferentially in swake_up and its variants. > > >=20 > >=20 > > I think it makes more sense that we delete the swait_active() in > > swake_up()? Because we seems to encourage users to do the quick check on > > wait queue on their own, so why do the check again in swake_up()? > > Besides, wake_up() doesn't call waitqueue_activie() outside the lock > > critical section either. > >=20 > > So how about the patch below(Testing is in progress)? Peter? >=20 > It is quite possible that a problem I am seeing is caused by this, but > there are reasons to believe otherwise. And in any case, the problem is > quite rare, taking tens or perhaps even hundreds of hours of rcutorture > to reproduce. >=20 > So, would you be willing to create a dedicated swait torture test to check > this out? The usual approach would be to create a circle of kthreads, > with each waiting on the previous kthread and waking up the next one. > Each kthread, after being awakened, checks a variable that its waker > sets just before the wakeup. Have another kthread check for hangs. >=20 > Possibly introduce timeouts and random delays to stir things up a bit. >=20 > But maybe such a test already exists. Does anyone know of one? I don't > see anything obvious. >=20 Your waketorture patchset[1] seems to be something similar, at least a good start ;-) As we don't know which kind of scenario will trigger the problem easily, I will play around with different ones, and hopefully we can find a way. Regards, Boqun [1]: https://marc.info/?l=3Dlinux-kernel&m=3D146602969518960 > Interested? >=20 > Thanx, Paul >=20 [...] --6exkrcuqtmy3iipr Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCAAdFiEEj5IosQTPz8XU1wRHSXnow7UH+rgFAllDL2oACgkQSXnow7UH +rhLewf9Ep9mG2jCFYoiP/cKwyCkjtE19Bx0mZQYiM0cfVTKHzC8U85Qe81/97JR qaH+PNmNPPdo6AO8cG83jc4hjECMS8fFcrG0ptMeqyunjF2Gi4ChlXKZRYu/IX9E yowIgZZClpBx5sPf5XNLXOfvrCoiI/IpkIuEnbE52lP+Vbxw0Zv0rXYC4K3DCbmK CyIeSBWmC8BRbC+P1EJMo33UyJO7mqxZXC4zhIzYStbgG2Z12QEJJ4YX7NaAgIA4 LaqLvpNrqjXoTwODUNEg32xRa0gyAU7/CN7CoZv0DO/U5TY1TnFg4ibXt1uhK9Lb VQQugFDzQq5drTMsRlxsVV5sqGKQCQ== =6JJv -----END PGP SIGNATURE----- --6exkrcuqtmy3iipr--