1. 16 11月, 2017 16 次提交
  2. 15 11月, 2017 1 次提交
    • M
      powerpc/64s: Fix Power9 DD2.0 workarounds by adding DD2.1 feature · 3ffa9d9e
      Michael Ellerman 提交于
      Recently we added a CPU feature for Power9 DD2.0, to capture the fact
      that some workarounds are required only on Power9 DD1 and DD2.0 but
      not DD2.1 or later.
      
      Then in commit 9d2f510a ("powerpc/64s/idle: avoid POWER9 DD1 and
      DD2.0 ERAT workaround on DD2.1") and commit e3646330
      "powerpc/64s/idle: avoid POWER9 DD1 and DD2.0 PMU workaround on
      DD2.1") we changed CPU_FTR_SECTIONs to check for DD1 or DD20, eg:
      
        BEGIN_FTR_SECTION
                PPC_INVALIDATE_ERAT
        END_FTR_SECTION_IFSET(CPU_FTR_POWER9_DD1 | CPU_FTR_POWER9_DD20)
      
      Unfortunately although this reads as "if set DD1 or DD2.0", the or is
      a bitwise or and actually generates a mask of both bits. The code that
      does the feature patching then checks that the value of the CPU
      features masked with that mask are equal to the mask.
      
      So the end result is we're checking for DD1 and DD20 being set, which
      never happens. Yes the API is terrible.
      
      Removing the ERAT workaround on DD2.0 results in random SEGVs, the
      system tends to boot, but things randomly die including sometimes
      dhclient, udev etc.
      
      To fix the problem and hopefully avoid it in future, we remove the
      DD2.0 CPU feature and instead add a DD2.1 (or later) feature. This
      allows us to easily express that the workarounds are required if DD2.1
      is not set.
      
      At some point we will drop the DD1 workarounds entirely and some of
      this can be cleaned up.
      
      Fixes: 9d2f510a ("powerpc/64s/idle: avoid POWER9 DD1 and DD2.0 ERAT workaround on DD2.1")
      Fixes: e3646330 ("powerpc/64s/idle: avoid POWER9 DD1 and DD2.0 PMU workaround on DD2.1")
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      3ffa9d9e
  3. 14 11月, 2017 7 次提交
    • M
      powerpc/64s: Fix masking of SRR1 bits on instruction fault · 475b581f
      Michael Ellerman 提交于
      On 64-bit Book3s, when we take an instruction fault the reason for the
      fault may be reported in SRR1. For data faults the reason is reported
      in DSISR (Data Storage Instruction Status Register).
      
      The reasons reported in each do not necessarily correspond, so we mask
      the SRR1 bits before copying them to the DSISR, which is then used by
      the page fault code.
      
      Prior to commit b4c001dc ("powerpc/mm: Use symbolic constants for
      filtering SRR1 bits on ISIs") we used a hard-coded mask of 0x58200000,
      which corresponds to:
      
        DSISR_NOHPTE		0x40000000 /* no translation found */
        DSISR_NOEXEC_OR_G	0x10000000 /* exec of no-exec or guarded */
        DSISR_PROTFAULT	0x08000000 /* protection fault */
        DSISR_KEYFAULT	0x00200000 /* Storage Key fault */
      
      That commit added a #define for the mask, DSISR_SRR1_MATCH_64S, but
      incorrectly used a different similarly named DSISR_BAD_FAULT_64S.
      
      This had the effect of changing the mask to 0xa43a0000, which omits
      everything but DSISR_KEYFAULT.
      
      Luckily this had no visible effect, because in practice we hardly use
      the DSISR bits. The lack of DSISR_NOHPTE means a TLB flush
      optimisation was missed in the native HPTE code, and DSISR_NOEXEC_OR_G
      and DSISR_PROTFAULT are both only used to trigger rare warnings.
      
      So we got lucky, but let's fix it. The new value only has bits between
      17 and 30 set, so we can continue to use andis.
      
      Fixes: b4c001dc ("powerpc/mm: Use symbolic constants for filtering SRR1 bits on ISIs")
      Cc: stable@vger.kernel.org # v4.14+
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      475b581f
    • R
      x86 / CPU: Avoid unnecessary IPIs in arch_freq_get_on_cpu() · b29c6ef7
      Rafael J. Wysocki 提交于
      Even though aperfmperf_snapshot_khz() caches the samples.khz value to
      return if called again in a sufficiently short time, its caller,
      arch_freq_get_on_cpu(), still uses smp_call_function_single() to run it
      which may allow user space to trigger an IPI storm by reading from the
      scaling_cur_freq cpufreq sysfs file in a tight loop.
      
      To avoid that, move the decision on whether or not to return the cached
      samples.khz value to arch_freq_get_on_cpu().
      
      This change was part of commit 941f5f0f ("x86: CPU: Fix up "cpu MHz"
      in /proc/cpuinfo"), but it was not the reason for the revert and it
      remains applicable.
      
      Fixes: 4815d3c5 (cpufreq: x86: Make scaling_cur_freq behave more as expected)
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Reviewed-by: NWANG Chao <chao.wang@ucloud.cn>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      b29c6ef7
    • D
      MIPS: Add iomem resource for kernel bss section. · e0c5f36b
      David Daney 提交于
      The kexec/kdump tools need to know where the .bss is so it can be
      included in the core dump.  This allows vmcore-dmesg to have access to
      the dmesg buffers of the crashed kernel as well as allowing the
      debugger to examine variables in the bss section.
      
      Add a request for the bss resource in addition to the already
      requested code and data sections.
      Signed-off-by: NDavid Daney <david.daney@cavium.com>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: Steven J. Hill <steven.hill@cavium.com>,
      Cc: linux-mips@linux-mips.org
      Patchwork: https://patchwork.linux-mips.org/patch/17485/Signed-off-by: NJames Hogan <jhogan@kernel.org>
      e0c5f36b
    • B
      MIPS: cmpxchg64() and HAVE_VIRT_CPU_ACCOUNTING_GEN don't work for 32-bit SMP · a3f14310
      Ben Hutchings 提交于
      __cmpxchg64_local_generic() is atomic only w.r.t tasks and interrupts
      on the same CPU (that's what the 'local' means).  We can't use it to
      implement cmpxchg64() in SMP configurations.
      
      So, for 32-bit SMP configurations:
      
      - Don't define cmpxchg64()
      - Don't enable HAVE_VIRT_CPU_ACCOUNTING_GEN, which requires it
      
      Fixes: e2093c7b ("MIPS: Fall back to generic implementation of ...")
      Fixes: bb877e96 ("MIPS: Add support for full dynticks CPU time accounting")
      Signed-off-by: NBen Hutchings <ben@decadent.org.uk>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: Deng-Cheng Zhu <dengcheng.zhu@mips.com>
      Cc: linux-mips@linux-mips.org
      Cc: <stable@vger.kernel.org> # 4.1+
      Patchwork: https://patchwork.linux-mips.org/patch/17413/Signed-off-by: NJames Hogan <jhogan@kernel.org>
      a3f14310
    • J
      MIPS: BMIPS: Enable HARDIRQS_SW_RESEND · 4dc4704c
      Justin Chen 提交于
      HW interrupts triggered when irq_disable() were being ignored. Enable
      resending HW interrupts as SW interrupts.
      
      This was causing an issue where the interrupts waking the system up from
      a suspend state were not calling their interrupt handlers.
      Signed-off-by: NJustin Chen <justinpopo6@gmail.com>
      Acked-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Cc: linux-mips@linux-mips.org
      Patchwork: https://patchwork.linux-mips.org/patch/16116/Signed-off-by: NJames Hogan <jhogan@kernel.org>
      4dc4704c
    • D
      arm64: Make ARMV8_DEPRECATED depend on SYSCTL · 6cfa7cc4
      Dave Martin 提交于
      If CONFIG_SYSCTL=n and CONFIG_ARMV8_DEPRECATED=y, the deprecated
      instruction emulation code currently leaks some memory at boot
      time, and won't have any runtime control interface.  This does
      not feel like useful or intended behaviour...
      
      This patch adds a dependency on CONFIG_SYSCTL, so that such a
      kernel can't be built in the first place.
      
      It's probably not worth adding the error-handling / cleanup code
      that would be needed to deal with this otherwise: people who
      desperately need the emulation can still enable SYSCTL.
      Acked-by: NArnd Bergmann <arnd@arndb.de>
      Signed-off-by: NDave Martin <Dave.Martin@arm.com>
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      6cfa7cc4
    • J
      arm64: Implement __lshrti3 library function · 9bfe7553
      Jason A. Donenfeld 提交于
      Commit fb872273 ("arm64: support __int128 on gcc 5+") added support
      for the __int128 data type, but this breaks the build in some configurations
      where GCC ends up emitting calls to the __lshrti3 helper in libgcc, which
      results in a link error:
      
        kernel/sched/fair.o: In function `__calc_delta':
        fair.c:(.text+0xca0): undefined reference to `__lshrti3'
        kernel/time/timekeeping.o: In function `timekeeping_resume':
        timekeeping.c:(.text+0x3f60): undefined reference to `__lshrti3'
        make: *** [vmlinux] Error 1
      
      Fix the build by providing an implementation of __lshrti3, like we do
      already for __ashlti3 and __ashrti3.
      Reported-by: NArnd Bergmann <arnd@arndb.de>
      Signed-off-by: NJason A. Donenfeld <Jason@zx2c4.com>
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      9bfe7553
  4. 13 11月, 2017 16 次提交