tree:   https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86/urgent
head:   f60606c4ce402963dc552c62910ffa7080b4a628
commit: f60606c4ce402963dc552c62910ffa7080b4a628 [3/3] x86/apic/vector: Handle 
vector release on CPU unplug correctly
config: i386-randconfig-x079-201807 (attached as .config)
compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
reproduce:
        git checkout f60606c4ce402963dc552c62910ffa7080b4a628
        # save the attached .config to linux build tree
        make ARCH=i386 

All warnings (new ones prefixed by >>):

   In file included from include/linux/kernel.h:10:0,
                    from include/linux/interrupt.h:6,
                    from arch/x86/kernel/apic/vector.c:13:
   arch/x86/kernel/apic/vector.c: In function 'apic_update_vector':
   arch/x86/kernel/apic/vector.c:151:11: error: 'struct apic' has no member 
named 'vector'
     if (!apic->vector || apicd->vector == MANAGED_IRQ_SHUTDOWN_VECTOR)
              ^
   include/linux/compiler.h:58:30: note: in definition of macro '__trace_if'
     if (__builtin_constant_p(!!(cond)) ? !!(cond) :   \
                                 ^~~~
>> arch/x86/kernel/apic/vector.c:151:2: note: in expansion of macro 'if'
     if (!apic->vector || apicd->vector == MANAGED_IRQ_SHUTDOWN_VECTOR)
     ^~
   arch/x86/kernel/apic/vector.c:151:11: error: 'struct apic' has no member 
named 'vector'
     if (!apic->vector || apicd->vector == MANAGED_IRQ_SHUTDOWN_VECTOR)
              ^
   include/linux/compiler.h:58:42: note: in definition of macro '__trace_if'
     if (__builtin_constant_p(!!(cond)) ? !!(cond) :   \
                                             ^~~~
>> arch/x86/kernel/apic/vector.c:151:2: note: in expansion of macro 'if'
     if (!apic->vector || apicd->vector == MANAGED_IRQ_SHUTDOWN_VECTOR)
     ^~
   arch/x86/kernel/apic/vector.c:151:11: error: 'struct apic' has no member 
named 'vector'
     if (!apic->vector || apicd->vector == MANAGED_IRQ_SHUTDOWN_VECTOR)
              ^
   include/linux/compiler.h:69:16: note: in definition of macro '__trace_if'
      ______r = !!(cond);     \
                   ^~~~
>> arch/x86/kernel/apic/vector.c:151:2: note: in expansion of macro 'if'
     if (!apic->vector || apicd->vector == MANAGED_IRQ_SHUTDOWN_VECTOR)
     ^~

vim +/if +151 arch/x86/kernel/apic/vector.c

  > 13  #include <linux/interrupt.h>
    14  #include <linux/seq_file.h>
    15  #include <linux/init.h>
    16  #include <linux/compiler.h>
    17  #include <linux/slab.h>
    18  #include <asm/irqdomain.h>
    19  #include <asm/hw_irq.h>
    20  #include <asm/apic.h>
    21  #include <asm/i8259.h>
    22  #include <asm/desc.h>
    23  #include <asm/irq_remapping.h>
    24  
    25  #include <asm/trace/irq_vectors.h>
    26  
    27  struct apic_chip_data {
    28          struct irq_cfg          hw_irq_cfg;
    29          unsigned int            vector;
    30          unsigned int            prev_vector;
    31          unsigned int            cpu;
    32          unsigned int            prev_cpu;
    33          unsigned int            irq;
    34          struct hlist_node       clist;
    35          unsigned int            move_in_progress        : 1,
    36                                  is_managed              : 1,
    37                                  can_reserve             : 1,
    38                                  has_reserved            : 1;
    39  };
    40  
    41  struct irq_domain *x86_vector_domain;
    42  EXPORT_SYMBOL_GPL(x86_vector_domain);
    43  static DEFINE_RAW_SPINLOCK(vector_lock);
    44  static cpumask_var_t vector_searchmask;
    45  static struct irq_chip lapic_controller;
    46  static struct irq_matrix *vector_matrix;
    47  #ifdef CONFIG_SMP
    48  static DEFINE_PER_CPU(struct hlist_head, cleanup_list);
    49  #endif
    50  
    51  void lock_vector_lock(void)
    52  {
    53          /* Used to the online set of cpus does not change
    54           * during assign_irq_vector.
    55           */
    56          raw_spin_lock(&vector_lock);
    57  }
    58  
    59  void unlock_vector_lock(void)
    60  {
    61          raw_spin_unlock(&vector_lock);
    62  }
    63  
    64  void init_irq_alloc_info(struct irq_alloc_info *info,
    65                           const struct cpumask *mask)
    66  {
    67          memset(info, 0, sizeof(*info));
    68          info->mask = mask;
    69  }
    70  
    71  void copy_irq_alloc_info(struct irq_alloc_info *dst, struct 
irq_alloc_info *src)
    72  {
    73          if (src)
    74                  *dst = *src;
    75          else
    76                  memset(dst, 0, sizeof(*dst));
    77  }
    78  
    79  static struct apic_chip_data *apic_chip_data(struct irq_data *irqd)
    80  {
    81          if (!irqd)
    82                  return NULL;
    83  
    84          while (irqd->parent_data)
    85                  irqd = irqd->parent_data;
    86  
    87          return irqd->chip_data;
    88  }
    89  
    90  struct irq_cfg *irqd_cfg(struct irq_data *irqd)
    91  {
    92          struct apic_chip_data *apicd = apic_chip_data(irqd);
    93  
    94          return apicd ? &apicd->hw_irq_cfg : NULL;
    95  }
    96  EXPORT_SYMBOL_GPL(irqd_cfg);
    97  
    98  struct irq_cfg *irq_cfg(unsigned int irq)
    99  {
   100          return irqd_cfg(irq_get_irq_data(irq));
   101  }
   102  
   103  static struct apic_chip_data *alloc_apic_chip_data(int node)
   104  {
   105          struct apic_chip_data *apicd;
   106  
   107          apicd = kzalloc_node(sizeof(*apicd), GFP_KERNEL, node);
   108          if (apicd)
   109                  INIT_HLIST_NODE(&apicd->clist);
   110          return apicd;
   111  }
   112  
   113  static void free_apic_chip_data(struct apic_chip_data *apicd)
   114  {
   115          kfree(apicd);
   116  }
   117  
   118  static void apic_update_irq_cfg(struct irq_data *irqd, unsigned int 
vector,
   119                                  unsigned int cpu)
   120  {
   121          struct apic_chip_data *apicd = apic_chip_data(irqd);
   122  
   123          lockdep_assert_held(&vector_lock);
   124  
   125          apicd->hw_irq_cfg.vector = vector;
   126          apicd->hw_irq_cfg.dest_apicid = apic->calc_dest_apicid(cpu);
   127          irq_data_update_effective_affinity(irqd, cpumask_of(cpu));
   128          trace_vector_config(irqd->irq, vector, cpu,
   129                              apicd->hw_irq_cfg.dest_apicid);
   130  }
   131  
   132  static void apic_update_vector(struct irq_data *irqd, unsigned int 
newvec,
   133                                 unsigned int newcpu)
   134  {
   135          struct apic_chip_data *apicd = apic_chip_data(irqd);
   136          struct irq_desc *desc = irq_data_to_desc(irqd);
   137          bool managed = irqd_affinity_is_managed(irqd);
   138  
   139          lockdep_assert_held(&vector_lock);
   140  
   141          trace_vector_update(irqd->irq, newvec, newcpu, apicd->vector,
   142                              apicd->cpu);
   143  
   144          /*
   145           * If there is no vector associated or if the associated vector 
is
   146           * the shutdown vector, which is associated to make PCI/MSI
   147           * shutdown mode work, then there is nothing to release. Clear 
out
   148           * prev_vector for this and the offlined target case.
   149           */
   150          apicd->prev_vector = 0;
 > 151          if (!apic->vector || apicd->vector == 
 > MANAGED_IRQ_SHUTDOWN_VECTOR)
   152                  goto setnew;
   153          /*
   154           * If the target CPU of the previous vector is online, then mark
   155           * the vector as move in progress and store it for cleanup when 
the
   156           * first interrupt on the new vector arrives. If the target CPU 
is
   157           * offline then the regular release mechanism via the cleanup
   158           * vector is not possible and the vector can be immediately 
freed
   159           * in the underlying matrix allocator.
   160           */
   161          if (cpu_online(apicd->cpu)) {
   162                  apicd->move_in_progress = true;
   163                  apicd->prev_vector = apicd->vector;
   164                  apicd->prev_cpu = apicd->cpu;
   165          } else {
   166                  irq_matrix_free(vector_matrix, apicd->cpu, 
apicd->vector,
   167                                  managed);
   168          }
   169  
   170  setnew:
   171          apicd->vector = newvec;
   172          apicd->cpu = newcpu;
   173          BUG_ON(!IS_ERR_OR_NULL(per_cpu(vector_irq, newcpu)[newvec]));
   174          per_cpu(vector_irq, newcpu)[newvec] = desc;
   175  }
   176  

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

Attachment: .config.gz
Description: application/gzip

Reply via email to