Message ID | 20240212075646.19114-4-herve.codina@bootlin.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-61168-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp2289480dyd; Mon, 12 Feb 2024 00:00:35 -0800 (PST) X-Google-Smtp-Source: AGHT+IFsYQ8mSikPGRjpIs2+2oK2UHvmBiiWxWZ3CA+BuqdNZX0/oBDHBaGk8Yg+/hz7ZCUf8lvE X-Received: by 2002:a0c:dd0d:0:b0:68c:da0a:10ef with SMTP id u13-20020a0cdd0d000000b0068cda0a10efmr6159738qvk.57.1707724835028; Mon, 12 Feb 2024 00:00:35 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707724835; cv=pass; d=google.com; s=arc-20160816; b=dUor0XhV/JL4u6Z9EiB4MrY0SIDbElKnZRbYEFumO2Y6Sq+rIS3C3yZs1RM5gm9y7J u7FUvUiP25E9lxJvaOdVSIjFW76j0Pe4coKdX77H9bj+pK+bingQL78OCmhKhoHU/u3b H2a+gM1HRCyCjRTryQ6pLMZJGCSdjzTJ9S5OGse8CYZcVdiHuNJkDh5wXt5sta3ACjUH sHGZPtmyPxiQ2J/IRq92/fnf/a+hSVAOJwHggBUELX40aNqC30xPmkvYwjWF6i9MjE1X AUcIF9HH7kuxt2zpGgsz9z59E8Dm4zRPZQ15d//IdWcKlDASv8xPDMW7eODYR1Dhjz4d xZQw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=9ic1ckcjchbcoVTjdKWShBulE5zgYlgBqlicFqMJYpM=; fh=EeLkDcGuS6w//H5aaFtauvTrVBVK6O+P1KLr98j5M/M=; b=d6c9G5q3n7cSum+kG5h61jCVd/boP53O6P4R9+95g8sbLGpkFYkUbpwQ1C6awQ6fwR /xpbyYkh9rvb/ubFIUuyWJH0Y8M8vmK0Nnmaxlb6O7ZUYQN54HM0OUps1MlRp6fHJj++ 7F9V1rTq99jQuQNXhY/6OwU9oKEpl5uK5s4mMnv01LFVJzVYRr9iWSmlKrpZkKgUQX7z 1VORygi25uMenpkwveSOKr4YezoZcNf3pwnV+MqtAO+rjEqWP2eGAo8RYZWnddcjZdQ8 wVF3TUHYPnVvIsrjNI/qahBZy/Y9BlRI/8BaQ0g5A07Nyllc0YiG3YnI2z/5RkJOBBW6 WmnQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=ReLx3Y7H; arc=pass (i=1 spf=pass spfdomain=bootlin.com dkim=pass dkdomain=bootlin.com dmarc=pass fromdomain=bootlin.com); spf=pass (google.com: domain of linux-kernel+bounces-61168-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-61168-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com X-Forwarded-Encrypted: i=2; AJvYcCWcqqXiQipLXpkO7kk2mnDXJ8myrrI/baLbLoI8UeT7X0n3PTNgmB+Rj0ZylhM9px/bW/VZ7GcAwaVA85d+aXX8fv29fw== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id jx10-20020a0562142b0a00b0068ccafa97dcsi8014951qvb.245.2024.02.12.00.00.34 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Feb 2024 00:00:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-61168-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=ReLx3Y7H; arc=pass (i=1 spf=pass spfdomain=bootlin.com dkim=pass dkdomain=bootlin.com dmarc=pass fromdomain=bootlin.com); spf=pass (google.com: domain of linux-kernel+bounces-61168-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-61168-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id CB6A91C21272 for <ouuuleilei@gmail.com>; Mon, 12 Feb 2024 08:00:34 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D925F1B7FD; Mon, 12 Feb 2024 07:57:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="ReLx3Y7H" Received: from relay2-d.mail.gandi.net (relay2-d.mail.gandi.net [217.70.183.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3ACFD8BFE; Mon, 12 Feb 2024 07:57:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.194 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707724635; cv=none; b=UZ0n6a9Qwt4Ct3G323hEtSZbv2Fy/R61HUYm2iHwaGAPAX1REC8scZd/mCsGMMMebHOi/eVGJWJVrDc5qg5ChhEvMOm7Nl6bg9gmxdU5M9f8/9KAwSZcaq9sEl8Qb9F/R7f4xjEtqeBSuQPJnzywJwITH5ocnSOAKmhcYlCK9BM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707724635; c=relaxed/simple; bh=Y4mTOkugzPKhkBlTmeRYr77COSSEZXPzeIqX8b/CK74=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=GtQRm26pTP7z088paoUSaK3HWPctDhDCAo14jXxUaNeAbJGRKd2i46NCMtue2ElB3GeXyl/qr0GFhak77N/5rhoCjoAGVy3FPWDjeHjDJOesAqfFYVQCSCJX5ePnCgWTHAbmiGAu4S2pvVmoJ6X+b3zVhwm9yCgmLNwEKvNkraQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=ReLx3Y7H; arc=none smtp.client-ip=217.70.183.194 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Received: by mail.gandi.net (Postfix) with ESMTPA id E37B940002; Mon, 12 Feb 2024 07:57:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1707724624; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9ic1ckcjchbcoVTjdKWShBulE5zgYlgBqlicFqMJYpM=; b=ReLx3Y7H2Z8kXqTURnVOLFHzNHB1i04hX3X050KGh7A+qeS5NOW9IYAQ1yf28bdEnrRcD/ qusAHp5xbftd5wslkTA9JjgbIluCxh/kgU+AsqDNGTJxhz0rNFXtrnEL8IRstR0JCd8PTj 5+0Cm5kSw2U4twA4RX3DSJLhcpZhZRwve4BF8OcrVAAxINednQFmM4jiw+Vw+qF2hh44cx Re+zYfP6LJzt5mIJCds1eSrI3qgN/tcoXtNpVSRbkKTwq9I3E11Rmz/9PtXlwLEO/nQe69 ip3Yl2ggq0QVneSuiqSHFRk3Ctoy64CISO8zY1iaipxbsLgoHteNBPMgi8sewQ== From: Herve Codina <herve.codina@bootlin.com> To: Vadim Fedorenko <vadim.fedorenko@linux.dev>, "David S. Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@google.com>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, Herve Codina <herve.codina@bootlin.com>, Yury Norov <yury.norov@gmail.com>, Andy Shevchenko <andriy.shevchenko@linux.intel.com>, Rasmus Villemoes <linux@rasmusvillemoes.dk> Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, Andrew Lunn <andrew@lunn.ch>, Mark Brown <broonie@kernel.org>, Christophe Leroy <christophe.leroy@csgroup.eu>, Thomas Petazzoni <thomas.petazzoni@bootlin.com> Subject: [PATCH v3 RESEND 3/6] bitmap: Make bitmap_onto() available to users Date: Mon, 12 Feb 2024 08:56:31 +0100 Message-ID: <20240212075646.19114-4-herve.codina@bootlin.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240212075646.19114-1-herve.codina@bootlin.com> References: <20240212075646.19114-1-herve.codina@bootlin.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-GND-Sasl: herve.codina@bootlin.com X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790679276796879406 X-GMAIL-MSGID: 1790679276796879406 |
Series |
Add support for QMC HDLC
|
|
Commit Message
Herve Codina
Feb. 12, 2024, 7:56 a.m. UTC
Currently the bitmap_onto() is available only for CONFIG_NUMA=y case,
while some users may benefit out of it and being independent to NUMA
code.
Make it available to users by moving out of ifdeffery and exporting for
modules.
Signed-off-by: Herve Codina <herve.codina@bootlin.com>
---
lib/bitmap.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
Comments
On Mon, Feb 12, 2024 at 08:56:31AM +0100, Herve Codina wrote: > Currently the bitmap_onto() is available only for CONFIG_NUMA=y case, > while some users may benefit out of it and being independent to NUMA > code. > > Make it available to users by moving out of ifdeffery and exporting for > modules. Wondering if you are trying to have something like https://lore.kernel.org/lkml/20230926052007.3917389-1-andriy.shevchenko@linux.intel.com/
Hi Andy, On Mon, 12 Feb 2024 14:27:16 +0200 Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote: > On Mon, Feb 12, 2024 at 08:56:31AM +0100, Herve Codina wrote: > > Currently the bitmap_onto() is available only for CONFIG_NUMA=y case, > > while some users may benefit out of it and being independent to NUMA > > code. > > > > Make it available to users by moving out of ifdeffery and exporting for > > modules. > > Wondering if you are trying to have something like > https://lore.kernel.org/lkml/20230926052007.3917389-1-andriy.shevchenko@linux.intel.com/ > Yes, it looks like. Can you confirm that your bitmap_scatter() do the same operations as the existing bitmap_onto() ? If so, your bitmap_gather() will match my bitmap_off() (patch 4 in this series). Thanks, Hervé
On Mon, Feb 12, 2024 at 02:37:53PM +0100, Herve Codina wrote: > On Mon, 12 Feb 2024 14:27:16 +0200 > Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote: > > On Mon, Feb 12, 2024 at 08:56:31AM +0100, Herve Codina wrote: > > > Currently the bitmap_onto() is available only for CONFIG_NUMA=y case, > > > while some users may benefit out of it and being independent to NUMA > > > code. > > > > > > Make it available to users by moving out of ifdeffery and exporting for > > > modules. > > > > Wondering if you are trying to have something like > > https://lore.kernel.org/lkml/20230926052007.3917389-1-andriy.shevchenko@linux.intel.com/ > > Yes, it looks like. > Can you confirm that your bitmap_scatter() do the same operations as the > existing bitmap_onto() ? I have test cases to be 100% sure, but on the first glance, yes it does with the adjustment to the atomicity of the operations (which I do not understand why be atomic in the original bitmap_onto() implementation). This actually gives a question if we should use your approach or mine. At least the help of bitmap_onto() is kinda hard to understand. > If so, your bitmap_gather() will match my bitmap_off() (patch 4 in this > series). Yes.
On Mon, 12 Feb 2024 16:01:38 +0200 Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote: > On Mon, Feb 12, 2024 at 02:37:53PM +0100, Herve Codina wrote: > > On Mon, 12 Feb 2024 14:27:16 +0200 > > Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote: > > > On Mon, Feb 12, 2024 at 08:56:31AM +0100, Herve Codina wrote: > > > > Currently the bitmap_onto() is available only for CONFIG_NUMA=y case, > > > > while some users may benefit out of it and being independent to NUMA > > > > code. > > > > > > > > Make it available to users by moving out of ifdeffery and exporting for > > > > modules. > > > > > > Wondering if you are trying to have something like > > > https://lore.kernel.org/lkml/20230926052007.3917389-1-andriy.shevchenko@linux.intel.com/ > > > > Yes, it looks like. > > Can you confirm that your bitmap_scatter() do the same operations as the > > existing bitmap_onto() ? > > I have test cases to be 100% sure, but on the first glance, yes it does with > the adjustment to the atomicity of the operations (which I do not understand > why be atomic in the original bitmap_onto() implementation). > > This actually gives a question if we should use your approach or mine. > At least the help of bitmap_onto() is kinda hard to understand. Agree, the bitmap_onto() code is simpler to understand than its help. I introduced bitmap_off() to be the "reverse" bitmap_onto() operations and I preferred to avoid duplicating function that do the same things. On my side, I initially didn't use the bitmap_*() functions and did the the bits manipulation by hand. During the review, it was suggested to use the bitmap_*() family and I followed this suggestion. I did tests to be sure that bitmap_onto() and bitmap_off() did exactly the same things as my previous code did. > > > If so, your bitmap_gather() will match my bitmap_off() (patch 4 in this > > series). > > Yes. > Regards, Hervé
On Mon, Feb 12, 2024 at 03:20:22PM +0100, Herve Codina wrote: > On Mon, 12 Feb 2024 16:01:38 +0200 > Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote: .. > Agree, the bitmap_onto() code is simpler to understand than its help. > > I introduced bitmap_off() to be the "reverse" bitmap_onto() operations > and I preferred to avoid duplicating function that do the same things. > > On my side, I initially didn't use the bitmap_*() functions and did the the > bits manipulation by hand. > During the review, it was suggested to use the bitmap_*() family and I followed > this suggestion. I also would go this way, the problems I see with the current implementation are: - being related to NUMA (and as Rasmus once pointed out better to be there); - unclear naming, esp. proposed bitmap_off(); - the quite hard to understand help text - atomicity when it's not needed (AFAICT). > I did tests to be sure that bitmap_onto() and bitmap_off() did > exactly the same things as my previous code did. Yuri, what do you think about all this?
On Mon, Feb 12, 2024 at 04:36:36PM +0200, Andy Shevchenko wrote: > On Mon, Feb 12, 2024 at 03:20:22PM +0100, Herve Codina wrote: > > On Mon, 12 Feb 2024 16:01:38 +0200 > > Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote: > > ... > > > Agree, the bitmap_onto() code is simpler to understand than its help. > > > > I introduced bitmap_off() to be the "reverse" bitmap_onto() operations > > and I preferred to avoid duplicating function that do the same things. > > > > On my side, I initially didn't use the bitmap_*() functions and did the the > > bits manipulation by hand. > > During the review, it was suggested to use the bitmap_*() family and I followed > > this suggestion. > > I also would go this way, the problems I see with the current implementation are: Sure, opencoding and duplicating the functionality is always a bad idea. > - being related to NUMA (and as Rasmus once pointed out better to be there); It's 'related to NUMA' for the only reason - it's used by NUMA only. Nothing NUMA-specific in the function itself. Now that we've got a non-NUMA user, the bitmap_onto() is not related to NUMA anymore. > - unclear naming, esp. proposed bitmap_off(); That's I agree. Scatter/gather from your last approach sound better. Do you plan to send a v2? > - the quite hard to understand help text Yes, we need a picture that would illustrate what actually happens > - atomicity when it's not needed (AFAICT). Agree. A series of atomic ops is not atomic. For example if (test_bit(n, map)) set_bit(m, map); is not atomic as a whole. And this is what we do in bitmap_onto/off() in a loop. This must be fixed by using underscoded version. > > I did tests to be sure that bitmap_onto() and bitmap_off() did > > exactly the same things as my previous code did. > > Yuri, what do you think about all this? I think your scatter/gather is better then this onto/off by naming and implementation. If you'll send a v2, and it would work for Herve, I'd prefer scatter/gather. But we can live with onto/off as well. Thanks, Yury
On Thu, Feb 15, 2024 at 06:46:12PM +0100, Herve Codina wrote: > On Mon, 12 Feb 2024 11:13:13 -0800 > Yury Norov <yury.norov@gmail.com> wrote: .. > > That's I agree. Scatter/gather from your last approach sound better. > > Do you plan to send a v2? See below. .. > > I think your scatter/gather is better then this onto/off by naming and > > implementation. If you'll send a v2, and it would work for Herve, I'd > > prefer scatter/gather. But we can live with onto/off as well. > > Andy, I tested your bitmap_{scatter,gather}() in my code. > I simply replaced my bitmap_{onto,off}() calls by calls to your helpers and > it works perfectly for my use case. > > I didn't use your whole patch > "[PATCH v1 2/5] lib/bitmap: Introduce bitmap_scatter() and bitmap_gather() helpers" > because it didn't apply on a v6.8-rc1 based branch. > I just manually extracted the needed functions for my tests and I didn't look > at the lib/test_bitmap.c part. > > Now what's the plan ? > Andy, do you want to send a v2 of this patch or may I get the patch, modify it > according to reviews already present in v1 and integrate it in my current > series ? I would like to do that, but under pile of different things. I would try my best but if you have enough time and motivation feel free to take over, address the comments and integrate in your series. I dunno what to do with bitmap_onto(), perhaps in a separate patch we can replace it with bitmap_scatter() (IIUC) with explanation that the former 1) uses atomic ops while being non-atomic as a whole, and b) having quite hard to get documentation. At least that's how I see it, I mean that I would like to leave bitmap_onto() alone and address it separately. > Yury, any preferences ?
Hi Andy, Yury, On Thu, 15 Feb 2024 21:17:23 +0200 Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote: [...] > > Now what's the plan ? > > Andy, do you want to send a v2 of this patch or may I get the patch, modify it > > according to reviews already present in v1 and integrate it in my current > > series ? > > I would like to do that, but under pile of different things. > I would try my best but if you have enough time and motivation feel free > to take over, address the comments and integrate in your series. > > I dunno what to do with bitmap_onto(), perhaps in a separate patch we can > replace it with bitmap_scatter() (IIUC) with explanation that the former > 1) uses atomic ops while being non-atomic as a whole, and b) having quite > hard to get documentation. At least that's how I see it, I mean that I would > like to leave bitmap_onto() alone and address it separately. > I will take the Andy's bitmap_{scatter,gather}() patch in my next iteration. And use bitmap_{scatter,gather}() in my code. For bitmap_onto() replacement, nothing will be done in my next iteration as it is out of this series scope. Hervé
On Wed, Feb 21, 2024 at 02:44:31PM +0100, Herve Codina wrote: > On Thu, 15 Feb 2024 21:17:23 +0200 > Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote: [...] > > > Now what's the plan ? > > > Andy, do you want to send a v2 of this patch or may I get the patch, modify it > > > according to reviews already present in v1 and integrate it in my current > > > series ? > > > > I would like to do that, but under pile of different things. > > I would try my best but if you have enough time and motivation feel free > > to take over, address the comments and integrate in your series. > > > > I dunno what to do with bitmap_onto(), perhaps in a separate patch we can > > replace it with bitmap_scatter() (IIUC) with explanation that the former > > 1) uses atomic ops while being non-atomic as a whole, and b) having quite > > hard to get documentation. At least that's how I see it, I mean that I would > > like to leave bitmap_onto() alone and address it separately. > > I will take the Andy's bitmap_{scatter,gather}() patch in my next iteration. > And use bitmap_{scatter,gather}() in my code. Thank you and sorry that I have no time to finish that. I will be happy to help reviewing if you Cc me. > For bitmap_onto() replacement, nothing will be done in my next iteration as > it is out of this series scope. I agree on this. This will be a separate logical change related to NUMA with explanation and replacement of all callers at once.
diff --git a/lib/bitmap.c b/lib/bitmap.c index 09522af227f1..2feccb5047dc 100644 --- a/lib/bitmap.c +++ b/lib/bitmap.c @@ -547,7 +547,6 @@ int bitmap_bitremap(int oldbit, const unsigned long *old, } EXPORT_SYMBOL(bitmap_bitremap); -#ifdef CONFIG_NUMA /** * bitmap_onto - translate one bitmap relative to another * @dst: resulting translated bitmap @@ -681,7 +680,9 @@ void bitmap_onto(unsigned long *dst, const unsigned long *orig, m++; } } +EXPORT_SYMBOL(bitmap_onto); +#ifdef CONFIG_NUMA /** * bitmap_fold - fold larger bitmap into smaller, modulo specified size * @dst: resulting smaller bitmap