From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7940EE810DB for ; Wed, 27 Sep 2023 12:17:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=S46qWiRCpx1NRYwwkrwOOpayD6uqJ6MmaBevn173G0o=; b=ZIxVdefn8ER6RC w6QG0qGC5Xdaw+TUL3LEXsH2VR1cT3wi5M9gmFOBJfiMLoBbAuExPUvWLiLTKWNu3ZfknI4q3ENJ0 miLYF586wJAZROUTArVrm3cnbJIXjEe0VWjVtK/4Km28iV+DdLG6R7NzhW1nUJg8vWWGtFfo667Q9 TcIRwUkoHEDmC4Ffqlt+/aLoLNJ69wP7zPHWlG1a2aNziSZicOuLLXmDnGq1igJnwUUB2/MNZjNcU G7prg5TALQI/+Dwfvn54s0Lwb3liDsKyjoG2XBLvfCu3h0h1XGs0wakgNL3Jb1Jfjsuq7t4YdB+Xe wjD9Fv6GS+BMEvX3V1Uw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qlTTj-000sGM-01; Wed, 27 Sep 2023 12:17:19 +0000 Received: from mgamail.intel.com ([192.55.52.115]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qlTTg-000sFU-1x for linux-arm-kernel@lists.infradead.org; Wed, 27 Sep 2023 12:17:17 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1695817036; x=1727353036; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=QmuETALrgMPjUAn12YFgIQeDTtWH91/gn8tjyGX6uwM=; b=fKwmwf4I3b8W0UHpDxUvtdthU+BqpC9WD43mS9kyUSD+MdCcufqz/iDv yOIoQOCn5V4gPwuc4Uc9JeaxbLUIAj77Gt12myzigKpUBPoJFj2YxiJCF 5SXHdyR0bHrseej5V8o4xdv8vmL2GVtP3PfJcaGi7aE7POgkg5nx1LUND JiV7lY6q/rfGlzDcw0L1D6ZD7eKz8h4zwmXzcjSVxtsst2Mk1Thm3kit/ 5UqSalLrXjwodpwtsoodZF/7sPh0qG2jwAfqRKQM9wSfyS9TvODNHTpac cXJ++IH87hY4JoW3GNjUJqT8k7bt8kNbVaY3LJzcB8vUJf+UT7bKvXK8S g==; X-IronPort-AV: E=McAfee;i="6600,9927,10845"; a="381710849" X-IronPort-AV: E=Sophos;i="6.03,181,1694761200"; d="scan'208";a="381710849" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Sep 2023 05:17:13 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10845"; a="778518582" X-IronPort-AV: E=Sophos;i="6.03,181,1694761200"; d="scan'208";a="778518582" Received: from smile.fi.intel.com ([10.237.72.54]) by orsmga008.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Sep 2023 05:17:09 -0700 Received: from andy by smile.fi.intel.com with local (Exim 4.97-RC0) (envelope-from ) id 1qlTTW-00000000scN-2fgC; Wed, 27 Sep 2023 15:17:06 +0300 Date: Wed, 27 Sep 2023 15:17:06 +0300 From: Andy Shevchenko To: Kent Gibson Cc: Linus Walleij , Bartosz Golaszewski , Yury Norov , linux-gpio@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Shubhrajyoti Datta , Srinivas Neeli , Michal Simek , Bartosz Golaszewski , Rasmus Villemoes , Marek =?iso-8859-1?Q?Beh=FAn?= Subject: Re: [PATCH v1 5/5] gpiolib: cdev: Utilize more bitmap APIs Message-ID: References: <20230926052007.3917389-1-andriy.shevchenko@linux.intel.com> <20230926052007.3917389-6-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230927_051716_658072_5C9C5D4D X-CRM114-Status: GOOD ( 25.99 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, Sep 27, 2023 at 09:32:11AM +0800, Kent Gibson wrote: > On Tue, Sep 26, 2023 at 08:20:07AM +0300, Andy Shevchenko wrote: > > Currently we have a few bitmap calls that are open coded in the library > > module. Let's convert them to use generic bitmap APIs instead. > > Firstly, I didn't consider using the bitmap module here as, in my mind at > least, that is intended for bitmaps wider than 64 bits, or with variable > width. In this case the bitmap is fixed at 64 bits, so bitops seemed more > appropriate. > > And I would argue that they aren't "open coded" - they are parallelized > to reduce the number of passes over the bitmap. > This change serialises them, e.g. the get used to require 2 passes over > the bitmap, it now requires 3 or 4. The set used to require 1 and now > requires 2. > And there are additional copies that the original doesn't require. > So your change looks less efficient to me - unless there is direct > hardware support for bitmap ops?? > > Wrt the argument that the serialized form is clearer and more > maintainable, optimised code is frequently more cryptic - as noted in > bitmap.c itself, and this code has remained unchanged since it was merged > 3 years ago, so the only maintenance it has required is to be more > maintainable?? Ok then. > > Your patch is functionally equivalent and pass my uAPI tests, so > > Tested-by: Kent Gibson Thanks for testing! > but my preference is to leave it as is. As Yury mentioned we need to look at bitmap APIs and make them possible to have a compile-time optimizations. With that in mind, I would prefer bitmap APIs over open-coded stuff which is hardly to be understood (yes, I still point out that it takes a few hours to me, maybe because I'm stupid enough, to get what's the heck is going one there, esp. for the == 1 case). Yet, it opens a way to scale this in case we might have v3 ABI that let's say allows to work with 512 GPIOs at a time. With your code it will be much harder to achieve and see what you wrote about maintenance (in that case). -- With Best Regards, Andy Shevchenko _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel