26 May, 2016

1 commit


21 May, 2016

1 commit

  • Similar to commits:

    51d7d5205d33 ("powerpc: Add smp_mb() to arch_spin_is_locked()")
    d86b8da04dfa ("arm64: spinlock: serialise spin_unlock_wait against concurrent lockers")

    qspinlock suffers from the fact that the _Q_LOCKED_VAL store is
    unordered inside the ACQUIRE of the lock.

    And while this is not a problem for the regular mutual exclusive
    critical section usage of spinlocks, it breaks creative locking like:

    spin_lock(A) spin_lock(B)
    spin_unlock_wait(B) if (!spin_is_locked(A))
    do_something() do_something()

    In that both CPUs can end up running do_something at the same time,
    because our _Q_LOCKED_VAL store can drop past the spin_unlock_wait()
    spin_is_locked() loads (even on x86!!).

    To avoid making the normal case slower, add smp_mb()s to the less used
    spin_unlock_wait() / spin_is_locked() side of things to avoid this
    problem.

    Reported-and-tested-by: Davidlohr Bueso
    Reported-by: Giovanni Gherdovich
    Signed-off-by: Peter Zijlstra (Intel)
    Cc: stable@vger.kernel.org # v4.2 and later
    Signed-off-by: Linus Torvalds

    Peter Zijlstra
     

20 May, 2016

4 commits

  • Merge updates from Andrew Morton:

    - fsnotify fix

    - poll() timeout fix

    - a few scripts/ tweaks

    - debugobjects updates

    - the (small) ocfs2 queue

    - Minor fixes to kernel/padata.c

    - Maybe half of the MM queue

    * emailed patches from Andrew Morton : (117 commits)
    mm, page_alloc: restore the original nodemask if the fast path allocation failed
    mm, page_alloc: uninline the bad page part of check_new_page()
    mm, page_alloc: don't duplicate code in free_pcp_prepare
    mm, page_alloc: defer debugging checks of pages allocated from the PCP
    mm, page_alloc: defer debugging checks of freed pages until a PCP drain
    cpuset: use static key better and convert to new API
    mm, page_alloc: inline pageblock lookup in page free fast paths
    mm, page_alloc: remove unnecessary variable from free_pcppages_bulk
    mm, page_alloc: pull out side effects from free_pages_check
    mm, page_alloc: un-inline the bad part of free_pages_check
    mm, page_alloc: check multiple page fields with a single branch
    mm, page_alloc: remove field from alloc_context
    mm, page_alloc: avoid looking up the first zone in a zonelist twice
    mm, page_alloc: shortcut watermark checks for order-0 pages
    mm, page_alloc: reduce cost of fair zone allocation policy retry
    mm, page_alloc: shorten the page allocator fast path
    mm, page_alloc: check once if a zone has isolated pageblocks
    mm, page_alloc: move __GFP_HARDWALL modifications out of the fastpath
    mm, page_alloc: simplify last cpupid reset
    mm, page_alloc: remove unnecessary initialisation from __alloc_pages_nodemask()
    ...

    Linus Torvalds
     
  • I've just discovered that the useful-sounding has_transparent_hugepage()
    is actually an architecture-dependent minefield: on some arches it only
    builds if CONFIG_TRANSPARENT_HUGEPAGE=y, on others it's also there when
    not, but on some of those (arm and arm64) it then gives the wrong
    answer; and on mips alone it's marked __init, which would crash if
    called later (but so far it has not been called later).

    Straighten this out: make it available to all configs, with a sensible
    default in asm-generic/pgtable.h, removing its definitions from those
    arches (arc, arm, arm64, sparc, tile) which are served by the default,
    adding #define has_transparent_hugepage has_transparent_hugepage to
    those (mips, powerpc, s390, x86) which need to override the default at
    runtime, and removing the __init from mips (but maybe that kind of code
    should be avoided after init: set a static variable the first time it's
    called).

    Signed-off-by: Hugh Dickins
    Cc: "Kirill A. Shutemov"
    Cc: Andrea Arcangeli
    Cc: Andres Lagar-Cavilla
    Cc: Yang Shi
    Cc: Ning Qu
    Cc: Mel Gorman
    Cc: Konstantin Khlebnikov
    Acked-by: David S. Miller
    Acked-by: Vineet Gupta [arch/arc]
    Acked-by: Gerald Schaefer [arch/s390]
    Acked-by: Ingo Molnar
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Hugh Dickins
     
  • Pull IOMMU updates from Joerg Roedel:
    "The updates include:

    - rate limiting for the VT-d fault handler

    - remove statistics code from the AMD IOMMU driver. It is unused and
    should be replaced by something more generic if needed

    - per-domain pagesize-bitmaps in IOMMU core code to support systems
    with different types of IOMMUs

    - support for ACPI devices in the AMD IOMMU driver

    - 4GB mode support for Mediatek IOMMU driver

    - ARM-SMMU updates from Will Deacon:
    - support for 64k pages with SMMUv1 implementations (e.g MMU-401)
    - remove open-coded 64-bit MMIO accessors
    - initial support for 16-bit VMIDs, as supported by some ThunderX
    SMMU implementations
    - a couple of errata workarounds for silicon in the field

    - various fixes here and there"

    * tag 'iommu-updates-v4.7' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu: (44 commits)
    iommu/arm-smmu: Use per-domain page sizes.
    iommu/amd: Remove statistics code
    iommu/dma: Finish optimising higher-order allocations
    iommu: Allow selecting page sizes per domain
    iommu: of: enforce const-ness of struct iommu_ops
    iommu: remove unused priv field from struct iommu_ops
    iommu/dma: Implement scatterlist segment merging
    iommu/arm-smmu: Clear cache lock bit of ACR
    iommu/arm-smmu: Support SMMUv1 64KB supplement
    iommu/arm-smmu: Decouple context format from kernel config
    iommu/arm-smmu: Tidy up 64-bit/atomic I/O accesses
    io-64-nonatomic: Add relaxed accessor variants
    iommu/arm-smmu: Work around MMU-500 prefetch errata
    iommu/arm-smmu: Convert ThunderX workaround to new method
    iommu/arm-smmu: Differentiate specific implementations
    iommu/arm-smmu: Workaround for ThunderX erratum #27704
    iommu/arm-smmu: Add support for 16 bit VMID
    iommu/amd: Move get_device_id() and friends to beginning of file
    iommu/amd: Don't use IS_ERR_VALUE to check integer values
    iommu/amd: Signedness bug in acpihid_device_group()
    ...

    Linus Torvalds
     
  • Pull MIPS updates from Ralf Baechle:
    "This is the main pull request for MIPS for 4.7. Here's the summary of
    the changes:

    - ATH79: Support for DTB passuing using the UHI boot protocol
    - ATH79: Remove support for builtin DTB.
    - ATH79: Add zboot debug serial support.
    - ATH79: Add initial support for Dragino MS14 (Dragine 2), Onion Omega
    and DPT-Module.
    - ATH79: Update devicetree clock support for AR9132 and AR9331.
    - ATH79: Cleanup the DT code.
    - ATH79: Support newer SOCs in ath79_ddr_ctrl_init.
    - ATH79: Fix regression in PCI window initialization.
    - BCM47xx: Move SPROM driver to drivers/firmware/
    - BCM63xx: Enable partition parser in defconfig.
    - BMIPS: BMIPS5000 has I cache filing from D cache
    - BMIPS: BMIPS: Add cpu-feature-overrides.h
    - BMIPS: Add Whirlwind support
    - BMIPS: Adjust mips-hpt-frequency for BCM7435
    - BMIPS: Remove maxcpus from BCM97435SVMB DTS
    - BMIPS: Add missing 7038 L1 register cells to BCM7435
    - BMIPS: Various tweaks to initialization code.
    - BMIPS: Enable partition parser in defconfig.
    - BMIPS: Cache tweaks.
    - BMIPS: Add UART, I2C and SATA devices to DT.
    - BMIPS: Add BCM6358 and BCM63268support
    - BMIPS: Add device tree example for BCM6358.
    - BMIPS: Improve Improve BCM6328 and BCM6368 device trees
    - Lantiq: Add support for device tree file from boot loader
    - Lantiq: Allow build with no built-in DT.
    - Loongson 3: Reserve 32MB for RS780E integrated GPU.
    - Loongson 3: Fix build error after ld-version.sh modification
    - Loongson 3: Move chipset ACPI code from drivers to arch.
    - Loongson 3: Speedup irq processing.
    - Loongson 3: Add basic Loongson 3A support.
    - Loongson 3: Set cache flush handlers to nop.
    - Loongson 3: Invalidate special TLBs when needed.
    - Loongson 3: Fast TLB refill handler.
    - MT7620: Fallback strategy for invalid syscfg0.
    - Netlogic: Fix CP0_EBASE redefinition warnings
    - Octeon: Initialization fixes
    - Octeon: Add DTS files for the D-Link DSR-1000N and EdgeRouter Lite
    - Octeon: Enable add Octeon-drivers in cavium_octeon_defconfig
    - Octeon: Correctly handle endian-swapped initramfs images.
    - Octeon: Support CN73xx, CN75xx and CN78xx.
    - Octeon: Remove dead code from cvmx-sysinfo.
    - Octeon: Extend number of supported CPUs past 32.
    - Octeon: Remove some code limiting NR_IRQS to 255.
    - Octeon: Simplify octeon_irq_ciu_gpio_set_type.
    - Octeon: Mark some functions __init in smp.c
    - Octeon: Octeon: Add Octeon III CN7xxx interface detection
    - PIC32: Add serial driver and bindings for it.
    - PIC32: Add PIC32 deadman timer driver and bindings.
    - PIC32: Add PIC32 clock timer driver and bindings.
    - Pistachio: Determine SoC revision during boot
    - Sibyte: Fix Kconfig dependencies of SIBYTE_BUS_WATCHER.
    - Sibyte: Strip redundant comments from bcm1480_regs.h.
    - Panic immediately if panic_on_oops is set.
    - module: fix incorrect IS_ERR_VALUE macro usage.
    - module: Make consistent use of pr_*
    - Remove no longer needed work_on_cpu() call.
    - Remove CONFIG_IPV6_PRIVACY from defconfigs.
    - Fix registers of non-crashing CPUs in dumps.
    - Handle MIPSisms in new vmcore_elf32_check_arch.
    - Select CONFIG_HANDLE_DOMAIN_IRQ and make it work.
    - Allow RIXI to be used on non-R2 or R6 cores.
    - Reserve nosave data for hibernation
    - Fix siginfo.h to use strict POSIX types.
    - Don't unwind user mode with EVA.
    - Fix watchpoint restoration
    - Ptrace watchpoints for R6.
    - Sync icache when it fills from dcache
    - I6400 I-cache fills from dcache.
    - Various MSA fixes.
    - Cleanup MIPS_CPU_* definitions.
    - Signal: Move generic copy_siginfo to signal.h
    - Signal: Fix uapi include in exported asm/siginfo.h
    - Timer fixes for sake of KVM.
    - XPA TLB refill fixes.
    - Treat perf counter feature
    - Update John Crispin's email address
    - Add PIC32 watchdog and bindings.
    - Handle R10000 LL/SC bug in set_pte()
    - cpufreq: Various fixes for Longson1.
    - R6: Fix R2 emulation.
    - mathemu: Cosmetic fix to ADDIUPC emulation, plenty of other small fixes
    - ELF: ABI and FP fixes.
    - Allow for relocatable kernel and use that to support KASLR.
    - Fix CPC_BASE_ADDR mask
    - Plenty fo smp-cps, CM, R6 and M6250 fixes.
    - Make reset_control_ops const.
    - Fix kernel command line handling of leading whitespace.
    - Cleanups to cache handling.
    - Add brcm, bcm6345-l1-intc device tree bindings.
    - Use generic clkdev.h header
    - Remove CLK_IS_ROOT usage.
    - Misc small cleanups.
    - CM: Fix compilation error when !MIPS_CM
    - oprofile: Fix a preemption issue
    - Detect DSP ASE v3 support:1"

    * 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus: (275 commits)
    MIPS: pic32mzda: fix getting timer clock rate.
    MIPS: ath79: fix regression in PCI window initialization
    MIPS: ath79: make ath79_ddr_ctrl_init() compatible for newer SoCs
    MIPS: Fix VZ probe gas errors with binutils of MSA context in non-MSA kernels
    MIPS: cevt-r4k: Dynamically calculate min_delta_ns
    MIPS: malta-time: Take seconds into account
    MIPS: malta-time: Start GIC count before syncing to RTC
    MIPS: Force CPUs to lose FP context during mode switches
    ...

    Linus Torvalds
     

