12 Jan, 2017

1 commit

  • commit c7858bf16c0b2cc62f475f31e6df28c3a68da1d6 upstream.

    The asm-prototypes.h file is used to provide dummy function declarations
    for genksyms, when processing asm files with EXPORT_SYMBOL. Make sure
    that any architecture defines get out of our way. x86 currently has an
    issue with memcpy on 64bit with CONFIG_KMEMCHECK=y and with
    memset/__memset on 32bit:

    $ cat init/test.c
    #include
    $ make -s init/test.o
    In file included from ./arch/x86/include/asm/string.h:4:0,
    from ./include/linux/string.h:18,
    from ./include/linux/bitmap.h:8,
    from ./include/linux/cpumask.h:11,
    from ./arch/x86/include/asm/cpumask.h:4,
    from ./arch/x86/include/asm/msr.h:10,
    from ./arch/x86/include/asm/processor.h:20,
    from ./arch/x86/include/asm/cpufeature.h:4,
    from ./arch/x86/include/asm/thread_info.h:52,
    from ./include/linux/thread_info.h:25,
    from ./arch/x86/include/asm/preempt.h:6,
    from ./include/linux/preempt.h:59,
    from ./include/linux/spinlock.h:50,
    from ./include/linux/seqlock.h:35,
    from ./include/linux/time.h:5,
    from ./include/uapi/linux/timex.h:56,
    from ./include/linux/timex.h:56,
    from ./include/linux/sched.h:19,
    from ./include/linux/uaccess.h:4,
    from ./arch/x86/include/asm/asm-prototypes.h:2,
    from init/test.c:1:
    ./arch/x86/include/asm/string_64.h:52:47: error: expected declaration specifiers or ‘...’ before ‘(’ token
    #define memcpy(dst, src, len) __inline_memcpy((dst), (src), (len))
    ./include/asm-generic/asm-prototypes.h:6:14: note: in expansion of macro ‘memcpy’
    extern void *memcpy(void *, const void *, __kernel_size_t);

    ^
    ...

    During real build, this manifests itself by genksyms segfaulting.

    Fixes: 334bb7738764 ("x86/kbuild: enable modversions for symbols exported from asm")
    Reported-and-tested-by: Borislav Petkov
    Cc: Adam Borowski
    Signed-off-by: Michal Marek
    Signed-off-by: Greg Kroah-Hartman

    Michal Marek
     

06 Jan, 2017

1 commit

  • commit 334bb773876403eae3457d81be0b8ea70f8e4ccc upstream.

    Commit 4efca4ed ("kbuild: modversions for EXPORT_SYMBOL() for asm") adds
    modversion support for symbols exported from asm files. Architectures
    must include C-style declarations for those symbols in asm/asm-prototypes.h
    in order for them to be versioned.

    Add these declarations for x86, and an architecture-independent file that
    can be used for common symbols.

    With f27c2f6 reverting 8ab2ae6 ("default exported asm symbols to zero") we
    produce a scary warning on x86, this commit fixes that.

    Signed-off-by: Adam Borowski
    Tested-by: Kalle Valo
    Acked-by: Nicholas Piggin
    Tested-by: Peter Wu
    Tested-by: Oliver Hartkopp
    Signed-off-by: Michal Marek
    Signed-off-by: Greg Kroah-Hartman

    Adam Borowski
     

08 Dec, 2016

1 commit

  • This reverts commit 8ab2ae655bfe384335c5b6b0d6041e0ddce26b00.

    I loved that commit because of how it explained what the problem with
    newer versions of binutils were, but the actual patch itself turns out
    to not work very well.

    It has two problems:

    - a zero CRC value isn't actually right. It happens to work for the
    case where both sides of the equation fail at giving the symbol a
    crc, but there are cases where the users of the exported symbol get
    the right crc (due to seeing the C declarations), but the actual
    exporting itself does not (due to the whole weak asm symbol issue).

    So then the module load fails after all - we did have a crc for the
    symbol, but we couldn't match it with the loaded module.

    - it seems that the alpha assembler has special semantics for the
    '.set' directive, and on alpha it doesn't actually set the value of
    the specified symbol at all, it is instead used to set various
    assembly modes (eg ".set noat" and ".set noreorder").

    So using ".set" to set the symbol value would just cause build
    failures on alpha.

    I'm sure we'll find some other workaround for these issues (hopefully
    that involves getting rid of modversions entirely some day, but people
    are also talking about just using smarter tools). But for now we'll
    just fall back on commit faaae2a58143 ("Re-enable CONFIG_MODVERSIONS in
    a slightly weaker form") that just let's a missing crc through.

    Reported-by: Jan Stancek
    Reported-by: Philip Müller
    Reported-by: Guenter Roeck
    Cc: Arnd Bergmann
    Signed-off-by: Linus Torvalds

    Linus Torvalds
     

03 Dec, 2016

1 commit

  • With binutils-2.26 and before, a weak missing symbol was kept during the
    final link, and a missing CRC for an export would lead to that CRC being
    treated as zero implicitly. With binutils-2.27, the crc symbol gets
    dropped, and any module trying to use it will fail to load.

    This sets the weak CRC symbol to zero explicitly, making it defined in
    vmlinux, which in turn lets us load the modules referring to that CRC.

    The comment above the __CRC_SYMBOL macro suggests that this was always
    the intention, although it also seems that all symbols defined in C have
    a correct CRC these days, and only the exports that are now done in
    assembly need this.

    Signed-off-by: Arnd Bergmann
    Tested-by: Adam Borowski
    Cc: stable@kernel.org
    Signed-off-by: Linus Torvalds

    Arnd Bergmann
     

12 Nov, 2016

1 commit

  • Limit the number of kmemleak false positives by including
    .data.ro_after_init in memory scanning. To achieve this we need to add
    symbols for start and end of the section to the linker scripts.

    The problem was been uncovered by commit 56989f6d8568 ("genetlink: mark
    families as __ro_after_init").

    Link: http://lkml.kernel.org/r/1478274173-15218-1-git-send-email-jakub.kicinski@netronome.com
    Reviewed-by: Catalin Marinas
    Signed-off-by: Jakub Kicinski
    Cc: Arnd Bergmann
    Cc: Cong Wang
    Cc: Johannes Berg
    Cc: Martin Schwidefsky
    Cc: Heiko Carstens
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jakub Kicinski
     

08 Nov, 2016

1 commit

  • Commit 345ddcc882d8 ("ftrace: Have set_ftrace_pid use the bitmap like
    events do") added a couple of this_cpu_read calls to the ftrace code.

    On x86 this is not a problem, since it has single instructions to read
    percpu data. Other architectures which use the generic variant now
    have additional preempt_disable and preempt_enable calls in the core
    ftrace code. This may lead to recursive calls and in result to a dead
    machine, e.g. if preemption and debugging options are enabled.

    To fix this use the notrace variant of preempt_disable and
    preempt_enable within the generic percpu code.

    Reported-and-bisected-by: Sebastian Ott
    Tested-by: Sebastian Ott
    Fixes: 345ddcc882d8 ("ftrace: Have set_ftrace_pid use the bitmap like events do")
    Signed-off-by: Heiko Carstens
    Acked-by: Steven Rostedt
    Signed-off-by: Martin Schwidefsky

    Heiko Carstens
     

28 Oct, 2016

1 commit

  • The use of config_enabled() is ambiguous. For config options,
    IS_ENABLED(), IS_REACHABLE(), etc. will make intention clearer.
    Sometimes config_enabled() has been used for non-config options because
    it is useful to check whether the given symbol is defined or not.

    I have been tackling on deprecating config_enabled(), and now is the
    time to finish this work.

    Some new users have appeared for v4.9-rc1, but it is trivial to replace
    them:

    - arch/x86/mm/kaslr.c
    replace config_enabled() with IS_ENABLED() because
    CONFIG_X86_ESPFIX64 and CONFIG_EFI are boolean.

    - include/asm-generic/export.h
    replace config_enabled() with __is_defined().

    Then, config_enabled() can be removed now.

    Going forward, please use IS_ENABLED(), IS_REACHABLE(), etc. for config
    options, and __is_defined() for non-config symbols.

    Link: http://lkml.kernel.org/r/1476616078-32252-1-git-send-email-yamada.masahiro@socionext.com
    Signed-off-by: Masahiro Yamada
    Acked-by: Ingo Molnar
    Acked-by: Nicolas Pitre
    Cc: Peter Oberparleiter
    Cc: Arnd Bergmann
    Cc: Kees Cook
    Cc: Michal Marek
    Cc: "H. Peter Anvin"
    Cc: Thomas Gleixner
    Cc: Thomas Garnier
    Cc: Paul Bolle
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Masahiro Yamada
     

15 Oct, 2016

3 commits

  • Pull kbuild updates from Michal Marek:

    - EXPORT_SYMBOL for asm source by Al Viro.

    This does bring a regression, because genksyms no longer generates
    checksums for these symbols (CONFIG_MODVERSIONS). Nick Piggin is
    working on a patch to fix this.

    Plus, we are talking about functions like strcpy(), which rarely
    change prototypes.

    - Fixes for PPC fallout of the above by Stephen Rothwell and Nick
    Piggin

    - fixdep speedup by Alexey Dobriyan.

    - preparatory work by Nick Piggin to allow architectures to build with
    -ffunction-sections, -fdata-sections and --gc-sections

    - CONFIG_THIN_ARCHIVES support by Stephen Rothwell

    - fix for filenames with colons in the initramfs source by me.

    * 'kbuild' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild: (22 commits)
    initramfs: Escape colons in depfile
    ppc: there is no clear_pages to export
    powerpc/64: whitelist unresolved modversions CRCs
    kbuild: -ffunction-sections fix for archs with conflicting sections
    kbuild: add arch specific post-link Makefile
    kbuild: allow archs to select link dead code/data elimination
    kbuild: allow architectures to use thin archives instead of ld -r
    kbuild: Regenerate genksyms lexer
    kbuild: genksyms fix for typeof handling
    fixdep: faster CONFIG_ search
    ia64: move exports to definitions
    sparc32: debride memcpy.S a bit
    [sparc] unify 32bit and 64bit string.h
    sparc: move exports to definitions
    ppc: move exports to definitions
    arm: move exports to definitions
    s390: move exports to definitions
    m68k: move exports to definitions
    alpha: move exports to actual definitions
    x86: move exports to actual definitions
    ...

    Linus Torvalds
     
  • Pull percpu updates from Tejun Heo:

    - Nick improved generic implementations of percpu operations which
    modify the variable and return so that they calculate the physical
    address only once.

    - percpu_ref percpu atomic mode switching improvements. The
    patchset was originally posted about a year ago but fell through the
    crack.

    - misc non-critical fixes.

    * 'for-4.9' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/percpu:
    mm/percpu.c: fix potential memory leakage for pcpu_embed_first_chunk()
    mm/percpu.c: correct max_distance calculation for pcpu_embed_first_chunk()
    percpu: eliminate two sparse warnings
    percpu: improve generic percpu modify-return implementation
    percpu-refcount: init ->confirm_switch member properly
    percpu_ref: allow operation mode switching operations to be called concurrently
    percpu_ref: restructure operation mode switching
    percpu_ref: unify staggered atomic switching wait behavior
    percpu_ref: reorganize __percpu_ref_switch_to_atomic() and relocate percpu_ref_switch_to_atomic()
    percpu_ref: remove unnecessary RCU grace period for staggered atomic switching confirmation

    Linus Torvalds
     
  • Pull libata updates from Tejun Heo:
    - Write same support added
    - Minor ahci MSIX irq handling updates
    - Non-critical SCSI command translation fixes
    - Controller specific changes

    * 'for-4.9' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/libata:
    ahci: qoriq: Revert "ahci: qoriq: Disable NCQ on ls2080a SoC"
    libata: remove
    libata: remove unused definitions from
    pata_at91: Use PTR_ERR_OR_ZERO rather than if(IS_ERR(...)) + PTR_ERR
    ata: Replace BUG() with BUG_ON().
    ata: sata_mv: Replacing dma_pool_alloc and memset with a single call dma_pool_zalloc.
    libata: Some drives failing on SCT Write Same
    ahci: use pci_alloc_irq_vectors
    libata: SCT Write Same handle ATA_DFLAG_PIO
    libata: SCT Write Same / DSM Trim
    libata: Add support for SCT Write Same
    libata: Safely overwrite attached page in WRITE SAME xlat
    ahci: also use a per-port lock for the multi-MSIX case
    ARM: dts: STiH407-family: Add ports-implemented property in sata nodes
    ahci: st: Add ports-implemented property in support
    ahci: qoriq: enable snoopable sata read and write
    ahci: qoriq: adjust sata parameter
    libata-scsi: fix MODE SELECT translation for Control mode page
    libata-scsi: use u8 array to store mode page copy

    Linus Torvalds
     

12 Oct, 2016

1 commit

  • Pull uaccess.h prepwork from Al Viro:
    "Preparations to tree-wide switch to use of linux/uaccess.h (which,
    obviously, will allow to start unifying stuff for real). The last step
    there, ie

    PATT='^[[:blank:]]*#[[:blank:]]*include[[:blank:]]*'
    sed -i -e "s!$PATT!#include !" \
    `git grep -l "$PATT"|grep -v ^include/linux/uaccess.h`

    is not taken here - I would prefer to do it once just before or just
    after -rc1. However, everything should be ready for it"

    * 'work.uaccess2' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
    remove a stray reference to asm/uaccess.h in docs
    sparc64: separate extable_64.h, switch elf_64.h to it
    score: separate extable.h, switch module.h to it
    mips: separate extable.h, switch module.h to it
    x86: separate extable.h, switch sections.h to it
    remove stray include of asm/uaccess.h from cacheflush.h
    mn10300: remove a bogus processor.h->uaccess.h include
    xtensa: split uaccess.h into C and asm sides
    bonding: quit messing with IOCTL
    kill __kernel_ds_p off
    mn10300: finish verify_area() off
    frv: move HAVE_ARCH_UNMAPPED_AREA to pgtable.h
    exceptions: detritus removal

    Linus Torvalds
     

08 Oct, 2016

2 commits

  • When doing an nmi backtrace of many cores, most of which are idle, the
    output is a little overwhelming and very uninformative. Suppress
    messages for cpus that are idling when they are interrupted and just
    emit one line, "NMI backtrace for N skipped: idling at pc 0xNNN".

    We do this by grouping all the cpuidle code together into a new
    .cpuidle.text section, and then checking the address of the interrupted
    PC to see if it lies within that section.

    This commit suitably tags x86 and tile idle routines, and only adds in
    the minimal framework for other architectures.

    Link: http://lkml.kernel.org/r/1472487169-14923-5-git-send-email-cmetcalf@mellanox.com
    Signed-off-by: Chris Metcalf
    Acked-by: Peter Zijlstra (Intel)
    Tested-by: Peter Zijlstra (Intel)
    Tested-by: Daniel Thompson [arm]
    Tested-by: Petr Mladek
    Cc: Aaron Tomlin
    Cc: Peter Zijlstra (Intel)
    Cc: "Rafael J. Wysocki"
    Cc: Russell King
    Cc: Thomas Gleixner
    Cc: Ingo Molnar
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Chris Metcalf
     
  • We get 1 warning when building kernel with W=1:

    drivers/char/mem.c:220:12: warning: no previous prototype for 'phys_mem_access_prot_allowed' [-Wmissing-prototypes]
    int __weak phys_mem_access_prot_allowed(struct file *file,

    In fact, its declaration is spreading to several header files in
    different architecture, but need to be declare in common header file.

    So this patch moves phys_mem_access_prot_allowed() to pgtable.h.

    Link: http://lkml.kernel.org/r/1473751597-12139-1-git-send-email-baoyou.xie@linaro.org
    Signed-off-by: Baoyou Xie
    Acked-by: Thomas Gleixner
    Acked-by: Ralf Baechle
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Baoyou Xie
     

28 Sep, 2016

1 commit


23 Sep, 2016

1 commit

  • Some architectures require an additional load to find the address of
    percpu pointers. In some implemenatations, the C aliasing rules do not
    allow the result of that load to be kept over the store that modifies
    the percpu variable, which causes additional loads.

    Work around this by finding the pointer first, then operating on that.

    It's also possible to mark things as restrict and those kind of games,
    but that can require larger and arch specific changes.

    On powerpc, __this_cpu_inc_return compiles to:

    ld 10,48(13)
    ldx 9,3,10
    addi 9,9,1
    stdx 9,3,10
    ld 9,48(13)
    ldx 3,9,3

    With this patch it compiles to:

    ld 10,48(13)
    ldx 9,3,10
    addi 9,9,1
    stdx 9,3,10

    Signed-off-by: Nicholas Piggin
    To: Tejun Heo
    To: Christoph Lameter
    Cc: linux-kernel@vger.kernel.org
    Cc: linux-arch@vger.kernel.org
    Signed-off-by: Tejun Heo

    Nicholas Piggin
     

22 Sep, 2016

2 commits

  • asm-generic is only intended for architecture defaults, and we can simply
    kill it off by moving the two defintions directly to .

    Signed-off-by: Christoph Hellwig
    Signed-off-by: Tejun Heo

    Christoph Hellwig
     
  • Enabling -ffunction-sections modified the generic linker script to
    pull .text.* sections into regular TEXT_TEXT section, conflicting
    with some architectures. Revert that change and require archs that
    enable the option to ensure they have no conflicting section names,
    and do the appropriate merging.

    Reported-by: Guenter Roeck
    Tested-by: Guenter Roeck
    Fixes: b67067f1176d ("kbuild: allow archs to select link dead code/data elimination")
    Signed-off-by: Nicholas Piggin
    Signed-off-by: Michal Marek

    Nicholas Piggin
     

15 Sep, 2016

1 commit

  • Pull uaccess fixes from Al Viro:
    "Fixes for broken uaccess primitives - mostly lack of proper zeroing
    in copy_from_user()/get_user()/__get_user(), but for several
    architectures there's more (broken clear_user() on frv and
    strncpy_from_user() on hexagon)"

    * 'uaccess-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (28 commits)
    avr32: fix copy_from_user()
    microblaze: fix __get_user()
    microblaze: fix copy_from_user()
    m32r: fix __get_user()
    blackfin: fix copy_from_user()
    sparc32: fix copy_from_user()
    sh: fix copy_from_user()
    sh64: failing __get_user() should zero
    score: fix copy_from_user() and friends
    score: fix __get_user/get_user
    s390: get_user() should zero on failure
    ppc32: fix copy_from_user()
    parisc: fix copy_from_user()
    openrisc: fix copy_from_user()
    nios2: fix __get_user()
    nios2: copy_from_user() should zero the tail of destination
    mn10300: copy_from_user() should zero on access_ok() failure...
    mn10300: failing __get_user() and get_user() should zero
    mips: copy_from_user() must zero the destination on access_ok() failure
    ARC: uaccess: get_user to zero out dest in cause of fault
    ...

    Linus Torvalds
     

14 Sep, 2016

1 commit


10 Sep, 2016

1 commit


09 Sep, 2016

1 commit

  • Introduce LD_DEAD_CODE_DATA_ELIMINATION option for architectures to
    select to build with -ffunction-sections, -fdata-sections, and link
    with --gc-sections. It requires some work (documented) to ensure all
    unreferenced entrypoints are live, and requires toolchain and build
    verification, so it is made a per-arch option for now.

    On a random powerpc64le build, this yelds a significant size saving,
    it boots and runs fine, but there is a lot I haven't tested as yet, so
    these savings may be reduced if there are bugs in the link.

    text data bss dec filename
    11169741 1180744 1923176 14273661 vmlinux
    10445269 1004127 1919707 13369103 vmlinux.dce

    ~700K text, ~170K data, 6% removed from kernel image size.

    Signed-off-by: Nicholas Piggin
    Signed-off-by: Michal Marek

    Nicholas Piggin
     

31 Aug, 2016

1 commit

  • There are three usercopy warnings which are currently being silenced for
    gcc 4.6 and newer:

    1) "copy_from_user() buffer size is too small" compile warning/error

    This is a static warning which happens when object size and copy size
    are both const, and copy size > object size. I didn't see any false
    positives for this one. So the function warning attribute seems to
    be working fine here.

    Note this scenario is always a bug and so I think it should be
    changed to *always* be an error, regardless of
    CONFIG_DEBUG_STRICT_USER_COPY_CHECKS.

    2) "copy_from_user() buffer size is not provably correct" compile warning

    This is another static warning which happens when I enable
    __compiletime_object_size() for new compilers (and
    CONFIG_DEBUG_STRICT_USER_COPY_CHECKS). It happens when object size
    is const, but copy size is *not*. In this case there's no way to
    compare the two at build time, so it gives the warning. (Note the
    warning is a byproduct of the fact that gcc has no way of knowing
    whether the overflow function will be called, so the call isn't dead
    code and the warning attribute is activated.)

    So this warning seems to only indicate "this is an unusual pattern,
    maybe you should check it out" rather than "this is a bug".

    I get 102(!) of these warnings with allyesconfig and the
    __compiletime_object_size() gcc check removed. I don't know if there
    are any real bugs hiding in there, but from looking at a small
    sample, I didn't see any. According to Kees, it does sometimes find
    real bugs. But the false positive rate seems high.

    3) "Buffer overflow detected" runtime warning

    This is a runtime warning where object size is const, and copy size >
    object size.

    All three warnings (both static and runtime) were completely disabled
    for gcc 4.6 with the following commit:

    2fb0815c9ee6 ("gcc4: disable __compiletime_object_size for GCC 4.6+")

    That commit mistakenly assumed that the false positives were caused by a
    gcc bug in __compiletime_object_size(). But in fact,
    __compiletime_object_size() seems to be working fine. The false
    positives were instead triggered by #2 above. (Though I don't have an
    explanation for why the warnings supposedly only started showing up in
    gcc 4.6.)

    So remove warning #2 to get rid of all the false positives, and re-enable
    warnings #1 and #3 by reverting the above commit.

    Furthermore, since #1 is a real bug which is detected at compile time,
    upgrade it to always be an error.

    Having done all that, CONFIG_DEBUG_STRICT_USER_COPY_CHECKS is no longer
    needed.

    Signed-off-by: Josh Poimboeuf
    Cc: Kees Cook
    Cc: Thomas Gleixner
    Cc: Ingo Molnar
    Cc: "H . Peter Anvin"
    Cc: Andy Lutomirski
    Cc: Steven Rostedt
    Cc: Brian Gerst
    Cc: Peter Zijlstra
    Cc: Frederic Weisbecker
    Cc: Byungchul Park
    Cc: Nilay Vaish
    Signed-off-by: Linus Torvalds

    Josh Poimboeuf
     

