Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932097AbdI1NYF (ORCPT ); Thu, 28 Sep 2017 09:24:05 -0400 Received: from mail-eopbgr10074.outbound.protection.outlook.com ([40.107.1.74]:31424 "EHLO EUR02-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753118AbdI1NYC (ORCPT ); Thu, 28 Sep 2017 09:24:02 -0400 From: Ruxandra Ioana Radulescu To: "gregkh@linuxfoundation.org" CC: Dan Carpenter , "devel@driverdev.osuosl.org" , "arnd@arndb.de" , "stuyoder@gmail.com" , Roy Pledge , "linux-kernel@vger.kernel.org" , "agraf@suse.de" , Bogdan Purcareata , Laurentiu Tudor Subject: RE: [PATCH] staging: fsl-mc/dpio: Fix incorrect comparison Thread-Topic: [PATCH] staging: fsl-mc/dpio: Fix incorrect comparison Thread-Index: AQHTN7oYgMCC9Nvla0+749/uaJzKTqLKQL4AgAAAVyCAAAfdgIAAAOrQ Date: Thu, 28 Sep 2017 13:23:56 +0000 Message-ID: References: <20170927175728.3307-1-ruxandra.radulescu@nxp.com> <20170928124836.kdqjowqibab53hf5@mwanda> <20170928131757.GA23657@kroah.com> In-Reply-To: <20170928131757.GA23657@kroah.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=ruxandra.radulescu@nxp.com; x-originating-ip: [213.233.90.35] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;DB6PR04MB3000;6:USL6akni86KYcqrTuj+GyqiM1IViBCJzw4ee0gYe6VjLapiIrlE2QAWk6OdGXNdG7UtGw720aHEJV8+/XSkadEdX8++gcsQ7o0cETVi52DtYamcAwzAANyCR5ms4dj95MK2aq0qJMvnmaPOMGb6F/U6pojFE4BF2/3uDJeyUqX6TTMJAXA2pyQS+WEAiEUrVGTRPvte5NXanNHh8lSYhf4SLoWKekZqKtMMtEjDete45/mD0QsBXoTQoEQswGF1fnptpe2XR6KsHs7zlwYtttTOvvPr2mY44SMgpZayR3+x5hkJT91/MVxqyenXE2jhig9sP9wXMjUq7f9zqlVINsw==;5:ieBZTFhDFWQGIqmWWUEVRdZJAy50OsKnC6+Exw/mq6vMdG47HM+xj8kxGv5spvhIIvL6Hq5rbhtoiPeVeY8XsTGwzsmeXXBpV8x5KcylmqIFtW3EigSFDyR0XReTal5ZyQ54EPSlLPRC4ntT8XBx9Q==;24:7ccMq64MLl+dbKutz910h55V8jxG0bRsyAH6/OzLlnoIxtxY4r0HRHgYW0dlbXj4rYwHTMic7UKn4v/xQGqkauAgckYVHPo5/T6R36lfc/4=;7:rEs+Ye4x7O/JK8nq999bZm2OvRfBlDMC/KJVDANy0DI5+GK7Q+UtM+TQNVLAZV73C2JI1Jo4kpwWZ78ipbFiBAHN+QierVStoAA0Y7FjkuI8aB0tdfGYzQDO03txMIq49DtkVh1P0YsniCkRNz3nP4S7B7hjv4Z5GS3sHiSM7bosDjeJrW7/3rVpiRvAIb3UoPQgt73LQizal+7oVintWbHRvako1Gpu2dKJhQE3wP8= x-ms-exchange-antispam-srfa-diagnostics: SSOS;SSOR; x-forefront-antispam-report: SFV:SKI;SCL:-1;SFV:NSPM;SFS:(10009020)(6009001)(346002)(39860400002)(376002)(199003)(51914003)(377454003)(13464003)(24454002)(189002)(189998001)(39060400002)(81166006)(33656002)(316002)(4326008)(93886005)(2351001)(54356999)(478600001)(74316002)(68736007)(3660700001)(7696004)(106356001)(25786009)(105586002)(53546010)(6506006)(305945005)(6436002)(2900100001)(86362001)(2950100002)(6916009)(14454004)(6246003)(97736004)(102836003)(3846002)(6116002)(229853002)(2501003)(8676002)(5660300001)(7736002)(5250100002)(8936002)(55016002)(99286003)(5640700003)(2906002)(1730700003)(81156014)(9686003)(50986999)(54906003)(101416001)(76176999)(3280700002)(53936002)(66066001);DIR:OUT;SFP:1101;SCL:1;SRVR:DB6PR04MB3000;H:VI1PR0402MB2847.eurprd04.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:3;LANG:en; x-ms-office365-filtering-correlation-id: f84b6390-ae70-4c49-512f-08d506742bc9 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001)(2017030254152)(48565401081)(2017052603199)(201703131423075)(201703031133081)(201702281549075);SRVR:DB6PR04MB3000; x-ms-traffictypediagnostic: DB6PR04MB3000: x-exchange-antispam-report-test: UriScan:(9452136761055)(185117386973197)(146099531331640); x-microsoft-antispam-prvs: x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(8121501046)(5005006)(100000703101)(100105400095)(3002001)(93006095)(93001095)(10201501046)(6055026)(6041248)(20161123562025)(20161123558100)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123560025)(20161123564025)(20161123555025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095);SRVR:DB6PR04MB3000;BCL:0;PCL:0;RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095);SRVR:DB6PR04MB3000; x-forefront-prvs: 0444EB1997 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: 28 Sep 2017 13:23:56.2130 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR04MB3000 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 nfs id v8SDOAGP022007 Content-Length: 2547 Lines: 59 > -----Original Message----- > From: gregkh@linuxfoundation.org [mailto:gregkh@linuxfoundation.org] > Sent: Thursday, September 28, 2017 4:18 PM > To: Ruxandra Ioana Radulescu > Cc: Dan Carpenter ; > devel@driverdev.osuosl.org; arnd@arndb.de; stuyoder@gmail.com; Roy > Pledge ; linux-kernel@vger.kernel.org; > agraf@suse.de; Bogdan Purcareata ; > Laurentiu Tudor > Subject: Re: [PATCH] staging: fsl-mc/dpio: Fix incorrect comparison > > On Thu, Sep 28, 2017 at 01:07:48PM +0000, Ruxandra Ioana Radulescu wrote: > > > -----Original Message----- > > > From: Dan Carpenter [mailto:dan.carpenter@oracle.com] > > > Sent: Thursday, September 28, 2017 3:49 PM > > > To: Ruxandra Ioana Radulescu > > > Cc: gregkh@linuxfoundation.org; devel@driverdev.osuosl.org; > > > arnd@arndb.de; stuyoder@gmail.com; Roy Pledge > ; > > > linux-kernel@vger.kernel.org; agraf@suse.de; Bogdan Purcareata > > > ; Laurentiu Tudor > > > > > > Subject: Re: [PATCH] staging: fsl-mc/dpio: Fix incorrect comparison > > > > > > On Wed, Sep 27, 2017 at 12:57:28PM -0500, Ioana Radulescu wrote: > > > > diff --git a/drivers/staging/fsl-mc/bus/dpio/dpio-service.c > > > b/drivers/staging/fsl-mc/bus/dpio/dpio-service.c > > > > index f809682..26922fc 100644 > > > > --- a/drivers/staging/fsl-mc/bus/dpio/dpio-service.c > > > > +++ b/drivers/staging/fsl-mc/bus/dpio/dpio-service.c > > > > @@ -76,7 +76,7 @@ static inline struct dpaa2_io > > > *service_select_by_cpu(struct dpaa2_io *d, > > > > if (d) > > > > return d; > > > > > > > > - if (unlikely(cpu >= num_possible_cpus())) > > > > + if (unlikely(cpu >= (int)num_possible_cpus())) > > > > > > > > > Drivers shouldn't use likely/unlikley. > > > > I was under the impression it's ok to use them on hotpath > > (and while not entirely obvious, this function is called on > > other drivers' hotpath). > > Only use it if you can measure the difference. If you can not, then do > not use it as the compiler and the CPU will guess it better than you > will. > > This has been proven many times, something like 80% of our > likely/unlikely usage in the kernel is wrong because of this, see the > work from Andi Kleen many years ago in this area. > > So please remove it. Unless you can prove it matters, and if so, > document that. Greg, thanks for the explanation. Will remove it in v2. Ioana