17 May, 2016

3 commits

  • Vikram reported that his ARM64 compiler managed to 'optimize' away the
    preempt_count manipulations in code like:

    preempt_enable_no_resched();
    put_user();
    preempt_disable();

    Irrespective of that fact that that is horrible code that should be
    fixed for many reasons, it does highlight a deficiency in the generic
    preempt_count manipulators. As it is never right to combine/elide
    preempt_count manipulations like this.

    Therefore sprinkle some volatile in the two generic accessors to
    ensure the compiler is aware of the fact that the preempt_count is
    observed outside of the regular program-order view and thus cannot be
    optimized away like this.

    x86; the only arch not using the generic code is not affected as we
    do all this in asm in order to use the segment base per-cpu stuff.

    Reported-by: Vikram Mulukutla
    Tested-by: Vikram Mulukutla
    Signed-off-by: Peter Zijlstra (Intel)
    Cc: Linus Torvalds
    Cc: Peter Zijlstra
    Cc: Thomas Gleixner
    Fixes: a787870924db ("sched, arch: Create asm/preempt.h")
    Link: http://lkml.kernel.org/r/20160516131751.GH3205@twins.programming.kicks-ass.net
    Signed-off-by: Ingo Molnar

    Peter Zijlstra
     
  • Pull x86 asm updates from Ingo Molnar:
    "The main changes in this cycle were:

    - MSR access API fixes and enhancements (Andy Lutomirski)

    - early exception handling improvements (Andy Lutomirski)

    - user-space FS/GS prctl usage fixes and improvements (Andy
    Lutomirski)

    - Remove the cpu_has_*() APIs and replace them with equivalents
    (Borislav Petkov)

    - task switch micro-optimization (Brian Gerst)

    - 32-bit entry code simplification (Denys Vlasenko)

    - enhance PAT handling in enumated CPUs (Toshi Kani)

    ... and lots of other cleanups/fixlets"

    * 'x86-asm-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (70 commits)
    x86/arch_prctl/64: Restore accidentally removed put_cpu() in ARCH_SET_GS
    x86/entry/32: Remove asmlinkage_protect()
    x86/entry/32: Remove GET_THREAD_INFO() from entry code
    x86/entry, sched/x86: Don't save/restore EFLAGS on task switch
    x86/asm/entry/32: Simplify pushes of zeroed pt_regs->REGs
    selftests/x86/ldt_gdt: Test set_thread_area() deletion of an active segment
    x86/tls: Synchronize segment registers in set_thread_area()
    x86/asm/64: Rename thread_struct's fs and gs to fsbase and gsbase
    x86/arch_prctl/64: Remove FSBASE/GSBASE < 4G optimization
    x86/segments/64: When load_gs_index fails, clear the base
    x86/segments/64: When loadsegment(fs, ...) fails, clear the base
    x86/asm: Make asm/alternative.h safe from assembly
    x86/asm: Stop depending on ptrace.h in alternative.h
    x86/entry: Rename is_{ia32,x32}_task() to in_{ia32,x32}_syscall()
    x86/asm: Make sure verify_cpu() has a good stack
    x86/extable: Add a comment about early exception handlers
    x86/msr: Set the return value to zero when native_rdmsr_safe() fails
    x86/paravirt: Make "unsafe" MSR accesses unsafe even if PARAVIRT=y
    x86/paravirt: Add paravirt_{read,write}_msr()
    x86/msr: Carry on after a non-"safe" MSR access fails
    ...

    Linus Torvalds
     
  • Pull support for killable rwsems from Ingo Molnar:
    "This, by Michal Hocko, implements down_write_killable().

    The main usecase will be to update mm_sem usage sites to use this new
    API, to allow the mm-reaper introduced in commit aac453635549 ("mm,
    oom: introduce oom reaper") to tear down oom victim address spaces
    asynchronously with minimum latencies and without deadlock worries"

    [ The vfs will want it too as the inode lock is changed from a mutex to
    a rwsem due to the parallel lookup and readdir updates ]

    * 'locking-rwsem-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
    locking/rwsem: Fix comment on register clobbering
    locking/rwsem: Fix down_write_killable()
    locking/rwsem, x86: Add frame annotation for call_rwsem_down_write_failed_killable()
    locking/rwsem: Provide down_write_killable()
    locking/rwsem, x86: Provide __down_write_killable()
    locking/rwsem, s390: Provide __down_write_killable()
    locking/rwsem, ia64: Provide __down_write_killable()
    locking/rwsem, alpha: Provide __down_write_killable()
    locking/rwsem: Introduce basis for down_write_killable()
    locking/rwsem, sparc: Drop superfluous arch specific implementation
    locking/rwsem, sh: Drop superfluous arch specific implementation
    locking/rwsem, xtensa: Drop superfluous arch specific implementation
    locking/rwsem: Drop explicit memory barriers
    locking/rwsem: Get rid of __down_write_nested()

    Linus Torvalds
     

13 May, 2016

2 commits

  • The generic copy_siginfo() is currently defined in
    asm-generic/siginfo.h, after including uapi/asm-generic/siginfo.h which
    defines the generic struct siginfo. However this makes it awkward for an
    architecture to use it if it has to define its own struct siginfo (e.g.
    MIPS and potentially IA64), since it means that asm-generic/siginfo.h
    can only be included after defining the arch-specific siginfo, which may
    be problematic if the arch-specific definition needs definitions from
    uapi/asm-generic/siginfo.h.

    It is possible to work around this by first including
    uapi/asm-generic/siginfo.h to get the constants before defining the
    arch-specific siginfo, and include asm-generic/siginfo.h after. However
    uapi headers can't be included by other uapi headers, so that first
    include has to be in an ifdef __kernel__, with the non __kernel__ case
    including the non-UAPI header instead.

    Instead of that mess, move the generic copy_siginfo() definition into
    linux/signal.h, which allows an arch-specific uapi/asm/siginfo.h to
    include asm-generic/siginfo.h and define the arch-specific siginfo, and
    for the generic copy_siginfo() to see that arch-specific definition.

    Signed-off-by: James Hogan
    Cc: Arnd Bergmann
    Cc: Ralf Baechle
    Cc: Petr Malat
    Cc: Tony Luck
    Cc: Fenghua Yu
    Cc: Christopher Ferris
    Cc: linux-arch@vger.kernel.org
    Cc: linux-mips@linux-mips.org
    Cc: linux-ia64@vger.kernel.org
    Cc: linux-kernel@vger.kernel.org
    Cc: # 4.0-
    Patchwork: https://patchwork.linux-mips.org/patch/12478/
    Signed-off-by: Ralf Baechle

    James Hogan
     
  • Move retrieval of compat syscall numbers into inline function defined in
    asm-generic header so that arches may override it.

    [ralf@linux-mips.org: Resolve merge conflict.]

    Suggested-by: Paul Burton
    Signed-off-by: Matt Redfearn
    Acked-by: Kees Cook
    Cc: IMG-MIPSLinuxKerneldevelopers@imgtec.com
    Cc: Arnd Bergmann
    Cc: Andy Lutomirski
    Cc: Will Drewry
    Cc: linux-arch@vger.kernel.org
    Cc: linux-kernel@vger.kernel.org
    Patchwork: https://patchwork.linux-mips.org/patch/12978/
    Signed-off-by: Ralf Baechle

    Matt Redfearn
     

09 May, 2016

1 commit


05 May, 2016

1 commit


04 May, 2016

1 commit

  • Whilst commit 9439eb3ab9d1 ("asm-generic: io: implement relaxed
    accessor macros as conditional wrappers") makes the *_relaxed forms of
    I/O accessors universally available to drivers, in cases where writeq()
    is implemented via the io-64-nonatomic helpers, writeq_relaxed() will
    end up falling back to writel() regardless of whether writel_relaxed()
    is available (identically for s/write/read/).

    Add corresponding relaxed forms of the nonatomic helpers to delegate
    to the equivalent 32-bit accessors as appropriate. We also need to fix
    io.h to avoid defining default relaxed variants if the basic accessors
    themselves don't exist.

    CC: Christoph Hellwig
    CC: Darren Hart
    CC: Hitoshi Mitake
    Acked-by: Arnd Bergmann
    Signed-off-by: Robin Murphy
    Signed-off-by: Will Deacon

    Robin Murphy
     

21 Apr, 2016

1 commit

  • The recent decoupling of pagefault disable and preempt disable added an
    explicit preempt_disable/enable() pair to the futex_atomic_cmpxchg_inatomic()
    implementation in asm-generic/futex.h. But it forgot to add preempt_enable()
    calls to the error handling code pathes, which results in a preemption count
    imbalance.

    This is observable on boot when the test for atomic_cmpxchg() is calling
    futex_atomic_cmpxchg_inatomic() on a NULL pointer.

    Add the missing preempt_enable() calls to the error handling code pathes.

    [ tglx: Massaged changelog ]

    Fixes: d9b9ff8c1889 ("sched/preempt, futex: Disable preemption in UP futex_atomic_cmpxchg_inatomic() explicitly")
    Signed-off-by: Romain Perier
    Cc: linux-arch@vger.kernel.org
    Cc: Thomas Petazzoni
    Cc: Arnd Bergmann
    Cc: Peter Zijlstra
    Cc: stable@vger.kernel.org
    Link: http://lkml.kernel.org/r/1460640963-690-1-git-send-email-romain.perier@free-electrons.com
    Signed-off-by: Thomas Gleixner

    Romain Perier
     

13 Apr, 2016

3 commits

  • 04633df0c43d ("x86/cpu: Call verify_cpu() after having entered long mode too")
    added the call to verify_cpu() for sanitizing CPU configuration.

    The latter uses the stack minimally and it can happen that we land in
    startup_64() directly from a 64-bit bootloader. Then we want to use our
    own, known good stack.

    Do that.

    APs don't need this as the trampoline sets up a stack for them.

    Reported-by: Tom Lendacky
    Signed-off-by: Borislav Petkov
    Cc: Brian Gerst
    Cc: Linus Torvalds
    Cc: Mika Penttilä
    Cc: Peter Zijlstra
    Cc: Thomas Gleixner
    Link: http://lkml.kernel.org/r/1459434062-31055-1-git-send-email-bp@alien8.de
    Signed-off-by: Ingo Molnar

    Borislav Petkov
     
  • Introduce a generic implementation necessary for down_write_killable().

    This is a trivial extension of the already existing down_write() call
    which can be interrupted by SIGKILL. This patch doesn't provide
    down_write_killable() yet because arches have to provide the necessary
    pieces before.

    rwsem_down_write_failed() which is a generic slow path for the
    write lock is extended to take a task state and renamed to
    __rwsem_down_write_failed_common(). The return value is either a valid
    semaphore pointer or ERR_PTR(-EINTR).

    rwsem_down_write_failed_killable() is exported as a new way to wait for
    the lock and be killable.

    For rwsem-spinlock implementation the current __down_write() it updated
    in a similar way as __rwsem_down_write_failed_common() except it doesn't
    need new exports just visible __down_write_killable().

    Architectures which are not using the generic rwsem implementation are
    supposed to provide their __down_write_killable() implementation and
    use rwsem_down_write_failed_killable() for the slow path.

    Signed-off-by: Michal Hocko
    Cc: Andrew Morton
    Cc: Chris Zankel
    Cc: David S. Miller
    Cc: Linus Torvalds
    Cc: Max Filippov
    Cc: Paul E. McKenney
    Cc: Peter Zijlstra
    Cc: Signed-off-by: Davidlohr Bueso
    Cc: Signed-off-by: Jason Low
    Cc: Thomas Gleixner
    Cc: Tony Luck
    Cc: linux-alpha@vger.kernel.org
    Cc: linux-arch@vger.kernel.org
    Cc: linux-ia64@vger.kernel.org
    Cc: linux-s390@vger.kernel.org
    Cc: linux-sh@vger.kernel.org
    Cc: linux-xtensa@linux-xtensa.org
    Cc: sparclinux@vger.kernel.org
    Link: http://lkml.kernel.org/r/1460041951-22347-7-git-send-email-mhocko@kernel.org
    Signed-off-by: Ingo Molnar

    Michal Hocko
     
  • This is no longer used anywhere and all callers (__down_write()) use
    0 as a subclass. Ditch __down_write_nested() to make the code easier
    to follow.

    This shouldn't introduce any functional change.

    Signed-off-by: Michal Hocko
    Acked-by: Davidlohr Bueso
    Cc: Andrew Morton
    Cc: Chris Zankel
    Cc: David S. Miller
    Cc: Linus Torvalds
    Cc: Max Filippov
    Cc: Paul E. McKenney
    Cc: Peter Zijlstra
    Cc: Signed-off-by: Davidlohr Bueso
    Cc: Signed-off-by: Jason Low
    Cc: Thomas Gleixner
    Cc: Tony Luck
    Cc: linux-alpha@vger.kernel.org
    Cc: linux-arch@vger.kernel.org
    Cc: linux-ia64@vger.kernel.org
    Cc: linux-s390@vger.kernel.org
    Cc: linux-sh@vger.kernel.org
    Cc: linux-xtensa@linux-xtensa.org
    Cc: sparclinux@vger.kernel.org
    Link: http://lkml.kernel.org/r/1460041951-22347-2-git-send-email-mhocko@kernel.org
    Signed-off-by: Ingo Molnar

    Michal Hocko
     

26 Mar, 2016

1 commit

  • KASAN needs to know whether the allocation happens in an IRQ handler.
    This lets us strip everything below the IRQ entry point to reduce the
    number of unique stack traces needed to be stored.

    Move the definition of __irq_entry to so that the
    users don't need to pull in . Also introduce the
    __softirq_entry macro which is similar to __irq_entry, but puts the
    corresponding functions to the .softirqentry.text section.

    Signed-off-by: Alexander Potapenko
    Acked-by: Steven Rostedt
    Cc: Christoph Lameter
    Cc: Pekka Enberg
    Cc: David Rientjes
    Cc: Joonsoo Kim
    Cc: Andrey Konovalov
    Cc: Dmitry Vyukov
    Cc: Andrey Ryabinin
    Cc: Konstantin Serebryany
    Cc: Dmitry Chernenkov
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Alexander Potapenko
     

25 Mar, 2016

2 commits

  • Pull asm-generic updates from Arnd Bergmann:
    "There are only three patches this time, most other changes to files in
    include/asm-generic tend to go through the tree of whoever depends on
    the change.

    Two patches are cleanups for stuff that is no longer needed, the main
    change is to adapt the generic version of BUG_ON() for CONFIG_BUG=n to
    make it behave consistently with BUG().

    This avoids undefined behavior along with a number of warnings about
    that undefined behavior in randconfig builds when we keep going on
    after hitting a BUG_ON()"

    * tag 'asm-generic-4.6' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/asm-generic:
    asm-generic: remove old nonatomic-io wrapper files
    asm-generic: default BUG_ON(x) to if(x)BUG()
    asm-generic: page.h: Remove useless get_user_page and free_user_page

    Linus Torvalds
     
  • Pull locking fixes from Ingo Molnar:
    "Documentation updates and a bitops ordering fix"

    * 'locking-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
    bitops: Do not default to __clear_bit() for __clear_bit_unlock()
    documentation: Clarify compiler store-fusion example
    documentation: Transitivity is not cumulativity
    documentation: Add alternative release-acquire outcome
    documentation: Distinguish between local and global transitivity
    documentation: Subsequent writes ordered by rcu_dereference()
    documentation: Remove obsolete reference to RCU-protected indexes
    documentation: Fix memory-barriers.txt section references
    documentation: Fix control dependency and identical stores

    Linus Torvalds
     

21 Mar, 2016

2 commits

  • __clear_bit_unlock() is a special little snowflake. While it carries the
    non-atomic '__' prefix, it is specifically documented to pair with
    test_and_set_bit() and therefore should be 'somewhat' atomic.

    Therefore the generic implementation of __clear_bit_unlock() cannot use
    the fully non-atomic __clear_bit() as a default.

    If an arch is able to do better; is must provide an implementation of
    __clear_bit_unlock() itself.

    Specifically, this came up as a result of hackbench livelock'ing in
    slab_lock() on ARC with SMP + SLUB + !LLSC.

    The issue was incorrect pairing of atomic ops.

    slab_lock() -> bit_spin_lock() -> test_and_set_bit()
    slab_unlock() -> __bit_spin_unlock() -> __clear_bit()

    The non serializing __clear_bit() was getting "lost"

    80543b8e: ld_s r2,[r13,0]
    Tested-by: Vineet Gupta
    Signed-off-by: Peter Zijlstra (Intel)
    Cc: Andrew Morton
    Cc: Christoph Lameter
    Cc: David Rientjes
    Cc: Helge Deller
    Cc: James E.J. Bottomley
    Cc: Joonsoo Kim
    Cc: Linus Torvalds
    Cc: Noam Camus
    Cc: Paul E. McKenney
    Cc: Pekka Enberg
    Cc: Peter Zijlstra
    Cc: Thomas Gleixner
    Cc: stable@vger.kernel.org
    Link: http://lkml.kernel.org/r/20160309114054.GJ6356@twins.programming.kicks-ass.net
    Signed-off-by: Ingo Molnar

    Peter Zijlstra
     
  • Pull x86 protection key support from Ingo Molnar:
    "This tree adds support for a new memory protection hardware feature
    that is available in upcoming Intel CPUs: 'protection keys' (pkeys).

    There's a background article at LWN.net:

    https://lwn.net/Articles/643797/

    The gist is that protection keys allow the encoding of
    user-controllable permission masks in the pte. So instead of having a
    fixed protection mask in the pte (which needs a system call to change
    and works on a per page basis), the user can map a (handful of)
    protection mask variants and can change the masks runtime relatively
    cheaply, without having to change every single page in the affected
    virtual memory range.

    This allows the dynamic switching of the protection bits of large
    amounts of virtual memory, via user-space instructions. It also
    allows more precise control of MMU permission bits: for example the
    executable bit is separate from the read bit (see more about that
    below).

    This tree adds the MM infrastructure and low level x86 glue needed for
    that, plus it adds a high level API to make use of protection keys -
    if a user-space application calls:

    mmap(..., PROT_EXEC);

    or

    mprotect(ptr, sz, PROT_EXEC);

    (note PROT_EXEC-only, without PROT_READ/WRITE), the kernel will notice
    this special case, and will set a special protection key on this
    memory range. It also sets the appropriate bits in the Protection
    Keys User Rights (PKRU) register so that the memory becomes unreadable
    and unwritable.

    So using protection keys the kernel is able to implement 'true'
    PROT_EXEC on x86 CPUs: without protection keys PROT_EXEC implies
    PROT_READ as well. Unreadable executable mappings have security
    advantages: they cannot be read via information leaks to figure out
    ASLR details, nor can they be scanned for ROP gadgets - and they
    cannot be used by exploits for data purposes either.

    We know about no user-space code that relies on pure PROT_EXEC
    mappings today, but binary loaders could start making use of this new
    feature to map binaries and libraries in a more secure fashion.

    There is other pending pkeys work that offers more high level system
    call APIs to manage protection keys - but those are not part of this
    pull request.

    Right now there's a Kconfig that controls this feature
    (CONFIG_X86_INTEL_MEMORY_PROTECTION_KEYS) that is default enabled
    (like most x86 CPU feature enablement code that has no runtime
    overhead), but it's not user-configurable at the moment. If there's
    any serious problem with this then we can make it configurable and/or
    flip the default"

    * 'mm-pkeys-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (38 commits)
    x86/mm/pkeys: Fix mismerge of protection keys CPUID bits
    mm/pkeys: Fix siginfo ABI breakage caused by new u64 field
    x86/mm/pkeys: Fix access_error() denial of writes to write-only VMA
    mm/core, x86/mm/pkeys: Add execute-only protection keys support
    x86/mm/pkeys: Create an x86 arch_calc_vm_prot_bits() for VMA flags
    x86/mm/pkeys: Allow kernel to modify user pkey rights register
    x86/fpu: Allow setting of XSAVE state
    x86/mm: Factor out LDT init from context init
    mm/core, x86/mm/pkeys: Add arch_validate_pkey()
    mm/core, arch, powerpc: Pass a protection key in to calc_vm_flag_bits()
    x86/mm/pkeys: Actually enable Memory Protection Keys in the CPU
    x86/mm/pkeys: Add Kconfig prompt to existing config option
    x86/mm/pkeys: Dump pkey from VMA in /proc/pid/smaps
    x86/mm/pkeys: Dump PKRU with other kernel registers
    mm/core, x86/mm/pkeys: Differentiate instruction fetches
    x86/mm/pkeys: Optimize fault handling in access_error()
    mm/core: Do not enforce PKEY permissions on remote mm access
    um, pkeys: Add UML arch_*_access_permitted() methods
    mm/gup, x86/mm/pkeys: Check VMAs and PTEs for protection keys
    x86/mm/gup: Simplify get_user_pages() PTE bit handling
    ...

    Linus Torvalds
     

20 Mar, 2016

1 commit

  • Pull networking updates from David Miller:
    "Highlights:

    1) Support more Realtek wireless chips, from Jes Sorenson.

    2) New BPF types for per-cpu hash and arrap maps, from Alexei
    Starovoitov.

    3) Make several TCP sysctls per-namespace, from Nikolay Borisov.

    4) Allow the use of SO_REUSEPORT in order to do per-thread processing
    of incoming TCP/UDP connections. The muxing can be done using a
    BPF program which hashes the incoming packet. From Craig Gallek.

    5) Add a multiplexer for TCP streams, to provide a messaged based
    interface. BPF programs can be used to determine the message
    boundaries. From Tom Herbert.

    6) Add 802.1AE MACSEC support, from Sabrina Dubroca.

    7) Avoid factorial complexity when taking down an inetdev interface
    with lots of configured addresses. We were doing things like
    traversing the entire address less for each address removed, and
    flushing the entire netfilter conntrack table for every address as
    well.

    8) Add and use SKB bulk free infrastructure, from Jesper Brouer.

    9) Allow offloading u32 classifiers to hardware, and implement for
    ixgbe, from John Fastabend.

    10) Allow configuring IRQ coalescing parameters on a per-queue basis,
    from Kan Liang.

    11) Extend ethtool so that larger link mode masks can be supported.
    From David Decotigny.

    12) Introduce devlink, which can be used to configure port link types
    (ethernet vs Infiniband, etc.), port splitting, and switch device
    level attributes as a whole. From Jiri Pirko.

    13) Hardware offload support for flower classifiers, from Amir Vadai.

    14) Add "Local Checksum Offload". Basically, for a tunneled packet
    the checksum of the outer header is 'constant' (because with the
    checksum field filled into the inner protocol header, the payload
    of the outer frame checksums to 'zero'), and we can take advantage
    of that in various ways. From Edward Cree"

    * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next: (1548 commits)
    bonding: fix bond_get_stats()
    net: bcmgenet: fix dma api length mismatch
    net/mlx4_core: Fix backward compatibility on VFs
    phy: mdio-thunder: Fix some Kconfig typos
    lan78xx: add ndo_get_stats64
    lan78xx: handle statistics counter rollover
    RDS: TCP: Remove unused constant
    RDS: TCP: Add sysctl tunables for sndbuf/rcvbuf on rds-tcp socket
    net: smc911x: convert pxa dma to dmaengine
    team: remove duplicate set of flag IFF_MULTICAST
    bonding: remove duplicate set of flag IFF_MULTICAST
    net: fix a comment typo
    ethernet: micrel: fix some error codes
    ip_tunnels, bpf: define IP_TUNNEL_OPTS_MAX and use it
    bpf, dst: add and use dst_tclassid helper
    bpf: make skb->tc_classid also readable
    net: mvneta: bm: clarify dependencies
    cls_bpf: reset class and reuse major in da
    ldmvsw: Checkpatch sunvnet.c and sunvnet_common.c
    ldmvsw: Add ldmvsw.c driver code
    ...

    Linus Torvalds
     