10 Aug, 2016

1 commit

  • This patch aims to get rid of endianness in queued_write_unlock(). We
    want to set __qrwlock->wmode to NULL, however the address is not
    &lock->cnts in big endian machine. That causes queued_write_unlock()
    write NULL to the wrong field of __qrwlock.

    So implement __qrwlock_write_byte() which returns the correct
    __qrwlock->wmode address.

    Suggested-by: Peter Zijlstra (Intel)
    Signed-off-by: Pan Xinhui
    Signed-off-by: Peter Zijlstra (Intel)
    Cc: Andrew Morton
    Cc: Linus Torvalds
    Cc: Paul E. McKenney
    Cc: Peter Zijlstra
    Cc: Thomas Gleixner
    Cc: Waiman.Long@hpe.com
    Cc: arnd@arndb.de
    Cc: boqun.feng@gmail.com
    Cc: will.deacon@arm.com
    Link: http://lkml.kernel.org/r/1468835259-4486-1-git-send-email-xinhui.pan@linux.vnet.ibm.com
    Signed-off-by: Ingo Molnar

    pan xinhui
     

08 Aug, 2016

1 commit

  • Add asm-usable variants of EXPORT_SYMBOL/EXPORT_SYMBOL_GPL. This
    commit just adds the default implementation; most of the architectures
    can simply add export.h to asm/Kbuild and start using
    from assembler. The rest needs to have their define
    everal macros and then explicitly include

    One area where the things might diverge from default is the alignment;
    normally it's 8 bytes on 64bit targets and 4 on 32bit ones, both for
    unsigned long and for struct kernel_symbol. Unfortunately, amd64 and
    m68k are unusual - m68k aligns to 2 bytes (for both) and amd64 aligns
    struct kernel_symbol to 16 bytes. For those we'll need asm/export.h to
    override the constants used by generic version - KSYM_ALIGN and KCRC_ALIGN
    for kernel_symbol and unsigned long resp. And no, __alignof__ would not
    do the trick - on amd64 __alignof__ of struct kernel_symbol is 8, not 16.

    More serious source of unpleasantness is treatment of function
    descriptors on architectures that have those. Things like ppc64,
    parisc, ia64, etc. need more than the address of the first insn to
    call an arbitrary function. As the result, their representation of
    pointers to functions is not the typical "address of the entry point" -
    it's an address of a small static structure containing all the required
    information (including the entry point, of course). Sadly, the asm-side
    conventions differ in what the function name refers to - entry point or
    the function descriptor. On ppc64 we do the latter;
    bar: .quad foo
    is what void (*bar)(void) = foo; turns into and the rare places where
    we need to explicitly work with the label of entry point are dealt with
    as DOTSYM(foo). For our purposes it's ideal - generic macros are usable.
    However, parisc would have foo and P%foo used for label of entry point
    and address of the function descriptor and
    bar: .long P%foo
    woudl be used instead. ia64 goes similar to parisc in that respect,
    except that there it's @fptr(foo) rather than P%foo. Such architectures
    need to define KSYM_FUNC that would turn a function name into whatever
    is needed to refer to function descriptor.

    What's more, on such architectures we need to know whether we are exporting
    a function or an object - in assembler we have to tell that explicitly, to
    decide whether we want EXPORT_SYMBOL(foo) produce e.g.
    __ksymtab_foo: .quad foo
    or
    __ksymtab_foo: .quad @fptr(foo)

    For that reason we introduce EXPORT_DATA_SYMBOL{,_GPL}(), to be used for
    exports of data objects. On normal architectures it's the same thing
    as EXPORT_SYMBOL{,_GPL}(), but on parisc-like ones they differ and the
    right one needs to be used. Most of the exports are functions, so we
    keep EXPORT_SYMBOL for those...

    Signed-off-by: Al Viro

    Al Viro
     

