Skip to content
Snippets Groups Projects
  1. Dec 07, 2023
  2. Apr 21, 2023
  3. Jan 18, 2023
    • Ingo Molnar's avatar
      genirq/affinity: Only build SMP-only helper functions on SMP kernels · 188a5696
      Ingo Molnar authored
      allnoconfig grew these new build warnings in lib/group_cpus.c:
      
        lib/group_cpus.c:247:12: warning: ‘__group_cpus_evenly’ defined but not used [-Wunused-function]
        lib/group_cpus.c:75:13: warning: ‘build_node_to_cpumask’ defined but not used [-Wunused-function]
        lib/group_cpus.c:66:13: warning: ‘free_node_to_cpumask’ defined but not used [-Wunused-function]
        lib/group_cpus.c:43:23: warning: ‘alloc_node_to_cpumask’ defined but not used [-Wunused-function]
      
      Widen the #ifdef CONFIG_SMP block to not expose unused helpers on
      non-SMP builds.
      
      Also annotate the preprocessor branches for better readability.
      
      Fixes: f7b3ea8c ("genirq/affinity: Move group_cpus_evenly() into lib/")
      Cc: Ming Lei <ming.lei@redhat.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Link: https://lore.kernel.org/r/20221227022905.352674-6-ming.lei@redhat.com
      
      
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      188a5696
  4. Jan 17, 2023
  5. Jun 03, 2022
  6. Apr 11, 2022
  7. Apr 10, 2022
  8. Aug 10, 2021
  9. Aug 28, 2019
  10. Aug 27, 2019
    • Ming Lei's avatar
      genirq/affinity: Spread vectors on node according to nr_cpu ratio · b1a5a73e
      Ming Lei authored
      
      Now __irq_build_affinity_masks() spreads vectors evenly per node, but there
      is a case that not all vectors have been spread when each numa node has a
      different number of CPUs which triggers the warning in the spreading code.
      
      Improve the spreading algorithm by
      
       - assigning vectors according to the ratio of the number of CPUs on a node
         to the number of remaining CPUs.
      
       - running the assignment from smaller nodes to bigger nodes to guarantee
         that every active node gets allocated at least one vector.
      
      This ensures that all vectors are spread out. Asided of that the spread
      becomes more fair if the nodes have different number of CPUs.
      
      For example, on the following machine:
      	CPU(s):              16
      	On-line CPU(s) list: 0-15
      	Thread(s) per core:  1
      	Core(s) per socket:  8
      	Socket(s):           2
      	NUMA node(s):        2
      	...
      	NUMA node0 CPU(s):   0,1,3,5-9,11,13-15
      	NUMA node1 CPU(s):   2,4,10,12
      
      When a driver requests to allocate 8 vectors, the following spread results:
      
      	irq 31, cpu list 2,4
      	irq 32, cpu list 10,12
      	irq 33, cpu list 0-1
      	irq 34, cpu list 3,5
      	irq 35, cpu list 6-7
      	irq 36, cpu list 8-9
      	irq 37, cpu list 11,13
      	irq 38, cpu list 14-15
      
      So Node 0 has now 6 and Node 1 has 2 vectors assigned. The original
      algorithm assigned 4 vectors on each node which was unfair versus Node 0.
      
      [ tglx: Massaged changelog ]
      
      Reported-by: default avatarJon Derrick <jonathan.derrick@intel.com>
      Signed-off-by: default avatarMing Lei <ming.lei@redhat.com>
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Reviewed-by: default avatarKeith Busch <kbusch@kernel.org>
      Reviewed-by: default avatarJon Derrick <jonathan.derrick@intel.com>
      Link: https://lkml.kernel.org/r/20190816022849.14075-3-ming.lei@redhat.com
      b1a5a73e
    • Ming Lei's avatar
      genirq/affinity: Improve __irq_build_affinity_masks() · 53c1788b
      Ming Lei authored
      
      One invariant of __irq_build_affinity_masks() is that all CPUs in the
      specified masks (cpu_mask AND node_to_cpumask for each node) should be
      covered during the spread. Even though all requested vectors have been
      reached, it's still required to spread vectors among remained CPUs. A
      similar policy has been taken in case of 'numvecs <= nodes' already.
      
      So remove the following check inside the loop:
      
      	if (done >= numvecs)
      		break;
      
      Meantime assign at least 1 vector for remaining nodes if 'numvecs' vectors
      have been handled already.
      
      Also, if the specified cpumask for one numa node is empty, simply do not
      spread vectors on this node.
      
      Signed-off-by: default avatarMing Lei <ming.lei@redhat.com>
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Link: https://lkml.kernel.org/r/20190816022849.14075-2-ming.lei@redhat.com
      53c1788b
  11. Aug 08, 2019
  12. Jun 12, 2019
  13. Feb 18, 2019
    • Thomas Gleixner's avatar
      genirq/affinity: Remove the leftovers of the original set support · a6a309ed
      Thomas Gleixner authored
      
      Now that the NVME driver is converted over to the calc_set() callback, the
      workarounds of the original set support can be removed.
      
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Reviewed-by: default avatarMing Lei <ming.lei@redhat.com>
      Acked-by: default avatarMarc Zyngier <marc.zyngier@arm.com>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Bjorn Helgaas <helgaas@kernel.org>
      Cc: Jens Axboe <axboe@kernel.dk>
      Cc: linux-block@vger.kernel.org
      Cc: Sagi Grimberg <sagi@grimberg.me>
      Cc: linux-nvme@lists.infradead.org
      Cc: linux-pci@vger.kernel.org
      Cc: Keith Busch <keith.busch@intel.com>
      Cc: Sumit Saxena <sumit.saxena@broadcom.com>
      Cc: Kashyap Desai <kashyap.desai@broadcom.com>
      Cc: Shivasharan Srikanteshwara <shivasharan.srikanteshwara@broadcom.com>
      Link: https://lkml.kernel.org/r/20190216172228.689834224@linutronix.de
      a6a309ed
    • Ming Lei's avatar
      genirq/affinity: Add new callback for (re)calculating interrupt sets · c66d4bd1
      Ming Lei authored
      
      The interrupt affinity spreading mechanism supports to spread out
      affinities for one or more interrupt sets. A interrupt set contains one or
      more interrupts. Each set is mapped to a specific functionality of a
      device, e.g. general I/O queues and read I/O queus of multiqueue block
      devices.
      
      The number of interrupts per set is defined by the driver. It depends on
      the total number of available interrupts for the device, which is
      determined by the PCI capabilites and the availability of underlying CPU
      resources, and the number of queues which the device provides and the
      driver wants to instantiate.
      
      The driver passes initial configuration for the interrupt allocation via a
      pointer to struct irq_affinity.
      
      Right now the allocation mechanism is complex as it requires to have a loop
      in the driver to determine the maximum number of interrupts which are
      provided by the PCI capabilities and the underlying CPU resources.  This
      loop would have to be replicated in every driver which wants to utilize
      this mechanism. That's unwanted code duplication and error prone.
      
      In order to move this into generic facilities it is required to have a
      mechanism, which allows the recalculation of the interrupt sets and their
      size, in the core code. As the core code does not have any knowledge about the
      underlying device, a driver specific callback is required in struct
      irq_affinity, which can be invoked by the core code. The callback gets the
      number of available interupts as an argument, so the driver can calculate the
      corresponding number and size of interrupt sets.
      
      At the moment the struct irq_affinity pointer which is handed in from the
      driver and passed through to several core functions is marked 'const', but for
      the callback to be able to modify the data in the struct it's required to
      remove the 'const' qualifier.
      
      Add the optional callback to struct irq_affinity, which allows drivers to
      recalculate the number and size of interrupt sets and remove the 'const'
      qualifier.
      
      For simple invocations, which do not supply a callback, a default callback
      is installed, which just sets nr_sets to 1 and transfers the number of
      spreadable vectors to the set_size array at index 0.
      
      This is for now guarded by a check for nr_sets != 0 to keep the NVME driver
      working until it is converted to the callback mechanism.
      
      To make sure that the driver configuration is correct under all circumstances
      the callback is invoked even when there are no interrupts for queues left,
      i.e. the pre/post requirements already exhaust the numner of available
      interrupts.
      
      At the PCI layer irq_create_affinity_masks() has to be invoked even for the
      case where the legacy interrupt is used. That ensures that the callback is
      invoked and the device driver can adjust to that situation.
      
      [ tglx: Fixed the simple case (no sets required). Moved the sanity check
        	for nr_sets after the invocation of the callback so it catches
        	broken drivers. Fixed the kernel doc comments for struct
        	irq_affinity and de-'This patch'-ed the changelog ]
      
      Signed-off-by: default avatarMing Lei <ming.lei@redhat.com>
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Acked-by: default avatarMarc Zyngier <marc.zyngier@arm.com>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Bjorn Helgaas <helgaas@kernel.org>
      Cc: Jens Axboe <axboe@kernel.dk>
      Cc: linux-block@vger.kernel.org
      Cc: Sagi Grimberg <sagi@grimberg.me>
      Cc: linux-nvme@lists.infradead.org
      Cc: linux-pci@vger.kernel.org
      Cc: Keith Busch <keith.busch@intel.com>
      Cc: Sumit Saxena <sumit.saxena@broadcom.com>
      Cc: Kashyap Desai <kashyap.desai@broadcom.com>
      Cc: Shivasharan Srikanteshwara <shivasharan.srikanteshwara@broadcom.com>
      Link: https://lkml.kernel.org/r/20190216172228.512444498@linutronix.de
      
      c66d4bd1
    • Ming Lei's avatar
      genirq/affinity: Store interrupt sets size in struct irq_affinity · 9cfef55b
      Ming Lei authored
      
      The interrupt affinity spreading mechanism supports to spread out
      affinities for one or more interrupt sets. A interrupt set contains one
      or more interrupts. Each set is mapped to a specific functionality of a
      device, e.g. general I/O queues and read I/O queus of multiqueue block
      devices.
      
      The number of interrupts per set is defined by the driver. It depends on
      the total number of available interrupts for the device, which is
      determined by the PCI capabilites and the availability of underlying CPU
      resources, and the number of queues which the device provides and the
      driver wants to instantiate.
      
      The driver passes initial configuration for the interrupt allocation via
      a pointer to struct irq_affinity.
      
      Right now the allocation mechanism is complex as it requires to have a
      loop in the driver to determine the maximum number of interrupts which
      are provided by the PCI capabilities and the underlying CPU resources.
      This loop would have to be replicated in every driver which wants to
      utilize this mechanism. That's unwanted code duplication and error
      prone.
      
      In order to move this into generic facilities it is required to have a
      mechanism, which allows the recalculation of the interrupt sets and
      their size, in the core code. As the core code does not have any
      knowledge about the underlying device, a driver specific callback will
      be added to struct affinity_desc, which will be invoked by the core
      code. The callback will get the number of available interupts as an
      argument, so the driver can calculate the corresponding number and size
      of interrupt sets.
      
      To support this, two modifications for the handling of struct irq_affinity
      are required:
      
      1) The (optional) interrupt sets size information is contained in a
         separate array of integers and struct irq_affinity contains a
         pointer to it.
      
         This is cumbersome and as the maximum number of interrupt sets is small,
         there is no reason to have separate storage. Moving the size array into
         struct affinity_desc avoids indirections and makes the code simpler.
      
      2) At the moment the struct irq_affinity pointer which is handed in from
         the driver and passed through to several core functions is marked
         'const'.
      
         With the upcoming callback to recalculate the number and size of
         interrupt sets, it's necessary to remove the 'const'
         qualifier. Otherwise the callback would not be able to update the data.
      
      Implement #1 and store the interrupt sets size in 'struct irq_affinity'.
      
      No functional change.
      
      [ tglx: Fixed the memcpy() size so it won't copy beyond the size of the
        	source. Fixed the kernel doc comments for struct irq_affinity and
        	de-'This patch'-ed the changelog ]
      
      Signed-off-by: default avatarMing Lei <ming.lei@redhat.com>
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Acked-by: default avatarMarc Zyngier <marc.zyngier@arm.com>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Bjorn Helgaas <helgaas@kernel.org>
      Cc: Jens Axboe <axboe@kernel.dk>
      Cc: linux-block@vger.kernel.org
      Cc: Sagi Grimberg <sagi@grimberg.me>
      Cc: linux-nvme@lists.infradead.org
      Cc: linux-pci@vger.kernel.org
      Cc: Keith Busch <keith.busch@intel.com>
      Cc: Sumit Saxena <sumit.saxena@broadcom.com>
      Cc: Kashyap Desai <kashyap.desai@broadcom.com>
      Cc: Shivasharan Srikanteshwara <shivasharan.srikanteshwara@broadcom.com>
      Link: https://lkml.kernel.org/r/20190216172228.423723127@linutronix.de
      
      9cfef55b
    • Thomas Gleixner's avatar
      genirq/affinity: Code consolidation · 0145c30e
      Thomas Gleixner authored
      
      All information and calculations in the interrupt affinity spreading code
      is strictly unsigned int. Though the code uses int all over the place.
      
      Convert it over to unsigned int.
      
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Reviewed-by: default avatarMing Lei <ming.lei@redhat.com>
      Acked-by: default avatarMarc Zyngier <marc.zyngier@arm.com>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Bjorn Helgaas <helgaas@kernel.org>
      Cc: Jens Axboe <axboe@kernel.dk>
      Cc: linux-block@vger.kernel.org
      Cc: Sagi Grimberg <sagi@grimberg.me>
      Cc: linux-nvme@lists.infradead.org
      Cc: linux-pci@vger.kernel.org
      Cc: Keith Busch <keith.busch@intel.com>
      Cc: Sumit Saxena <sumit.saxena@broadcom.com>
      Cc: Kashyap Desai <kashyap.desai@broadcom.com>
      Cc: Shivasharan Srikanteshwara <shivasharan.srikanteshwara@broadcom.com>
      Link: https://lkml.kernel.org/r/20190216172228.336424556@linutronix.de
      0145c30e
  14. Feb 10, 2019
  15. Dec 19, 2018
    • Dou Liyang's avatar
      genirq/affinity: Add is_managed to struct irq_affinity_desc · c410abbb
      Dou Liyang authored
      
      Devices which use managed interrupts usually have two classes of
      interrupts:
      
        - Interrupts for multiple device queues
        - Interrupts for general device management
      
      Currently both classes are treated the same way, i.e. as managed
      interrupts. The general interrupts get the default affinity mask assigned
      while the device queue interrupts are spread out over the possible CPUs.
      
      Treating the general interrupts as managed is both a limitation and under
      certain circumstances a bug. Assume the following situation:
      
       default_irq_affinity = 4..7
      
      So if CPUs 4-7 are offlined, then the core code will shut down the device
      management interrupts because the last CPU in their affinity mask went
      offline.
      
      It's also a limitation because it's desired to allow manual placement of
      the general device interrupts for various reasons. If they are marked
      managed then the interrupt affinity setting from both user and kernel space
      is disabled. That limitation was reported by Kashyap and Sumit.
      
      Expand struct irq_affinity_desc with a new bit 'is_managed' which is set
      for truly managed interrupts (queue interrupts) and cleared for the general
      device interrupts.
      
      [ tglx: Simplify code and massage changelog ]
      
      Reported-by: default avatarKashyap Desai <kashyap.desai@broadcom.com>
      Reported-by: default avatarSumit Saxena <sumit.saxena@broadcom.com>
      Signed-off-by: default avatarDou Liyang <douliyangs@gmail.com>
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Cc: linux-pci@vger.kernel.org
      Cc: shivasharan.srikanteshwara@broadcom.com
      Cc: ming.lei@redhat.com
      Cc: hch@lst.de
      Cc: bhelgaas@google.com
      Cc: douliyang1@huawei.com
      Link: https://lkml.kernel.org/r/20181204155122.6327-3-douliyangs@gmail.com
      c410abbb
    • Dou Liyang's avatar
      genirq/core: Introduce struct irq_affinity_desc · bec04037
      Dou Liyang authored
      
      The interrupt affinity management uses straight cpumask pointers to convey
      the automatically assigned affinity masks for managed interrupts. The core
      interrupt descriptor allocation also decides based on the pointer being non
      NULL whether an interrupt is managed or not.
      
      Devices which use managed interrupts usually have two classes of
      interrupts:
      
        - Interrupts for multiple device queues
        - Interrupts for general device management
      
      Currently both classes are treated the same way, i.e. as managed
      interrupts. The general interrupts get the default affinity mask assigned
      while the device queue interrupts are spread out over the possible CPUs.
      
      Treating the general interrupts as managed is both a limitation and under
      certain circumstances a bug. Assume the following situation:
      
       default_irq_affinity = 4..7
      
      So if CPUs 4-7 are offlined, then the core code will shut down the device
      management interrupts because the last CPU in their affinity mask went
      offline.
      
      It's also a limitation because it's desired to allow manual placement of
      the general device interrupts for various reasons. If they are marked
      managed then the interrupt affinity setting from both user and kernel space
      is disabled.
      
      To remedy that situation it's required to convey more information than the
      cpumasks through various interfaces related to interrupt descriptor
      allocation.
      
      Instead of adding yet another argument, create a new data structure
      'irq_affinity_desc' which for now just contains the cpumask. This struct
      can be expanded to convey auxilliary information in the next step.
      
      No functional change, just preparatory work.
      
      [ tglx: Simplified logic and clarified changelog ]
      
      Suggested-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Suggested-by: default avatarBjorn Helgaas <bhelgaas@google.com>
      Signed-off-by: default avatarDou Liyang <douliyangs@gmail.com>
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Cc: linux-pci@vger.kernel.org
      Cc: kashyap.desai@broadcom.com
      Cc: shivasharan.srikanteshwara@broadcom.com
      Cc: sumit.saxena@broadcom.com
      Cc: ming.lei@redhat.com
      Cc: hch@lst.de
      Cc: douliyang1@huawei.com
      Link: https://lkml.kernel.org/r/20181204155122.6327-2-douliyangs@gmail.com
      bec04037
    • Thomas Gleixner's avatar
      genirq/affinity: Remove excess indentation · c2899c34
      Thomas Gleixner authored
      
      Plus other coding style issues which stood out while staring at that code.
      
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      c2899c34
  16. Nov 05, 2018
  17. Apr 06, 2018
    • Ming Lei's avatar
      genirq/affinity: Spread irq vectors among present CPUs as far as possible · d3056812
      Ming Lei authored
      
      Commit 84676c1f ("genirq/affinity: assign vectors to all possible CPUs")
      tried to spread the interrupts accross all possible CPUs to make sure that
      in case of phsyical hotplug (e.g. virtualization) the CPUs which get
      plugged in after the device was initialized are targeted by a hardware
      queue and the corresponding interrupt.
      
      This has a downside in cases where the ACPI tables claim that there are
      more possible CPUs than present CPUs and the number of interrupts to spread
      out is smaller than the number of possible CPUs. These bogus ACPI tables
      are unfortunately not uncommon.
      
      In such a case the vector spreading algorithm assigns interrupts to CPUs
      which can never be utilized and as a consequence these interrupts are
      unused instead of being mapped to present CPUs. As a result the performance
      of the device is suboptimal.
      
      To fix this spread the interrupt vectors in two stages:
      
       1) Spread as many interrupts as possible among the present CPUs
      
       2) Spread the remaining vectors among non present CPUs
      
      On a 8 core system, where CPU 0-3 are present and CPU 4-7 are not present,
      for a device with 4 queues the resulting interrupt affinity is:
      
        1) Before 84676c1f ("genirq/affinity: assign vectors to all possible CPUs")
      	irq 39, cpu list 0
      	irq 40, cpu list 1
      	irq 41, cpu list 2
      	irq 42, cpu list 3
      
        2) With 84676c1f ("genirq/affinity: assign vectors to all possible CPUs")
      	irq 39, cpu list 0-2
      	irq 40, cpu list 3-4,6
      	irq 41, cpu list 5
      	irq 42, cpu list 7
      
        3) With the refined vector spread applied:
      	irq 39, cpu list 0,4
      	irq 40, cpu list 1,6
      	irq 41, cpu list 2,5
      	irq 42, cpu list 3,7
      
      On a 8 core system, where all CPUs are present the resulting interrupt
      affinity for the 4 queues is:
      
      	irq 39, cpu list 0,1
      	irq 40, cpu list 2,3
      	irq 41, cpu list 4,5
      	irq 42, cpu list 6,7
      
      This is independent of the number of CPUs which are online at the point of
      initialization because in such a system the offline CPUs can be easily
      onlined afterwards, while in non-present CPUs need to be plugged physically
      or virtually which requires external interaction.
      
      The downside of this approach is that in case of physical hotplug the
      interrupt vector spreading might be suboptimal when CPUs 4-7 are physically
      plugged. Suboptimal from a NUMA point of view and due to the single target
      nature of interrupt affinities the later plugged CPUs might not be targeted
      by interrupts at all.
      
      Though, physical hotplug systems are not the common case while the broken
      ACPI table disease is wide spread. So it's preferred to have as many
      interrupts as possible utilized at the point where the device is
      initialized.
      
      Block multi-queue devices like NVME create a hardware queue per possible
      CPU, so the goal of commit 84676c1f to assign one interrupt vector per
      possible CPU is still achieved even with physical/virtual hotplug.
      
      [ tglx: Changed from online to present CPUs for the first spreading stage,
        	renamed variables for readability sake, added comments and massaged
        	changelog ]
      
      Reported-by: default avatarLaurence Oberman <loberman@redhat.com>
      Signed-off-by: default avatarMing Lei <ming.lei@redhat.com>
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
      Cc: Jens Axboe <axboe@kernel.dk>
      Cc: linux-block@vger.kernel.org
      Cc: Christoph Hellwig <hch@infradead.org>
      Link: https://lkml.kernel.org/r/20180308105358.1506-5-ming.lei@redhat.com
      d3056812
    • Ming Lei's avatar
      genirq/affinity: Allow irq spreading from a given starting point · 1a2d0914
      Ming Lei authored
      
      To support two stage irq vector spreading, it's required to add a starting
      point to the spreading function. No functional change, just preparatory
      work for the actual two stage change.
      
      [ tglx: Renamed variables, tidied up the code and massaged changelog ]
      
      Signed-off-by: default avatarMing Lei <ming.lei@redhat.com>
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
      Cc: Jens Axboe <axboe@kernel.dk>
      Cc: linux-block@vger.kernel.org
      Cc: Laurence Oberman <loberman@redhat.com>
      Cc: Christoph Hellwig <hch@infradead.org>
      Link: https://lkml.kernel.org/r/20180308105358.1506-4-ming.lei@redhat.com
      1a2d0914
    • Ming Lei's avatar
      genirq/affinity: Move actual irq vector spreading into a helper function · b3e6aaa8
      Ming Lei authored
      
      No functional change, just prepare for converting to 2-stage irq vector
      spreading.
      
      Signed-off-by: default avatarMing Lei <ming.lei@redhat.com>
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
      Cc: Jens Axboe <axboe@kernel.dk>
      Cc: linux-block@vger.kernel.org
      Cc: Laurence Oberman <loberman@redhat.com>
      Cc: Christoph Hellwig <hch@infradead.org>
      Link: https://lkml.kernel.org/r/20180308105358.1506-3-ming.lei@redhat.com
      b3e6aaa8
    • Ming Lei's avatar
      genirq/affinity: Rename *node_to_possible_cpumask as *node_to_cpumask · 47778f33
      Ming Lei authored
      
      The following patches will introduce two stage irq spreading for improving
      irq spread on all possible CPUs.
      
      No functional change.
      
      Signed-off-by: default avatarMing Lei <ming.lei@redhat.com>
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
      Cc: Jens Axboe <axboe@kernel.dk>
      Cc: linux-block@vger.kernel.org
      Cc: Laurence Oberman <loberman@redhat.com>
      Cc: Christoph Hellwig <hch@infradead.org>
      Link: https://lkml.kernel.org/r/20180308105358.1506-2-ming.lei@redhat.com
      47778f33
    • Thomas Gleixner's avatar
      genirq/affinity: Don't return with empty affinity masks on error · 0211e12d
      Thomas Gleixner authored
      
      When the allocation of node_to_possible_cpumask fails, then
      irq_create_affinity_masks() returns with a pointer to the empty affinity
      masks array, which will cause malfunction.
      
      Reorder the allocations so the masks array allocation comes last and every
      failure path returns NULL.
      
      Fixes: 9a0ef98e ("genirq/affinity: Assign vectors to all present CPUs")
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Cc: Christoph Hellwig <hch@infradead.org>
      Cc: Ming Lei <ming.lei@redhat.com>
      0211e12d
  18. Jan 12, 2018
  19. Nov 02, 2017
    • Greg Kroah-Hartman's avatar
      License cleanup: add SPDX GPL-2.0 license identifier to files with no license · b2441318
      Greg Kroah-Hartman authored
      
      Many source files in the tree are missing licensing information, which
      makes it harder for compliance tools to determine the correct license.
      
      By default all files without license information are under the default
      license of the kernel, which is GPL version 2.
      
      Update the files which contain no license information with the 'GPL-2.0'
      SPDX license identifier.  The SPDX identifier is a legally binding
      shorthand, which can be used instead of the full boiler plate text.
      
      This patch is based on work done by Thomas Gleixner and Kate Stewart and
      Philippe Ombredanne.
      
      How this work was done:
      
      Patches were generated and checked against linux-4.14-rc6 for a subset of
      the use cases:
       - file had no licensing information it it.
       - file was a */uapi/* one with no licensing information in it,
       - file was a */uapi/* one with existing licensing information,
      
      Further patches will be generated in subsequent months to fix up cases
      where non-standard license headers were used, and references to license
      had to be inferred by heuristics based on keywords.
      
      The analysis to determine which SPDX License Identifier to be applied to
      a file was done in a spreadsheet of side by side results from of the
      output of two independent scanners (ScanCode & Windriver) producing SPDX
      tag:value files created by Philippe Ombredanne.  Philippe prepared the
      base worksheet, and did an initial spot review of a few 1000 files.
      
      The 4.13 kernel was the starting point of the analysis with 60,537 files
      assessed.  Kate Stewart did a file by file comparison of the scanner
      results in the spreadsheet to determine which SPDX license identifier(s)
      to be applied to the file. She confirmed any determination that was not
      immediately clear with lawyers working with the Linux Foundation.
      
      Criteria used to select files for SPDX license identifier tagging was:
       - Files considered eligible had to be source code files.
       - Make and config files were included as candidates if they contained >5
         lines of source
       - File already had some variant of a license header in it (even if <5
         lines).
      
      All documentation files were explicitly excluded.
      
      The following heuristics were used to determine which SPDX license
      identifiers to apply.
      
       - when both scanners couldn't find any license traces, file was
         considered to have no license information in it, and the top level
         COPYING file license applied.
      
         For non */uapi/* files that summary was:
      
         SPDX license identifier                            # files
         ---------------------------------------------------|-------
         GPL-2.0                                              11139
      
         and resulted in the first patch in this series.
      
         If that file was a */uapi/* path one, it was "GPL-2.0 WITH
         Linux-syscall-note" otherwise it was "GPL-2.0".  Results of that was:
      
         SPDX license identifier                            # files
         ---------------------------------------------------|-------
         GPL-2.0 WITH Linux-syscall-note                        930
      
         and resulted in the second patch in this series.
      
       - if a file had some form of licensing information in it, and was one
         of the */uapi/* ones, it was denoted with the Linux-syscall-note if
         any GPL family license was found in the file or had no licensing in
         it (per prior point).  Results summary:
      
         SPDX license identifier                            # files
         ---------------------------------------------------|------
         GPL-2.0 WITH Linux-syscall-note                       270
         GPL-2.0+ WITH Linux-syscall-note                      169
         ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause)    21
         ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause)    17
         LGPL-2.1+ WITH Linux-syscall-note                      15
         GPL-1.0+ WITH Linux-syscall-note                       14
         ((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause)    5
         LGPL-2.0+ WITH Linux-syscall-note                       4
         LGPL-2.1 WITH Linux-syscall-note                        3
         ((GPL-2.0 WITH Linux-syscall-note) OR MIT)              3
         ((GPL-2.0 WITH Linux-syscall-note) AND MIT)             1
      
         and that resulted in the third patch in this series.
      
       - when the two scanners agreed on the detected license(s), that became
         the concluded license(s).
      
       - when there was disagreement between the two scanners (one detected a
         license but the other didn't, or they both detected different
         licenses) a manual inspection of the file occurred.
      
       - In most cases a manual inspection of the information in the file
         resulted in a clear resolution of the license that should apply (and
         which scanner probably needed to revisit its heuristics).
      
       - When it was not immediately clear, the license identifier was
         confirmed with lawyers working with the Linux Foundation.
      
       - If there was any question as to the appropriate license identifier,
         the file was flagged for further research and to be revisited later
         in time.
      
      In total, over 70 hours of logged manual review was done on the
      spreadsheet to determine the SPDX license identifiers to apply to the
      source files by Kate, Philippe, Thomas and, in some cases, confirmation
      by lawyers working with the Linux Foundation.
      
      Kate also obtained a third independent scan of the 4.13 code base from
      FOSSology, and compared selected files where the other two scanners
      disagreed against that SPDX file, to see if there was new insights.  The
      Windriver scanner is based on an older version of FOSSology in part, so
      they are related.
      
      Thomas did random spot checks in about 500 files from the spreadsheets
      for the uapi headers and agreed with SPDX license identifier in the
      files he inspected. For the non-uapi files Thomas did random spot checks
      in about 15000 files.
      
      In initial set of patches against 4.14-rc6, 3 files were found to have
      copy/paste license identifier errors, and have been fixed to reflect the
      correct identifier.
      
      Additionally Philippe spent 10 hours this week doing a detailed manual
      inspection and review of the 12,461 patched files from the initial patch
      version early this week with:
       - a full scancode scan run, collecting the matched texts, detected
         license ids and scores
       - reviewing anything where there was a license detected (about 500+
         files) to ensure that the applied SPDX license was correct
       - reviewing anything where there was no detection but the patch license
         was not GPL-2.0 WITH Linux-syscall-note to ensure that the applied
         SPDX license was correct
      
      This produced a worksheet with 20 files needing minor correction.  This
      worksheet was then exported into 3 different .csv files for the
      different types of files to be modified.
      
      These .csv files were then reviewed by Greg.  Thomas wrote a script to
      parse the csv files and add the proper SPDX tag to the file, in the
      format that the file expected.  This script was further refined by Greg
      based on the output to detect more types of files automatically and to
      distinguish between header and source .c files (which need different
      comment types.)  Finally Greg ran the script using the .csv files to
      generate the patches.
      
      Reviewed-by: default avatarKate Stewart <kstewart@linuxfoundation.org>
      Reviewed-by: default avatarPhilippe Ombredanne <pombredanne@nexb.com>
      Reviewed-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b2441318
  20. Jun 22, 2017
    • Christoph Hellwig's avatar
      genirq/affinity: Assign vectors to all present CPUs · 9a0ef98e
      Christoph Hellwig authored
      
      Currently the irq vector spread algorithm is restricted to online CPUs,
      which ties the IRQ mapping to the currently online devices and doesn't deal
      nicely with the fact that CPUs could come and go rapidly due to e.g. power
      management.
      
      Instead assign vectors to all present CPUs to avoid this churn.
      
      Build a map of all possible CPUs for a given node, as the architectures
      only provide a map of all onlines CPUs. Do this dynamically on each call
      for the vector assingments, which is a bit suboptimal and could be
      optimized in the future by provinding a mapping from the arch code.
      
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Cc: Jens Axboe <axboe@kernel.dk>
      Cc: linux-block@vger.kernel.org
      Cc: Sagi Grimberg <sagi@grimberg.me>
      Cc: Marc Zyngier <marc.zyngier@arm.com>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: linux-nvme@lists.infradead.org
      Cc: Keith Busch <keith.busch@intel.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/20170603140403.27379-5-hch@lst.de
      9a0ef98e
  21. May 22, 2017
  22. Apr 20, 2017
  23. Apr 13, 2017
Loading