diff mbox series

[13/14] PCI: hv: switch hv_compose_multi_msi_req_get_cpu() to using cpumask_next_wrap()

Message ID 20241228184949.31582-14-yury.norov@gmail.com (mailing list archive)
State New
Delegated to: Krzysztof WilczyƄski
Headers show
Series cpumask: cleanup cpumask_next_wrap() implementation and usage | expand

Commit Message

Yury Norov Dec. 28, 2024, 6:49 p.m. UTC
Calling cpumask_next_wrap_old() with starting CPU == nr_cpu_ids
is effectively the same as request to find first CPU, starting
from a given one and wrapping around if needed.

cpumask_next_wrap() is a proper replacement for that.

Signed-off-by: Yury Norov <yury.norov@gmail.com>
---
 drivers/pci/controller/pci-hyperv.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Michael Kelley Dec. 29, 2024, 5:34 p.m. UTC | #1
From: Yury Norov <yury.norov@gmail.com> Sent: Saturday, December 28, 2024 10:50 AM
> 
> Calling cpumask_next_wrap_old() with starting CPU == nr_cpu_ids
> is effectively the same as request to find first CPU, starting
> from a given one and wrapping around if needed.
> 
> cpumask_next_wrap() is a proper replacement for that.
> 
> Signed-off-by: Yury Norov <yury.norov@gmail.com>
> ---
>  drivers/pci/controller/pci-hyperv.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/pci/controller/pci-hyperv.c b/drivers/pci/controller/pci-hyperv.c
> index 86d1c2be8eb5..f8ebf98248b3 100644
> --- a/drivers/pci/controller/pci-hyperv.c
> +++ b/drivers/pci/controller/pci-hyperv.c
> @@ -1757,8 +1757,7 @@ static int hv_compose_multi_msi_req_get_cpu(void)
> 
>  	spin_lock_irqsave(&multi_msi_cpu_lock, flags);
> 
> -	cpu_next = cpumask_next_wrap_old(cpu_next, cpu_online_mask, nr_cpu_ids,
> -				     false);
> +	cpu_next = cpumask_next_wrap(cpu_next, cpu_online_mask);
>  	cpu = cpu_next;
> 
>  	spin_unlock_irqrestore(&multi_msi_cpu_lock, flags);
> --
> 2.43.0
> 

I remember reviewing the patch that originally added this use of
cpumask_next_wrap(). The two extra parameters were really
hard to understand. Nice to see them go away!

Reviewed-by: Michael Kelley <mhklinux@outlook.com>
Bjorn Helgaas Jan. 3, 2025, 5:45 p.m. UTC | #2
On Sat, Dec 28, 2024 at 10:49:45AM -0800, Yury Norov wrote:
> Calling cpumask_next_wrap_old() with starting CPU == nr_cpu_ids
> is effectively the same as request to find first CPU, starting
> from a given one and wrapping around if needed.
> 
> cpumask_next_wrap() is a proper replacement for that.
> 
> Signed-off-by: Yury Norov <yury.norov@gmail.com>

s/switch/Switch/ in subject to match history.

Since this depends on previous patches, I assume you'll merge them all
together, so:

Acked-by: Bjorn Helgaas <bhelgaas@google.com>

> ---
>  drivers/pci/controller/pci-hyperv.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/pci/controller/pci-hyperv.c b/drivers/pci/controller/pci-hyperv.c
> index 86d1c2be8eb5..f8ebf98248b3 100644
> --- a/drivers/pci/controller/pci-hyperv.c
> +++ b/drivers/pci/controller/pci-hyperv.c
> @@ -1757,8 +1757,7 @@ static int hv_compose_multi_msi_req_get_cpu(void)
>  
>  	spin_lock_irqsave(&multi_msi_cpu_lock, flags);
>  
> -	cpu_next = cpumask_next_wrap_old(cpu_next, cpu_online_mask, nr_cpu_ids,
> -				     false);
> +	cpu_next = cpumask_next_wrap(cpu_next, cpu_online_mask);
>  	cpu = cpu_next;
>  
>  	spin_unlock_irqrestore(&multi_msi_cpu_lock, flags);
> -- 
> 2.43.0
>
Yury Norov Jan. 3, 2025, 6:56 p.m. UTC | #3
On Fri, Jan 03, 2025 at 11:45:43AM -0600, Bjorn Helgaas wrote:
> On Sat, Dec 28, 2024 at 10:49:45AM -0800, Yury Norov wrote:
> > Calling cpumask_next_wrap_old() with starting CPU == nr_cpu_ids
> > is effectively the same as request to find first CPU, starting
> > from a given one and wrapping around if needed.
> > 
> > cpumask_next_wrap() is a proper replacement for that.
> > 
> > Signed-off-by: Yury Norov <yury.norov@gmail.com>
> 
> s/switch/Switch/ in subject to match history.
> 
> Since this depends on previous patches, I assume you'll merge them all
> together, so:
> 
> Acked-by: Bjorn Helgaas <bhelgaas@google.com>

Hi Bjorn,

Thanks for review!

Agree with everything you spotted out. I'll fix it in v2 if it will be
needed, or inplace when applying.

Thanks,
Yury
diff mbox series

Patch

diff --git a/drivers/pci/controller/pci-hyperv.c b/drivers/pci/controller/pci-hyperv.c
index 86d1c2be8eb5..f8ebf98248b3 100644
--- a/drivers/pci/controller/pci-hyperv.c
+++ b/drivers/pci/controller/pci-hyperv.c
@@ -1757,8 +1757,7 @@  static int hv_compose_multi_msi_req_get_cpu(void)
 
 	spin_lock_irqsave(&multi_msi_cpu_lock, flags);
 
-	cpu_next = cpumask_next_wrap_old(cpu_next, cpu_online_mask, nr_cpu_ids,
-				     false);
+	cpu_next = cpumask_next_wrap(cpu_next, cpu_online_mask);
 	cpu = cpu_next;
 
 	spin_unlock_irqrestore(&multi_msi_cpu_lock, flags);