05 Aug, 2016

1 commit

  • Pull RTC updates from Alexandre Belloni:
    "RTC for 4.8

    Cleanups:
    - huge cleanup of rtc-generic and char/genrtc this allowed to cleanup
    rtc-cmos, rtc-sh, rtc-m68k, rtc-powerpc and rtc-parisc
    - move mn10300 to rtc-cmos

    Subsystem:
    - fix wakealarms after hibernate
    - multiples fixes for rctest
    - simplify implementations of .read_alarm

    New drivers:
    - Maxim MAX6916

    Drivers:
    - ds1307: fix weekday
    - m41t80: add wakeup support
    - pcf85063: add support for PCF85063A variant
    - rv8803: extend i2c fix and other fixes
    - s35390a: fix alarm reading, this fixes instant reboot after
    shutdown for QNAP TS-41x
    - s3c: clock fixes"

    * tag 'rtc-4.8' of git://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux: (65 commits)
    rtc: rv8803: Clear V1F when setting the time
    rtc: rv8803: Stop the clock while setting the time
    rtc: rv8803: Always apply the I²C workaround
    rtc: rv8803: Fix read day of week
    rtc: rv8803: Remove the check for valid time
    rtc: rv8803: Kconfig: Indicate rx8900 support
    rtc: asm9260: remove .owner field for driver
    rtc: at91sam9: Fix missing spin_lock_init()
    rtc: m41t80: add suspend handlers for alarm IRQ
    rtc: m41t80: make it a real error message
    rtc: pcf85063: Add support for the PCF85063A device
    rtc: pcf85063: fix year range
    rtc: hym8563: in .read_alarm set .tm_sec to 0 to signal minute accuracy
    rtc: explicitly set tm_sec = 0 for drivers with minute accurancy
    rtc: s3c: Add s3c_rtc_{enable/disable}_clk in s3c_rtc_setfreq()
    rtc: s3c: Remove unnecessary call to disable already disabled clock
    rtc: abx80x: use devm_add_action_or_reset()
    rtc: m41t80: use devm_add_action_or_reset()
    rtc: fix a typo and reduce three empty lines to one
    rtc: s35390a: improve two comments in .set_alarm
    ...

    Linus Torvalds
     

