All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Beulich <jbeulich@suse.com>
To: "xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>
Cc: "Andrew Cooper" <andrew.cooper3@citrix.com>,
	"Julien Grall" <julien@xen.org>,
	"Stefano Stabellini" <sstabellini@kernel.org>,
	"Wei Liu" <wl@xen.org>, "Roger Pau Monné" <roger.pau@citrix.com>,
	"Oleksii Kurochko" <oleksii.kurochko@gmail.com>
Subject: [PATCH v5 for-4.19? 1/2] amend 'cmdline: document and enforce "extra_guest_irqs" upper bounds'
Date: Wed, 3 Jul 2024 10:44:56 +0200	[thread overview]
Message-ID: <37f1a5b8-9b54-42f1-845f-dddcf0b0401e@suse.com> (raw)
In-Reply-To: <789d567b-db3a-4c4d-9eac-f73232777244@suse.com>

Address late review comments for what is now commit 17f6d398f765:
- bound max_irqs right away against nr_irqs
- introduce a #define for a constant used twice

Signed-off-by: Jan Beulich <jbeulich@suse.com>
---
v5: New.

--- a/xen/arch/x86/io_apic.c
+++ b/xen/arch/x86/io_apic.c
@@ -2663,15 +2663,16 @@ void __init ioapic_init(void)
 unsigned int __hwdom_init arch_hwdom_irqs(const struct domain *d)
 {
     unsigned int n = fls(num_present_cpus());
-    /* Bounded by the domain pirq EOI bitmap gfn. */
-    const unsigned int max_irqs = PAGE_SIZE * BITS_PER_BYTE;
+    /* Bounding by the domain pirq EOI bitmap capacity. */
+    const unsigned int max_irqs = min_t(unsigned int, nr_irqs,
+                                        PAGE_SIZE * BITS_PER_BYTE);
 
     if ( is_system_domain(d) )
         return max_irqs;
 
     if ( !d->domain_id )
         n = min(n, dom0_max_vcpus());
-    n = min(nr_irqs_gsi + n * NR_DYNAMIC_VECTORS, min(nr_irqs, max_irqs));
+    n = min(nr_irqs_gsi + n * NR_DYNAMIC_VECTORS, max_irqs);
 
     printk("%pd has maximum %u PIRQs\n", d, n);
 
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -353,7 +353,8 @@ static int late_hwdom_init(struct domain
 #ifdef CONFIG_HAS_PIRQ
 
 static unsigned int __read_mostly extra_hwdom_irqs;
-static unsigned int __read_mostly extra_domU_irqs = 32;
+#define DEFAULT_EXTRA_DOMU_IRQS 32U
+static unsigned int __read_mostly extra_domU_irqs = DEFAULT_EXTRA_DOMU_IRQS;
 
 static int __init cf_check parse_extra_guest_irqs(const char *s)
 {
@@ -839,7 +840,8 @@ void __init setup_system_domains(void)
             extra_hwdom_irqs = n - nr_static_irqs;
             printk(XENLOG_WARNING "hwdom IRQs bounded to %u\n", n);
         }
-        if ( extra_domU_irqs > max(32U, n - nr_static_irqs) )
+        if ( extra_domU_irqs >
+             max(DEFAULT_EXTRA_DOMU_IRQS, n - nr_static_irqs) )
         {
             extra_domU_irqs = n - nr_static_irqs;
             printk(XENLOG_WARNING "domU IRQs bounded to %u\n", n);



  reply	other threads:[~2024-07-03  8:45 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-03  8:43 [PATCH v5 for-4.19? 0/2] new extra_guest_irqs adjustment Jan Beulich
2024-07-03  8:44 ` Jan Beulich [this message]
2024-07-03  8:47   ` [PATCH v5 for-4.19? 1/2] amend 'cmdline: document and enforce "extra_guest_irqs" upper bounds' Jan Beulich
2024-07-03  9:22     ` Roger Pau Monné
2024-07-03  8:45 ` [PATCH v5 for-4.19? 2/2] cmdline: "extra_guest_irqs" is inapplicable to PVH Jan Beulich
2024-07-03  9:23   ` Roger Pau Monné
2024-07-03 10:21 ` [PATCH v5 for-4.19? 0/2] new extra_guest_irqs adjustment Oleksii

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=37f1a5b8-9b54-42f1-845f-dddcf0b0401e@suse.com \
    --to=jbeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=julien@xen.org \
    --cc=oleksii.kurochko@gmail.com \
    --cc=roger.pau@citrix.com \
    --cc=sstabellini@kernel.org \
    --cc=wl@xen.org \
    --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.