Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752815AbdF0Qrn (ORCPT ); Tue, 27 Jun 2017 12:47:43 -0400 Received: from mail-ve1eur01on0082.outbound.protection.outlook.com ([104.47.1.82]:38592 "EHLO EUR01-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752566AbdF0Qra (ORCPT ); Tue, 27 Jun 2017 12:47:30 -0400 From: Leo Li To: David Laight , "'Karim Eshapa'" , "oss@buserror.net" CC: Roy Pledge , "linux-kernel@vger.kernel.org" , Claudiu Manoil , "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: AQHS7cXa1oAmrFP60UKls/zMhiDjIaI3TXIAgAGeoCA= Date: Tue, 27 Jun 2017 16:47:25 +0000 Message-ID: References: <1498403622-2878-1-git-send-email-karim.eshapa@gmail.com> <063D6719AE5E284EB5DD2968C1650D6DD002B1A5@AcuExch.aculab.com> In-Reply-To: <063D6719AE5E284EB5DD2968C1650D6DD002B1A5@AcuExch.aculab.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: ACULAB.COM; dkim=none (message not signed) header.d=none;ACULAB.COM; dmarc=none action=none header.from=nxp.com; x-originating-ip: [192.88.168.1] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;DB6PR0401MB2566;7:cHWDxAXtdGQoHhxWNU4Q38RyTzz3yWC+7VWGtGB/jNl2vfESrT73xQE2r0TYIb3YxO3Yr3ODrjKJSHzCPgPD/7uEdqIkBK0uvqAFQYZ2ibIkcleKmamXSzrWkqCj6/AhUrSRTXAEO4uRixtTM6AXe6Y2WBcrc70jMkZRoraEXSpvZBasRyZbRfNo3iAsm/EzaaZwbmeIoJdVm6cvjRmEjxx4TrNejK4i8Ft0Pqz2QDPy327/E6vRCD9r07MSMWKXDu0dn6TnGM4sSYmsefG3tl94dpTWdwPJXS+Jn8eKsFbyTvxGXK3nHZ17xwziBH+CqVwsj6YWxeB/OH1VdLNj4AgSUNsC+3ba8OmHvpC3KZUOltEsIx63mOWACmcKn5WKBr1M85p1ZMT918DJ7XedLhkjR+UGhHAuQqM4oUNgPxuOP0wD45jzgBp3OWjnbS3kfFxLqQIJz0TYplYWXza9dD5pD0fjs1TeTy4yHxTCdirSsTahW9XcFr6x3zrQuJUsUWTF1fUDBl1HCRToUng+SDfFBpucg0jffncZuu3laKpgD29KcZ/r7QmD7ybjZUKQDwQYdMUoIauWqU3RvFYvaz9YSv7WOLDirPn4czuqY0infAd6+qJ7OtNggC9T4XzickoOndNOZZ58y4WFIQk5Bf8NogXEDAdibEfTcJtSgAz0NuAJV2xfWV1MuHhn0tBOtslVwZbMatitS2b/FEyCwJ92erBNMQrwWlnx9jLdxkgh8/7DUgpEMwhJxzufmB0lBwyRtOxqq/4eQV8+HmAj7GY52fMWTi+bBmCqWWTvytk= x-forefront-antispam-report: SFV:SKI;SCL:-1SFV:NSPM;SFS:(10009020)(6009001)(39850400002)(39410400002)(39860400002)(39450400003)(39840400002)(39400400002)(13464003)(377454003)(2501003)(7696004)(74316002)(229853002)(53936002)(6246003)(5660300001)(6436002)(3280700002)(25786009)(66066001)(8676002)(39060400002)(2950100002)(4326008)(14454004)(81156014)(5250100002)(99286003)(76176999)(50986999)(54356999)(86362001)(55016002)(81166006)(9686003)(3660700001)(102836003)(189998001)(478600001)(7736002)(53546010)(2906002)(305945005)(3846002)(38730400002)(6506006)(54906002)(33656002)(2900100001)(8936002)(6116002);DIR:OUT;SFP:1101;SCL:1;SRVR:DB6PR0401MB2566;H:AM4PR0401MB1699.eurprd04.prod.outlook.com;FPR:;SPF:None;MLV:ovrnspm;PTR:InfoNoRecords;LANG:en; x-ms-office365-filtering-correlation-id: c0fce536-59ed-40a1-4f86-08d4bd7c30e5 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(300000502095)(300135100095)(22001)(2017030254075)(300000503095)(300135400095)(48565401081)(201703131423075)(201703031133081)(300000504095)(300135200095)(300000505095)(300135600095)(300000506067)(300135500095);SRVR:DB6PR0401MB2566; x-ms-traffictypediagnostic: DB6PR0401MB2566: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(236129657087228)(9452136761055)(65623756079841)(185117386973197)(258649278758335)(198206253151910); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(8121501046)(5005006)(93006095)(93001095)(3002001)(100000703101)(100105400095)(10201501046)(6055026)(6041248)(20161123562025)(20161123564025)(20161123560025)(20161123555025)(20161123558100)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(6072148)(100000704101)(100105200095)(100000705101)(100105500095);SRVR:DB6PR0401MB2566;BCL:0;PCL:0;RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095);SRVR:DB6PR0401MB2566; x-forefront-prvs: 0351D213B3 spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-originalarrivaltime: 27 Jun 2017 16:47:25.8605 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0401MB2566 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by mail.home.local id v5RGlkGF021416 Content-Length: 1629 Lines: 43 > -----Original Message----- > From: Linuxppc-dev [mailto:linuxppc-dev- > bounces+leoli=freescale.com@lists.ozlabs.org] On Behalf Of David Laight > Sent: Monday, June 26, 2017 10:55 AM > To: 'Karim Eshapa' ; oss@buserror.net > Cc: Roy Pledge ; linux-kernel@vger.kernel.org; > Claudiu Manoil ; 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. > > 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. It was indeed broken. The intent was to wait for 10000 cycles but mistakenly coded as 10000 jiffies. I think we choose 1ms as it is not too long and almost guarantees the 10000 cycles delay. Regards, Leo