03 Aug, 2016

1 commit

  • Pull kbuild updates from Michal Marek:

    - GCC plugin support by Emese Revfy from grsecurity, with a fixup from
    Kees Cook. The plugins are meant to be used for static analysis of
    the kernel code. Two plugins are provided already.

    - reduction of the gcc commandline by Arnd Bergmann.

    - IS_ENABLED / IS_REACHABLE macro enhancements by Masahiro Yamada

    - bin2c fix by Michael Tautschnig

    - setlocalversion fix by Wolfram Sang

    * 'kbuild' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild:
    gcc-plugins: disable under COMPILE_TEST
    kbuild: Abort build on bad stack protector flag
    scripts: Fix size mismatch of kexec_purgatory_size
    kbuild: make samples depend on headers_install
    Kbuild: don't add obj tree in additional includes
    Kbuild: arch: look for generated headers in obtree
    Kbuild: always prefix objtree in LINUXINCLUDE
    Kbuild: avoid duplicate include path
    Kbuild: don't add ../../ to include path
    vmlinux.lds.h: replace config_enabled() with IS_ENABLED()
    kconfig.h: allow to use IS_{ENABLE,REACHABLE} in macro expansion
    kconfig.h: use already defined macros for IS_REACHABLE() define
    export.h: use __is_defined() to check if __KSYM_* is defined
    kconfig.h: use __is_defined() to check if MODULE is defined
    kbuild: setlocalversion: print error to STDERR
    Add sancov plugin
    Add Cyclomatic complexity GCC plugin
    GCC plugin infrastructure
    Shared library support

    Linus Torvalds
     

