[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 02/12] x86/apic: remove vector_allocation_cpumask hook


  • To: xen-devel@xxxxxxxxxxxxxxxxxxxx
  • From: Roger Pau Monne <roger.pau@xxxxxxxxxx>
  • Date: Thu, 20 Nov 2025 10:06:27 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=3Ps4qpb/HeavGjoMpeWQVB1HeWzQZcZOSFbllOt3RlQ=; b=SF0wmm+LYf/dIyWeUEIUEAbmAu4lr1jKDvXmgOVKcP1cdKaaxStX8vegDd0q+9cxiyA7NdgbO2YzqBN4AIJ3tNSW/bqQOMHu50NK0ZcLdE8eQYkykSxSjwt6zus7/wOwil6QmUUyrlSj80BSpH9NW0c7jbydj05uQgudg88xb+Epnpmxl7uBlOXjqKhx+SBi/mUGPtahp60vBYlxW6xn8UL+3EwNDpKHdvRZsWBIsK1geYpG5uNazVElD6oXGShU3lmk60JMgM0k7RG0JirjEAQpnnG4YStD/DUdV/8g+pR+E+8jlOTy+53Ke7zn9R7Q8moAxSKlV0lHpNdVhOYidg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=opDwc27w//lq7tx6MGfu0Ts43rrRmNuj0rz+CTuNK5D/H7qfTqKsukpex9Xz4B+UyMP0KpDx4MBClcc7NAFQKfCB+sab0kBDjusHAm6DQ5MkvuVS2YpymfhMhAnENmaIMp60p7+UUbzrzssxn+/R31Pkr/lKaYzLQqPbj9bMLms3lnOLQWILx5s3XtnYQM++q7Skmr1OP/AHMD6B7Lg6GIRlWWWINLaJiCGA4JZXE1aUgn+8bMYhLf+bYtoNnVxgqLBASV9d9Oxv03RDkp9nnxf65XpxEU9Hj3EpDfjUrgE+Hq6AfidrCt0tvYu0EkieEx3JIdecFpdJMKDN1/2o/Q==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: Roger Pau Monne <roger.pau@xxxxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • Delivery-date: Thu, 20 Nov 2025 09:09:30 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

All implementations use the same hook which is a wrapper around
cpumask_of(cpu).  Adjust callers to no longer use such dummy mask with a
single CPU set, as the CPU is already known to the caller.  This removes a
pair of usages of for_each_cpu().

No functional change intended.

Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
---
 xen/arch/x86/genapic/bigsmp.c      |  1 -
 xen/arch/x86/genapic/default.c     |  1 -
 xen/arch/x86/genapic/delivery.c    |  5 -----
 xen/arch/x86/genapic/x2apic.c      |  7 -------
 xen/arch/x86/include/asm/genapic.h |  4 ----
 xen/arch/x86/irq.c                 | 19 +++++++------------
 6 files changed, 7 insertions(+), 30 deletions(-)

diff --git a/xen/arch/x86/genapic/bigsmp.c b/xen/arch/x86/genapic/bigsmp.c
index 066feb4a1755..c0bcee659f1b 100644
--- a/xen/arch/x86/genapic/bigsmp.c
+++ b/xen/arch/x86/genapic/bigsmp.c
@@ -47,7 +47,6 @@ static int __init cf_check probe_bigsmp(void)
 const struct genapic __initconst_cf_clobber apic_bigsmp = {
        APIC_INIT("bigsmp", probe_bigsmp),
        .init_apic_ldr = init_apic_ldr_phys,
-       .vector_allocation_cpumask = vector_allocation_cpumask_phys,
        .send_IPI_mask = send_IPI_mask_phys,
        .send_IPI_self = send_IPI_self_legacy
 };
diff --git a/xen/arch/x86/genapic/default.c b/xen/arch/x86/genapic/default.c
index ab9a292464d6..58b5884aac0d 100644
--- a/xen/arch/x86/genapic/default.c
+++ b/xen/arch/x86/genapic/default.c
@@ -17,7 +17,6 @@
 const struct genapic __initconst_cf_clobber apic_default = {
        APIC_INIT("default", NULL),
        .init_apic_ldr = init_apic_ldr_flat,
-       .vector_allocation_cpumask = vector_allocation_cpumask_phys,
        .send_IPI_mask = send_IPI_mask_flat,
        .send_IPI_self = send_IPI_self_legacy
 };
diff --git a/xen/arch/x86/genapic/delivery.c b/xen/arch/x86/genapic/delivery.c
index 5d105e848502..777570f3b633 100644
--- a/xen/arch/x86/genapic/delivery.c
+++ b/xen/arch/x86/genapic/delivery.c
@@ -30,11 +30,6 @@ void cf_check init_apic_ldr_phys(void)
        /* We only deliver in phys mode - no setup needed. */
 }
 
