1. 01 9月, 2021 2 次提交
  2. 03 6月, 2021 1 次提交
  3. 13 4月, 2021 1 次提交
    • Z
      KVM: arm64: Support the vCPU preemption check · cf6d95e3
      Zengruan Ye 提交于
      virt inclusion
      category: feature
      bugzilla: 47624
      CVE: NA
      
      --------------------------------
      
      Support the vcpu_is_preempted() functionality under KVM/arm64. This will
      enhance lock performance on overcommitted hosts (more runnable vCPUs
      than physical CPUs in the system) as doing busy waits for preempted
      vCPUs will hurt system performance far worse than early yielding.
      
      unix benchmark result:
        host:  kernel 4.19.87, HiSilicon Kunpeng920, 8 CPUs
        guest: kernel 4.19.87, 16 vCPUs
      
                     test-case                |    after-patch    |   before-patch
      ----------------------------------------+-------------------+------------------
       Dhrystone 2 using register variables   | 338955728.5 lps   | 339266319.5 lps
       Double-Precision Whetstone             |     30634.9 MWIPS |     30884.4 MWIPS
       Execl Throughput                       |      6753.2 lps   |      3580.1 lps
       File Copy 1024 bufsize 2000 maxblocks  |    490048.0 KBps  |    313282.3 KBps
       File Copy 256 bufsize 500 maxblocks    |    129662.5 KBps  |     83550.7 KBps
       File Copy 4096 bufsize 8000 maxblocks  |   1552551.5 KBps  |    814327.0 KBps
       Pipe Throughput                        |   8976422.5 lps   |   9048628.4 lps
       Pipe-based Context Switching           |    258641.7 lps   |    252925.9 lps
       Process Creation                       |      5312.2 lps   |      4507.9 lps
       Shell Scripts (1 concurrent)           |      8704.2 lpm   |      6720.9 lpm
       Shell Scripts (8 concurrent)           |      1708.8 lpm   |       607.2 lpm
       System Call Overhead                   |   3714444.7 lps   |   3746386.8 lps
      ----------------------------------------+-------------------+------------------
       System Benchmarks Index Score          |      2270.6       |      1679.2
      Signed-off-by: NZengruan Ye <yezengruan@huawei.com>
      Reviewed-by: NZhanghailiang <zhang.zhanghailiang@huawei.com>
      Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
      cf6d95e3
  4. 07 10月, 2020 1 次提交
  5. 01 10月, 2020 1 次提交
  6. 18 9月, 2020 1 次提交
    • A
      arm64: paravirt: Initialize steal time when cpu is online · 75df529b
      Andrew Jones 提交于
      Steal time initialization requires mapping a memory region which
      invokes a memory allocation. Doing this at CPU starting time results
      in the following trace when CONFIG_DEBUG_ATOMIC_SLEEP is enabled:
      
      BUG: sleeping function called from invalid context at mm/slab.h:498
      in_atomic(): 1, irqs_disabled(): 128, non_block: 0, pid: 0, name: swapper/1
      CPU: 1 PID: 0 Comm: swapper/1 Not tainted 5.9.0-rc5+ #1
      Call trace:
       dump_backtrace+0x0/0x208
       show_stack+0x1c/0x28
       dump_stack+0xc4/0x11c
       ___might_sleep+0xf8/0x130
       __might_sleep+0x58/0x90
       slab_pre_alloc_hook.constprop.101+0xd0/0x118
       kmem_cache_alloc_node_trace+0x84/0x270
       __get_vm_area_node+0x88/0x210
       get_vm_area_caller+0x38/0x40
       __ioremap_caller+0x70/0xf8
       ioremap_cache+0x78/0xb0
       memremap+0x9c/0x1a8
       init_stolen_time_cpu+0x54/0xf0
       cpuhp_invoke_callback+0xa8/0x720
       notify_cpu_starting+0xc8/0xd8
       secondary_start_kernel+0x114/0x180
      CPU1: Booted secondary processor 0x0000000001 [0x431f0a11]
      
      However we don't need to initialize steal time at CPU starting time.
      We can simply wait until CPU online time, just sacrificing a bit of
      accuracy by returning zero for steal time until we know better.
      
      While at it, add __init to the functions that are only called by
      pv_time_init() which is __init.
      Signed-off-by: NAndrew Jones <drjones@redhat.com>
      Fixes: e0685fa2 ("arm64: Retrieve stolen time as paravirtualized guest")
      Cc: stable@vger.kernel.org
      Reviewed-by: NSteven Price <steven.price@arm.com>
      Link: https://lore.kernel.org/r/20200916154530.40809-1-drjones@redhat.comSigned-off-by: NCatalin Marinas <catalin.marinas@arm.com>
      75df529b
  7. 21 8月, 2020 1 次提交
  8. 16 7月, 2020 1 次提交
  9. 10 6月, 2020 1 次提交
    • A
      irqchip: RISC-V per-HART local interrupt controller driver · 6b7ce892
      Anup Patel 提交于
      The RISC-V per-HART local interrupt controller manages software
      interrupts, timer interrupts, external interrupts (which are routed
      via the platform level interrupt controller) and other per-HART
      local interrupts.
      
      We add a driver for the RISC-V local interrupt controller, which
      eventually replaces the RISC-V architecture code, allowing for a
      better split between arch code and drivers.
      
      The driver is compliant with RISC-V Hart-Level Interrupt Controller
      DT bindings located at:
      Documentation/devicetree/bindings/interrupt-controller/riscv,cpu-intc.txt
      Co-developed-by: NPalmer Dabbelt <palmer@dabbelt.com>
      Signed-off-by: NAnup Patel <anup.patel@wdc.com>
      [Palmer: Cleaned up warnings]
      Signed-off-by: NPalmer Dabbelt <palmer@dabbelt.com>
      6b7ce892
  10. 30 5月, 2020 1 次提交
    • M
      blk-mq: drain I/O when all CPUs in a hctx are offline · bf0beec0
      Ming Lei 提交于
      Most of blk-mq drivers depend on managed IRQ's auto-affinity to setup
      up queue mapping. Thomas mentioned the following point[1]:
      
      "That was the constraint of managed interrupts from the very beginning:
      
       The driver/subsystem has to quiesce the interrupt line and the associated
       queue _before_ it gets shutdown in CPU unplug and not fiddle with it
       until it's restarted by the core when the CPU is plugged in again."
      
      However, current blk-mq implementation doesn't quiesce hw queue before
      the last CPU in the hctx is shutdown.  Even worse, CPUHP_BLK_MQ_DEAD is a
      cpuhp state handled after the CPU is down, so there isn't any chance to
      quiesce the hctx before shutting down the CPU.
      
      Add new CPUHP_AP_BLK_MQ_ONLINE state to stop allocating from blk-mq hctxs
      where the last CPU goes away, and wait for completion of in-flight
      requests.  This guarantees that there is no inflight I/O before shutting
      down the managed IRQ.
      
      Add a BLK_MQ_F_STACKING and set it for dm-rq and loop, so we don't need
      to wait for completion of in-flight requests from these drivers to avoid
      a potential dead-lock. It is safe to do this for stacking drivers as those
      do not use interrupts at all and their I/O completions are triggered by
      underlying devices I/O completion.
      
      [1] https://lore.kernel.org/linux-block/alpine.DEB.2.21.1904051331270.1802@nanos.tec.linutronix.de/
      
      [hch: different retry mechanism, merged two patches, minor cleanups]
      Signed-off-by: NMing Lei <ming.lei@redhat.com>
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      Reviewed-by: NHannes Reinecke <hare@suse.de>
      Reviewed-by: NDaniel Wagner <dwagner@suse.de>
      Signed-off-by: NJens Axboe <axboe@kernel.dk>
      bf0beec0
  11. 19 5月, 2020 1 次提交
  12. 16 3月, 2020 1 次提交
  13. 02 1月, 2020 1 次提交
  14. 11 12月, 2019 1 次提交
    • D
      padata: validate cpumask without removed CPU during offline · 894c9ef9
      Daniel Jordan 提交于
      Configuring an instance's parallel mask without any online CPUs...
      
        echo 2 > /sys/kernel/pcrypt/pencrypt/parallel_cpumask
        echo 0 > /sys/devices/system/cpu/cpu1/online
      
      ...makes tcrypt mode=215 crash like this:
      
        divide error: 0000 [#1] SMP PTI
        CPU: 4 PID: 283 Comm: modprobe Not tainted 5.4.0-rc8-padata-doc-v2+ #2
        Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS ?-20191013_105130-anatol 04/01/2014
        RIP: 0010:padata_do_parallel+0x114/0x300
        Call Trace:
         pcrypt_aead_encrypt+0xc0/0xd0 [pcrypt]
         crypto_aead_encrypt+0x1f/0x30
         do_mult_aead_op+0x4e/0xdf [tcrypt]
         test_mb_aead_speed.constprop.0.cold+0x226/0x564 [tcrypt]
         do_test+0x28c2/0x4d49 [tcrypt]
         tcrypt_mod_init+0x55/0x1000 [tcrypt]
         ...
      
      cpumask_weight() in padata_cpu_hash() returns 0 because the mask has no
      CPUs.  The problem is __padata_remove_cpu() checks for valid masks too
      early and so doesn't mark the instance PADATA_INVALID as expected, which
      would have made padata_do_parallel() return error before doing the
      division.
      
      Fix by introducing a second padata CPU hotplug state before
      CPUHP_BRINGUP_CPU so that __padata_remove_cpu() sees the online mask
      without @cpu.  No need for the second argument to padata_replace() since
      @cpu is now already missing from the online mask.
      
      Fixes: 33e54450 ("padata: Handle empty padata cpumasks")
      Signed-off-by: NDaniel Jordan <daniel.m.jordan@oracle.com>
      Cc: Eric Biggers <ebiggers@kernel.org>
      Cc: Herbert Xu <herbert@gondor.apana.org.au>
      Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
      Cc: Steffen Klassert <steffen.klassert@secunet.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: linux-crypto@vger.kernel.org
      Cc: linux-kernel@vger.kernel.org
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      894c9ef9
  15. 15 11月, 2019 1 次提交
    • M
      x86/hyperv: Initialize clockevents earlier in CPU onlining · 4df4cb9e
      Michael Kelley 提交于
      Hyper-V has historically initialized stimer-based clockevents late in the
      process of onlining a CPU because clockevents depend on stimer
      interrupts. In the original Hyper-V design, stimer interrupts generate a
      VMbus message, so the VMbus machinery must be running first, and VMbus
      can't be initialized until relatively late. On x86/64, LAPIC timer based
      clockevents are used during early initialization before VMbus and
      stimer-based clockevents are ready, and again during CPU offlining after
      the stimer clockevents have been shut down.
      
      Unfortunately, this design creates problems when offlining CPUs for
      hibernation or other purposes. stimer-based clockevents are shut down
      relatively early in the offlining process, so clockevents_unbind_device()
      must be used to fallback to the LAPIC-based clockevents for the remainder
      of the offlining process.  Furthermore, the late initialization and early
      shutdown of stimer-based clockevents doesn't work well on ARM64 since there
      is no other timer like the LAPIC to fallback to. So CPU onlining and
      offlining doesn't work properly.
      
      Fix this by recognizing that stimer Direct Mode is the normal path for
      newer versions of Hyper-V on x86/64, and the only path on other
      architectures. With stimer Direct Mode, stimer interrupts don't require any
      VMbus machinery. stimer clockevents can be initialized and shut down
      consistent with how it is done for other clockevent devices. While the old
      VMbus-based stimer interrupts must still be supported for backward
      compatibility on x86, that mode of operation can be treated as legacy.
      
      So add a new Hyper-V stimer entry in the CPU hotplug state list, and use
      that new state when in Direct Mode. Update the Hyper-V clocksource driver
      to allocate and initialize stimer clockevents earlier during boot. Update
      Hyper-V initialization and the VMbus driver to use this new design. As a
      result, the LAPIC timer is no longer used during boot or CPU
      onlining/offlining and clockevents_unbind_device() is not called.  But
      retain the old design as a legacy implementation for older versions of
      Hyper-V that don't support Direct Mode.
      Signed-off-by: NMichael Kelley <mikelley@microsoft.com>
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Tested-by: NDexuan Cui <decui@microsoft.com>
      Reviewed-by: NDexuan Cui <decui@microsoft.com>
      Link: https://lkml.kernel.org/r/1573607467-9456-1-git-send-email-mikelley@microsoft.com
      4df4cb9e
  16. 22 10月, 2019 1 次提交
    • S
      arm64: Retrieve stolen time as paravirtualized guest · e0685fa2
      Steven Price 提交于
      Enable paravirtualization features when running under a hypervisor
      supporting the PV_TIME_ST hypercall.
      
      For each (v)CPU, we ask the hypervisor for the location of a shared
      page which the hypervisor will use to report stolen time to us. We set
      pv_time_ops to the stolen time function which simply reads the stolen
      value from the shared page for a VCPU. We guarantee single-copy
      atomicity using READ_ONCE which means we can also read the stolen
      time for another VCPU than the currently running one while it is
      potentially being updated by the hypervisor.
      Signed-off-by: NSteven Price <steven.price@arm.com>
      Signed-off-by: NMarc Zyngier <maz@kernel.org>
      e0685fa2
  17. 04 7月, 2019 1 次提交
    • J
      drivers: base: cacheinfo: Ensure cpu hotplug work is done before Intel RDT · 83b44fe3
      James Morse 提交于
      The cacheinfo structures are alloced/freed by cpu online/offline
      callbacks. Originally these were only used by sysfs to expose the
      cache topology to user space. Without any in-kernel dependencies
      CPUHP_AP_ONLINE_DYN was an appropriate choice.
      
      resctrl has started using these structures to identify CPUs that
      share a cache. It updates its 'domain' structures from cpu
      online/offline callbacks. These depend on the cacheinfo structures
      (resctrl_online_cpu()->domain_add_cpu()->get_cache_id()->
       get_cpu_cacheinfo()).
      These also run as CPUHP_AP_ONLINE_DYN.
      
      Now that there is an in-kernel dependency, move the cacheinfo
      work earlier so we know its done before resctrl's CPUHP_AP_ONLINE_DYN
      work runs.
      
      Fixes: 2264d9c7 ("x86/intel_rdt: Build structures for each resource based on cache topology")
      Cc: <stable@vger.kernel.org>
      Cc: Fenghua Yu <fenghua.yu@intel.com>
      Cc: Reinette Chatre <reinette.chatre@intel.com>
      Signed-off-by: NJames Morse <james.morse@arm.com>
      Link: https://lore.kernel.org/r/20190624173656.202407-1-james.morse@arm.comSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      83b44fe3
  18. 26 6月, 2019 1 次提交
    • M
      clocksource/drivers/exynos_mct: Increase priority over ARM arch timer · 6282edb7
      Marek Szyprowski 提交于
      Exynos SoCs based on CA7/CA15 have 2 timer interfaces: custom Exynos MCT
      (Multi Core Timer) and standard ARM Architected Timers.
      
      There are use cases, where both timer interfaces are used simultanously.
      One of such examples is using Exynos MCT for the main system timer and
      ARM Architected Timers for the KVM and virtualized guests (KVM requires
      arch timers).
      
      Exynos Multi-Core Timer driver (exynos_mct) must be however started
      before ARM Architected Timers (arch_timer), because they both share some
      common hardware blocks (global system counter) and turning on MCT is
      needed to get ARM Architected Timer working properly.
      
      To ensure selecting Exynos MCT as the main system timer, increase MCT
      timer rating. To ensure proper starting order of both timers during
      suspend/resume cycle, increase MCT hotplug priority over ARM Archictected
      Timers.
      Signed-off-by: NMarek Szyprowski <m.szyprowski@samsung.com>
      Reviewed-by: NKrzysztof Kozlowski <krzk@kernel.org>
      Reviewed-by: NChanwoo Choi <cw00.choi@samsung.com>
      Signed-off-by: NDaniel Lezcano <daniel.lezcano@linaro.org>
      6282edb7
  19. 15 6月, 2019 1 次提交
    • B
      x86/microcode, cpuhotplug: Add a microcode loader CPU hotplug callback · 78f4e932
      Borislav Petkov 提交于
      Adric Blake reported the following warning during suspend-resume:
      
        Enabling non-boot CPUs ...
        x86: Booting SMP configuration:
        smpboot: Booting Node 0 Processor 1 APIC 0x2
        unchecked MSR access error: WRMSR to 0x10f (tried to write 0x0000000000000000) \
         at rIP: 0xffffffff8d267924 (native_write_msr+0x4/0x20)
        Call Trace:
         intel_set_tfa
         intel_pmu_cpu_starting
         ? x86_pmu_dead_cpu
         x86_pmu_starting_cpu
         cpuhp_invoke_callback
         ? _raw_spin_lock_irqsave
         notify_cpu_starting
         start_secondary
         secondary_startup_64
        microcode: sig=0x806ea, pf=0x80, revision=0x96
        microcode: updated to revision 0xb4, date = 2019-04-01
        CPU1 is up
      
      The MSR in question is MSR_TFA_RTM_FORCE_ABORT and that MSR is emulated
      by microcode. The log above shows that the microcode loader callback
      happens after the PMU restoration, leading to the conjecture that
      because the microcode hasn't been updated yet, that MSR is not present
      yet, leading to the #GP.
      
      Add a microcode loader-specific hotplug vector which comes before
      the PERF vectors and thus executes earlier and makes sure the MSR is
      present.
      
      Fixes: 400816f6 ("perf/x86/intel: Implement support for TSX Force Abort")
      Reported-by: NAdric Blake <promarbler14@gmail.com>
      Signed-off-by: NBorislav Petkov <bp@suse.de>
      Reviewed-by: NThomas Gleixner <tglx@linutronix.de>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: <stable@vger.kernel.org>
      Cc: x86@kernel.org
      Link: https://bugzilla.kernel.org/show_bug.cgi?id=203637
      78f4e932
  20. 03 5月, 2019 1 次提交
  21. 08 4月, 2019 1 次提交
    • R
      PM / arch: x86: Rework the MSR_IA32_ENERGY_PERF_BIAS handling · 5861381d
      Rafael J. Wysocki 提交于
      The current handling of MSR_IA32_ENERGY_PERF_BIAS in the kernel is
      problematic, because it may cause changes made by user space to that
      MSR (with the help of the x86_energy_perf_policy tool, for example)
      to be lost every time a CPU goes offline and then back online as well
      as during system-wide power management transitions into sleep states
      and back into the working state.
      
      The first problem is that if the current EPB value for a CPU going
      online is 0 ('performance'), the kernel will change it to 6 ('normal')
      regardless of whether or not this is the first bring-up of that CPU.
      That also happens during system-wide resume from sleep states
      (including, but not limited to, hibernation).  However, the EPB may
      have been adjusted by user space this way and the kernel should not
      blindly override that setting.
      
      The second problem is that if the platform firmware resets the EPB
      values for any CPUs during system-wide resume from a sleep state,
      the kernel will not restore their previous EPB values that may
      have been set by user space before the preceding system-wide
      suspend transition.  Again, that behavior may at least be confusing
      from the user space perspective.
      
      In order to address these issues, rework the handling of
      MSR_IA32_ENERGY_PERF_BIAS so that the EPB value is saved on CPU
      offline and restored on CPU online as well as (for the boot CPU)
      during the syscore stages of system-wide suspend and resume
      transitions, respectively.
      
      However, retain the policy by which the EPB is set to 6 ('normal')
      on the first bring-up of each CPU if its initial value is 0, based
      on the observation that 0 may mean 'not initialized' just as well as
      'performance' in that case.
      
      While at it, move the MSR_IA32_ENERGY_PERF_BIAS handling code into
      a separate file and document it in Documentation/admin-guide.
      
      Fixes: abe48b10 (x86, intel, power: Initialize MSR_IA32_ENERGY_PERF_BIAS)
      Fixes: b51ef52d (x86/cpu: Restore MSR_IA32_ENERGY_PERF_BIAS after resume)
      Reported-by: NThomas Renninger <trenn@suse.de>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Reviewed-by: NHannes Reinecke <hare@suse.com>
      Acked-by: NBorislav Petkov <bp@suse.de>
      Acked-by: NThomas Gleixner <tglx@linutronix.de>
      5861381d
  22. 23 2月, 2019 1 次提交
  23. 06 12月, 2018 1 次提交
  24. 22 11月, 2018 1 次提交
    • H
      drivers/perf: xgene: Add CPU hotplug support · cbb72a3c
      Hoan Tran 提交于
      If the CPU assigned to the xgene PMU is taken offline, then subsequent
      perf invocations on the PMU will fail:
      
        # echo 0 > /sys/devices/system/cpu/cpu0/online
        # perf stat -a -e l3c0/cycle-count/,l3c0/write/ sleep 1
          Error:
          The sys_perf_event_open() syscall returned with 19 (No such device) for event (l3c0/cycle-count/).
          /bin/dmesg may provide additional information.
          No CONFIG_PERF_EVENTS=y kernel support configured?
      
      This patch implements a hotplug notifier in the xgene PMU driver so that
      the PMU context is migrated to another online CPU should its assigned
      CPU disappear.
      Acked-by: NMark Rutland <mark.rutland@arm.com>
      Signed-off-by: NHoan Tran <hoan.tran@amperecomputing.com>
      [will: Made naming of new cpuhp_state enum entry consistent]
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      cbb72a3c
  25. 03 11月, 2018 1 次提交
  26. 13 8月, 2018 1 次提交
  27. 03 7月, 2018 1 次提交
  28. 27 6月, 2018 1 次提交
  29. 16 3月, 2018 1 次提交
    • A
      arch: remove blackfin port · 4ba66a97
      Arnd Bergmann 提交于
      The Analog Devices Blackfin port was added in 2007 and was rather
      active for a while, but all work on it has come to a standstill
      over time, as Analog have changed their product line-up.
      
      Aaron Wu confirmed that the architecture port is no longer relevant,
      and multiple people suggested removing blackfin independently because
      of some of its oddities like a non-working SMP port, and the amount of
      duplication between the chip variants, which cause extra work when
      doing cross-architecture changes.
      
      Link: https://docs.blackfin.uclinux.org/Acked-by: NAaron Wu <Aaron.Wu@analog.com>
      Acked-by: NBryan Wu <cooloney@gmail.com>
      Cc: Steven Miao <realmz6@gmail.com>
      Cc: Mike Frysinger <vapier@chromium.org>
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      4ba66a97
  30. 23 2月, 2018 2 次提交
  31. 13 1月, 2018 1 次提交
    • J
      firmware: arm_sdei: Add support for CPU and system power states · da351827
      James Morse 提交于
      When a CPU enters an idle lower-power state or is powering off, we
      need to mask SDE events so that no events can be delivered while we
      are messing with the MMU as the registered entry points won't be valid.
      
      If the system reboots, we want to unregister all events and mask the CPUs.
      For kexec this allows us to hand a clean slate to the next kernel
      instead of relying on it to call sdei_{private,system}_data_reset().
      
      For hibernate we unregister all events and re-register them on restore,
      in case we restored with the SDE code loaded at a different address.
      (e.g. KASLR).
      
      Add all the notifiers necessary to do this. We only support shared events
      so all events are left registered and enabled over CPU hotplug.
      Reviewed-by: NLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
      Signed-off-by: NJames Morse <james.morse@arm.com>
      [catalin.marinas@arm.com: added CPU_PM_ENTER_FAILED case]
      Signed-off-by: NCatalin Marinas <catalin.marinas@arm.com>
      da351827
  32. 30 12月, 2017 1 次提交
  33. 18 12月, 2017 1 次提交
  34. 02 11月, 2017 2 次提交
    • P
      irqchip: mips-gic: Use irq_cpu_online to (un)mask all-VP(E) IRQs · da61fcf9
      Paul Burton 提交于
      The gic_all_vpes_local_irq_controller chip currently attempts to operate
      on all CPUs/VPs in the system when masking or unmasking an interrupt.
      This has a few drawbacks:
      
       - In multi-cluster systems we may not always have access to all CPUs in
         the system. When all CPUs in a cluster are powered down that
         cluster's GIC may also power down, in which case we cannot configure
         its state.
      
       - Relatedly, if we power down a cluster after having configured
         interrupts for CPUs within it then the cluster's GIC may lose state &
         we need to reconfigure it. The current approach doesn't take this
         into account.
      
       - It's wasteful if we run Linux on fewer VPs than are present in the
         system. For example if we run a uniprocessor kernel on CPU0 of a
         system with 16 CPUs then there's no point in us configuring CPUs
         1-15.
      
       - The implementation is also lacking in that it expects the range
         0..gic_vpes-1 to represent valid Linux CPU numbers which may not
         always be the case - for example if we run on a system with more VPs
         than the kernel is configured to support.
      
      Fix all of these issues by only configuring the affected interrupts for
      CPUs which are online at the time, and recording the configuration in a
      new struct gic_all_vpes_chip_data for later use by CPUs being brought
      online. We register a CPU hotplug state (reusing
      CPUHP_AP_IRQ_GIC_STARTING which the ARM GIC driver uses, and which seems
      suitably generic for reuse with the MIPS GIC) and execute
      irq_cpu_online() in order to configure the interrupts on the newly
      onlined CPU.
      Signed-off-by: NPaul Burton <paul.burton@mips.com>
      Cc: Jason Cooper <jason@lakedaemon.net>
      Cc: Marc Zyngier <marc.zyngier@arm.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: linux-mips@linux-mips.org
      Signed-off-by: NMarc Zyngier <marc.zyngier@arm.com>
      da61fcf9
    • G
      License cleanup: add SPDX GPL-2.0 license identifier to files with no license · b2441318
      Greg Kroah-Hartman 提交于
      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: NKate Stewart <kstewart@linuxfoundation.org>
      Reviewed-by: NPhilippe Ombredanne <pombredanne@nexb.com>
      Reviewed-by: NThomas Gleixner <tglx@linutronix.de>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b2441318
  35. 20 10月, 2017 3 次提交