27 Jul, 2016

5 commits

  • Merge updates from Andrew Morton:

    - a few misc bits

    - ocfs2

    - most(?) of MM

    * emailed patches from Andrew Morton : (125 commits)
    thp: fix comments of __pmd_trans_huge_lock()
    cgroup: remove unnecessary 0 check from css_from_id()
    cgroup: fix idr leak for the first cgroup root
    mm: memcontrol: fix documentation for compound parameter
    mm: memcontrol: remove BUG_ON in uncharge_list
    mm: fix build warnings in
    mm, thp: convert from optimistic swapin collapsing to conservative
    mm, thp: fix comment inconsistency for swapin readahead functions
    thp: update Documentation/{vm/transhuge,filesystems/proc}.txt
    shmem: split huge pages beyond i_size under memory pressure
    thp: introduce CONFIG_TRANSPARENT_HUGE_PAGECACHE
    khugepaged: add support of collapse for tmpfs/shmem pages
    shmem: make shmem_inode_info::lock irq-safe
    khugepaged: move up_read(mmap_sem) out of khugepaged_alloc_page()
    thp: extract khugepaged from mm/huge_memory.c
    shmem, thp: respect MADV_{NO,}HUGEPAGE for file mappings
    shmem: add huge pages support
    shmem: get_unmapped_area align huge page
    shmem: prepare huge= mount option and sysfs knob
    mm, rmap: account shmem thp pages
    ...

    Linus Torvalds
     
  • This allows an arch which needs to do special handing with respect to
    different page size when flushing tlb to implement the same in mmu
    gather.

    Link: http://lkml.kernel.org/r/1465049193-22197-3-git-send-email-aneesh.kumar@linux.vnet.ibm.com
    Signed-off-by: Aneesh Kumar K.V
    Cc: Benjamin Herrenschmidt
    Cc: Michael Ellerman
    Cc: Hugh Dickins
    Cc: "Kirill A. Shutemov"
    Cc: Andrea Arcangeli
    Cc: Joonsoo Kim
    Cc: Mel Gorman
    Cc: David Rientjes
    Cc: Vlastimil Babka
    Cc: Minchan Kim
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Aneesh Kumar K.V
     
  • This updates the generic and arch specific implementation to return true
    if we need to do a tlb flush. That means if a __tlb_remove_page
    indicate a flush is needed, the page we try to remove need to be tracked
    and added again after the flush. We need to track it because we have
    already update the pte to none and we can't just loop back.

    This change is done to enable us to do a tlb_flush when we try to flush
    a range that consists of different page sizes. For architectures like
    ppc64, we can do a range based tlb flush and we need to track page size
    for that. When we try to remove a huge page, we will force a tlb flush
    and starts a new mmu gather.

    [aneesh.kumar@linux.vnet.ibm.com: mm-change-the-interface-for-__tlb_remove_page-v3]
    Link: http://lkml.kernel.org/r/1465049193-22197-2-git-send-email-aneesh.kumar@linux.vnet.ibm.com
    Link: http://lkml.kernel.org/r/1464860389-29019-2-git-send-email-aneesh.kumar@linux.vnet.ibm.com
    Signed-off-by: Aneesh Kumar K.V
    Cc: Benjamin Herrenschmidt
    Cc: Michael Ellerman
    Cc: Hugh Dickins
    Cc: "Kirill A. Shutemov"
    Cc: Andrea Arcangeli
    Cc: Joonsoo Kim
    Cc: Mel Gorman
    Cc: David Rientjes
    Cc: Vlastimil Babka
    Cc: Minchan Kim
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Aneesh Kumar K.V
     
  • Pull crypto updates from Herbert Xu:
    "Here is the crypto update for 4.8:

    API:
    - first part of skcipher low-level conversions
    - add KPP (Key-agreement Protocol Primitives) interface.

    Algorithms:
    - fix IPsec/cryptd reordering issues that affects aesni
    - RSA no longer does explicit leading zero removal
    - add SHA3
    - add DH
    - add ECDH
    - improve DRBG performance by not doing CTR by hand

    Drivers:
    - add x86 AVX2 multibuffer SHA256/512
    - add POWER8 optimised crc32c
    - add xts support to vmx
    - add DH support to qat
    - add RSA support to caam
    - add Layerscape support to caam
    - add SEC1 AEAD support to talitos
    - improve performance by chaining requests in marvell/cesa
    - add support for Araneus Alea I USB RNG
    - add support for Broadcom BCM5301 RNG
    - add support for Amlogic Meson RNG
    - add support Broadcom NSP SoC RNG"

    * 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6: (180 commits)
    crypto: vmx - Fix aes_p8_xts_decrypt build failure
    crypto: vmx - Ignore generated files
    crypto: vmx - Adding support for XTS
    crypto: vmx - Adding asm subroutines for XTS
    crypto: skcipher - add comment for skcipher_alg->base
    crypto: testmgr - Print akcipher algorithm name
    crypto: marvell - Fix wrong flag used for GFP in mv_cesa_dma_add_iv_op
    crypto: nx - off by one bug in nx_of_update_msc()
    crypto: rsa-pkcs1pad - fix rsa-pkcs1pad request struct
    crypto: scatterwalk - Inline start/map/done
    crypto: scatterwalk - Remove unnecessary BUG in scatterwalk_start
    crypto: scatterwalk - Remove unnecessary advance in scatterwalk_pagedone
    crypto: scatterwalk - Fix test in scatterwalk_done
    crypto: api - Optimise away crypto_yield when hard preemption is on
    crypto: scatterwalk - add no-copy support to copychunks
    crypto: scatterwalk - Remove scatterwalk_bytes_sglen
    crypto: omap - Stop using crypto scatterwalk_bytes_sglen
    crypto: skcipher - Remove top-level givcipher interface
    crypto: user - Remove crypto_lookup_skcipher call
    crypto: cts - Convert to skcipher
    ...

    Linus Torvalds
     
  • Pull s390 updates from Martin Schwidefsky:
    "There are a couple of new things for s390 with this merge request:

    - a new scheduling domain "drawer" is added to reflect the unusual
    topology found on z13 machines. Performance tests showed up to 8
    percent gain with the additional domain.

    - the new crc-32 checksum crypto module uses the vector-galois-field
    multiply and sum SIMD instruction to speed up crc-32 and crc-32c.

    - proper __ro_after_init support, this requires RO_AFTER_INIT_DATA in
    the generic vmlinux.lds linker script definitions.

    - kcov instrumentation support. A prerequisite for that is the
    inline assembly basic block cleanup, which is the reason for the
    net/iucv/iucv.c change.

    - support for 2GB pages is added to the hugetlbfs backend.

    Then there are two removals:

    - the oprofile hardware sampling support is dead code and is removed.
    The oprofile user space uses the perf interface nowadays.

    - the ETR clock synchronization is removed, this has been superseeded
    be the STP clock synchronization. And it always has been
    "interesting" code..

    And the usual bug fixes and cleanups"

    * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux: (82 commits)
    s390/pci: Delete an unnecessary check before the function call "pci_dev_put"
    s390/smp: clean up a condition
    s390/cio/chp : Remove deprecated create_singlethread_workqueue
    s390/chsc: improve channel path descriptor determination
    s390/chsc: sanitize fmt check for chp_desc determination
    s390/cio: make fmt1 channel path descriptor optional
    s390/chsc: fix ioctl CHSC_INFO_CU command
    s390/cio/device_ops: fix kernel doc
    s390/cio: allow to reset channel measurement block
    s390/console: Make preferred console handling more consistent
    s390/mm: fix gmap tlb flush issues
    s390/mm: add support for 2GB hugepages
    s390: have unique symbol for __switch_to address
    s390/cpuinfo: show maximum thread id
    s390/ptrace: clarify bits in the per_struct
    s390: stack address vs thread_info
    s390: remove pointless load within __switch_to
    s390: enable kcov support
    s390/cpumf: use basic block for ecctr inline assembly
    s390/hypfs: use basic block for diag inline assembly
    ...

    Linus Torvalds
     

