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>,
	"Wei Liu" <wl@xen.org>, "Roger Pau Monné" <roger.pau@citrix.com>
Subject: [Xen-devel] [PATCH v4 11/13] x86/IRQ: tighten vector checks
Date: Tue, 16 Jul 2019 07:43:57 +0000	[thread overview]
Message-ID: <72140e85-8444-4a51-358e-2cc297f86249@suse.com> (raw)
In-Reply-To: <5cda711a-b417-76e9-d113-ea838463f225@suse.com>

Use valid_irq_vector() rather than "> 0".

Also replace an open-coded use of IRQ_VECTOR_UNASSIGNED.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
v3: New.

--- a/xen/arch/x86/irq.c
+++ b/xen/arch/x86/irq.c
@@ -342,7 +342,7 @@ void clear_irq_vector(int irq)
  
  int irq_to_vector(int irq)
  {
-    int vector = -1;
+    int vector = IRQ_VECTOR_UNASSIGNED;
  
      BUG_ON(irq >= nr_irqs || irq < 0);
  
@@ -452,15 +452,18 @@ static vmask_t *irq_get_used_vector_mask
              int vector;
              
              vector = irq_to_vector(irq);
-            if ( vector > 0 )
+            if ( valid_irq_vector(vector) )
              {
-                printk(XENLOG_INFO "IRQ %d already assigned vector %d\n",
+                printk(XENLOG_INFO "IRQ%d already assigned vector %02x\n",
                         irq, vector);
                  
                  ASSERT(!test_bit(vector, ret));
  
                  set_bit(vector, ret);
              }
+            else if ( vector != IRQ_VECTOR_UNASSIGNED )
+                printk(XENLOG_WARNING "IRQ%d mapped to bogus vector %02x\n",
+                       irq, vector);
          }
      }
      else if ( IO_APIC_IRQ(irq) &&
@@ -491,7 +494,7 @@ static int _assign_irq_vector(struct irq
      vmask_t *irq_used_vectors = NULL;
  
      old_vector = irq_to_vector(irq);
-    if ( old_vector > 0 )
+    if ( valid_irq_vector(old_vector) )
      {
          cpumask_t tmp_mask;
  
@@ -555,7 +558,7 @@ next:
          current_vector = vector;
          current_offset = offset;
  
-        if ( old_vector > 0 )
+        if ( valid_irq_vector(old_vector) )
          {
              cpumask_and(desc->arch.old_cpu_mask, desc->arch.cpu_mask,
                          &cpu_online_map);

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

  parent reply	other threads:[~2019-07-16  7:44 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-16  7:24 [Xen-devel] [PATCH v4 00/13] x86: IRQ management adjustments Jan Beulich
2019-07-16  7:37 ` [Xen-devel] [PATCH v4 01/13] x86/IRQ: deal with move-in-progress state in fixup_irqs() Jan Beulich
2019-07-19 13:20   ` Andrew Cooper
2019-07-16  7:37 ` [Xen-devel] [PATCH v4 02/13] x86/IRQ: deal with move cleanup count " Jan Beulich
2019-07-16  7:38 ` [Xen-devel] [PATCH v4 03/13] x86/IRQ: desc->affinity should strictly represent the requested value Jan Beulich
2019-07-19 13:25   ` Andrew Cooper
2019-07-16  7:38 ` [Xen-devel] [PATCH v4 04/13] x86/IRQ: consolidate use of ->arch.cpu_mask Jan Beulich
2019-07-16  7:39 ` [Xen-devel] [PATCH v4 05/13] x86/IRQ: fix locking around vector management Jan Beulich
2019-07-16  7:40 ` [Xen-devel] [PATCH v4 06/13] x86/IOMMU: don't restrict IRQ affinities to online CPUs Jan Beulich
2019-07-16  9:12   ` Roger Pau Monné
2019-07-16 10:20     ` Jan Beulich
2019-07-16 11:17       ` Roger Pau Monné
2019-07-19 13:27   ` Andrew Cooper
2019-07-24  0:53   ` Tian, Kevin
2019-07-24 19:53   ` Woods, Brian
2019-07-16  7:41 ` [Xen-devel] [PATCH v4 07/13] x86/IRQ: target online CPUs when binding guest IRQ Jan Beulich
2019-07-16  7:42 ` [Xen-devel] [PATCH v4 08/13] x86/IRQs: correct/tighten vector check in _clear_irq_vector() Jan Beulich
2019-07-16  7:42 ` [Xen-devel] [PATCH v4 09/13] x86/IRQ: make fixup_irqs() skip unconnected internally used interrupts Jan Beulich
2019-07-16  7:43 ` [Xen-devel] [PATCH v4 10/13] x86/IRQ: drop redundant cpumask_empty() from move_masked_irq() Jan Beulich
2019-07-16  7:43 ` Jan Beulich [this message]
2019-07-16  7:44 ` [Xen-devel] [PATCH v4 12/13] x86/IRQ: eliminate some on-stack cpumask_t instances Jan Beulich
2019-07-16  7:45 ` [Xen-devel] [PATCH v4 13/13] x86/IRQ: move {,_}clear_irq_vector() Jan Beulich
2019-07-19 12:36 ` [Xen-devel] [PATCH v4 00/13] x86: IRQ management adjustments Andrew Cooper
2019-07-19 13:04   ` Jan Beulich
2019-07-19 13:13     ` Andrew Cooper

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=72140e85-8444-4a51-358e-2cc297f86249@suse.com \
    --to=jbeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=roger.pau@citrix.com \
    --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.