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

[Xen-devel] [PATCH v4 02/13] x86/IRQ: deal with move cleanup count state in fixup_irqs()


  • To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Jan Beulich <JBeulich@xxxxxxxx>
  • Date: Tue, 16 Jul 2019 07:37:36 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1;spf=pass smtp.mailfrom=suse.com;dmarc=pass action=none header.from=suse.com;dkim=pass header.d=suse.com;arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=5XsuRYlo9O9yePuFmC76k1W7jFTXusfwS+bbwzyeAUY=; b=XHfoJod67ahpFbFYqHKlaa6d1sBrAcFPiPF3o7NlBHbxVRtVePlqTIHr0ounVoy0jrkNQI6IOuyrN4YVHLrQG1tBZ0yCZ1x4rEcl+sHTuIJSDFaPR+OT72oZt1Zf5KCSJT8w5u36dCui6UDWdA3Iz3VhucaDtMggn9dr68be4nNuRGc9zuhH8eJEZKjM2zoS+EjLm+5DgsA/0wYKMDxPULmnRbzxAj0hqNg87GyE+XxnHY+zJ8YjiYUOC4AmN5OouQdGCvFP9vEzouTNFeSdylJiaD0N6US6pZHZ8C4bbBR3k2eCTfWIz+m378sPn/vDFswYeiqhlK6Qy0lF5hJU6w==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=V+mxOclmQl/Iwnmb3Ajz3NaVoYkQZnBwRiUvl/8JGlAOvFpNQQKJMCpM4KRDfjrDTdd/tnqUj51lctIUWTTn6E0ow6j0rPzADMIpnbuTcaGxNqyK2LKwMgP1MnKbilCGNAjGWCGEDrxcbS2ME+SeRne1y3q4uz9XLxTNm4TVO1U6A2CtEtE6jE+x9HDHFyqNOxqejhw5s1UntKIFbYHXfikS3lhnaQV/IxvgzQWFZUZ6M8lLJZL7+teF3jsOxW9TijfWzvJs8Dmeuw4s1aZe++vMHVxnoXSN1W0K06ZsuLSc6A7BMjaP9J8ltcQseWOYtvmvHksajlRC0wf38FVS5w==
  • Authentication-results: spf=none (sender IP is ) smtp.mailfrom=JBeulich@xxxxxxxx;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Delivery-date: Tue, 16 Jul 2019 07:43:03 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHVO6lWFnWLjuNRXkiFzFypmuh6cQ==
  • Thread-topic: [PATCH v4 02/13] x86/IRQ: deal with move cleanup count state in fixup_irqs()

The cleanup IPI may get sent immediately before a CPU gets removed from
the online map. In such a case the IPI would get handled on the CPU
being offlined no earlier than in the interrupts disabled window after
fixup_irqs()' main loop. This is too late, however, because a possible
affinity change may incur the need for vector assignment, which will
fail when the IRQ's move cleanup count is still non-zero.

To fix this
- record the set of CPUs the cleanup IPIs gets actually sent to alongside
   setting their count,
- adjust the count in fixup_irqs(), accounting for all CPUs that the
   cleanup IPI was sent to, but that are no longer online,
- bail early from the cleanup IPI handler when the CPU is no longer
   online, to prevent double accounting.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
Reviewed-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
Acked-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>

--- a/xen/arch/x86/irq.c
+++ b/xen/arch/x86/irq.c
@@ -675,6 +675,9 @@ void irq_move_cleanup_interrupt(struct c
      ack_APIC_irq();
  
      me = smp_processor_id();
+    if ( !cpu_online(me) )
+        return;
+
      for ( vector = FIRST_DYNAMIC_VECTOR;
            vector <= LAST_HIPRIORITY_VECTOR; vector++)
      {
@@ -735,11 +738,14 @@ unlock:
  
  static void send_cleanup_vector(struct irq_desc *desc)
  {
-    cpumask_t cleanup_mask;
+    cpumask_and(desc->arch.old_cpu_mask, desc->arch.old_cpu_mask,
+                &cpu_online_map);
+    desc->arch.move_cleanup_count = cpumask_weight(desc->arch.old_cpu_mask);
  
-    cpumask_and(&cleanup_mask, desc->arch.old_cpu_mask, &cpu_online_map);
-    desc->arch.move_cleanup_count = cpumask_weight(&cleanup_mask);
-    send_IPI_mask(&cleanup_mask, IRQ_MOVE_CLEANUP_VECTOR);
+    if ( desc->arch.move_cleanup_count )
+        send_IPI_mask(desc->arch.old_cpu_mask, IRQ_MOVE_CLEANUP_VECTOR);
+    else
+        release_old_vec(desc);
  
      desc->arch.move_in_progress = 0;
  }
@@ -2419,6 +2425,16 @@ void fixup_irqs(const cpumask_t *mask, b
               vector <= LAST_HIPRIORITY_VECTOR )
              cpumask_and(desc->arch.cpu_mask, desc->arch.cpu_mask, mask);
  
+        if ( desc->arch.move_cleanup_count )
+        {
+            /* The cleanup IPI may have got sent while we were still online. */
+            cpumask_andnot(&affinity, desc->arch.old_cpu_mask,
+                           &cpu_online_map);
+            desc->arch.move_cleanup_count -= cpumask_weight(&affinity);
+            if ( !desc->arch.move_cleanup_count )
+                release_old_vec(desc);
+        }
+
          cpumask_copy(&affinity, desc->affinity);
          if ( !desc->action || cpumask_subset(&affinity, mask) )
          {

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

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