19 Mar, 2016

1 commit

  • Merge second patch-bomb from Andrew Morton:

    - a couple of hotfixes

    - the rest of MM

    - a new timer slack control in procfs

    - a couple of procfs fixes

    - a few misc things

    - some printk tweaks

    - lib/ updates, notably to radix-tree.

    - add my and Nick Piggin's old userspace radix-tree test harness to
    tools/testing/radix-tree/. Matthew said it was a godsend during the
    radix-tree work he did.

    - a few code-size improvements, switching to __always_inline where gcc
    screwed up.

    - partially implement character sets in sscanf

    * emailed patches from Andrew Morton : (118 commits)
    sscanf: implement basic character sets
    lib/bug.c: use common WARN helper
    param: convert some "on"/"off" users to strtobool
    lib: add "on"/"off" support to kstrtobool
    lib: update single-char callers of strtobool()
    lib: move strtobool() to kstrtobool()
    include/linux/unaligned: force inlining of byteswap operations
    include/uapi/linux/byteorder, swab: force inlining of some byteswap operations
    include/asm-generic/atomic-long.h: force inlining of some atomic_long operations
    usb: common: convert to use match_string() helper
    ide: hpt366: convert to use match_string() helper
    ata: hpt366: convert to use match_string() helper
    power: ab8500: convert to use match_string() helper
    power: charger_manager: convert to use match_string() helper
    drm/edid: convert to use match_string() helper
    pinctrl: convert to use match_string() helper
    device property: convert to use match_string() helper
    lib/string: introduce match_string() helper
    radix-tree tests: add test for radix_tree_iter_next
    radix-tree tests: add regression3 test
    ...

    Linus Torvalds
     

