1. 17 Sep, 2019 1 commit
  2. 04 Sep, 2019 1 commit
  3. 30 Aug, 2019 7 commits
    • Will Deacon's avatar
      Merge branch 'for-next/atomics' into for-next/core · 61b7cddf
      Will Deacon authored
      * for-next/atomics: (10 commits)
        Rework LSE instruction selection to use static keys instead of alternatives
      61b7cddf
    • Will Deacon's avatar
      Merge branches 'for-next/52-bit-kva', 'for-next/cpu-topology',... · ac12cf85
      Will Deacon authored
      Merge branches 'for-next/52-bit-kva', 'for-next/cpu-topology', 'for-next/error-injection', 'for-next/perf', 'for-next/psci-cpuidle', 'for-next/rng', 'for-next/smpboot', 'for-next/tbi' and 'for-next/tlbi' into for-next/core
      
      * for-next/52-bit-kva: (25 commits)
        Support for 52-bit virtual addressing in kernel space
      
      * for-next/cpu-topology: (9 commits)
        Move CPU topology parsing into core code and add support for ACPI 6.3
      
      * for-next/error-injection: (2 commits)
        Support for function error injection via kprobes
      
      * for-next/perf: (8 commits)
        Support for i.MX8 DDR PMU and proper SMMUv3 group validation
      
      * for-next/psci-cpuidle: (7 commits)
        Move PSCI idle code into a new CPUidle driver
      
      * for-next/rng: (4 commits)
        Support for 'rng-seed' property being passed in the devicetree
      
      * for-next/smpboot: (3 commits)
        Reduce fragility of secondary CPU bringup in debug configurations
      
      * for-next/tbi: (10 commits)
        Introduce new syscall ABI with relaxed requirements for pointer tags
      
      * for-next/tlbi: (6 commits)
        Handle spurious page faults arising from kernel space
      ac12cf85
    • Will Deacon's avatar
      arm64: atomics: Use K constraint when toolchain appears to support it · 03adcbd9
      Will Deacon authored
      The 'K' constraint is a documented AArch64 machine constraint supported
      by GCC for matching integer constants that can be used with a 32-bit
      logical instruction. Unfortunately, some released compilers erroneously
      accept the immediate '4294967295' for this constraint, which is later
      refused by GAS at assembly time. This had led us to avoid the use of
      the 'K' constraint altogether.
      
      Instead, detect whether the compiler is up to the job when building the
      kernel and pass the 'K' constraint to our 32-bit atomic macros when it
      appears to be supported.
      Signed-off-by: default avatarWill Deacon <will@kernel.org>
      03adcbd9
    • Will Deacon's avatar
      arm64: atomics: Undefine internal macros after use · 5aad6cda
      Will Deacon authored
      We use a bunch of internal macros when constructing our atomic and
      cmpxchg routines in order to save on boilerplate. Avoid exposing these
      directly to users of the header files.
      Reviewed-by: default avatarAndrew Murray <andrew.murray@arm.com>
      Signed-off-by: default avatarWill Deacon <will@kernel.org>
      5aad6cda
    • Will Deacon's avatar
      arm64: lse: Make ARM64_LSE_ATOMICS depend on JUMP_LABEL · b32baf91
      Will Deacon authored
      Support for LSE atomic instructions (CONFIG_ARM64_LSE_ATOMICS) relies on
      a static key to select between the legacy LL/SC implementation which is
      available on all arm64 CPUs and the super-duper LSE implementation which
      is available on CPUs implementing v8.1 and later.
      
      Unfortunately, when building a kernel with CONFIG_JUMP_LABEL disabled
      (e.g. because the toolchain doesn't support 'asm goto'), the static key
      inside the atomics code tries to use atomics itself. This results in a
      mess of circular includes and a build failure:
      
      In file included from ./arch/arm64/include/asm/lse.h:11,
                       from ./arch/arm64/include/asm/atomic.h:16,
                       from ./include/linux/atomic.h:7,
                       from ./include/asm-generic/bitops/atomic.h:5,
                       from ./arch/arm64/include/asm/bitops.h:26,
                       from ./include/linux/bitops.h:19,
                       from ./include/linux/kernel.h:12,
                       from ./include/asm-generic/bug.h:18,
                       from ./arch/arm64/include/asm/bug.h:26,
                       from ./include/linux/bug.h:5,
                       from ./include/linux/page-flags.h:10,
                       from kernel/bounds.c:10:
      ./include/linux/jump_label.h: In function ‘static_key_count’:
      ./include/linux/jump_label.h:254:9: error: implicit declaration of function ‘atomic_read’ [-Werror=implicit-function-declaration]
        return atomic_read(&key->enabled);
               ^~~~~~~~~~~
      
      [ ... more of the same ... ]
      
      Since LSE atomic instructions are not critical to the operation of the
      kernel, make them depend on JUMP_LABEL at compile time.
      Reviewed-by: default avatarAndrew Murray <andrew.murray@arm.com>
      Signed-off-by: default avatarWill Deacon <will@kernel.org>
      b32baf91
    • Will Deacon's avatar
      arm64: asm: Kill 'asm/atomic_arch.h' · 0533f97b
      Will Deacon authored
      The contents of 'asm/atomic_arch.h' can be split across some of our
      other 'asm/' headers. Remove it.
      Reviewed-by: default avatarAndrew Murray <andrew.murray@arm.com>
      Signed-off-by: default avatarWill Deacon <will@kernel.org>
      0533f97b
    • Will Deacon's avatar
      arm64: lse: Remove unused 'alt_lse' assembly macro · 0ca98b24
      Will Deacon authored
      The 'alt_lse' assembly macro has been unused since 7c8fc35d
      ("locking/atomics/arm64: Replace our atomic/lock bitop implementations
      with asm-generic").
      
      Remove it.
      Reviewed-by: default avatarAndrew Murray <andrew.murray@arm.com>
      Signed-off-by: default avatarWill Deacon <will@kernel.org>
      0ca98b24
  4. 29 Aug, 2019 5 commits
    • Andrew Murray's avatar
      arm64: atomics: Remove atomic_ll_sc compilation unit · eb3aabbf
      Andrew Murray authored
      We no longer fall back to out-of-line atomics on systems with
      CONFIG_ARM64_LSE_ATOMICS where ARM64_HAS_LSE_ATOMICS is not set.
      
      Remove the unused compilation unit which provided these symbols.
      Signed-off-by: default avatarAndrew Murray <andrew.murray@arm.com>
      Signed-off-by: default avatarWill Deacon <will@kernel.org>
      eb3aabbf
    • Andrew Murray's avatar
      arm64: avoid using hard-coded registers for LSE atomics · 3337cb5a
      Andrew Murray authored
      Now that we have removed the out-of-line ll/sc atomics we can give
      the compiler the freedom to choose its own register allocation.
      
      Remove the hard-coded use of x30.
      Signed-off-by: default avatarAndrew Murray <andrew.murray@arm.com>
      Signed-off-by: default avatarWill Deacon <will@kernel.org>
      3337cb5a
    • Andrew Murray's avatar
      arm64: atomics: avoid out-of-line ll/sc atomics · addfc386
      Andrew Murray authored
      When building for LSE atomics (CONFIG_ARM64_LSE_ATOMICS), if the hardware
      or toolchain doesn't support it the existing code will fallback to ll/sc
      atomics. It achieves this by branching from inline assembly to a function
      that is built with special compile flags. Further this results in the
      clobbering of registers even when the fallback isn't used increasing
      register pressure.
      
      Improve this by providing inline implementations of both LSE and
      ll/sc and use a static key to select between them, which allows for the
      compiler to generate better atomics code. Put the LL/SC fallback atomics
      in their own subsection to improve icache performance.
      Signed-off-by: default avatarAndrew Murray <andrew.murray@arm.com>
      Signed-off-by: default avatarWill Deacon <will@kernel.org>
      addfc386
    • Andrew Murray's avatar
      arm64: Use correct ll/sc atomic constraints · 580fa1b8
      Andrew Murray authored
      The A64 ISA accepts distinct (but overlapping) ranges of immediates for:
      
       * add arithmetic instructions ('I' machine constraint)
       * sub arithmetic instructions ('J' machine constraint)
       * 32-bit logical instructions ('K' machine constraint)
       * 64-bit logical instructions ('L' machine constraint)
      
      ... but we currently use the 'I' constraint for many atomic operations
      using sub or logical instructions, which is not always valid.
      
      When CONFIG_ARM64_LSE_ATOMICS is not set, this allows invalid immediates
      to be passed to instructions, potentially resulting in a build failure.
      When CONFIG_ARM64_LSE_ATOMICS is selected the out-of-line ll/sc atomics
      always use a register as they have no visibility of the value passed by
      the caller.
      
      This patch adds a constraint parameter to the ATOMIC_xx and
      __CMPXCHG_CASE macros so that we can pass appropriate constraints for
      each case, with uses updated accordingly.
      
      Unfortunately prior to GCC 8.1.0 the 'K' constraint erroneously accepted
      '4294967295', so we must instead force the use of a register.
      Signed-off-by: default avatarAndrew Murray <andrew.murray@arm.com>
      Signed-off-by: default avatarWill Deacon <will@kernel.org>
      580fa1b8
    • Andrew Murray's avatar
      jump_label: Don't warn on __exit jump entries · 8f35eaa5
      Andrew Murray authored
      On architectures that discard .exit.* sections at runtime, a
      warning is printed for each jump label that is used within an
      in-kernel __exit annotated function:
      
      can't patch jump_label at ehci_hcd_cleanup+0x8/0x3c
      WARNING: CPU: 0 PID: 1 at kernel/jump_label.c:410 __jump_label_update+0x12c/0x138
      
      As these functions will never get executed (they are free'd along
      with the rest of initmem) - we do not need to patch them and should
      not display any warnings.
      
      The warning is displayed because the test required to satisfy
      jump_entry_is_init is based on init_section_contains (__init_begin to
      __init_end) whereas the test in __jump_label_update is based on
      init_kernel_text (_sinittext to _einittext) via kernel_text_address).
      
      Fixes: 19483677 ("jump_label: Annotate entries that operate on __init code earlier")
      Signed-off-by: default avatarAndrew Murray <andrew.murray@arm.com>
      Acked-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Acked-by: default avatarMark Rutland <mark.rutland@arm.com>
      Signed-off-by: default avatarWill Deacon <will@kernel.org>
      8f35eaa5
  5. 28 Aug, 2019 4 commits
    • Joakim Zhang's avatar
      docs/perf: Add documentation for the i.MX8 DDR PMU · 3724e186
      Joakim Zhang authored
      Add some documentation describing the DDR PMU residing in the Freescale
      i.MDX SoC and its perf driver implementation in Linux.
      Signed-off-by: default avatarJoakim Zhang <qiangqing.zhang@nxp.com>
      Signed-off-by: default avatarWill Deacon <will@kernel.org>
      3724e186
    • Joakim Zhang's avatar
      perf/imx_ddr: Add support for AXI ID filtering · c12c0288
      Joakim Zhang authored
      AXI filtering is used by events 0x41 and 0x42 to count reads or writes
      with an ARID or AWID matching a specified filter. The filter is exposed
      to userspace as an (ID, MASK) pair, where each set bit in the mask
      causes the corresponding bit in the ID to be ignored when matching
      against the ID of memory transactions for the purposes of incrementing
      the counter.
      
      For example:
      
        # perf stat -a -e imx8_ddr0/axid-read,axi_mask=0xff,axi_id=0x800/ cmd
      
      will count all read transactions from AXI IDs 0x800 - 0x8ff. If the
      'axi_mask' is omitted, then it is treated as 0x0 which means that the
      'axi_id' will be matched exactly.
      Signed-off-by: default avatarJoakim Zhang <qiangqing.zhang@nxp.com>
      Signed-off-by: default avatarWill Deacon <will@kernel.org>
      c12c0288
    • Mark Rutland's avatar
      arm64: kpti: ensure patched kernel text is fetched from PoU · f32c7a8e
      Mark Rutland authored
      While the MMUs is disabled, I-cache speculation can result in
      instructions being fetched from the PoC. During boot we may patch
      instructions (e.g. for alternatives and jump labels), and these may be
      dirty at the PoU (and stale at the PoC).
      
      Thus, while the MMU is disabled in the KPTI pagetable fixup code we may
      load stale instructions into the I-cache, potentially leading to
      subsequent crashes when executing regions of code which have been
      modified at runtime.
      
      Similarly to commit:
      
        8ec41987 ("arm64: mm: ensure patched kernel text is fetched from PoU")
      
      ... we can invalidate the I-cache after enabling the MMU to prevent such
      issues.
      
      The KPTI pagetable fixup code itself should be clean to the PoC per the
      boot protocol, so no maintenance is required for this code.
      Signed-off-by: default avatarMark Rutland <mark.rutland@arm.com>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Reviewed-by: default avatarJames Morse <james.morse@arm.com>
      Signed-off-by: default avatarWill Deacon <will@kernel.org>
      f32c7a8e
    • Mark Rutland's avatar
      arm64: fix fixmap copy for 16K pages and 48-bit VA · b333b0ba
      Mark Rutland authored
      With 16K pages and 48-bit VAs, the PGD level of table has two entries,
      and so the fixmap shares a PGD with the kernel image. Since commit:
      
        f9040773 ("arm64: move kernel image to base of vmalloc area")
      
      ... we copy the existing fixmap to the new fine-grained page tables at
      the PUD level in this case. When walking to the new PUD, we forgot to
      offset the PGD entry and always used the PGD entry at index 0, but this
      worked as the kernel image and fixmap were in the low half of the TTBR1
      address space.
      
      As of commit:
      
        14c127c9 ("arm64: mm: Flip kernel VA space")
      
      ... the kernel image and fixmap are in the high half of the TTBR1
      address space, and hence use the PGD at index 1, but we didn't update
      the fixmap copying code to account for this.
      
      Thus, we'll erroneously try to copy the fixmap slots into a PUD under
      the PGD entry at index 0. At the point we do so this PGD entry has not
      been initialised, and thus we'll try to write a value to a small offset
      from physical address 0, causing a number of potential problems.
      
      Fix this be correctly offsetting the PGD. This is split over a few steps
      for legibility.
      
      Fixes: 14c127c9 ("arm64: mm: Flip kernel VA space")
      Reported-by: default avatarAnshuman Khandual <anshuman.khandual@arm.com>
      Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Signed-off-by: default avatarMark Rutland <mark.rutland@arm.com>
      Acked-by: default avatarMarc Zyngier <maz@kernel.org>
      Tested-by: default avatarMarc Zyngier <maz@kernel.org>
      Acked-by: default avatarSteve Capper <Steve.Capper@arm.com>
      Tested-by: default avatarSteve Capper <Steve.Capper@arm.com>
      Tested-by: default avatarAnshuman Khandual <anshuman.khandual@arm.com>
      Signed-off-by: default avatarWill Deacon <will@kernel.org>
      b333b0ba
  6. 27 Aug, 2019 13 commits
    • Robin Murphy's avatar
      perf/smmuv3: Validate groups for global filtering · 3c934735
      Robin Murphy authored
      With global filtering, it becomes possible for users to construct
      self-contradictory groups with conflicting filters. Make sure we
      cover that when initially validating events.
      Signed-off-by: default avatarRobin Murphy <robin.murphy@arm.com>
      Signed-off-by: default avatarWill Deacon <will@kernel.org>
      3c934735
    • Robin Murphy's avatar
      perf/smmuv3: Validate group size · 33e84ea4
      Robin Murphy authored
      Ensure that a group will actually fit into the available counters.
      Signed-off-by: default avatarRobin Murphy <robin.murphy@arm.com>
      Signed-off-by: default avatarWill Deacon <will@kernel.org>
      33e84ea4
    • Vincenzo Frascino's avatar
      arm64: Relax Documentation/arm64/tagged-pointers.rst · 92af2b69
      Vincenzo Frascino authored
      On AArch64 the TCR_EL1.TBI0 bit is set by default, allowing userspace
      (EL0) to perform memory accesses through 64-bit pointers with a non-zero
      top byte. However, such pointers were not allowed at the user-kernel
      syscall ABI boundary.
      
      With the Tagged Address ABI patchset, it is now possible to pass tagged
      pointers to the syscalls. Relax the requirements described in
      tagged-pointers.rst to be compliant with the behaviours guaranteed by
      the AArch64 Tagged Address ABI.
      
      Cc: Will Deacon <will.deacon@arm.com>
      Cc: Szabolcs Nagy <szabolcs.nagy@arm.com>
      Cc: Kevin Brodsky <kevin.brodsky@arm.com>
      Acked-by: default avatarAndrey Konovalov <andreyknvl@google.com>
      Signed-off-by: default avatarVincenzo Frascino <vincenzo.frascino@arm.com>
      Co-developed-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      Signed-off-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      Signed-off-by: default avatarWill Deacon <will@kernel.org>
      92af2b69
    • Will Deacon's avatar
      arm64: kvm: Replace hardcoded '1' with SYS_PAR_EL1_F · 5c062ef4
      Will Deacon authored
      Now that we have a definition for the 'F' field of PAR_EL1, use that
      instead of coding the immediate directly.
      Acked-by: default avatarMarc Zyngier <maz@kernel.org>
      Reviewed-by: default avatarMark Rutland <mark.rutland@arm.com>
      Signed-off-by: default avatarWill Deacon <will@kernel.org>
      5c062ef4
    • Will Deacon's avatar
      arm64: mm: Ignore spurious translation faults taken from the kernel · 42f91093
      Will Deacon authored
      Thanks to address translation being performed out of order with respect to
      loads and stores, it is possible for a CPU to take a translation fault when
      accessing a page that was mapped by a different CPU.
      
      For example, in the case that one CPU maps a page and then sets a flag to
      tell another CPU:
      
      	CPU 0
      	-----
      
      	MOV	X0, <valid pte>
      	STR	X0, [Xptep]	// Store new PTE to page table
      	DSB	ISHST
      	ISB
      	MOV	X1, #1
      	STR	X1, [Xflag]	// Set the flag
      
      	CPU 1
      	-----
      
      loop:	LDAR	X0, [Xflag]	// Poll flag with Acquire semantics
      	CBZ	X0, loop
      	LDR	X1, [X2]	// Translates using the new PTE
      
      then the final load on CPU 1 can raise a translation fault because the
      translation can be performed speculatively before the read of the flag and
      marked as "faulting" by the CPU. This isn't quite as bad as it sounds
      since, in reality, code such as:
      
      	CPU 0				CPU 1
      	-----				-----
      	spin_lock(&lock);		spin_lock(&lock);
      	*ptr = vmalloc(size);		if (*ptr)
      	spin_unlock(&lock);			foo = **ptr;
      					spin_unlock(&lock);
      
      will not trigger the fault because there is an address dependency on CPU 1
      which prevents the speculative translation. However, more exotic code where
      the virtual address is known ahead of time, such as:
      
      	CPU 0				CPU 1
      	-----				-----
      	spin_lock(&lock);		spin_lock(&lock);
      	set_fixmap(0, paddr, prot);	if (mapped)
      	mapped = true;				foo = *fix_to_virt(0);
      	spin_unlock(&lock);		spin_unlock(&lock);
      
      could fault. This can be avoided by any of:
      
      	* Introducing broadcast TLB maintenance on the map path
      	* Adding a DSB;ISB sequence after checking a flag which indicates
      	  that a virtual address is now mapped
      	* Handling the spurious fault
      
      Given that we have never observed a problem due to this under Linux and
      future revisions of the architecture are being tightened so that
      translation table walks are effectively ordered in the same way as explicit
      memory accesses, we no longer treat spurious kernel faults as fatal if an
      AT instruction indicates that the access does not trigger a translation
      fault.
      Reviewed-by: default avatarMark Rutland <mark.rutland@arm.com>
      Signed-off-by: default avatarWill Deacon <will@kernel.org>
      42f91093
    • Will Deacon's avatar
      arm64: sysreg: Add some field definitions for PAR_EL1 · e8620cff
      Will Deacon authored
      PAR_EL1 is a mysterious creature, but sometimes it's necessary to read
      it when translating addresses in situations where we cannot walk the
      page table directly.
      
      Add a couple of system register definitions for the fault indication
      field ('F') and the fault status code ('FST').
      Reviewed-by: default avatarMark Rutland <mark.rutland@arm.com>
      Signed-off-by: default avatarWill Deacon <will@kernel.org>
      e8620cff
    • Will Deacon's avatar
      arm64: mm: Add ISB instruction to set_pgd() · eb6a4dcc
      Will Deacon authored
      Commit 6a4cbd63c25a ("Revert "arm64: Remove unnecessary ISBs from
      set_{pte,pmd,pud}"") reintroduced ISB instructions to some of our
      page table setter functions in light of a recent clarification to the
      Armv8 architecture. Although 'set_pgd()' isn't currently used to update
      a live page table, add the ISB instruction there too for consistency
      with the other macros and to provide some future-proofing if we use it
      on live tables in the future.
      Reported-by: default avatarMark Rutland <mark.rutland@arm.com>
      Reviewed-by: default avatarMark Rutland <mark.rutland@arm.com>
      Signed-off-by: default avatarWill Deacon <will@kernel.org>
      eb6a4dcc
    • Will Deacon's avatar
      arm64: tlb: Ensure we execute an ISB following walk cache invalidation · 51696d34
      Will Deacon authored
      05f2d2f8 ("arm64: tlbflush: Introduce __flush_tlb_kernel_pgtable")
      added a new TLB invalidation helper which is used when freeing
      intermediate levels of page table used for kernel mappings, but is
      missing the required ISB instruction after completion of the TLBI
      instruction.
      
      Add the missing barrier.
      
      Cc: <stable@vger.kernel.org>
      Fixes: 05f2d2f8 ("arm64: tlbflush: Introduce __flush_tlb_kernel_pgtable")
      Reviewed-by: default avatarMark Rutland <mark.rutland@arm.com>
      Signed-off-by: default avatarWill Deacon <will@kernel.org>
      51696d34
    • Will Deacon's avatar
      Revert "arm64: Remove unnecessary ISBs from set_{pte,pmd,pud}" · d0b7a302
      Will Deacon authored
      This reverts commit 24fe1b0e.
      
      Commit 24fe1b0e ("arm64: Remove unnecessary ISBs from
      set_{pte,pmd,pud}") removed ISB instructions immediately following updates
      to the page table, on the grounds that they are not required by the
      architecture and a DSB alone is sufficient to ensure that subsequent data
      accesses use the new translation:
      
        DDI0487E_a, B2-128:
      
        | ... no instruction that appears in program order after the DSB
        | instruction can alter any state of the system or perform any part of
        | its functionality until the DSB completes other than:
        |
        | * Being fetched from memory and decoded
        | * Reading the general-purpose, SIMD and floating-point,
        |   Special-purpose, or System registers that are directly or indirectly
        |   read without causing side-effects.
      
      However, the same document also states the following:
      
        DDI0487E_a, B2-125:
      
        | DMB and DSB instructions affect reads and writes to the memory system
        | generated by Load/Store instructions and data or unified cache
        | maintenance instructions being executed by the PE. Instruction fetches
        | or accesses caused by a hardware translation table access are not
        | explicit accesses.
      
      which appears to claim that the DSB alone is insufficient.  Unfortunately,
      some CPU designers have followed the second clause above, whereas in Linux
      we've been relying on the first. This means that our mapping sequence:
      
      	MOV	X0, <valid pte>
      	STR	X0, [Xptep]	// Store new PTE to page table
      	DSB	ISHST
      	LDR	X1, [X2]	// Translates using the new PTE
      
      can actually raise a translation fault on the load instruction because the
      translation can be performed speculatively before the page table update and
      then marked as "faulting" by the CPU. For user PTEs, this is ok because we
      can handle the spurious fault, but for kernel PTEs and intermediate table
      entries this results in a panic().
      
      Revert the offending commit to reintroduce the missing barriers.
      
      Cc: <stable@vger.kernel.org>
      Fixes: 24fe1b0e ("arm64: Remove unnecessary ISBs from set_{pte,pmd,pud}")
      Reviewed-by: default avatarMark Rutland <mark.rutland@arm.com>
      Signed-off-by: default avatarWill Deacon <will@kernel.org>
      d0b7a302
    • Will Deacon's avatar
      arm64: smp: Treat unknown boot failures as being 'stuck in kernel' · ebef7465
      Will Deacon authored
      When we fail to bring a secondary CPU online and it fails in an unknown
      state, we should assume the worst and increment 'cpus_stuck_in_kernel'
      so that things like kexec() are disabled.
      Reviewed-by: default avatarMark Rutland <mark.rutland@arm.com>
      Signed-off-by: default avatarWill Deacon <will@kernel.org>
      ebef7465
    • Will Deacon's avatar
      arm64: smp: Don't enter kernel with NULL stack pointer or task struct · 5b1cfe3a
      Will Deacon authored
      Although SMP bringup is inherently racy, we can significantly reduce
      the window during which secondary CPUs can unexpectedly enter the
      kernel by sanity checking the 'stack' and 'task' fields of the
      'secondary_data' structure. If the booting CPU gave up waiting for us,
      then they will have been cleared to NULL and we should spin in a WFE; WFI
      loop instead.
      Reviewed-by: default avatarMark Rutland <mark.rutland@arm.com>
      Signed-off-by: default avatarWill Deacon <will@kernel.org>
      5b1cfe3a
    • Will Deacon's avatar
      arm64: smp: Increase secondary CPU boot timeout value · 0e164555
      Will Deacon authored
      When many debug options are enabled simultaneously (e.g. PROVE_LOCKING,
      KMEMLEAK, DEBUG_PAGE_ALLOC, KASAN etc), it is possible for us to timeout
      when attempting to boot a secondary CPU and give up. Unfortunately, the
      CPU will /eventually/ appear, and sit in the background happily stuck
      in a recursive exception due to a NULL stack pointer.
      
      Increase the timeout to 5s, which will of course be enough for anybody.
      Reviewed-by: default avatarMark Rutland <mark.rutland@arm.com>
      Signed-off-by: default avatarWill Deacon <will@kernel.org>
      0e164555
    • Hsin-Yi Wang's avatar
      fdt: Update CRC check for rng-seed · dd753d96
      Hsin-Yi Wang authored
      Commit 428826f5 ("fdt: add support for rng-seed") moves of_fdt_crc32
      from early_init_dt_verify() to early_init_dt_scan() since
      early_init_dt_scan_chosen() may modify fdt to erase rng-seed.
      
      However, arm and some other arch won't call early_init_dt_scan(), they
      call early_init_dt_verify() then early_init_dt_scan_nodes().
      
      Restore of_fdt_crc32 to early_init_dt_verify() then update it in
      early_init_dt_scan_chosen() if fdt if updated.
      
      Fixes: 428826f5 ("fdt: add support for rng-seed")
      Reported-by: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
      Signed-off-by: default avatarHsin-Yi Wang <hsinyi@chromium.org>
      Tested-by: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
      Signed-off-by: default avatarWill Deacon <will@kernel.org>
      dd753d96
  7. 23 Aug, 2019 3 commits
  8. 22 Aug, 2019 2 commits
  9. 21 Aug, 2019 2 commits
    • Masahiro Yamada's avatar
      arm64: add arch/arm64/Kbuild · 6bfa3134
      Masahiro Yamada authored
      Use the standard obj-y form to specify the sub-directories under
      arch/arm64/. No functional change intended.
      Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      Signed-off-by: default avatarWill Deacon <will@kernel.org>
      6bfa3134
    • James Morse's avatar
      arm64: entry: Move ct_user_exit before any other exception · 2671828c
      James Morse authored
      When taking an SError or Debug exception from EL0, we run the C
      handler for these exceptions before updating the context tracking
      code and unmasking lower priority interrupts.
      
      When booting with nohz_full lockdep tells us we got this wrong:
      | =============================
      | WARNING: suspicious RCU usage
      | 5.3.0-rc2-00010-gb4b5e9dcb11b-dirty #11271 Not tainted
      | -----------------------------
      | include/linux/rcupdate.h:643 rcu_read_unlock() used illegally wh!
      |
      | other info that might help us debug this:
      |
      |
      | RCU used illegally from idle CPU!
      | rcu_scheduler_active = 2, debug_locks = 1
      | RCU used illegally from extended quiescent state!
      | 1 lock held by a.out/432:
      |  #0: 00000000c7a79515 (rcu_read_lock){....}, at: brk_handler+0x00
      |
      | stack backtrace:
      | CPU: 1 PID: 432 Comm: a.out Not tainted 5.3.0-rc2-00010-gb4b5e9d1
      | Hardware name: ARM LTD ARM Juno Development Platform/ARM Juno De8
      | Call trace:
      |  dump_backtrace+0x0/0x140
      |  show_stack+0x14/0x20
      |  dump_stack+0xbc/0x104
      |  lockdep_rcu_suspicious+0xf8/0x108
      |  brk_handler+0x164/0x1b0
      |  do_debug_exception+0x11c/0x278
      |  el0_dbg+0x14/0x20
      
      Moving the ct_user_exit calls to be before do_debug_exception() means
      they are also before trace_hardirqs_off() has been updated. Add a new
      ct_user_exit_irqoff macro to avoid the context-tracking code using
      irqsave/restore before we've updated trace_hardirqs_off(). To be
      consistent, do this everywhere.
      
      The C helper is called enter_from_user_mode() to match x86 in the hope
      we can merge them into kernel/context_tracking.c later.
      
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Fixes: 6c81fe79 ("arm64: enable context tracking")
      Signed-off-by: default avatarJames Morse <james.morse@arm.com>
      Signed-off-by: default avatarWill Deacon <will@kernel.org>
      2671828c
  10. 20 Aug, 2019 2 commits