26 Jul, 2016

2 commits

  • Pull NOHZ updates from Ingo Molnar:

    - fix system/idle cputime leaked on cputime accounting (all nohz
    configs) (Rik van Riel)

    - remove the messy, ad-hoc irqtime account on nohz-full and make it
    compatible with CONFIG_IRQ_TIME_ACCOUNTING=y instead (Rik van Riel)

    - cleanups (Frederic Weisbecker)

    - remove unecessary irq disablement in the irqtime code (Rik van Riel)

    * 'timers-nohz-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
    sched/cputime: Drop local_irq_save/restore from irqtime_account_irq()
    sched/cputime: Reorganize vtime native irqtime accounting headers
    sched/cputime: Clean up the old vtime gen irqtime accounting completely
    sched/cputime: Replace VTIME_GEN irq time code with IRQ_TIME_ACCOUNTING code
    sched/cputime: Count actually elapsed irq & softirq time

    Linus Torvalds
     
  • Pull locking updates from Ingo Molnar:
    "The locking tree was busier in this cycle than the usual pattern - a
    couple of major projects happened to coincide.

    The main changes are:

    - implement the atomic_fetch_{add,sub,and,or,xor}() API natively
    across all SMP architectures (Peter Zijlstra)

    - add atomic_fetch_{inc/dec}() as well, using the generic primitives
    (Davidlohr Bueso)

    - optimize various aspects of rwsems (Jason Low, Davidlohr Bueso,
    Waiman Long)

    - optimize smp_cond_load_acquire() on arm64 and implement LSE based
    atomic{,64}_fetch_{add,sub,and,andnot,or,xor}{,_relaxed,_acquire,_release}()
    on arm64 (Will Deacon)

    - introduce smp_acquire__after_ctrl_dep() and fix various barrier
    mis-uses and bugs (Peter Zijlstra)

    - after discovering ancient spin_unlock_wait() barrier bugs in its
    implementation and usage, strengthen its semantics and update/fix
    usage sites (Peter Zijlstra)

    - optimize mutex_trylock() fastpath (Peter Zijlstra)

    - ... misc fixes and cleanups"

    * 'locking-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (67 commits)
    locking/atomic: Introduce inc/dec variants for the atomic_fetch_$op() API
    locking/barriers, arch/arm64: Implement LDXR+WFE based smp_cond_load_acquire()
    locking/static_keys: Fix non static symbol Sparse warning
    locking/qspinlock: Use __this_cpu_dec() instead of full-blown this_cpu_dec()
    locking/atomic, arch/tile: Fix tilepro build
    locking/atomic, arch/m68k: Remove comment
    locking/atomic, arch/arc: Fix build
    locking/Documentation: Clarify limited control-dependency scope
    locking/atomic, arch/rwsem: Employ atomic_long_fetch_add()
    locking/atomic, arch/qrwlock: Employ atomic_fetch_add_acquire()
    locking/atomic, arch/mips: Convert to _relaxed atomics
    locking/atomic, arch/alpha: Convert to _relaxed atomics
    locking/atomic: Remove the deprecated atomic_{set,clear}_mask() functions
    locking/atomic: Remove linux/atomic.h:atomic_fetch_or()
    locking/atomic: Implement atomic{,64,_long}_fetch_{add,sub,and,andnot,or,xor}{,_relaxed,_acquire,_release}()
    locking/atomic: Fix atomic64_relaxed() bits
    locking/atomic, arch/xtensa: Implement atomic_fetch_{add,sub,and,or,xor}()
    locking/atomic, arch/x86: Implement atomic{,64}_fetch_{add,sub,and,or,xor}()
    locking/atomic, arch/tile: Implement atomic{,64}_fetch_{add,sub,and,or,xor}()
    locking/atomic, arch/sparc: Implement atomic{,64}_fetch_{add,sub,and,or,xor}()
    ...

    Linus Torvalds
     

