1. 24 8月, 2018 6 次提交
  2. 23 8月, 2018 8 次提交
    • P
      x86/mm/tlb: Revert the recent lazy TLB patches · 52a288c7
      Peter Zijlstra 提交于
      Revert commits:
      
        95b0e635 x86/mm/tlb: Always use lazy TLB mode
        64482aaf x86/mm/tlb: Only send page table free TLB flush to lazy TLB CPUs
        ac031589 x86/mm/tlb: Make lazy TLB mode lazier
        61d0beb5 x86/mm/tlb: Restructure switch_mm_irqs_off()
        2ff6ddf1 x86/mm/tlb: Leave lazy TLB mode at page table free time
      
      In order to simplify the TLB invalidate fixes for x86 and unify the
      parts that need backporting.  We'll try again later.
      Signed-off-by: NPeter Zijlstra (Intel) <peterz@infradead.org>
      Acked-by: NRik van Riel <riel@surriel.com>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      52a288c7
    • N
      include/linux/compiler*.h: make compiler-*.h mutually exclusive · 815f0ddb
      Nick Desaulniers 提交于
      Commit cafa0010 ("Raise the minimum required gcc version to 4.6")
      recently exposed a brittle part of the build for supporting non-gcc
      compilers.
      
      Both Clang and ICC define __GNUC__, __GNUC_MINOR__, and
      __GNUC_PATCHLEVEL__ for quick compatibility with code bases that haven't
      added compiler specific checks for __clang__ or __INTEL_COMPILER.
      
      This is brittle, as they happened to get compatibility by posing as a
      certain version of GCC.  This broke when upgrading the minimal version
      of GCC required to build the kernel, to a version above what ICC and
      Clang claim to be.
      
      Rather than always including compiler-gcc.h then undefining or
      redefining macros in compiler-intel.h or compiler-clang.h, let's
      separate out the compiler specific macro definitions into mutually
      exclusive headers, do more proper compiler detection, and keep shared
      definitions in compiler_types.h.
      
      Fixes: cafa0010 ("Raise the minimum required gcc version to 4.6")
      Reported-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      Suggested-by: NEli Friedman <efriedma@codeaurora.org>
      Suggested-by: NJoe Perches <joe@perches.com>
      Signed-off-by: NNick Desaulniers <ndesaulniers@google.com>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      815f0ddb
    • T
      ia64: Fix allnoconfig section mismatch for ioc_init/ioc_iommu_info · 2edd73a4
      Tony Luck 提交于
      This has been broken for an embarassingly long time (since v4.4).
      
      Just needs a couple of __init tags on functions to make the sections
      match up.
      Signed-off-by: NTony Luck <tony.luck@intel.com>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      2edd73a4
    • A
      module: use relative references for __ksymtab entries · 7290d580
      Ard Biesheuvel 提交于
      An ordinary arm64 defconfig build has ~64 KB worth of __ksymtab entries,
      each consisting of two 64-bit fields containing absolute references, to
      the symbol itself and to a char array containing its name, respectively.
      
      When we build the same configuration with KASLR enabled, we end up with an
      additional ~192 KB of relocations in the .init section, i.e., one 24 byte
      entry for each absolute reference, which all need to be processed at boot
      time.
      
      Given how the struct kernel_symbol that describes each entry is completely
      local to module.c (except for the references emitted by EXPORT_SYMBOL()
      itself), we can easily modify it to contain two 32-bit relative references
      instead.  This reduces the size of the __ksymtab section by 50% for all
      64-bit architectures, and gets rid of the runtime relocations entirely for
      architectures implementing KASLR, either via standard PIE linking (arm64)
      or using custom host tools (x86).
      
      Note that the binary search involving __ksymtab contents relies on each
      section being sorted by symbol name.  This is implemented based on the
      input section names, not the names in the ksymtab entries, so this patch
      does not interfere with that.
      
      Given that the use of place-relative relocations requires support both in
      the toolchain and in the module loader, we cannot enable this feature for
      all architectures.  So make it dependent on whether
      CONFIG_HAVE_ARCH_PREL32_RELOCATIONS is defined.
      
      Link: http://lkml.kernel.org/r/20180704083651.24360-4-ard.biesheuvel@linaro.orgSigned-off-by: NArd Biesheuvel <ard.biesheuvel@linaro.org>
      Acked-by: NJessica Yu <jeyu@kernel.org>
      Acked-by: NMichael Ellerman <mpe@ellerman.id.au>
      Reviewed-by: NWill Deacon <will.deacon@arm.com>
      Acked-by: NIngo Molnar <mingo@kernel.org>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Bjorn Helgaas <bhelgaas@google.com>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: James Morris <james.morris@microsoft.com>
      Cc: James Morris <jmorris@namei.org>
      Cc: Josh Poimboeuf <jpoimboe@redhat.com>
      Cc: Kees Cook <keescook@chromium.org>
      Cc: Nicolas Pitre <nico@linaro.org>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Petr Mladek <pmladek@suse.com>
      Cc: Russell King <linux@armlinux.org.uk>
      Cc: "Serge E. Hallyn" <serge@hallyn.com>
      Cc: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Thomas Garnier <thgarnie@google.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      7290d580
    • A
      module: allow symbol exports to be disabled · f922c4ab
      Ard Biesheuvel 提交于
      To allow existing C code to be incorporated into the decompressor or the
      UEFI stub, introduce a CPP macro that turns all EXPORT_SYMBOL_xxx
      declarations into nops, and #define it in places where such exports are
      undesirable.  Note that this gets rid of a rather dodgy redefine of
      linux/export.h's header guard.
      
      Link: http://lkml.kernel.org/r/20180704083651.24360-3-ard.biesheuvel@linaro.orgSigned-off-by: NArd Biesheuvel <ard.biesheuvel@linaro.org>
      Acked-by: NNicolas Pitre <nico@linaro.org>
      Acked-by: NMichael Ellerman <mpe@ellerman.id.au>
      Reviewed-by: NWill Deacon <will.deacon@arm.com>
      Acked-by: NIngo Molnar <mingo@kernel.org>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Bjorn Helgaas <bhelgaas@google.com>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: James Morris <james.morris@microsoft.com>
      Cc: James Morris <jmorris@namei.org>
      Cc: Jessica Yu <jeyu@kernel.org>
      Cc: Josh Poimboeuf <jpoimboe@redhat.com>
      Cc: Kees Cook <keescook@chromium.org>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Petr Mladek <pmladek@suse.com>
      Cc: Russell King <linux@armlinux.org.uk>
      Cc: "Serge E. Hallyn" <serge@hallyn.com>
      Cc: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Thomas Garnier <thgarnie@google.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      f922c4ab
    • A
      arch: enable relative relocations for arm64, power and x86 · 271ca788
      Ard Biesheuvel 提交于
      Patch series "add support for relative references in special sections", v10.
      
      This adds support for emitting special sections such as initcall arrays,
      PCI fixups and tracepoints as relative references rather than absolute
      references.  This reduces the size by 50% on 64-bit architectures, but
      more importantly, it removes the need for carrying relocation metadata for
      these sections in relocatable kernels (e.g., for KASLR) that needs to be
      fixed up at boot time.  On arm64, this reduces the vmlinux footprint of
      such a reference by 8x (8 byte absolute reference + 24 byte RELA entry vs
      4 byte relative reference)
      
      Patch #3 was sent out before as a single patch.  This series supersedes
      the previous submission.  This version makes relative ksymtab entries
      dependent on the new Kconfig symbol HAVE_ARCH_PREL32_RELOCATIONS rather
      than trying to infer from kbuild test robot replies for which
      architectures it should be blacklisted.
      
      Patch #1 introduces the new Kconfig symbol HAVE_ARCH_PREL32_RELOCATIONS,
      and sets it for the main architectures that are expected to benefit the
      most from this feature, i.e., 64-bit architectures or ones that use
      runtime relocations.
      
      Patch #2 add support for #define'ing __DISABLE_EXPORTS to get rid of
      ksymtab/kcrctab sections in decompressor and EFI stub objects when
      rebuilding existing C files to run in a different context.
      
      Patches #4 - #6 implement relative references for initcalls, PCI fixups
      and tracepoints, respectively, all of which produce sections with order
      ~1000 entries on an arm64 defconfig kernel with tracing enabled.  This
      means we save about 28 KB of vmlinux space for each of these patches.
      
      [From the v7 series blurb, which included the jump_label patches as well]:
      
        For the arm64 kernel, all patches combined reduce the memory footprint
        of vmlinux by about 1.3 MB (using a config copied from Ubuntu that has
        KASLR enabled), of which ~1 MB is the size reduction of the RELA section
        in .init, and the remaining 300 KB is reduction of .text/.data.
      
      This patch (of 6):
      
      Before updating certain subsystems to use place relative 32-bit
      relocations in special sections, to save space and reduce the number of
      absolute relocations that need to be processed at runtime by relocatable
      kernels, introduce the Kconfig symbol and define it for some architectures
      that should be able to support and benefit from it.
      
      Link: http://lkml.kernel.org/r/20180704083651.24360-2-ard.biesheuvel@linaro.orgSigned-off-by: NArd Biesheuvel <ard.biesheuvel@linaro.org>
      Acked-by: NMichael Ellerman <mpe@ellerman.id.au>
      Reviewed-by: NWill Deacon <will.deacon@arm.com>
      Acked-by: NIngo Molnar <mingo@kernel.org>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Kees Cook <keescook@chromium.org>
      Cc: Thomas Garnier <thgarnie@google.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: "Serge E. Hallyn" <serge@hallyn.com>
      Cc: Bjorn Helgaas <bhelgaas@google.com>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Russell King <linux@armlinux.org.uk>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Petr Mladek <pmladek@suse.com>
      Cc: James Morris <jmorris@namei.org>
      Cc: Nicolas Pitre <nico@linaro.org>
      Cc: Josh Poimboeuf <jpoimboe@redhat.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>,
      Cc: James Morris <james.morris@microsoft.com>
      Cc: Jessica Yu <jeyu@kernel.org>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      271ca788
    • A
      mm: zero out the vma in vma_init() · a670468f
      Andrew Morton 提交于
      Rather than in vm_area_alloc().  To ensure that the various oddball
      stack-based vmas are in a good state.  Some of the callers were zeroing
      them out, others were not.
      Acked-by: NKirill A. Shutemov <kirill.shutemov@linux.intel.com>
      Cc: Russell King <rmk+kernel@arm.linux.org.uk>
      Cc: Dmitry Vyukov <dvyukov@google.com>
      Cc: Oleg Nesterov <oleg@redhat.com>
      Cc: Andrea Arcangeli <aarcange@redhat.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      a670468f
    • M
      mm, oom: distinguish blockable mode for mmu notifiers · 93065ac7
      Michal Hocko 提交于
      There are several blockable mmu notifiers which might sleep in
      mmu_notifier_invalidate_range_start and that is a problem for the
      oom_reaper because it needs to guarantee a forward progress so it cannot
      depend on any sleepable locks.
      
      Currently we simply back off and mark an oom victim with blockable mmu
      notifiers as done after a short sleep.  That can result in selecting a new
      oom victim prematurely because the previous one still hasn't torn its
      memory down yet.
      
      We can do much better though.  Even if mmu notifiers use sleepable locks
      there is no reason to automatically assume those locks are held.  Moreover
      majority of notifiers only care about a portion of the address space and
      there is absolutely zero reason to fail when we are unmapping an unrelated
      range.  Many notifiers do really block and wait for HW which is harder to
      handle and we have to bail out though.
      
      This patch handles the low hanging fruit.
      __mmu_notifier_invalidate_range_start gets a blockable flag and callbacks
      are not allowed to sleep if the flag is set to false.  This is achieved by
      using trylock instead of the sleepable lock for most callbacks and
      continue as long as we do not block down the call chain.
      
      I think we can improve that even further because there is a common pattern
      to do a range lookup first and then do something about that.  The first
      part can be done without a sleeping lock in most cases AFAICS.
      
      The oom_reaper end then simply retries if there is at least one notifier
      which couldn't make any progress in !blockable mode.  A retry loop is
      already implemented to wait for the mmap_sem and this is basically the
      same thing.
      
      The simplest way for driver developers to test this code path is to wrap
      userspace code which uses these notifiers into a memcg and set the hard
      limit to hit the oom.  This can be done e.g.  after the test faults in all
      the mmu notifier managed memory and set the hard limit to something really
      small.  Then we are looking for a proper process tear down.
      
      [akpm@linux-foundation.org: coding style fixes]
      [akpm@linux-foundation.org: minor code simplification]
      Link: http://lkml.kernel.org/r/20180716115058.5559-1-mhocko@kernel.orgSigned-off-by: NMichal Hocko <mhocko@suse.com>
      Acked-by: Christian König <christian.koenig@amd.com> # AMD notifiers
      Acked-by: Leon Romanovsky <leonro@mellanox.com> # mlx and umem_odp
      Reported-by: NDavid Rientjes <rientjes@google.com>
      Cc: "David (ChunMing) Zhou" <David1.Zhou@amd.com>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: Alex Deucher <alexander.deucher@amd.com>
      Cc: David Airlie <airlied@linux.ie>
      Cc: Jani Nikula <jani.nikula@linux.intel.com>
      Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
      Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
      Cc: Doug Ledford <dledford@redhat.com>
      Cc: Jason Gunthorpe <jgg@ziepe.ca>
      Cc: Mike Marciniszyn <mike.marciniszyn@intel.com>
      Cc: Dennis Dalessandro <dennis.dalessandro@intel.com>
      Cc: Sudeep Dutt <sudeep.dutt@intel.com>
      Cc: Ashutosh Dixit <ashutosh.dixit@intel.com>
      Cc: Dimitri Sivanich <sivanich@sgi.com>
      Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
      Cc: Juergen Gross <jgross@suse.com>
      Cc: "Jérôme Glisse" <jglisse@redhat.com>
      Cc: Andrea Arcangeli <aarcange@redhat.com>
      Cc: Felix Kuehling <felix.kuehling@amd.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      93065ac7
  3. 22 8月, 2018 25 次提交
    • P
      KVM: VMX: fixes for vmentry_l1d_flush module parameter · 0027ff2a
      Paolo Bonzini 提交于
      Two bug fixes:
      
      1) missing entries in the l1d_param array; this can cause a host crash
      if an access attempts to reach the missing entry. Future-proof the get
      function against any overflows as well.  However, the two entries
      VMENTER_L1D_FLUSH_EPT_DISABLED and VMENTER_L1D_FLUSH_NOT_REQUIRED must
      not be accepted by the parse function, so disable them there.
      
      2) invalid values must be rejected even if the CPU does not have the
      bug, so test for them before checking boot_cpu_has(X86_BUG_L1TF)
      
      ... and a small refactoring, since the .cmd field is redundant with
      the index in the array.
      Reported-by: NBandan Das <bsd@redhat.com>
      Cc: stable@vger.kernel.org
      Fixes: a7b9020bSigned-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      0027ff2a
    • T
      KVM: x86: SVM: Call x86_spec_ctrl_set_guest/host() with interrupts disabled · 024d83ca
      Thomas Gleixner 提交于
      Mikhail reported the following lockdep splat:
      
      WARNING: possible irq lock inversion dependency detected
      CPU 0/KVM/10284 just changed the state of lock:
        000000000d538a88 (&st->lock){+...}, at:
        speculative_store_bypass_update+0x10b/0x170
      
      but this lock was taken by another, HARDIRQ-safe lock
      in the past:
      
      (&(&sighand->siglock)->rlock){-.-.}
      
         and interrupts could create inverse lock ordering between them.
      
      Possible interrupt unsafe locking scenario:
      
          CPU0                    CPU1
          ----                    ----
         lock(&st->lock);
                                 local_irq_disable();
                                 lock(&(&sighand->siglock)->rlock);
                                 lock(&st->lock);
          <Interrupt>
           lock(&(&sighand->siglock)->rlock);
           *** DEADLOCK ***
      
      The code path which connects those locks is:
      
         speculative_store_bypass_update()
         ssb_prctl_set()
         do_seccomp()
         do_syscall_64()
      
      In svm_vcpu_run() speculative_store_bypass_update() is called with
      interupts enabled via x86_virt_spec_ctrl_set_guest/host().
      
      This is actually a false positive, because GIF=0 so interrupts are
      disabled even if IF=1; however, we can easily move the invocations of
      x86_virt_spec_ctrl_set_guest/host() into the interrupt disabled region to
      cure it, and it's a good idea to keep the GIF=0/IF=1 area as small
      and self-contained as possible.
      
      Fixes: 1f50ddb4 ("x86/speculation: Handle HT correctly on AMD")
      Reported-by: NMikhail Gavrilov <mikhail.v.gavrilov@gmail.com>
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Tested-by: NMikhail Gavrilov <mikhail.v.gavrilov@gmail.com>
      Cc: Joerg Roedel <joro@8bytes.org>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: Radim Krčmář <rkrcmar@redhat.com>
      Cc: Matthew Wilcox <willy@infradead.org>
      Cc: Borislav Petkov <bp@suse.de>
      Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      Cc: Tom Lendacky <thomas.lendacky@amd.com>
      Cc: kvm@vger.kernel.org
      Cc: x86@kernel.org
      Cc: stable@vger.kernel.org
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      024d83ca
    • S
      KVM: vmx: Inject #UD for SGX ENCLS instruction in guest · 0b665d30
      Sean Christopherson 提交于
      Virtualization of Intel SGX depends on Enclave Page Cache (EPC)
      management that is not yet available in the kernel, i.e. KVM support
      for exposing SGX to a guest cannot be added until basic support
      for SGX is upstreamed, which is a WIP[1].
      
      Until SGX is properly supported in KVM, ensure a guest sees expected
      behavior for ENCLS, i.e. all ENCLS #UD.  Because SGX does not have a
      true software enable bit, e.g. there is no CR4.SGXE bit, the ENCLS
      instruction can be executed[1] by the guest if SGX is supported by the
      system.  Intercept all ENCLS leafs (via the ENCLS- exiting control and
      field) and unconditionally inject #UD.
      
      [1] https://www.spinics.net/lists/kvm/msg171333.html or
          https://lkml.org/lkml/2018/7/3/879
      
      [2] A guest can execute ENCLS in the sense that ENCLS will not take
          an immediate #UD, but no ENCLS will ever succeed in a guest
          without explicit support from KVM (map EPC memory into the guest),
          unless KVM has a *very* egregious bug, e.g. accidentally mapped
          EPC memory into the guest SPTEs.  In other words this patch is
          needed only to prevent the guest from seeing inconsistent behavior,
          e.g. #GP (SGX not enabled in Feature Control MSR) or #PF (leaf
          operand(s) does not point at EPC memory) instead of #UD on ENCLS.
          Intercepting ENCLS is not required to prevent the guest from truly
          utilizing SGX.
      Signed-off-by: NSean Christopherson <sean.j.christopherson@intel.com>
      Message-Id: <20180814163334.25724-3-sean.j.christopherson@intel.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      0b665d30
    • S
      KVM: vmx: Add defines for SGX ENCLS exiting · 802ec461
      Sean Christopherson 提交于
      Hardware support for basic SGX virtualization adds a new execution
      control (ENCLS_EXITING), VMCS field (ENCLS_EXITING_BITMAP) and exit
      reason (ENCLS), that enables a VMM to intercept specific ENCLS leaf
      functions, e.g. to inject faults when the VMM isn't exposing SGX to
      a VM.  When ENCLS_EXITING is enabled, the VMM can set/clear bits in
      the bitmap to intercept/allow ENCLS leaf functions in non-root, e.g.
      setting bit 2 in the ENCLS_EXITING_BITMAP will cause ENCLS[EINIT]
      to VMExit(ENCLS).
      
      Note: EXIT_REASON_ENCLS was previously added by commit 1f519992
      ("KVM: VMX: add missing exit reasons").
      Signed-off-by: NSean Christopherson <sean.j.christopherson@intel.com>
      Message-Id: <20180814163334.25724-2-sean.j.christopherson@intel.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      802ec461
    • Y
      x86/kvm/vmx: Fix coding style in vmx_setup_l1d_flush() · d806afa4
      Yi Wang 提交于
      Substitute spaces with tab. No functional changes.
      Signed-off-by: NYi Wang <wang.yi59@zte.com.cn>
      Reviewed-by: NJiang Biao <jiang.biao2@zte.com.cn>
      Message-Id: <1534398159-48509-1-git-send-email-wang.yi59@zte.com.cn>
      Cc: stable@vger.kernel.org # L1TF
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      d806afa4
    • A
      x86: kvm: avoid unused variable warning · 7288bde1
      Arnd Bergmann 提交于
      Removing one of the two accesses of the maxphyaddr variable led to
      a harmless warning:
      
      arch/x86/kvm/x86.c: In function 'kvm_set_mmio_spte_mask':
      arch/x86/kvm/x86.c:6563:6: error: unused variable 'maxphyaddr' [-Werror=unused-variable]
      
      Removing the #ifdef seems to be the nicest workaround, as it
      makes the code look cleaner than adding another #ifdef.
      
      Fixes: 28a1f3ac ("kvm: x86: Set highest physical address bits in non-present/reserved SPTEs")
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Cc: stable@vger.kernel.org # L1TF
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      7288bde1
    • Y
      h8300: fix IRQ no · 4bdf61cc
      Yoshinori Sato 提交于
      Old timer handler use 24 (Compare match A).
      But current timer handler use 26 (Overflow).
      Signed-off-by: NYoshinori Sato <ysato@users.sourceforge.jp>
      4bdf61cc
    • R
      arch/h8300: add a defconfig target · 7b291be8
      Randy Dunlap 提交于
      Make the "defconfig" target valid for arch/h8300.  Currently
      "make ARCH=h8300 defconfig" produces:
      
      *** Can't find default configuration "arch/h8300/defconfig"!
      ../scripts/kconfig/Makefile:87: recipe for target 'defconfig' failed
      
      By adding a value for KBUILD_DEFCONFIG, "make ARCH=h8300 defconfig"
      successfully produces a kernel .config file:
      
      *** Default configuration is based on 'edosk2674_defconfig'
      
      This is useful for Kconfig editing/testing.
      Signed-off-by: NRandy Dunlap <rdunlap@infradead.org>
      Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
      Cc: uclinux-h8-devel@lists.sourceforge.jp (moderated for non-subscribers)
      Signed-off-by: NYoshinori Sato <ysato@users.sourceforge.jp>
      7b291be8
    • R
      arch/h8300: eliminate kgbd.c warning · ce156feb
      Randy Dunlap 提交于
      Drop the "const" qualifier from arch_kgdb_ops to eliminate the gcc
      warning (gcc version is 8.1.0).
      
      arch/h8300/kernel/kgdb.c:132:24: error: conflicting type qualifiers for 'arch_kgdb_ops'
       const struct kgdb_arch arch_kgdb_ops = {
      In file included from ../arch/h8300/kernel/kgdb.c:12:
      ../include/linux/kgdb.h:284:26: note: previous declaration of 'arch_kgdb_ops' was here
       extern struct kgdb_arch  arch_kgdb_ops;
      Signed-off-by: NRandy Dunlap <rdunlap@infradead.org>
      Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
      Cc: uclinux-h8-devel@lists.sourceforge.jp
      Signed-off-by: NYoshinori Sato <ysato@users.sourceforge.jp>
      ce156feb
    • R
      arch/h8300: eliminate ptrace.h warnings · cfa2d688
      Randy Dunlap 提交于
      Add a "struct task_struct;" stub to arch/h8300's ptrace.h header to
      eliminate gcc warnings (gcc version is 8.1.0).
      
      ../arch/h8300/include/asm/ptrace.h:32:34: warning: 'struct task_struct' declared inside parameter list will not be visible outside of this definition or declaration
       extern long h8300_get_reg(struct task_struct *task, int regno);
      ../arch/h8300/include/asm/ptrace.h:33:33: warning: 'struct task_struct' declared inside parameter list will not be visible outside of this definition or declaration
       extern int h8300_put_reg(struct task_struct *task, int regno,
      Signed-off-by: NRandy Dunlap <rdunlap@infradead.org>
      Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
      Cc: uclinux-h8-devel@lists.sourceforge.jp
      Signed-off-by: NYoshinori Sato <ysato@users.sourceforge.jp>
      cfa2d688
    • L
      h8300:let the checker know that size_t is ulong · 1b803a35
      Luc Van Oostenryck 提交于
      All 64bit archs use unsigned long for size_t and most 32bit
      archs use 'unsigned int'. By default, this is what is assumed
      by sparse.
      
      However, on h8300 (a 32bit arch) size_t is unsigned long which
      can led sparse to emit wrong warnings.
      
      Fix this by passing to sparse the flag -msize-long, telling it
      that size_t is unsigned long.
      Signed-off-by: NLuc Van Oostenryck <luc.vanoostenryck@gmail.com>
      Signed-off-by: NYoshinori Sato <ysato@users.sourceforge.jp>
      1b803a35
    • W
      h8300: Don't include linux/kernel.h in asm/atomic.h · 9819d4e4
      Will Deacon 提交于
      linux/kernel.h isn't needed by asm/atomic.h and will result in circular
      dependencies when the asm-generic atomic bitops are built around the
      tomic_long_t interface.
      
      Remove the broad include and replace it with linux/compiler.h for
      READ_ONCE etc and asm/irqflags.h for arch_local_irq_save etc.
      
      Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      Signed-off-by: NYoshinori Sato <ysato@users.sourceforge.jp>
      9819d4e4
    • R
      h8300: remove unnecessary of_platform_populate call · ec3d5f16
      Rob Herring 提交于
      The DT core will call of_platform_populate, so it is not necessary for
      arch specific code to call it unless there are custom match entries,
      auxdata or parent device. Neither of those apply here, so remove the call.
      
      Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
      Cc: uclinux-h8-devel@lists.sourceforge.jp
      Signed-off-by: NRob Herring <robh@kernel.org>
      Signed-off-by: NYoshinori Sato <ysato@users.sourceforge.jp>
      ec3d5f16
    • G
      h8300: Correct signature of test_bit() · 5743ee22
      Geert Uytterhoeven 提交于
          mm/filemap.c: In function 'clear_bit_unlock_is_negative_byte':
          mm/filemap.c:1181:30: warning: passing argument 2 of 'test_bit' discards 'volatile' qualifier from pointer target type [-Wdiscarded-qualifiers]
            return test_bit(PG_waiters, mem);
      				  ^~~
          In file included from include/linux/bitops.h:38,
      		     from include/linux/kernel.h:11,
      		     from include/linux/list.h:9,
      		     from include/linux/wait.h:7,
      		     from include/linux/wait_bit.h:8,
      		     from include/linux/fs.h:6,
      		     from include/linux/dax.h:5,
      		     from mm/filemap.c:14:
          arch/h8300/include/asm/bitops.h:69:57: note: expected 'const long unsigned int *' but argument is of type 'volatile void *'
           static inline int test_bit(int nr, const unsigned long *addr)
      					~~~~~~~~~~~~~~~~~~~~~^~~~
      
      Make the bitmask pointed to by the "addr" parameter volatile to fix
      this, like is done on other architectures.
      Signed-off-by: NGeert Uytterhoeven <geert@linux-m68k.org>
      Signed-off-by: NYoshinori Sato <ysato@users.sourceforge.jp>
      5743ee22
    • R
      h8300: switch to NO_BOOTMEM · c489dfef
      Rob Herring 提交于
      Commit 0fa1c579 ("of/fdt: use memblock_virt_alloc for early alloc")
      inadvertently switched the DT unflattening allocations from memblock to
      bootmem which doesn't work because the unflattening happens before
      bootmem is initialized. Swapping the order of bootmem init and
      unflattening could also fix this, but removing bootmem is desired. So
      enable NO_BOOTMEM on h8300 like other architectures have done.
      
      Fixes: 0fa1c579 ("of/fdt: use memblock_virt_alloc for early alloc")
      Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
      Cc: uclinux-h8-devel@lists.sourceforge.jp
      Signed-off-by: NRob Herring <robh@kernel.org>
      Signed-off-by: NYoshinori Sato <ysato@users.sourceforge.jp>
      c489dfef
    • Y
      h8300: gcc-8.1 fix · 811d1b0e
      Yoshinori Sato 提交于
      Since gcc 8.1 does not generate an assignment statement to er 0,
      we had to explicitly write it.
      Signed-off-by: NYoshinori Sato <ysato@users.sourceforge.jp>
      811d1b0e
    • Y
      h8300: Add missing output register. · 686320e9
      Yoshinori Sato 提交于
      Signed-off-by: NYoshinori Sato <ysato@users.sourceforge.jp>
      686320e9
    • M
      sparc: fix KBUILD_DEFCONFIG for ARCH=sparc32 · c84ca616
      Masahiro Yamada 提交于
      As commit 5ba80096 ("kbuild: update ARCH alias info for sparc")
      addressed, SPARC accepts ARCH=sparc32 as an alias.
      
      However, arch/sparc/Makefile wrongly sets KBUILD_DEFCONFIG, then
      sparc64_defconfig is chosen as the base configuration for ARCH=sparc32.
      
        $ make ARCH=sparc32 defconfig
        *** Default configuration is based on 'sparc64_defconfig'
        #
        # configuration written to .config
        #
      
      Fix the logic to choose sparc64_defconfig only when ARCH=sparc64.
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      c84ca616
    • M
      sparc32: split ramdisk detection and reservation to a helper function · 8818d89c
      Mike Rapoport 提交于
      The detection and reservation of ramdisk memory were separated to allow
      bootmem bitmap initialization after the ramdisk boundaries are detected.
      Since the bootmem initialization is removed, the reservation of ramdisk
      memory is done immediately after its boundaries are found.
      
      Split the entire block into a separate helper function.
      Signed-off-by: NMike Rapoport <rppt@linux.vnet.ibm.com>
      Suggested-by: NSam Ravnborg <sam@ravnborg.org>
      Reviewed-by: NSam Ravnborg <sam@ravnborg.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      8818d89c
    • M
      sparc32: switch to NO_BOOTMEM · cca079ef
      Mike Rapoport 提交于
      Each populated sparc_phys_bank is added to memblock.memory. The
      reserve_bootmem() calls are replaced with memblock_reserve(), and the
      bootmem bitmap initialization is droppped.
      Signed-off-by: NMike Rapoport <rppt@linux.vnet.ibm.com>
      Reviewed-by: NSam Ravnborg <sam@ravnborg.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      cca079ef
    • M
      60ef8616
    • C
      sparc: use generic dma_noncoherent_ops · dfaad39c
      Christoph Hellwig 提交于
      Switch to the generic noncoherent direct mapping implementation.
      
      This removes the previous sync_single_for_device implementation, which
      looks bogus given that no syncing is happening in the similar but more
      important map_single case.
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      Acked-by: NSam Ravnborg <sam@ravnborg.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      dfaad39c
    • P
      MIPS: lib: Provide MIPS64r6 __multi3() for GCC < 7 · 690d9163
      Paul Burton 提交于
      Some versions of GCC suboptimally generate calls to the __multi3()
      intrinsic for MIPS64r6 builds, resulting in link failures due to the
      missing function:
      
          LD      vmlinux.o
          MODPOST vmlinux.o
        kernel/bpf/verifier.o: In function `kmalloc_array':
        include/linux/slab.h:631: undefined reference to `__multi3'
        fs/select.o: In function `kmalloc_array':
        include/linux/slab.h:631: undefined reference to `__multi3'
        ...
      
      We already have a workaround for this in which we provide the
      instrinsic, but we do so selectively for GCC 7 only. Unfortunately the
      issue occurs with older GCC versions too - it has been observed with
      both GCC 5.4.0 & GCC 6.4.0.
      
      MIPSr6 support was introduced in GCC 5, so all major GCC versions prior
      to GCC 8 are affected and we extend our workaround accordingly to all
      MIPS64r6 builds using GCC versions older than GCC 8.
      Signed-off-by: NPaul Burton <paul.burton@mips.com>
      Reported-by: NVladimir Kondratiev <vladimir.kondratiev@intel.com>
      Fixes: ebabcf17 ("MIPS: Implement __multi3 for GCC7 MIPS64r6 builds")
      Patchwork: https://patchwork.linux-mips.org/patch/20297/
      Cc: James Hogan <jhogan@kernel.org>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: linux-mips@linux-mips.org
      Cc: stable@vger.kernel.org # 4.15+
      690d9163
    • P
      MIPS: Workaround GCC __builtin_unreachable reordering bug · 906d441f
      Paul Burton 提交于
      Some versions of GCC for the MIPS architecture suffer from a bug which
      can lead to instructions from beyond an unreachable statement being
      incorrectly reordered into earlier branch delay slots if the unreachable
      statement is the only content of a case in a switch statement. This can
      lead to seemingly random behaviour, such as invalid memory accesses from
      incorrectly reordered loads or stores, and link failures on microMIPS
      builds.
      
      See this potential GCC fix for details:
      
          https://gcc.gnu.org/ml/gcc-patches/2015-09/msg00360.html
      
      Runtime problems resulting from this bug were initially observed using a
      maltasmvp_defconfig v4.4 kernel built using GCC 4.9.2 (from a Codescape
      SDK 2015.06-05 toolchain), with the result being an address exception
      taken after log messages about the L1 caches (during probe of the L2
      cache):
      
          Initmem setup node 0 [mem 0x0000000080000000-0x000000009fffffff]
          VPE topology {2,2} total 4
          Primary instruction cache 64kB, VIPT, 4-way, linesize 32 bytes.
          Primary data cache 64kB, 4-way, PIPT, no aliases, linesize 32 bytes
          <AdEL exception here>
      
      This is early enough that the kernel exception vectors are not in use,
      so any further output depends upon the bootloader. This is reproducible
      in QEMU where no further output occurs - ie. the system hangs here.
      Given the nature of the bug it may potentially be hit with differing
      symptoms. The bug is known to affect GCC versions as recent as 7.3, and
      it is unclear whether GCC 8 fixed it or just happens not to encounter
      the bug in the testcase found at the link above due to differing
      optimizations.
      
      This bug can be worked around by placing a volatile asm statement, which
      GCC is prevented from reordering past, prior to the
      __builtin_unreachable call.
      
      That was actually done already for other reasons by commit 173a3efd
      ("bug.h: work around GCC PR82365 in BUG()"), but creates problems for
      microMIPS builds due to the lack of a .insn directive. The microMIPS ISA
      allows for interlinking with regular MIPS32 code by repurposing bit 0 of
      the program counter as an ISA mode bit. To switch modes one changes the
      value of this bit in the PC. However typical branch instructions encode
      their offsets as multiples of 2-byte instruction halfwords, which means
      they cannot change ISA mode - this must be done using either an indirect
      branch (a jump-register in MIPS terminology) or a dedicated jalx
      instruction. In order to ensure that regular branches don't attempt to
      target code in a different ISA which they can't actually switch to, the
      linker will check that branch targets are code in the same ISA as the
      branch.
      
      Unfortunately our empty asm volatile statements don't qualify as code,
      and the link for microMIPS builds fails with errors such as:
      
          arch/mips/mm/dma-default.s:3265: Error: branch to a symbol in another ISA mode
          arch/mips/mm/dma-default.s:5027: Error: branch to a symbol in another ISA mode
      
      Resolve this by adding a .insn directive within the asm statement which
      declares that what comes next is code. This may or may not be true,
      since we don't really know what comes next, but as this code is in an
      unreachable path anyway that doesn't matter since we won't execute it.
      
      We do this in asm/compiler.h & select CONFIG_HAVE_ARCH_COMPILER_H in
      order to have this included by linux/compiler_types.h after
      linux/compiler-gcc.h. This will result in asm/compiler.h being included
      in all C compilations via the -include linux/compiler_types.h argument
      in c_flags, which should be harmless.
      Signed-off-by: NPaul Burton <paul.burton@mips.com>
      Fixes: 173a3efd ("bug.h: work around GCC PR82365 in BUG()")
      Patchwork: https://patchwork.linux-mips.org/patch/20270/
      Cc: James Hogan <jhogan@kernel.org>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: linux-mips@linux-mips.org
      906d441f
    • P
      compiler.h: Allow arch-specific asm/compiler.h · 04f264d3
      Paul Burton 提交于
      We have a need to override the definition of
      barrier_before_unreachable() for MIPS, which means we either need to add
      architecture-specific code into linux/compiler-gcc.h or we need to allow
      the architecture to provide a header that can define the macro before
      the generic definition. The latter seems like the better approach.
      
      A straightforward approach to the per-arch header is to make use of
      asm-generic to provide a default empty header & adjust architectures
      which don't need anything specific to make use of that by adding the
      header to generic-y. Unfortunately this doesn't work so well due to
      commit 28128c61 ("kconfig.h: Include compiler types to avoid missed
      struct attributes") which caused linux/compiler_types.h to be included
      in the compilation of every C file via the -include linux/kconfig.h flag
      in c_flags.
      
      Because the -include flag is present for all C files we compile, we need
      the architecture-provided header to be present before any C files are
      compiled. If any C files can be compiled prior to the asm-generic header
      wrappers being generated then we hit a build failure due to missing
      header. Such cases do exist - one pointed out by the kbuild test robot
      is the compilation of arch/ia64/kernel/nr-irqs.c, which occurs as part
      of the archprepare target [1].
      
      This leaves us with a few options:
      
        1) Use generic-y & fix any build failures we find by enforcing
           ordering such that the asm-generic target occurs before any C
           compilation, such that linux/compiler_types.h can always include
           the generated asm-generic wrapper which in turn includes the empty
           asm-generic header. This would rely on us finding all the
           problematic cases - I don't know for sure that the ia64 issue is
           the only one.
      
        2) Add an actual empty header to each architecture, so that we don't
           need the generated asm-generic wrapper. This seems messy.
      
        3) Give up & add #ifdef CONFIG_MIPS or similar to
           linux/compiler_types.h. This seems messy too.
      
        4) Include the arch header only when it's actually needed, removing
           the need for the asm-generic wrapper for all other architectures.
      
      This patch allows us to use approach 4, by including an asm/compiler.h
      header from linux/compiler_types.h after the inclusion of the
      compiler-specific linux/compiler-*.h header(s). We do this
      conditionally, only when CONFIG_HAVE_ARCH_COMPILER_H is selected, in
      order to avoid the need for asm-generic wrappers & the associated build
      ordering issue described above. The asm/compiler.h header is included
      after the generic linux/compiler-*.h header(s) for consistency with the
      way linux/compiler-intel.h & linux/compiler-clang.h are included after
      the linux/compiler-gcc.h header that they override.
      
      [1] https://lists.01.org/pipermail/kbuild-all/2018-August/051175.htmlSigned-off-by: NPaul Burton <paul.burton@mips.com>
      Reviewed-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      Patchwork: https://patchwork.linux-mips.org/patch/20269/
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: James Hogan <jhogan@kernel.org>
      Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: linux-arch@vger.kernel.org
      Cc: linux-kbuild@vger.kernel.org
      Cc: linux-mips@linux-mips.org
      04f264d3
  4. 21 8月, 2018 1 次提交