-const cpumask_t *cf_check vector_allocation_cpumask_phys(int cpu)
-{
-       return cpumask_of(cpu);
-}
-
 unsigned int cpu_mask_to_apicid(const cpumask_t *cpumask)
 {
        /* As we are using single CPU as destination, pick only one CPU here */
diff --git a/xen/arch/x86/genapic/x2apic.c b/xen/arch/x86/genapic/x2apic.c
index f4709ab92950..89d66bc627d7 100644
--- a/xen/arch/x86/genapic/x2apic.c
+++ b/xen/arch/x86/genapic/x2apic.c
@@ -141,7 +141,6 @@ static void cf_check send_IPI_mask_x2apic_cluster(
 static const struct genapic __initconst_cf_clobber apic_x2apic_phys = {
     APIC_INIT("x2apic_phys", NULL),
     .init_apic_ldr = init_apic_ldr_phys,
-    .vector_allocation_cpumask = vector_allocation_cpumask_phys,
     .send_IPI_mask = send_IPI_mask_x2apic_phys,
     .send_IPI_self = send_IPI_self_x2apic
 };
@@ -156,12 +155,6 @@ static const struct genapic __initconst_cf_clobber 
apic_x2apic_phys = {
 static const struct genapic __initconst_cf_clobber apic_x2apic_mixed = {
     APIC_INIT("x2apic_mixed", NULL),
 
-    /*
-     * The following fields are exclusively used by external interrupts and
-     * hence are set to use Physical destination mode handlers.
-     */
-    .vector_allocation_cpumask = vector_allocation_cpumask_phys,
-
     /*
      * The following fields are exclusively used by IPIs and hence are set to
      * use Cluster Logical destination mode handlers.  Note that init_apic_ldr
diff --git a/xen/arch/x86/include/asm/genapic.h 
b/xen/arch/x86/include/asm/genapic.h
index 6d979279bd2b..33ec492a6ff5 100644
--- a/xen/arch/x86/include/asm/genapic.h
+++ b/xen/arch/x86/include/asm/genapic.h
@@ -24,7 +24,6 @@ struct genapic {
        int (*probe)(void);
 
        void (*init_apic_ldr)(void);
-       const cpumask_t *(*vector_allocation_cpumask)(int cpu);
        void (*send_IPI_mask)(const cpumask_t *mask, int vector);
     void (*send_IPI_self)(uint8_t vector);
 };
@@ -35,8 +34,6 @@ struct genapic {
 
 #define TARGET_CPUS ((const typeof(cpu_online_map) *)&cpu_online_map)
 #define init_apic_ldr() alternative_vcall(genapic.init_apic_ldr)
-#define vector_allocation_cpumask(cpu) \
-       alternative_call(genapic.vector_allocation_cpumask, cpu)
 
 extern struct genapic genapic;
 extern const struct genapic apic_default;
@@ -50,7 +47,6 @@ void cf_check send_IPI_mask_flat(const cpumask_t *cpumask, 
int vector);
 void cf_check init_apic_ldr_phys(void);
 unsigned int cpu_mask_to_apicid(const cpumask_t *cpumask);
 void cf_check send_IPI_mask_phys(const cpumask_t *mask, int vector);
-const cpumask_t *cf_check vector_allocation_cpumask_phys(int cpu);
 
 void generic_apic_probe(void);
 void generic_bigsmp_probe(void);
diff --git a/xen/arch/x86/irq.c b/xen/arch/x86/irq.c
index 80f7417d2103..7009a3c6d0dd 100644
--- a/xen/arch/x86/irq.c
+++ b/xen/arch/x86/irq.c
@@ -621,16 +621,12 @@ static int _assign_irq_vector(struct irq_desc *desc, 
const cpumask_t *mask)
 
     for_each_cpu(cpu, mask)
     {
-        const cpumask_t *vec_mask;
-        int new_cpu;
         int vector, offset;
 
         /* Only try and allocate irqs on cpus that are present. */
         if (!cpu_online(cpu))
             continue;
 
-        vec_mask = vector_allocation_cpumask(cpu);
-
         vector = current_vector;
         offset = current_offset;
 next:
@@ -650,13 +646,12 @@ next:
             && test_bit(vector, irq_used_vectors) )
             goto next;
 
-        if ( cpumask_test_cpu(0, vec_mask) &&
+        if ( !cpu &&
              vector >= FIRST_LEGACY_VECTOR && vector <= LAST_LEGACY_VECTOR )
             goto next;
 
-        for_each_cpu(new_cpu, vec_mask)
-            if (per_cpu(vector_irq, new_cpu)[vector] >= 0)
-                goto next;
+        if ( per_cpu(vector_irq, cpu)[vector] >= 0 )
+            goto next;
         /* Found one! */
         current_vector = vector;
         current_offset = offset;
@@ -688,12 +683,12 @@ next:
                 release_old_vec(desc);
         }
 
-        trace_irq_mask(TRC_HW_IRQ_ASSIGN_VECTOR, irq, vector, vec_mask);
+        trace_irq_mask(TRC_HW_IRQ_ASSIGN_VECTOR, irq, vector, cpumask_of(cpu));
 
-        for_each_cpu(new_cpu, vec_mask)
-            per_cpu(vector_irq, new_cpu)[vector] = irq;
+        per_cpu(vector_irq, cpu)[vector] = irq;
         desc->arch.vector = vector;
-        cpumask_copy(desc->arch.cpu_mask, vec_mask);
+        cpumask_clear(desc->arch.cpu_mask);
+        cpumask_set_cpu(cpu, desc->arch.cpu_mask);
 
         desc->arch.used = IRQ_USED;
         ASSERT((desc->arch.used_vectors == NULL)
-- 
2.51.0




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.