15 Jul, 2016

1 commit

  • If CONFIG_KASAN is enabled and gcc is configured with
    --disable-initfini-array and/or gold linker is used, gcc emits
    .ctors/.dtors and .text.startup/.text.exit sections instead of
    .init_array/.fini_array. .dtors section is not explicitly accounted in
    the linker script and messes vvar/percpu layout.

    We want:
    ffffffff822bfd80 D _edata
    ffffffff822c0000 D __vvar_beginning_hack
    ffffffff822c0000 A __vvar_page
    ffffffff822c0080 0000000000000098 D vsyscall_gtod_data
    ffffffff822c1000 A __init_begin
    ffffffff822c1000 D init_per_cpu__irq_stack_union
    ffffffff822c1000 A __per_cpu_load
    ffffffff822d3000 D init_per_cpu__gdt_page

    We got:
    ffffffff8279a600 D _edata
    ffffffff8279b000 A __vvar_page
    ffffffff8279c000 A __init_begin
    ffffffff8279c000 D init_per_cpu__irq_stack_union
    ffffffff8279c000 A __per_cpu_load
    ffffffff8279e000 D __vvar_beginning_hack
    ffffffff8279e080 0000000000000098 D vsyscall_gtod_data
    ffffffff827ae000 D init_per_cpu__gdt_page

    This happens because __vvar_page and .vvar get different addresses in
    arch/x86/kernel/vmlinux.lds.S:

    . = ALIGN(PAGE_SIZE);
    __vvar_page = .;

    .vvar : AT(ADDR(.vvar) - LOAD_OFFSET) {
    /* work around gold bug 13023 */
    __vvar_beginning_hack = .;

    Discard .dtors/.fini_array/.text.exit, since we don't call dtors.
    Merge .text.startup into init text.

    Link: http://lkml.kernel.org/r/1467386363-120030-1-git-send-email-dvyukov@google.com
    Signed-off-by: Dmitry Vyukov
    Reviewed-by: Andrey Ryabinin
    Cc: [4.0+]
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Dmitry Vyukov
     

14 Jul, 2016

1 commit

  • Currently, if there was any irq or softirq time during 'ticks'
    jiffies, the entire period will be accounted as irq or softirq
    time.

    This is inaccurate if only a subset of the time was actually spent
    handling irqs, and could conceivably mis-count all of the ticks during
    a period as irq time, when there was some irq and some softirq time.

    This can actually happen when irqtime_account_process_tick is called
    from account_idle_ticks, which can pass a larger number of ticks down
    all at once.

    Fix this by changing irqtime_account_hi_update(), irqtime_account_si_update(),
    and steal_account_process_ticks() to work with cputime_t time units, and
    return the amount of time spent in each mode.

    Rename steal_account_process_ticks() to steal_account_process_time(), to
    reflect that time is now accounted in cputime_t, instead of ticks.

    Additionally, have irqtime_account_process_tick() take into account how
    much time was spent in each of steal, irq, and softirq time.

    The latter could help improve the accuracy of cputime
    accounting when returning from idle on a NO_HZ_IDLE CPU.

    Properly accounting how much time was spent in hardirq and
    softirq time will also allow the NO_HZ_FULL code to re-use
    these same functions for hardirq and softirq accounting.

    Signed-off-by: Rik van Riel
    [ Make nsecs_to_cputime64() actually return cputime64_t. ]
    Signed-off-by: Frederic Weisbecker
    Cc: Linus Torvalds
    Cc: Mike Galbraith
    Cc: Paolo Bonzini
    Cc: Peter Zijlstra
    Cc: Radim Krcmar
    Cc: Thomas Gleixner
    Cc: Wanpeng Li
    Link: http://lkml.kernel.org/r/1468421405-20056-2-git-send-email-fweisbec@gmail.com
    Signed-off-by: Ingo Molnar

    Rik van Riel
     

07 Jul, 2016

1 commit

  • With the inclusion of atomic FETCH-OP variants, many places in the
    kernel can make use of atomic_fetch_$op() to avoid the callers that
    need to compute the value/state _before_ the operation.

    Peter Zijlstra laid out the machinery but we are still missing the
    simpler dec,inc() calls (which future patches will make use of).

    This patch only deals with the generic code, as at least right now
    no arch actually implement them -- which is similar to what the
    OP-RETURN primitives currently do.

    Signed-off-by: Davidlohr Bueso
    Signed-off-by: Peter Zijlstra (Intel)
    Cc: Andrew Morton
    Cc: James.Bottomley@HansenPartnership.com
    Cc: Linus Torvalds
    Cc: Paul E. McKenney
    Cc: Peter Zijlstra
    Cc: Thomas Gleixner
    Cc: awalls@md.metrocast.net
    Cc: bp@alien8.de
    Cc: cw00.choi@samsung.com
    Cc: davem@davemloft.net
    Cc: dledford@redhat.com
    Cc: dougthompson@xmission.com
    Cc: gregkh@linuxfoundation.org
    Cc: hans.verkuil@cisco.com
    Cc: heiko.carstens@de.ibm.com
    Cc: jikos@kernel.org
    Cc: kys@microsoft.com
    Cc: mchehab@osg.samsung.com
    Cc: pfg@sgi.com
    Cc: schwidefsky@de.ibm.com
    Cc: sean.hefty@intel.com
    Cc: sumit.semwal@linaro.org
    Link: http://lkml.kernel.org/r/20160628215651.GA20048@linux-80c1.suse
    Signed-off-by: Ingo Molnar

    Davidlohr Bueso
     

21 Jun, 2016

1 commit


16 Jun, 2016

2 commits

  • Since all architectures have this implemented now natively, remove this
    dead code.

    Signed-off-by: Peter Zijlstra (Intel)
    Cc: Andrew Morton
    Cc: Linus Torvalds
    Cc: Paul E. McKenney
    Cc: Peter Zijlstra
    Cc: Thomas Gleixner
    Cc: linux-arch@vger.kernel.org
    Cc: linux-kernel@vger.kernel.org
    Signed-off-by: Ingo Molnar

    Peter Zijlstra
     
  • …relaxed,_acquire,_release}()

    Now that all the architectures have implemented support for these new
    atomic primitives add on the generic infrastructure to expose and use
    it.

    Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
    Cc: Andrew Morton <akpm@linux-foundation.org>
    Cc: Arnd Bergmann <arnd@arndb.de>
    Cc: Boqun Feng <boqun.feng@gmail.com>
    Cc: Borislav Petkov <bp@suse.de>
    Cc: Davidlohr Bueso <dave@stgolabs.net>
    Cc: Frederic Weisbecker <fweisbec@gmail.com>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Cc: Will Deacon <will.deacon@arm.com>
    Cc: linux-arch@vger.kernel.org
    Cc: linux-kernel@vger.kernel.org
    Signed-off-by: Ingo Molnar <mingo@kernel.org>

    Peter Zijlstra
     

