All of lore.kernel.org
 help / color / mirror / Atom feed
From: Roger Pau Monne <roger.pau@citrix.com>
To: xen-devel@lists.xenproject.org
Cc: Roger Pau Monne <roger.pau@citrix.com>,
	Jan Beulich <jbeulich@suse.com>,
	Andrew Cooper <andrew.cooper3@citrix.com>
Subject: [PATCH 1/2] x86/irq: fix calculation of max PV dom0 pIRQs
Date: Wed, 20 Nov 2024 12:35:54 +0100	[thread overview]
Message-ID: <20241120113555.38146-2-roger.pau@citrix.com> (raw)
In-Reply-To: <20241120113555.38146-1-roger.pau@citrix.com>

The current calculation of PV dom0 pIRQs uses:

n = min(fls(num_present_cpus()), dom0_max_vcpus());

The usage of fls() is wrong, as num_present_cpus() already returns the number
of present CPUs, not the bitmap mask of CPUs.

Fix by removing the usage of fls().

Fixes: 7e73a6e7f12a ('have architectures specify the number of PIRQs a hardware domain gets')
Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/io_apic.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/io_apic.c b/xen/arch/x86/io_apic.c
index d44d2c9a4173..bd5ad61c85e4 100644
--- a/xen/arch/x86/io_apic.c
+++ b/xen/arch/x86/io_apic.c
@@ -2744,7 +2744,7 @@ void __init ioapic_init(void)
 
 unsigned int __hwdom_init arch_hwdom_irqs(const struct domain *d)
 {
-    unsigned int n = fls(num_present_cpus());
+    unsigned int n = num_present_cpus();
     /* Bounding by the domain pirq EOI bitmap capacity. */
     const unsigned int max_irqs = min_t(unsigned int, nr_irqs,
                                         PAGE_SIZE * BITS_PER_BYTE);
-- 
2.46.0



  reply	other threads:[~2024-11-20 11:36 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-20 11:35 [PATCH 0/2] x86/irq: fix calculation of maximum pIRQs for dom0 Roger Pau Monne
2024-11-20 11:35 ` Roger Pau Monne [this message]
2024-11-20 12:06   ` [PATCH 1/2] x86/irq: fix calculation of max PV dom0 pIRQs Andrew Cooper
2024-11-21 10:49   ` Jan Beulich
2024-11-21 11:04     ` Roger Pau Monné
2024-11-21 11:39       ` Jan Beulich
2024-11-22  8:01         ` Roger Pau Monné
2024-11-22  9:27           ` Jan Beulich
2024-11-20 11:35 ` [PATCH 2/2] x86/pvh: also print hardware domain pIRQ limit for PVH Roger Pau Monne
2024-11-20 11:45   ` Andrew Cooper
2024-11-21 10:54   ` Jan Beulich
2024-11-21 11:08     ` Roger Pau Monné
2024-11-21 11:14       ` Andrew Cooper
2024-11-21 11:24         ` Roger Pau Monné
2024-11-21 11:27           ` Jan Beulich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241120113555.38146-2-roger.pau@citrix.com \
    --to=roger.pau@citrix.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=jbeulich@suse.com \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.