[PATCH RESEND 0/3] ice: use better bitmap API

Yury Norov posted 3 patches 1 month, 2 weeks ago
There is a newer version of this series
drivers/net/ethernet/intel/ice/ice_switch.c |  4 +---
drivers/net/ethernet/intel/ice/ice_vf_lib.c |  4 ++--
include/linux/bitmap.h                      | 14 ++++++++++++++
lib/bitmap.c                                |  7 +++++++
4 files changed, 24 insertions(+), 5 deletions(-)
[PATCH RESEND 0/3] ice: use better bitmap API
Posted by Yury Norov 1 month, 2 weeks ago
Use better bitmap API where appropriate.

Original series:

https://lore.kernel.org/all/20251223162303.434659-1-yury.norov@gmail.com/

RESEND: rebase on top of v7.0-rc1

Yury Norov (3):
  bitmap: introduce bitmap_weighted_xor()
  ice: use bitmap_weighted_xor() in ice_find_free_recp_res_idx()
  ice: use bitmap_empty() in ice_vf_has_no_qs_ena

 drivers/net/ethernet/intel/ice/ice_switch.c |  4 +---
 drivers/net/ethernet/intel/ice/ice_vf_lib.c |  4 ++--
 include/linux/bitmap.h                      | 14 ++++++++++++++
 lib/bitmap.c                                |  7 +++++++
 4 files changed, 24 insertions(+), 5 deletions(-)

-- 
2.43.0
Re: [PATCH RESEND 0/3] ice: use better bitmap API
Posted by Przemek Kitszel 1 month, 2 weeks ago
On 2/25/26 01:00, Yury Norov wrote:
> Use better bitmap API where appropriate.
> 
> Original series:
> 
> https://lore.kernel.org/all/20251223162303.434659-1-yury.norov@gmail.com/
> 
> RESEND: rebase on top of v7.0-rc1
> 
> Yury Norov (3):
>    bitmap: introduce bitmap_weighted_xor()
>    ice: use bitmap_weighted_xor() in ice_find_free_recp_res_idx()

Thank you for working on better API.
Do you want this to go through intel, then netdev, tree?
Likely that would slow any future user, if you have already one in mind.

>    ice: use bitmap_empty() in ice_vf_has_no_qs_ena

For unrelated reasons I have one series that will possibly conflict
with your patch. Would prefer to not wait/block each other, so will
be best if we (Tony) just take this one (in case you will proceed
with the first two patches via your tree)

> 
>   drivers/net/ethernet/intel/ice/ice_switch.c |  4 +---
>   drivers/net/ethernet/intel/ice/ice_vf_lib.c |  4 ++--
>   include/linux/bitmap.h                      | 14 ++++++++++++++
>   lib/bitmap.c                                |  7 +++++++
>   4 files changed, 24 insertions(+), 5 deletions(-)
>
Re: [PATCH RESEND 0/3] ice: use better bitmap API
Posted by Yury Norov 1 month, 2 weeks ago
On Wed, Feb 25, 2026 at 01:02:35PM +0100, Przemek Kitszel wrote:
> On 2/25/26 01:00, Yury Norov wrote:
> > Use better bitmap API where appropriate.
> > 
> > Original series:
> > 
> > https://lore.kernel.org/all/20251223162303.434659-1-yury.norov@gmail.com/
> > 
> > RESEND: rebase on top of v7.0-rc1
> > 
> > Yury Norov (3):
> >    bitmap: introduce bitmap_weighted_xor()
> >    ice: use bitmap_weighted_xor() in ice_find_free_recp_res_idx()
> 
> Thank you for working on better API.
> Do you want this to go through intel, then netdev, tree?
> Likely that would slow any future user, if you have already one in mind.
>
> >    ice: use bitmap_empty() in ice_vf_has_no_qs_ena
> 
> For unrelated reasons I have one series that will possibly conflict
> with your patch. Would prefer to not wait/block each other, so will
> be best if we (Tony) just take this one (in case you will proceed
> with the first two patches via your tree)

Another trivial user (recently added) for bitmap_weighted_xx() is
xe_pagefault_queue_init() in drivers/gpu/drm/xe/xe_pagefault.c, but
it's again the Intel's driver, so it will go with your tree anyways.
 
I'm not aware of others, so I believe Tony's tree is the best route.

> >   drivers/net/ethernet/intel/ice/ice_switch.c |  4 +---
> >   drivers/net/ethernet/intel/ice/ice_vf_lib.c |  4 ++--
> >   include/linux/bitmap.h                      | 14 ++++++++++++++
> >   lib/bitmap.c                                |  7 +++++++
> >   4 files changed, 24 insertions(+), 5 deletions(-)

 + Matthew Brost

Attaching a patch for xe_pagefault_queue_init(). Feel free to append it
to this series, or let me know if it's better to send it separately.

Thanks,
Yury

From 21804f4ae1674aa166e3566fa898996806ebd3e3 Mon Sep 17 00:00:00 2001
From: Yury Norov <ynorov@nvidia.com>
Date: Wed, 25 Feb 2026 10:02:22 -0500
Subject: [PATCH] drm/xe: switch xe_pagefault_queue_init() to using
 bitmap_weighted_or()

The function calls bitmap_or() immediately followed by bitmap_weight().
Switch to using the dedicated bitmap_weighted_or() and save one bitmap
traverse.

Signed-off-by: Yury Norov <ynorov@nvidia.com>
---
 drivers/gpu/drm/xe/xe_pagefault.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/xe/xe_pagefault.c b/drivers/gpu/drm/xe/xe_pagefault.c
index 6bee53d6ffc3..c4ce3cfe2164 100644
--- a/drivers/gpu/drm/xe/xe_pagefault.c
+++ b/drivers/gpu/drm/xe/xe_pagefault.c
@@ -285,10 +285,9 @@ static int xe_pagefault_queue_init(struct xe_device *xe,
 		xe_dss_mask_t all_dss;
 		int num_dss, num_eus;
 
-		bitmap_or(all_dss, gt->fuse_topo.g_dss_mask,
+		num_dss = bitmap_weighted_or(all_dss, gt->fuse_topo.g_dss_mask,
 			  gt->fuse_topo.c_dss_mask, XE_MAX_DSS_FUSE_BITS);
 
-		num_dss = bitmap_weight(all_dss, XE_MAX_DSS_FUSE_BITS);
 		num_eus = bitmap_weight(gt->fuse_topo.eu_mask_per_dss,
 					XE_MAX_EU_FUSE_BITS) * num_dss;
 
-- 
2.43.0