14 Jun, 2016

1 commit

  • This patch updates/fixes all spin_unlock_wait() implementations.

    The update is in semantics; where it previously was only a control
    dependency, we now upgrade to a full load-acquire to match the
    store-release from the spin_unlock() we waited on. This ensures that
    when spin_unlock_wait() returns, we're guaranteed to observe the full
    critical section we waited on.

    This fixes a number of spin_unlock_wait() users that (not
    unreasonably) rely on this.

    I also fixed a number of ticket lock versions to only wait on the
    current lock holder, instead of for a full unlock, as this is
    sufficient.

    Furthermore; again for ticket locks; I added an smp_rmb() in between
    the initial ticket load and the spin loop testing the current value
    because I could not convince myself the address dependency is
    sufficient, esp. if the loads are of different sizes.

    I'm more than happy to remove this smp_rmb() again if people are
    certain the address dependency does indeed work as expected.

    Note: PPC32 will be fixed independently

    Signed-off-by: Peter Zijlstra (Intel)
    Cc: Andrew Morton
    Cc: Linus Torvalds
    Cc: Paul E. McKenney
    Cc: Peter Zijlstra
    Cc: Thomas Gleixner
    Cc: chris@zankel.net
    Cc: cmetcalf@mellanox.com
    Cc: davem@davemloft.net
    Cc: dhowells@redhat.com
    Cc: james.hogan@imgtec.com
    Cc: jejb@parisc-linux.org
    Cc: linux@armlinux.org.uk
    Cc: mpe@ellerman.id.au
    Cc: ralf@linux-mips.org
    Cc: realmz6@gmail.com
    Cc: rkuo@codeaurora.org
    Cc: rth@twiddle.net
    Cc: schwidefsky@de.ibm.com
    Cc: tony.luck@intel.com
    Cc: vgupta@synopsys.com
    Cc: ysato@users.sourceforge.jp
    Cc: linux-kernel@vger.kernel.org
    Signed-off-by: Ingo Molnar

    Peter Zijlstra