18 Mar, 2016

7 commits

  • Pull GPIO updates from Linus Walleij:
    "This is the bulk of GPIO changes for kernel v4.6. There is quite a
    lot of interesting stuff going on.

    The patches to other subsystems and arch-wide are ACKed as far as
    possible, though I consider things like per-arch as
    essentially a part of the GPIO subsystem so it should not be needed.

    Core changes:

    - The gpio_chip is now a *real device*. Until now the gpio chips
    were just piggybacking the parent device or (gasp) floating in
    space outside of the device model.

    We now finally make GPIO chips devices. The gpio_chip will create
    a gpio_device which contains a struct device, and this gpio_device
    struct is kept private. Anything that needs to be kept private
    from the rest of the kernel will gradually be moved over to the
    gpio_device.

    - As a result of making the gpio_device a real device, we have added
    resource management, so devm_gpiochip_add_data() will cut down on
    overhead and reduce code lines. A huge slew of patches convert
    almost all drivers in the subsystem to use this.

    - Building on making the GPIO a real device, we add the first step of
    a new userspace ABI: the GPIO character device. We take small
    steps here, so we first add a pure *information* ABI and the tool
    "lsgpio" that will list all GPIO devices on the system and all
    lines on these devices.

    We can now discover GPIOs properly from userspace. We still have
    not come up with a way to actually *use* GPIOs from userspace.

    - To encourage people to use the character device for the future, we
    have it always-enabled when using GPIO. The old sysfs ABI is still
    opt-in (and can be used in parallel), but is marked as deprecated.

    We will keep it around for the foreseeable future, but it will not
    be extended to cover ever more use cases.

    Cleanup:

    - Bjorn Helgaas removed a whole slew of per-architecture
    includes.

    This dates back to when GPIO was an opt-in feature and no shared
    library even existed: just a header file with proper prototypes was
    provided and all semantics were up to the arch to implement. These
    patches make the GPIO chip even more a proper device and cleans out
    leftovers of the old in-kernel API here and there.

    Still some cruft is left but it's very little now.

    - There is still some clamping of return values for .get() going on,
    but we now return sane values in the vast majority of drivers and
    the errorpath is sanitized. Some patches for powerpc, blackfin and
    unicore still drop in.

    - We continue to switch the ARM, MIPS, blackfin, m68k local GPIO
    implementations to use gpiochip_add_data() and cut down on code
    lines.

    - MPC8xxx is converted to use the generic GPIO helpers.

    - ATH79 is converted to use the generic GPIO helpers.

    New drivers:

    - WinSystems WS16C48

    - Acces 104-DIO-48E

    - F81866 (a F7188x variant)

    - Qoric (a MPC8xxx variant)

    - TS-4800

    - SPI serializers (pisosr): simple 74xx shift registers connected to
    SPI to obtain a dirt-cheap output-only GPIO expander.

    - Texas Instruments TPIC2810

    - Texas Instruments TPS65218

    - Texas Instruments TPS65912

    - X-Gene (ARM64) standby GPIO controller"

    * tag 'gpio-v4.6-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio: (194 commits)
    Revert "Share upstreaming patches"
    gpio: mcp23s08: Fix clearing of interrupt.
    gpiolib: Fix comment referring to gpio_*() in gpiod_*()
    gpio: pca953x: Fix pca953x_gpio_set_multiple() on 64-bit
    gpio: xgene: Fix kconfig for standby GIPO contoller
    gpio: Add generic serializer DT binding
    gpio: uapi: use 0xB4 as ioctl() major
    gpio: tps65912: fix bad merge
    Revert "gpio: lp3943: Drop pin_used and lp3943_gpio_request/lp3943_gpio_free"
    gpio: omap: drop dev field from gpio_bank structure
    gpio: mpc8xxx: Slightly update the code for better readability
    gpio: mpc8xxx: Remove *read_reg and *write_reg from struct mpc8xxx_gpio_chip
    gpio: mpc8xxx: Fixup setting gpio direction output
    gpio: mcp23s08: Add support for mcp23s18
    dt-bindings: gpio: altera: Fix altr,interrupt-type property
    gpio: add driver for MEN 16Z127 GPIO controller
    gpio: lp3943: Drop pin_used and lp3943_gpio_request/lp3943_gpio_free
    gpio: timberdale: Switch to devm_ioremap_resource()
    gpio: ts4800: Add IMX51 dependency
    gpiolib: rewrite gpiodev_add_to_list
    ...

    Linus Torvalds
     
  • Pull arm64 updates from Catalin Marinas:
    "Here are the main arm64 updates for 4.6. There are some relatively
    intrusive changes to support KASLR, the reworking of the kernel
    virtual memory layout and initial page table creation.

    Summary:

    - Initial page table creation reworked to avoid breaking large block
    mappings (huge pages) into smaller ones. The ARM architecture
    requires break-before-make in such cases to avoid TLB conflicts but
    that's not always possible on live page tables

    - Kernel virtual memory layout: the kernel image is no longer linked
    to the bottom of the linear mapping (PAGE_OFFSET) but at the bottom
    of the vmalloc space, allowing the kernel to be loaded (nearly)
    anywhere in physical RAM

    - Kernel ASLR: position independent kernel Image and modules being
    randomly mapped in the vmalloc space with the randomness is
    provided by UEFI (efi_get_random_bytes() patches merged via the
    arm64 tree, acked by Matt Fleming)

    - Implement relative exception tables for arm64, required by KASLR
    (initial code for ARCH_HAS_RELATIVE_EXTABLE added to lib/extable.c
    but actual x86 conversion to deferred to 4.7 because of the merge
    dependencies)

    - Support for the User Access Override feature of ARMv8.2: this
    allows uaccess functions (get_user etc.) to be implemented using
    LDTR/STTR instructions. Such instructions, when run by the kernel,
    perform unprivileged accesses adding an extra level of protection.
    The set_fs() macro is used to "upgrade" such instruction to
    privileged accesses via the UAO bit

    - Half-precision floating point support (part of ARMv8.2)

    - Optimisations for CPUs with or without a hardware prefetcher (using
    run-time code patching)

    - copy_page performance improvement to deal with 128 bytes at a time

    - Sanity checks on the CPU capabilities (via CPUID) to prevent
    incompatible secondary CPUs from being brought up (e.g. weird
    big.LITTLE configurations)

    - valid_user_regs() reworked for better sanity check of the
    sigcontext information (restored pstate information)

    - ACPI parking protocol implementation

    - CONFIG_DEBUG_RODATA enabled by default

    - VDSO code marked as read-only

    - DEBUG_PAGEALLOC support

    - ARCH_HAS_UBSAN_SANITIZE_ALL enabled

    - Erratum workaround Cavium ThunderX SoC

    - set_pte_at() fix for PROT_NONE mappings

    - Code clean-ups"

    * tag 'arm64-upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux: (99 commits)
    arm64: kasan: Fix zero shadow mapping overriding kernel image shadow
    arm64: kasan: Use actual memory node when populating the kernel image shadow
    arm64: Update PTE_RDONLY in set_pte_at() for PROT_NONE permission
    arm64: Fix misspellings in comments.
    arm64: efi: add missing frame pointer assignment
    arm64: make mrs_s prefixing implicit in read_cpuid
    arm64: enable CONFIG_DEBUG_RODATA by default
    arm64: Rework valid_user_regs
    arm64: mm: check at build time that PAGE_OFFSET divides the VA space evenly
    arm64: KVM: Move kvm_call_hyp back to its original localtion
    arm64: mm: treat memstart_addr as a signed quantity
    arm64: mm: list kernel sections in order
    arm64: lse: deal with clobbered IP registers after branch via PLT
    arm64: mm: dump: Use VA_START directly instead of private LOWEST_ADDR
    arm64: kconfig: add submenu for 8.2 architectural features
    arm64: kernel: acpi: fix ioremap in ACPI parking protocol cpu_postboot
    arm64: Add support for Half precision floating point
    arm64: Remove fixmap include fragility
    arm64: Add workaround for Cavium erratum 27456
    arm64: mm: Mark .rodata as RO
    ...

    Linus Torvalds
     
  • The traceoff_on_warning option doesn't have any effect on s390, powerpc,
    arm64, parisc, and sh because there are two different types of WARN
    implementations:

    1) The above mentioned architectures treat WARN() as a special case of a
    BUG() exception. They handle warnings in report_bug() in lib/bug.c.

    2) All other architectures just call warn_slowpath_*() directly. Their
    warnings are handled in warn_slowpath_common() in kernel/panic.c.

    Support traceoff_on_warning on all architectures and prevent any future
    divergence by using a single common function to emit the warning.

    Also remove the '()' from '%pS()', because the parentheses look funky:

    [ 45.607629] WARNING: at /root/warn_mod/warn_mod.c:17 .init_dummy+0x20/0x40 [warn_mod]()

    Reported-by: Chunyu Hu
    Signed-off-by: Josh Poimboeuf
    Acked-by: Heiko Carstens
    Tested-by: Prarit Bhargava
    Acked-by: Prarit Bhargava
    Acked-by: Steven Rostedt
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Josh Poimboeuf
     
  • Sometimes gcc mysteriously doesn't inline
    very small functions we expect to be inlined. See

    https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66122

    With this .config:
    http://busybox.net/~vda/kernel_config_OPTIMIZE_INLINING_and_Os,
    atomic_long_inc(), atomic_long_dec() and atomic_long_add()
    functions get deinlined about 40 times. Examples of disassembly:

    (21 copies, 147 calls):
    55 push %rbp
    48 89 e5 mov %rsp,%rbp
    f0 48 ff 07 lock incq (%rdi)
    5d pop %rbp
    c3 retq

    (4 copies, 14 calls) is similar to inc.

    (11 copies, 41 calls):
    55 push %rbp
    48 89 e5 mov %rsp,%rbp
    f0 48 01 3e lock add %rdi,(%rsi)
    5d pop %rbp
    c3 retq

    This patch fixes this via s/inline/__always_inline/.
    Code size decrease after the patch is ~1.3k:

    text data bss dec hex filename
    92203657 20826112 36417536 149447305 8e86289 vmlinux
    92202377 20826112 36417536 149446025 8e85d89 vmlinux4_atomiclong_after

    Signed-off-by: Denys Vlasenko
    Cc: Ingo Molnar
    Cc: Thomas Graf
    Cc: Peter Zijlstra
    Cc: David Rientjes
    Cc: Arnd Bergmann
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Denys Vlasenko
     
  • This has hit me a couple of times already. I would be debugging code
    and the system would simply hang and then reboot. Finally, I found that
    the problem was caused by WARN_ON_ONCE() and friends.

    The macro WARN_ON_ONCE(condition) is defined as:

    static bool __section(.data.unlikely) __warned;
    int __ret_warn_once = !!(condition);

    if (unlikely(__ret_warn_once))
    if (WARN_ON(!__warned))
    __warned = true;

    unlikely(__ret_warn_once);

    Which looks great and all. But what I have hit, is an issue when
    WARN_ON() itself hits the same WARN_ON_ONCE() code. Because, the
    variable __warned is not yet set. Then it too calls WARN_ON() and that
    triggers the warning again. It keeps doing this until the stack is
    overflowed and the system crashes.

    By setting __warned first before calling WARN_ON() makes the original
    WARN_ON_ONCE() really only warn once, and not an infinite amount of
    times if the WARN_ON() also triggers the warning.

    Signed-off-by: Steven Rostedt
    Acked-by: Peter Zijlstra (Intel)
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Steven Rostedt
     
  • We remove one instace of flush_tlb_range here. That was added by commit
    f714f4f20e59 ("mm: numa: call MMU notifiers on THP migration"). But the
    pmdp_huge_clear_flush_notify should have done the require flush for us.
    Hence remove the extra flush.

    Signed-off-by: Aneesh Kumar K.V
    Cc: Mel Gorman
    Cc: "Kirill A. Shutemov"
    Cc: Vineet Gupta
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Aneesh Kumar K.V
     
  • Pull tty/serial updates from Greg KH:
    "Here's the big tty/serial driver pull request for 4.6-rc1.

    Lots of changes in here, Peter has been on a tear again, with lots of
    refactoring and bugs fixes, many thanks to the great work he has been
    doing. Lots of driver updates and fixes as well, full details in the
    shortlog.

    All have been in linux-next for a while with no reported issues"

    * tag 'tty-4.6-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty: (220 commits)
    serial: 8250: describe CONFIG_SERIAL_8250_RSA
    serial: samsung: optimize UART rx fifo access routine
    serial: pl011: add mark/space parity support
    serial: sa1100: make sa1100_register_uart_fns a function
    tty: serial: 8250: add MOXA Smartio MUE boards support
    serial: 8250: convert drivers to use up_to_u8250p()
    serial: 8250/mediatek: fix building with SERIAL_8250=m
    serial: 8250/ingenic: fix building with SERIAL_8250=m
    serial: 8250/uniphier: fix modular build
    Revert "drivers/tty/serial: make 8250/8250_ingenic.c explicitly non-modular"
    Revert "drivers/tty/serial: make 8250/8250_mtk.c explicitly non-modular"
    serial: mvebu-uart: initial support for Armada-3700 serial port
    serial: mctrl_gpio: Add missing module license
    serial: ifx6x60: avoid uninitialized variable use
    tty/serial: at91: fix bad offset for UART timeout register
    tty/serial: at91: restore dynamic driver binding
    serial: 8250: Add hardware dependency to RT288X option
    TTY, devpts: document pty count limiting
    tty: goldfish: support platform_device with id -1
    drivers: tty: goldfish: Add device tree bindings
    ...

    Linus Torvalds
     

