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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 717BEE810D9 for ; Wed, 27 Sep 2023 12:11:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231571AbjI0MLZ (ORCPT ); Wed, 27 Sep 2023 08:11:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49842 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231169AbjI0MLW (ORCPT ); Wed, 27 Sep 2023 08:11:22 -0400 X-Greylist: delayed 61 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Wed, 27 Sep 2023 05:11:21 PDT Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.9]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B563D139; Wed, 27 Sep 2023 05:11:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1695816682; x=1727352682; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=4vQe1q4hMJ3hNkO7sxKc4Crn7sjhVzAnB6hHM6cKjoI=; b=C0i4X3rOPrfUc3jcwuFpFMfYYRmBemCZfhMfKrs5nxgqZdPN/ZxNciix MzgDLl9/cho0tPp3ZtDw9dzS022sQr803ZluYi1PLiPI567+NLWyIl2w+ Hn89GBo2O/sjZowO0UEtr4kF6E06MK0173DKCqjmeJ7QlwNBzGmwfv11p 348vgeHEWTmMng6bofEIpqf+t8Hi/5BKhZIHj4jEl7Iy0HAIuAS1rWUal DuH+cYAfEaT69wWUI+CptfA1/fawmi5CPW/60rAnauLwaa6i0l/w5GyOU iLpHWHot1H1Tx93aAAY+0CuzJ84LhmN6yJYnEhP4FMDTS4EGiggS2GncF Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10845"; a="404480" X-IronPort-AV: E=Sophos;i="6.03,181,1694761200"; d="scan'208";a="404480" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orvoesa101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Sep 2023 05:10:21 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10845"; a="725781465" X-IronPort-AV: E=Sophos;i="6.03,181,1694761200"; d="scan'208";a="725781465" Received: from smile.fi.intel.com ([10.237.72.54]) by orsmga006.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Sep 2023 05:10:17 -0700 Received: from andy by smile.fi.intel.com with local (Exim 4.97-RC0) (envelope-from ) id 1qlTMs-00000000sW0-0brW; Wed, 27 Sep 2023 15:10:14 +0300 Date: Wed, 27 Sep 2023 15:10:13 +0300 From: Andy Shevchenko To: Yury Norov Cc: Linus Walleij , Bartosz Golaszewski , 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 2/5] lib/bitmap: Introduce bitmap_scatter() and bitmap_gather() helpers Message-ID: References: <20230926052007.3917389-1-andriy.shevchenko@linux.intel.com> <20230926052007.3917389-3-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Sep 26, 2023 at 07:10:33PM -0700, Yury Norov wrote: ... > So, if mask is 0b01, and src is 0b10, the output will be 0b00. Correct. This how it must work. > To me it sounds like you've gathered nothing, while the intention > was to gather all source bits to bit #0. No, the idea is to gather bits positions of which are provided by a mask from source to a destination, where the positions are sequential. > This is my understanding > of the word 'gather', You should get the mask meaning. It's not the bit provider, it's a bit positions provider. > and this is how bitmap_remap() works. It's NOT a replacement of bitmap_remap(). It's specifically written in the commit message that domain of these APIs is when @old or @new (in case of bitmap_remap() API) equals 2^n - 1, where n is amount of bits we consider. ... > If you claim you're replacing bitmap_remap(), > you should correctly handle > the above case; when src == dst; when mask is empty, and probably more... I don't care about corner cases of bitmap_remap(), and we can solve the issue when it comes. Currently there is no issue with the all users that need these API as they use different addresses. -- With Best Regards, Andy Shevchenko