Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751866AbdFZPym convert rfc822-to-8bit (ORCPT ); Mon, 26 Jun 2017 11:54:42 -0400 Received: from smtp-out4.electric.net ([192.162.216.186]:50682 "EHLO smtp-out4.electric.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750919AbdFZPyi (ORCPT ); Mon, 26 Jun 2017 11:54:38 -0400 From: David Laight To: "'Karim Eshapa'" , "oss@buserror.net" CC: "roy.pledge@nxp.com" , "linux-kernel@vger.kernel.org" , "claudiu.manoil@nxp.com" , "colin.king@canonical.com" , "linuxppc-dev@lists.ozlabs.org" , "linux-arm-kernel@lists.infradead.org" Subject: RE: [PATCH] soc/qman: Sleep instead of stuck hacking jiffies. Thread-Topic: [PATCH] soc/qman: Sleep instead of stuck hacking jiffies. Thread-Index: AQHS7cXVh/2WCtpWx0e0tdxY1qDPZKI3TJ3A Date: Mon, 26 Jun 2017 15:54:30 +0000 Message-ID: <063D6719AE5E284EB5DD2968C1650D6DD002B1A5@AcuExch.aculab.com> References: <1498403622-2878-1-git-send-email-karim.eshapa@gmail.com> In-Reply-To: <1498403622-2878-1-git-send-email-karim.eshapa@gmail.com> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.202.99.200] Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 X-Outbound-IP: 156.67.243.126 X-Env-From: David.Laight@ACULAB.COM X-Proto: esmtps X-Revdns: X-HELO: AcuExch.aculab.com X-TLS: TLSv1:AES128-SHA:128 X-Authenticated_ID: X-PolicySMART: 3396946, 3397078 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 842 Lines: 28 From: Karim Eshapa > Sent: 25 June 2017 16:14 > Use msleep() instead of stucking with > long delay will be more efficient. ... > --- a/drivers/soc/fsl/qbman/qman.c > +++ b/drivers/soc/fsl/qbman/qman.c > @@ -1084,11 +1084,7 @@ static int drain_mr_fqrni(struct qm_portal *p) > * entries well before the ring has been fully consumed, so > * we're being *really* paranoid here. > */ > - u64 now, then = jiffies; > - > - do { > - now = jiffies; > - } while ((then + 10000) > now); > + msleep(1); ... How is that in any way equivalent? If HZ is 1000 the old code loops for 10 seconds. If HZ is 250 (common for some distros) it loops for 40 seconds. Clearly both are horrid, but it isn't at all clear that a 1ms sleep is performing the same job. My guess is that this code is never called, and broken if actually called. David