17 Mar, 2016

1 commit

  • Pull PCI updates from Bjorn Helgaas:
    "PCI changes for v4.6:

    Enumeration:
    - Disable IO/MEM decoding for devices with non-compliant BARs (Bjorn Helgaas)
    - Mark Broadwell-EP Home Agent & PCU as having non-compliant BARs (Bjorn Helgaas

    Resource management:
    - Mark shadow copy of VGA ROM as IORESOURCE_PCI_FIXED (Bjorn Helgaas)
    - Don't assign or reassign immutable resources (Bjorn Helgaas)
    - Don't enable/disable ROM BAR if we're using a RAM shadow copy (Bjorn Helgaas)
    - Set ROM shadow location in arch code, not in PCI core (Bjorn Helgaas)
    - Remove arch-specific IORESOURCE_ROM_SHADOW size from sysfs (Bjorn Helgaas)
    - ia64: Use ioremap() instead of open-coded equivalent (Bjorn Helgaas)
    - ia64: Keep CPU physical (not virtual) addresses in shadow ROM resource (Bjorn Helgaas)
    - MIPS: Keep CPU physical (not virtual) addresses in shadow ROM resource (Bjorn Helgaas)
    - Remove unused IORESOURCE_ROM_COPY and IORESOURCE_ROM_BIOS_COPY (Bjorn Helgaas)
    - Don't leak memory if sysfs_create_bin_file() fails (Bjorn Helgaas)
    - rcar: Remove PCI_PROBE_ONLY handling (Lorenzo Pieralisi)
    - designware: Remove PCI_PROBE_ONLY handling (Lorenzo Pieralisi)

    Virtualization:
    - Wait for up to 1000ms after FLR reset (Alex Williamson)
    - Support SR-IOV on any function type (Kelly Zytaruk)
    - Add ACS quirk for all Cavium devices (Manish Jaggi)

    AER:
    - Rename pci_ops_aer to aer_inj_pci_ops (Bjorn Helgaas)
    - Restore pci_ops pointer while calling original pci_ops (David Daney)
    - Fix aer_inject error codes (Jean Delvare)
    - Use dev_warn() in aer_inject (Jean Delvare)
    - Log actual error causes in aer_inject (Jean Delvare)
    - Log aer_inject error injections (Jean Delvare)

    VPD:
    - Prevent VPD access for buggy devices (Babu Moger)
    - Move pci_read_vpd() and pci_write_vpd() close to other VPD code (Bjorn Helgaas)
    - Move pci_vpd_release() from header file to pci/access.c (Bjorn Helgaas)
    - Remove struct pci_vpd_ops.release function pointer (Bjorn Helgaas)
    - Rename VPD symbols to remove unnecessary "pci22" (Bjorn Helgaas)
    - Fold struct pci_vpd_pci22 into struct pci_vpd (Bjorn Helgaas)
    - Sleep rather than busy-wait for VPD access completion (Bjorn Helgaas)
    - Update VPD definitions (Hannes Reinecke)
    - Allow access to VPD attributes with size 0 (Hannes Reinecke)
    - Determine actual VPD size on first access (Hannes Reinecke)

    Generic host bridge driver:
    - Move structure definitions to separate header file (David Daney)
    - Add pci_host_common_probe(), based on gen_pci_probe() (David Daney)
    - Expose pci_host_common_probe() for use by other drivers (David Daney)

    Altera host bridge driver:
    - Fix altera_pcie_link_is_up() (Ley Foon Tan)

    Cavium ThunderX host bridge driver:
    - Add PCIe host driver for ThunderX processors (David Daney)
    - Add driver for ThunderX-pass{1,2} on-chip devices (David Daney)

    Freescale i.MX6 host bridge driver:
    - Add DT bindings to configure PHY Tx driver settings (Justin Waters)
    - Move imx6_pcie_reset_phy() near other PHY handling functions (Lucas Stach)
    - Move PHY reset into imx6_pcie_establish_link() (Lucas Stach)
    - Remove broken Gen2 workaround (Lucas Stach)
    - Move link up check into imx6_pcie_wait_for_link() (Lucas Stach)

    Freescale Layerscape host bridge driver:
    - Add "fsl,ls2085a-pcie" compatible ID (Yang Shi)

    Intel VMD host bridge driver:
    - Attach VMD resources to parent domain's resource tree (Jon Derrick)
    - Set bus resource start to 0 (Keith Busch)

    Microsoft Hyper-V host bridge driver:
    - Add fwnode_handle to x86 pci_sysdata (Jake Oshins)
    - Look up IRQ domain by fwnode_handle (Jake Oshins)
    - Add paravirtual PCI front-end for Microsoft Hyper-V VMs (Jake Oshins)

    NVIDIA Tegra host bridge driver:
    - Add pci_ops.{add,remove}_bus() callbacks (Thierry Reding)
    - Implement ->{add,remove}_bus() callbacks (Thierry Reding)
    - Remove unused struct tegra_pcie.num_ports field (Thierry Reding)
    - Track bus -> CPU mapping (Thierry Reding)
    - Remove misleading PHYS_OFFSET (Thierry Reding)

    Renesas R-Car host bridge driver:
    - Depend on ARCH_RENESAS, not ARCH_SHMOBILE (Simon Horman)

    Synopsys DesignWare host bridge driver:
    - ARC: Add PCI support (Joao Pinto)
    - Add generic dw_pcie_wait_for_link() (Joao Pinto)
    - Add default link up check if sub-driver doesn't override (Joao Pinto)
    - Add driver for prototyping kits based on ARC SDP (Joao Pinto)

    TI Keystone host bridge driver:
    - Defer probing if devm_phy_get() returns -EPROBE_DEFER (Shawn Lin)

    Xilinx AXI host bridge driver:
    - Use of_pci_get_host_bridge_resources() to parse DT (Bharat Kumar Gogada)
    - Remove dependency on ARM-specific struct hw_pci (Bharat Kumar Gogada)
    - Don't call pci_fixup_irqs() on Microblaze (Bharat Kumar Gogada)
    - Update Zynq binding with Microblaze node (Bharat Kumar Gogada)
    - microblaze: Support generic Xilinx AXI PCIe Host Bridge IP driver (Bharat Kumar Gogada)

    Xilinx NWL host bridge driver:
    - Add support for Xilinx NWL PCIe Host Controller (Bharat Kumar Gogada)

    Miscellaneous:
    - Check device_attach() return value always (Bjorn Helgaas)
    - Move pci_set_flags() from asm-generic/pci-bridge.h to linux/pci.h (Bjorn Helgaas)
    - Remove includes of empty asm-generic/pci-bridge.h (Bjorn Helgaas)
    - ARM64: Remove generated include of asm-generic/pci-bridge.h (Bjorn Helgaas)
    - Remove empty asm-generic/pci-bridge.h (Bjorn Helgaas)
    - Remove includes of asm/pci-bridge.h (Bjorn Helgaas)
    - Consolidate PCI DMA constants and interfaces in linux/pci-dma-compat.h (Bjorn Helgaas)
    - unicore32: Remove unused HAVE_ARCH_PCI_SET_DMA_MASK definition (Bjorn Helgaas)
    - Cleanup pci/pcie/Kconfig whitespace (Andreas Ziegler)
    - Include pci/hotplug Kconfig directly from pci/Kconfig (Bjorn Helgaas)
    - Include pci/pcie/Kconfig directly from pci/Kconfig (Bogicevic Sasa)
    - frv: Remove stray pci_{alloc,free}_consistent() declaration (Christoph Hellwig)
    - Move pci_dma_* helpers to common code (Christoph Hellwig)
    - Add PCI_CLASS_SERIAL_USB_DEVICE definition (Heikki Krogerus)
    - Add QEMU top-level IDs for (sub)vendor & device (Robin H. Johnson)
    - Fix broken URL for Dell biosdevname (Naga Venkata Sai Indubhaskar Jupudi)"

    * tag 'pci-v4.6-changes' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci: (94 commits)
    PCI: Add PCI_CLASS_SERIAL_USB_DEVICE definition
    PCI: designware: Add driver for prototyping kits based on ARC SDP
    PCI: designware: Add default link up check if sub-driver doesn't override
    PCI: designware: Add generic dw_pcie_wait_for_link()
    PCI: Cleanup pci/pcie/Kconfig whitespace
    PCI: Simplify pci_create_attr() control flow
    PCI: Don't leak memory if sysfs_create_bin_file() fails
    PCI: Simplify sysfs ROM cleanup
    PCI: Remove unused IORESOURCE_ROM_COPY and IORESOURCE_ROM_BIOS_COPY
    MIPS: Loongson 3: Keep CPU physical (not virtual) addresses in shadow ROM resource
    MIPS: Loongson 3: Use temporary struct resource * to avoid repetition
    ia64/PCI: Keep CPU physical (not virtual) addresses in shadow ROM resource
    ia64/PCI: Use ioremap() instead of open-coded equivalent
    ia64/PCI: Use temporary struct resource * to avoid repetition
    PCI: Clean up pci_map_rom() whitespace
    PCI: Remove arch-specific IORESOURCE_ROM_SHADOW size from sysfs
    PCI: thunder: Add driver for ThunderX-pass{1,2} on-chip devices
    PCI: thunder: Add PCIe host driver for ThunderX processors
    PCI: generic: Expose pci_host_common_probe() for use by other drivers
    PCI: generic: Add pci_host_common_probe(), based on gen_pci_probe()
    ...

    Linus Torvalds
     

15 Mar, 2016

1 commit

  • Pull read-only kernel memory updates from Ingo Molnar:
    "This tree adds two (security related) enhancements to the kernel's
    handling of read-only kernel memory:

    - extend read-only kernel memory to a new class of formerly writable
    kernel data: 'post-init read-only memory' via the __ro_after_init
    attribute, and mark the ARM and x86 vDSO as such read-only memory.

    This kind of attribute can be used for data that requires a once
    per bootup initialization sequence, but is otherwise never modified
    after that point.

    This feature was based on the work by PaX Team and Brad Spengler.

    (by Kees Cook, the ARM vDSO bits by David Brown.)

    - make CONFIG_DEBUG_RODATA always enabled on x86 and remove the
    Kconfig option. This simplifies the kernel and also signals that
    read-only memory is the default model and a first-class citizen.
    (Kees Cook)"

    * 'mm-readonly-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
    ARM/vdso: Mark the vDSO code read-only after init
    x86/vdso: Mark the vDSO code read-only after init
    lkdtm: Verify that '__ro_after_init' works correctly
    arch: Introduce post-init read-only memory
    x86/mm: Always enable CONFIG_DEBUG_RODATA and remove the Kconfig option
    mm/init: Add 'rodata=off' boot cmdline parameter to disable read-only kernel mappings
    asm-generic: Consolidate mark_rodata_ro()

    Linus Torvalds
     

14 Mar, 2016

1 commit

  • This patch updates all instances of csum_tcpudp_magic and
    csum_tcpudp_nofold to reflect the types that are usually used as the source
    inputs. For example the protocol field is populated based on nexthdr which
    is actually an unsigned 8 bit value. The length is usually populated based
    on skb->len which is an unsigned integer.

    This addresses an issue in which the IPv6 function csum_ipv6_magic was
    generating a checksum using the full 32b of skb->len while
    csum_tcpudp_magic was only using the lower 16 bits. As a result we could
    run into issues when attempting to adjust the checksum as there was no
    protocol agnostic way to update it.

    With this change the value is still truncated as many architectures use
    "(len + proto) << 8", however this truncation only occurs for values
    greater than 16776960 in length and as such is unlikely to occur as we stop
    the inner headers at ~64K in size.

    I did have to make a few minor changes in the arm, mn10300, nios2, and
    score versions of the function in order to support these changes as they
    were either using things such as an OR to combine the protocol and length,
    or were using ntohs to convert the length which would have truncated the
    value.

    I also updated a few spots in terms of whitespace and type differences for
    the addresses. Most of this was just to make sure all of the definitions
    were in sync going forward.

    Signed-off-by: Alexander Duyck
    Signed-off-by: David S. Miller

    Alexander Duyck
     

08 Mar, 2016

1 commit

  • For a long time all architectures implement the pci_dma_* functions using
    the generic DMA API, and they all use the same header to do so.

    Move this header, pci-dma-compat.h, to include/linux and include it from
    the generic pci.h instead of having each arch duplicate this include.

    Signed-off-by: Christoph Hellwig
    Signed-off-by: Bjorn Helgaas

    Christoph Hellwig
     

02 Mar, 2016

2 commits

  • The two header files got moved to include/linux, and most
    users were already converted, this changes the remaining drivers
    and removes the files.

    Signed-off-by: Arnd Bergmann
    Reviewed-by: Christoph Hellwig
    Acked-by: Vinod Koul
    Acked-by: Simon Horman
    Acked-by: Yisen Zhuang

    Arnd Bergmann
     
  • When CONFIG_BUG is disabled, BUG_ON() will only evaluate the condition,
    but will not actually stop the current thread. GCC warns about a couple
    of BUG_ON() users where this actually leads to further undefined
    behavior:

    include/linux/ceph/osdmap.h: In function 'ceph_can_shift_osds':
    include/linux/ceph/osdmap.h:54:1: warning: control reaches end of non-void function
    fs/ext4/inode.c: In function 'ext4_map_blocks':
    fs/ext4/inode.c:548:5: warning: 'retval' may be used uninitialized in this function
    drivers/mfd/db8500-prcmu.c: In function 'prcmu_config_clkout':
    drivers/mfd/db8500-prcmu.c:762:10: warning: 'div_mask' may be used uninitialized in this function
    drivers/mfd/db8500-prcmu.c:769:13: warning: 'mask' may be used uninitialized in this function
    drivers/mfd/db8500-prcmu.c:757:7: warning: 'bits' may be used uninitialized in this function
    drivers/tty/serial/8250/8250_core.c: In function 'univ8250_release_irq':
    drivers/tty/serial/8250/8250_core.c:252:18: warning: 'i' may be used uninitialized in this function
    drivers/tty/serial/8250/8250_core.c:235:19: note: 'i' was declared here

    There is an obvious conflict of interest here: on the one hand, someone
    who disables CONFIG_BUG() will want the kernel to be as small as possible
    and doesn't care about printing error messages to a console that nobody
    looks at. On the other hand, running into a BUG_ON() condition means that
    something has gone wrong, and we probably want to also stop doing things
    that might cause data corruption.

    This patch picks the second choice, and changes the NOP to BUG(), which
    normally stops the execution of the current thread in some form (endless
    loop or a trap). This follows the logic we applied in a4b5d580e078 ("bug:
    Make BUG() always stop the machine").

    For ARM multi_v7_defconfig, the size slightly increases:

    section CONFIG_BUG=y CONFIG_BUG=n CONFIG_BUG=n+patch

    .text 8320248 | 8180944 | 8207688
    .rodata 3633720 | 3567144 | 3570648
    __bug_table 32508 | --- | ---
    __modver 692 | 1584 | 2176
    .init.text 558132 | 548300 | 550088
    .exit.text 12380 | 12256 | 12380
    .data 1016672 | 1016064 | 1016128
    Total 14622556 | 14374510 | 14407326

    So instead of saving 1.70% of the total image size, we only save 1.48%
    by turning off CONFIG_BUG, but in return we can ensure that we don't run
    into cases of uninitialized variable or return code uses when something
    bad happens. Aside from that, we significantly reduce the number of
    warnings in randconfig builds, which makes it easier to fix the warnings
    about other problems.

    Signed-off-by: Arnd Bergmann

    Arnd Bergmann
     

29 Feb, 2016

1 commit

  • Move the __ARCH_SPIN_LOCK_UNLOCKED definition from qspinlock.h into
    qspinlock_types.h.

    The definition of __ARCH_SPIN_LOCK_UNLOCKED comes from the build arch's
    include files; but on x86 when CONFIG_QUEUED_SPINLOCKS=y, it just
    it's defined in asm-generic/qspinlock.h. In most cases, this doesn't
    matter because linux/spinlock.h includes asm/spinlock.h, which for x86
    includes asm-generic/qspinlock.h. However, any code that only includes
    linux/mutex.h will break, because it only includes asm/spinlock_types.h.

    For example, this breaks systemtap, which only includes mutex.h.

    Signed-off-by: Dan Streetman
    Signed-off-by: Peter Zijlstra (Intel)
    Acked-by: Waiman Long
    Cc: Andrew Morton
    Cc: Arnd Bergmann
    Cc: Dan Streetman
    Cc: Linus Torvalds
    Cc: Paul E. McKenney
    Cc: Peter Zijlstra
    Cc: Thomas Gleixner
    Link: http://lkml.kernel.org/r/1455907767-17821-1-git-send-email-dan.streetman@canonical.com
    Signed-off-by: Ingo Molnar

    Dan Streetman
     

26 Feb, 2016

1 commit