08 Mar, 2019

39 commits

  • Original comment "Activate ep->ws since epi->ws may get deactivated at
    any time" indeed sounds loud, but it is incorrect, because the path
    where we check epi->ws is a path where insert to ovflist happens, i.e.
    ep_scan_ready_list() has taken ep->mtx and waits for this callback to
    finish, thus ep_modify() (which unregisters wakeup source) waits for
    ep_scan_ready_list().

    Here in this patch I simply call ep_pm_stay_awake_rcu(), which is a bit
    extra for this path (indirectly protected by main ep->mtx, so even rcu
    is not needed), but I do not want to create another naked
    __ep_pm_stay_awake() variant only for this particular case, so rcu variant
    is just better for all the cases.

    Link: http://lkml.kernel.org/r/20190103150104.17128-4-rpenyaev@suse.de
    Signed-off-by: Roman Penyaev
    Cc: Davidlohr Bueso
    Cc: Jason Baron
    Cc: Al Viro
    Cc: "Paul E. McKenney"
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Roman Penyaev
     
  • Patch series "use rwlock in order to reduce ep_poll_callback()
    contention", v3.

    The last patch targets the contention problem in ep_poll_callback(),
    which can be very well reproduced by generating events (write to pipe or
    eventfd) from many threads, while consumer thread does polling.

    The following are some microbenchmark results based on the test [1]
    which starts threads which generate N events each. The test ends when
    all events are successfully fetched by the poller thread:

    spinlock
    ========

    threads events/ms run-time ms
    8 6402 12495
    16 7045 22709
    32 7395 43268

    rwlock + xchg
    =============

    threads events/ms run-time ms
    8 10038 7969
    16 12178 13138
    32 13223 24199

    According to the results bandwidth of delivered events is significantly
    increased, thus execution time is reduced.

    This patch (of 4):

    All coming events are stored in FIFO order and this is also should be
    applicable to ->ovflist, which originally is stack, i.e. LIFO.

    Thus to keep correct FIFO order ->ovflist should reversed by adding
    elements to the head of the read list but not to the tail.

    Link: http://lkml.kernel.org/r/20190103150104.17128-2-rpenyaev@suse.de
    Signed-off-by: Roman Penyaev
    Reviewed-by: Davidlohr Bueso
    Cc: Jason Baron
    Cc: Al Viro
    Cc: "Paul E. McKenney"
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Roman Penyaev
     
  • Warn when any SPDX-License-Identifier: tag is not created on the proper
    line number.

    Link: http://lkml.kernel.org/r/9b74ee87f8c1b8fd310e213fcb4994d58610fcb6.camel@perches.com
    Signed-off-by: Joe Perches
    Cc: Linus Walleij
    Cc: "Enrico Weigelt, metux IT consult"
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Joe Perches
     
  • Presently C99 style comments are removed unconditionally before actual
    patch validity check happens. This is a problem for some third party
    projects which use checkpatch.pl but do not allow C99 style comments.

    This patch adds yet another variable, named C99_COMMENT_TOLERANCE. If
    it is included in the --ignore command line or config file options list,
    C99 comments in the patch are reported as errors.

    Tested by processing a patch with a C99 style comment, it passes the
    check just fine unless '--ignore C99_COMMENT_TOLERANCE' is present in
    .checkpatch.conf.

    Link: http://lkml.kernel.org/r/20190110224957.25008-1-vbendeb@chromium.org
    Signed-off-by: Vadim Bendebury
    Cc: Joe Perches
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Vadim Bendebury
     
  • Many new generic allocation functions like the kvmalloc family have been
    added recently to the kernel.

    The allocation functions test now includes:

    o kvmalloc and variants
    o kstrdup_const
    o kmemdup_nul
    o dma_alloc_coherent
    o alloc_skb and variants

    Add a separate $allocFunctions variable to help make the allocation
    functions test a bit more readable.

    Miscellanea:

    o Use $allocFunctions in the unnecessary OOM message test and
    add exclude uses with __GFP_NOWARN
    o Use $allocFunctions in the unnecessary cast test
    o Add the kvmalloc family to the preferred sizeof alloc style
    foo = kvmalloc(sizeof(*foo), ...)

    Link: http://lkml.kernel.org/r/a5e60a2b93e10baf84af063f6c8e56402273105d.camel@perches.com
    Signed-off-by: Joe Perches
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Joe Perches
     
  • Using SPDX commenting style // or /* is specified for various file types
    in Documentation/process/license-rules.rst so add an appropriate test for
    .[chsS] files because many proposed file additions and patches do not use
    the correct style.

    Link: http://lkml.kernel.org/r/8b02899853247a2c67669561761f354dd3bd110e.camel@perches.com
    Signed-off-by: Joe Perches
    Cc: Rob Herring
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Joe Perches
     
  • The test_fw_config->reqs allocation succeeded so these addresses can't
    be NULL.

    Also on the second error path, we forgot to set "rc = -ENOMEM;".

    Link: http://lkml.kernel.org/r/20190221183700.GA1737@kadam
    Signed-off-by: Dan Carpenter
    Reviewed-by: Andrew Morton
    Cc: "Luis R. Rodriguez"
    Cc: Randy Dunlap
    Cc: Greg Kroah-Hartman
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Dan Carpenter
     
  • In preparation to enabling -Wimplicit-fallthrough, mark switch cases
    where we are expecting to fall through.

    This patch fixes the following warning:

    lib/assoc_array.c: In function `assoc_array_delete':
    lib/assoc_array.c:1110:3: warning: this statement may fall through [-Wimplicit-fallthrough=]
    for (slot = 0; slot < ASSOC_ARRAY_FAN_OUT; slot++) {
    ^~~
    lib/assoc_array.c:1118:2: note: here
    case assoc_array_walk_tree_empty:
    ^~~~

    Warning level 3 was used: -Wimplicit-fallthrough=3

    This patch is part of the ongoing efforts to enable
    -Wimplicit-fallthrough.

    Link: http://lkml.kernel.org/r/20190212212206.GA16378@embeddedor
    Signed-off-by: Gustavo A. R. Silva
    Cc: Kees Cook
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Gustavo A. R. Silva
     
  • Since we now build with -Wvla, any use of VLA throws a warning.
    Including this test, so... maybe we should just remove the test?

    lib/test_ubsan.c: In function 'test_ubsan_vla_bound_not_positive':
    lib/test_ubsan.c:48:2: warning: ISO C90 forbids variable length array 'buf' [-Wvla]

    For the out-of-bounds test, switch to non-VLA setup.

    lib/test_ubsan.c: In function 'test_ubsan_out_of_bounds':
    lib/test_ubsan.c:64:2: warning: ISO C90 forbids variable length array 'arr' [-Wvla]

    Link: http://lkml.kernel.org/r/20190113183210.56154-1-olof@lixom.net
    Signed-off-by: Olof Johansson
    Acked-by: Dmitry Vyukov
    Cc: Colin Ian King
    Cc: Jinbum Park
    Cc: Andrey Ryabinin
    Cc: Kees Cook
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Olof Johansson
     
  • fls counts bits starting from 1 to 32 (returns 0 for zero argument). If
    we add 1 we shift right one bit more and loose precision from divisor,
    what cause function incorect results with some numbers.

    Corrected code was tested in user-space, see bugzilla:
    https://bugzilla.kernel.org/show_bug.cgi?id=202391

    Link: http://lkml.kernel.org/r/1548686944-11891-1-git-send-email-sgruszka@redhat.com
    Fixes: 658716d19f8f ("div64_u64(): improve precision on 32bit platforms")
    Signed-off-by: Stanislaw Gruszka
    Reported-by: Siarhei Volkau
    Tested-by: Siarhei Volkau
    Acked-by: Oleg Nesterov
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Stanislaw Gruszka
     
  • | > Also, set_mask_bits is used in fs quite a bit and we can possibly come up
    | > with a generic llsc based implementation (w/o the cmpxchg loop)
    |
    | May I also suggest changing the return value of set_mask_bits() to old.
    |
    | You can compute the new value given old, but you cannot compute the old
    | value given new, therefore old is the better return value. Also, no
    | current user seems to use the return value, so changing it is without
    | risk.

    Link: http://lkml.kernel.org/g/20150807110955.GH16853@twins.programming.kicks-ass.net
    Link: http://lkml.kernel.org/r/1548275584-18096-4-git-send-email-vgupta@synopsys.com
    Signed-off-by: Vineet Gupta
    Suggested-by: Peter Zijlstra
    Reviewed-by: Anthony Yznaga
    Acked-by: Will Deacon
    Cc: Miklos Szeredi
    Cc: Ingo Molnar
    Cc: Jani Nikula
    Cc: Chris Wilson
    Cc: Alexander Viro
    Cc: Oleg Nesterov
    Cc: Theodore Ts'o
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Vineet Gupta
     
  • With coming changes on x86-64, all dynamic debug descriptors in a
    translation unit must have distinct names. The macro _dynamic_func_call
    takes care of that. No functional change.

    Link: http://lkml.kernel.org/r/20190212214150.4807-15-linux@rasmusvillemoes.dk
    Signed-off-by: Rasmus Villemoes
    Acked-by: Rafael J. Wysocki
    Acked-by: Jason Baron
    Cc: David Sterba
    Cc: Greg Kroah-Hartman
    Cc: Ingo Molnar
    Cc: Petr Mladek
    Cc: Steven Rostedt
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Rasmus Villemoes
     
  • If CONFIG_DYNAMIC_DEBUG is not set, acpi_handle_debug directly invokes
    acpi_handle_printk (if DEBUG) or does a no-printk (if !DEBUG). So this
    macro is never used.

    Link: http://lkml.kernel.org/r/20190212214150.4807-14-linux@rasmusvillemoes.dk
    Signed-off-by: Rasmus Villemoes
    Acked-by: Jason Baron
    Acked-by: Rafael J. Wysocki
    Cc: David Sterba
    Cc: Greg Kroah-Hartman
    Cc: Ingo Molnar
    Cc: Petr Mladek
    Cc: Steven Rostedt
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Rasmus Villemoes
     
  • dynamic debug may be implemented via static keys, but ACPI is missing
    out on that runtime benefit since it open-codes one possible definition
    of DYNAMIC_DEBUG_BRANCH.

    Link: http://lkml.kernel.org/r/20190212214150.4807-13-linux@rasmusvillemoes.dk
    Signed-off-by: Rasmus Villemoes
    Acked-by: Jason Baron
    Acked-by: Rafael J. Wysocki
    Cc: David Sterba
    Cc: Greg Kroah-Hartman
    Cc: Ingo Molnar
    Cc: Petr Mladek
    Cc: Steven Rostedt
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Rasmus Villemoes
     
  • First, the btrfs_debug macros open-code (one possible definition of)
    DYNAMIC_DEBUG_BRANCH, so they don't benefit from the CONFIG_JUMP_LABEL
    optimization.

    Second, a planned change of struct _ddebug (to reduce its size on 64 bit
    machines) requires that all descriptors in a translation unit use
    distinct identifiers.

    Using the new _dynamic_func_call_no_desc helper macro from
    dynamic_debug.h takes care of both of these. No functional change.

    Link: http://lkml.kernel.org/r/20190212214150.4807-12-linux@rasmusvillemoes.dk
    Signed-off-by: Rasmus Villemoes
    Acked-by: David Sterba
    Acked-by: Jason Baron
    Cc: Greg Kroah-Hartman
    Cc: Ingo Molnar
    Cc: Petr Mladek
    Cc: "Rafael J . Wysocki"
    Cc: Steven Rostedt
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Rasmus Villemoes
     
  • For the upcoming 'define the _ddebug descriptor in assembly', we need
    all the descriptors in a translation unit to have distinct names
    (because asm does not understand C scope). The easiest way to achieve
    that is as usual with an extra level of macros, passing the identifier
    to use to the innermost macro, generating it via __UNIQUE_ID or
    something.

    However, instead of repeating that exercise for dynamic_pr_debug,
    dynamic_dev_dbg, dynamic_netdev_dbg and dynamic_hex_dump separately, we
    can use the similarity between their bodies to implement them via a
    common macro, _dynamic_func_call - though the hex_dump case requires a
    slight variant, since print_hex_dump does not take the _ddebug
    descriptor. We'll also get to use that variant elsewhere (btrfs).

    Link: http://lkml.kernel.org/r/20190212214150.4807-11-linux@rasmusvillemoes.dk
    Signed-off-by: Rasmus Villemoes
    Acked-by: Jason Baron
    Cc: David Sterba
    Cc: Greg Kroah-Hartman
    Cc: Ingo Molnar
    Cc: Petr Mladek
    Cc: "Rafael J . Wysocki"
    Cc: Steven Rostedt
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Rasmus Villemoes
     
  • For symmetry with ddebug_remove_module, and to avoid a bit of ifdeffery
    in module.c, move the declaration of ddebug_add_module inside #if
    defined(CONFIG_DYNAMIC_DEBUG) and add a corresponding no-op stub in the
    #else branch.

    Link: http://lkml.kernel.org/r/20190212214150.4807-10-linux@rasmusvillemoes.dk
    Signed-off-by: Rasmus Villemoes
    Acked-by: Jason Baron
    Cc: David Sterba
    Cc: Greg Kroah-Hartman
    Cc: Ingo Molnar
    Cc: Petr Mladek
    Cc: "Rafael J . Wysocki"
    Cc: Steven Rostedt
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Rasmus Villemoes
     
  • This serves two purposes: First, we get a diagnostic if (though
    extremely unlikely), any of the calls of ddebug_add_module for built-in
    code fails, effectively disabling dynamic_debug. Second, I want to make
    struct _ddebug opaque, and avoid accessing any of its members outside
    dynamic_debug.[ch].

    Link: http://lkml.kernel.org/r/20190212214150.4807-9-linux@rasmusvillemoes.dk
    Signed-off-by: Rasmus Villemoes
    Acked-by: Jason Baron
    Cc: David Sterba
    Cc: Greg Kroah-Hartman
    Cc: Ingo Molnar
    Cc: Petr Mladek
    Cc: "Rafael J . Wysocki"
    Cc: Steven Rostedt
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Rasmus Villemoes
     
  • The only caller of ddebug_{add,remove}_module outside dynamic_debug.c is
    kernel/module.c, which is obviously not itself modular (though it would
    be an interesting exercise to make that happen...). I also fail to see
    how these interfaces can be used by modules, in-tree or not.

    Link: http://lkml.kernel.org/r/20190212214150.4807-8-linux@rasmusvillemoes.dk
    Signed-off-by: Rasmus Villemoes
    Acked-by: Jason Baron
    Cc: David Sterba
    Cc: Greg Kroah-Hartman
    Cc: Ingo Molnar
    Cc: Petr Mladek
    Cc: "Rafael J . Wysocki"
    Cc: Steven Rostedt
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Rasmus Villemoes
     
  • Now that we store the passed-in string directly in ddebug_add_module, we
    can use pointer equality instead of strcmp. This is a little more
    efficient, but more importantly, this also makes the code somewhat more
    correct:

    Currently, if one loads and then unloads a module whose name happens to
    match the KBUILD_MODNAME of some built-in functionality (which need not
    even be modular at all), all of their dynamic debug entries vanish along
    with those of the actual module. For example, loading and unloading a
    core.ko hides all pr_debugs from drivers/base/core.c and other built-in
    files called core.c (incidentally, there is an in-tree module whose name
    is core, but I just tested this with an out-of-tree trivial one).

    Link: http://lkml.kernel.org/r/20190212214150.4807-7-linux@rasmusvillemoes.dk
    Signed-off-by: Rasmus Villemoes
    Acked-by: Jason Baron
    Cc: David Sterba
    Cc: Greg Kroah-Hartman
    Cc: Ingo Molnar
    Cc: Petr Mladek
    Cc: "Rafael J . Wysocki"
    Cc: Steven Rostedt
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Rasmus Villemoes
     
  • For built-in modules, we're already reusing the passed-in string via
    kstrdup_const(). But for actual modules (i.e. when we're called from
    dynamic_debug_setup in module.c), the passed-in string (which points at
    the name[] array inside struct module) is also guaranteed to live at
    least as long as the struct ddebug_table, since free_module() calls
    ddebug_remove_module().

    Link: http://lkml.kernel.org/r/20190212214150.4807-6-linux@rasmusvillemoes.dk
    Signed-off-by: Rasmus Villemoes
    Acked-by: Jason Baron
    Cc: David Sterba
    Cc: Greg Kroah-Hartman
    Cc: Ingo Molnar
    Cc: Petr Mladek
    Cc: "Rafael J . Wysocki"
    Cc: Steven Rostedt
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Rasmus Villemoes
     
  • Instead of defining DEFINE_DYNAMIC_DEBUG_METADATA in terms of a helper
    DEFINE_DYNAMIC_DEBUG_METADATA_KEY, that needs another helper dd_key_init
    to be properly defined, just make the various #ifdef branches define a
    _DPRINTK_KEY_INIT that can be used directly, similar to
    _DPRINTK_FLAGS_DEFAULT.

    Link: http://lkml.kernel.org/r/20190212214150.4807-5-linux@rasmusvillemoes.dk
    Signed-off-by: Rasmus Villemoes
    Acked-by: Jason Baron
    Cc: David Sterba
    Cc: Greg Kroah-Hartman
    Cc: Ingo Molnar
    Cc: Petr Mladek
    Cc: "Rafael J . Wysocki"
    Cc: Steven Rostedt
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Rasmus Villemoes
     
  • pr_debug_ratelimited tests the dynamic debug descriptor the
    old-fashioned way, and doesn't utilize the static key/jump label
    implementation when CONFIG_JUMP_LABEL is set. Use the
    DYNAMIC_DEBUG_BRANCH which is defined appropriately.

    Link: http://lkml.kernel.org/r/20190212214150.4807-4-linux@rasmusvillemoes.dk
    Signed-off-by: Rasmus Villemoes
    Acked-by: Petr Mladek
    Acked-by: Jason Baron
    Cc: Steven Rostedt
    Cc: David Sterba
    Cc: Greg Kroah-Hartman
    Cc: Ingo Molnar
    Cc: "Rafael J . Wysocki"
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Rasmus Villemoes
     
  • net_dbg_ratelimited tests the dynamic debug descriptor the old-fashioned
    way, and doesn't utilize the static key/jump label implementation when
    CONFIG_JUMP_LABEL is set. Use the DYNAMIC_DEBUG_BRANCH which is defined
    appropriately.

    Link: http://lkml.kernel.org/r/20190212214150.4807-3-linux@rasmusvillemoes.dk
    Signed-off-by: Rasmus Villemoes
    Acked-by: Jason Baron
    Cc: David Sterba
    Cc: Greg Kroah-Hartman
    Cc: Ingo Molnar
    Cc: Petr Mladek
    Cc: "Rafael J . Wysocki"
    Cc: Steven Rostedt
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Rasmus Villemoes
     
  • Patch series "various dynamic_debug patches", v4.

    This started as an experiment to see how hard it would be to change the
    four pointers in struct _ddebug into relative offsets, a la
    CONFIG_GENERIC_BUG_RELATIVE_POINTERS, thus saving 16 bytes per pr_debug
    site (and thus exactly making up for the extra space used by the
    introduction of jump labels in 9049fc74). I stumbled on a few things
    that are probably worth fixing regardless of whether that goal is deemed
    worthwhile.

    Back at v3 (in November), I redid the implementation on top of the fancy
    new asm-macros stuff. Luckily enough, v3 didn't get picked up, since
    the asm-macros were backed out again. I still want to do the
    relative-pointers thing eventually, but we're close to the merge window
    opening, so here's just most of the "incidental" patches, some of which
    also serve as preparation for the relative pointers.

    This patch (of 4):

    dev_dbg_ratelimited tests the dynamic debug descriptor the old-fashioned
    way, and doesn't utilize the static key/jump label implementation when
    CONFIG_JUMP_LABEL is set. Use the DYNAMIC_DEBUG_BRANCH which is defined
    appropriately.

    Link: http://lkml.kernel.org/r/20190212214150.4807-2-linux@rasmusvillemoes.dk
    Signed-off-by: Rasmus Villemoes
    Reviewed-by: Greg Kroah-Hartman
    Acked-by: Jason Baron
    Cc: David Sterba
    Cc: Petr Mladek
    Cc: "Rafael J . Wysocki"
    Cc: Steven Rostedt
    Cc: Greg Kroah-Hartman
    Cc: Ingo Molnar
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Rasmus Villemoes
     
  • Commit 95846ecf9dac ("pid: replace pid bitmap implementation with IDR
    API") removed next_pidmap() but left its declaration.

    Remove it. No functional change.

    Link: http://lkml.kernel.org/r/20190213113736.21922-1-namit@vmware.com
    Signed-off-by: Nadav Amit
    Cc: "Eric W. Biederman"
    Cc: Gargi Sharma
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Nadav Amit
     
  • tends to be cluttered because we often put various sort
    of unrelated stuff in it. So, we have split out a sensible chunk of
    code into a separate header from time to time.

    This commit splits out the *_MAX and *_MIN defines.

    The standard header contains various MAX, MIN constants
    including numerial limits. [1]

    I think it makes sense to move in-kernel MAX, MIN constants into
    include/linux/limits.h.

    We already have include/uapi/linux/limits.h to contain some user-space
    constants. I changed its include guard to _UAPI_LINUX_LIMITS_H. This
    change has no impact to the user-space because
    scripts/headers_install.sh rips off the '_UAPI' prefix from the include
    guards of exported headers.

    [1] http://pubs.opengroup.org/onlinepubs/009604499/basedefs/limits.h.html

    Link: http://lkml.kernel.org/r/1549156242-20806-2-git-send-email-yamada.masahiro@socionext.com
    Signed-off-by: Masahiro Yamada
    Cc: Alex Elder
    Cc: Alexey Dobriyan
    Cc: Zhang Yanmin
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Masahiro Yamada
     
  • The commit log of 44f564a4bf6a ("ipc: add definitions of USHORT_MAX and
    others") did not explain why it used (s16) and (u16) instead of (short)
    and (unsigned short).

    Let's use (short) and (unsigned short), which is more sensible, and more
    consistent with the other MAX/MIN defines.

    As you see in include/uapi/asm-generic/int-ll64.h, s16/u16 are
    typedef'ed as signed/unsigned short. So, this commit does not have a
    functional change.

    Remove the unneeded parentheses around ~0U while we are here.

    Link: http://lkml.kernel.org/r/1549156242-20806-1-git-send-email-yamada.masahiro@socionext.com
    Signed-off-by: Masahiro Yamada
    Cc: Alexey Dobriyan
    Cc: Zhang Yanmin
    Cc: Alex Elder
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Masahiro Yamada
     
  • Instead of doing this compile-time check in some slightly arbitrary user
    of struct filename, put it next to the definition.

    Link: http://lkml.kernel.org/r/20190208203015.29702-3-linux@rasmusvillemoes.dk
    Signed-off-by: Rasmus Villemoes
    Cc: Alexander Viro
    Cc: Kees Cook
    Cc: Luc Van Oostenryck
    Cc: Masahiro Yamada
    Cc: Nick Desaulniers
    Cc: Alexey Dobriyan
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Rasmus Villemoes
     
  • At the time of commit d048419311ff ("lib/vsprintf.c: expand field_width
    to 24 bits"), there was no compiletime_assert/BUILD_BUG/.... variant
    that could be used outside function scope. Now we have static_assert(),
    so move the assertion next to the definition instead of hiding it in
    some arbitrary function.

    Also add the appropriate #include to avoid relying on build_bug.h being
    pulled in via some arbitrary chain of includes.

    Link: http://lkml.kernel.org/r/20190208203015.29702-2-linux@rasmusvillemoes.dk
    Signed-off-by: Rasmus Villemoes
    Cc: Alexander Viro
    Cc: Kees Cook
    Cc: Luc Van Oostenryck
    Cc: Masahiro Yamada
    Cc: Nick Desaulniers
    Cc: Alexey Dobriyan
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Rasmus Villemoes
     
  • BUILD_BUG_ON() is a little annoying, since it cannot be used outside
    function scope. So one cannot put assertions about the sizeof() a
    struct next to the struct definition, but has to hide that in some more
    or less arbitrary function.

    Since gcc 4.6 (which is now also the required minimum), there is support
    for the C11 _Static_assert in all C modes, including gnu89. So add a
    simple wrapper for that.

    _Static_assert() requires a message argument, which is usually quite
    redundant (and I believe that bug got fixed at least in newer C++
    standards), but we can easily work around that with a little macro
    magic, making it optional.

    For example, adding

    static_assert(sizeof(struct printf_spec) == 8);

    in vsprintf.c and modifying that struct to violate it, one gets

    ./include/linux/build_bug.h:78:41: error: static assertion failed: "sizeof(struct printf_spec) == 8"
    #define __static_assert(expr, msg, ...) _Static_assert(expr, "" msg "")

    godbolt.org suggests that _Static_assert() has been support by clang
    since at least 3.0.0.

    Link: http://lkml.kernel.org/r/20190208203015.29702-1-linux@rasmusvillemoes.dk
    Signed-off-by: Rasmus Villemoes
    Acked-by: Alexey Dobriyan
    Cc: Masahiro Yamada
    Cc: Nick Desaulniers
    Cc: Kees Cook
    Cc: Luc Van Oostenryck
    Cc: Alexander Viro
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Rasmus Villemoes
     
  • Here are some of the more common spelling mistakes and typos that I've
    found while fixing up spelling mistakes in the kernel over the past 4
    months.

    Link: http://lkml.kernel.org/r/20190114110215.1986-1-colin.king@canonical.com
    Signed-off-by: Colin Ian King
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Colin Ian King
     
  • There is a plan to build the kernel with -Wimplicit-fallthrough and this
    place in the code produced a warning (W=1).

    This commit remove the following warning:

    kernel/sys.c:1748:6: warning: this statement may fall through [-Wimplicit-fallthrough=]

    Link: http://lkml.kernel.org/r/20190114203347.17530-1-malat@debian.org
    Signed-off-by: Mathieu Malaterre
    Reviewed-by: Andrew Morton
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Mathieu Malaterre
     
  • Since commit a2e514453861 ("kernel/hung_task.c: allow to set checking
    interval separately from timeout") added hung_task_check_interval_secs,
    setting a value different from hung_task_timeout_secs

    echo 0 > /proc/sys/kernel/hung_task_panic
    echo 120 > /proc/sys/kernel/hung_task_timeout_secs
    echo 5 > /proc/sys/kernel/hung_task_check_interval_secs

    causes confusing output as if the task was blocked for
    hung_task_timeout_secs seconds from the previous report.

    [ 399.395930] INFO: task kswapd0:75 blocked for more than 120 seconds.
    [ 405.027637] INFO: task kswapd0:75 blocked for more than 120 seconds.
    [ 410.659725] INFO: task kswapd0:75 blocked for more than 120 seconds.
    [ 416.292860] INFO: task kswapd0:75 blocked for more than 120 seconds.
    [ 421.932305] INFO: task kswapd0:75 blocked for more than 120 seconds.

    Although we could update t->last_switch_time after sched_show_task(t) if
    we want to report only every 120 seconds, reporting every 5 seconds
    might not be very bad for monitoring after a problematic situation has
    started. Thus, let's use continuously blocked time instead of updating
    previously reported time.

    [ 677.985011] INFO: task kswapd0:80 blocked for more than 122 seconds.
    [ 693.856126] INFO: task kswapd0:80 blocked for more than 138 seconds.
    [ 709.728075] INFO: task kswapd0:80 blocked for more than 154 seconds.
    [ 725.600018] INFO: task kswapd0:80 blocked for more than 170 seconds.
    [ 741.473133] INFO: task kswapd0:80 blocked for more than 186 seconds.

    Link: http://lkml.kernel.org/r/1551175083-10669-1-git-send-email-penguin-kernel@I-love.SAKURA.ne.jp
    Signed-off-by: Tetsuo Handa
    Acked-by: Dmitry Vyukov
    Cc: "Paul E. McKenney"
    Cc: Thomas Gleixner
    Cc: Peter Zijlstra
    Cc: Ingo Molnar
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Tetsuo Handa
     
  • sparse complains:

    CHECK kernel/hung_task.c
    kernel/hung_task.c:28:19: warning: symbol 'sysctl_hung_task_check_count' was not declared. Should it be static?
    kernel/hung_task.c:42:29: warning: symbol 'sysctl_hung_task_timeout_secs' was not declared. Should it be static?
    kernel/hung_task.c:47:29: warning: symbol 'sysctl_hung_task_check_interval_secs' was not declared. Should it be static?
    kernel/hung_task.c:49:19: warning: symbol 'sysctl_hung_task_warnings' was not declared. Should it be static?
    kernel/hung_task.c:61:28: warning: symbol 'sysctl_hung_task_panic' was not declared. Should it be static?
    kernel/hung_task.c:219:5: warning: symbol 'proc_dohung_task_timeout_secs' was not declared. Should it be static?

    Add the appropriate header file to provide declarations.

    Link: http://lkml.kernel.org/r/467.1548649525@turing-police.cc.vt.edu
    Signed-off-by: Valdis Kletnieks
    Cc: "Paul E. McKenney"
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Valdis Kletnieks
     
  • Use "unsigned int" instead of "unsigned", to make code more clear.

    Link: http://lkml.kernel.org/r/1551354739-6648-1-git-send-email-wdjjwb@163.com
    Signed-off-by: WangBo
    Reviewed-by: Masahiro Yamada
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    WangBo
     
  • The single quotation marks around "const" were causing a documentation
    markup warning with reST. Instead of fixing that warning, just delete
    that comment line and the gcc-3.3 hack of using "const" in the roundup()
    macro since gcc-3.3 is no longer supported for kernel builds.

    I did around 20 different $arch builds with no problems, but we'll just
    have to see if this causes problems for anyone else out there.

    Link: http://lkml.kernel.org/r/ec5dcf72-7c3e-3513-af0c-4003ed598854@infradead.org
    Signed-off-by: Randy Dunlap
    Suggested-by: Matthew Wilcox
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Randy Dunlap
     
  • Use DEFINE_DEBUGFS_ATTRIBUTE rather than DEFINE_SIMPLE_ATTRIBUTE for
    debugfs files.

    Semantic patch information:
    Rationale: DEFINE_SIMPLE_ATTRIBUTE + debugfs_create_file()
    imposes some significant overhead as compared to
    DEFINE_DEBUGFS_ATTRIBUTE + debugfs_create_file_unsafe().

    Generated by: scripts/coccinelle/api/debugfs/debugfs_simple_attr.cocci

    The _unsafe() part suggests that some of them "safeness
    responsibilities" are now panic.c responsibilities. The patch is OK
    since panic's clear_warn_once_fops struct file_operations is safe
    against removal, so we don't have to use otherwise necessary
    debugfs_file_get()/debugfs_file_put().

    [sergey.senozhatsky.work@gmail.com: changelog addition]
    Link: http://lkml.kernel.org/r/1545990861-158097-1-git-send-email-yuehaibing@huawei.com
    Signed-off-by: YueHaibing
    Reviewed-by: Sergey Senozhatsky
    Cc: Kees Cook
    Cc: Borislav Petkov
    Cc: Steven Rostedt (VMware)
    Cc: Petr Mladek
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    YueHaibing
     
  • Include asm/div64.h for do_div() usage in DIV_ROUND_DOWN_ULL() and
    DIV_ROUND_CLOSEST_ULL(). Remove the old CONFIG_LBDAF=y conditional
    include.

    Link: http://lkml.kernel.org/r/20181228153430.23763-1-jani.nikula@intel.com
    Signed-off-by: Jani Nikula
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jani Nikula
     

07 Mar, 2019

1 commit

  • Pull USB/PHY updates from Greg KH:
    "Here is the big USB/PHY driver pull request for 5.1-rc1.

    The usual set of gadget driver updates, phy driver updates, xhci
    updates, and typec additions. Also included in here are a lot of small
    cleanups and fixes and driver updates where needed.

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

    * tag 'usb-5.1-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: (167 commits)
    wusb: Remove unnecessary static function ckhdid_printf
    usb: core: make default autosuspend delay configurable
    usb: core: Fix typo in description of "authorized_default"
    usb: chipidea: Refactor USB PHY selection and keep a single PHY
    usb: chipidea: Grab the (legacy) USB PHY by phandle first
    usb: chipidea: imx: set power polarity
    dt-bindings: usb: ci-hdrc-usb2: add property power-active-high
    usb: chipidea: imx: remove unused header files
    usb: chipidea: tegra: Fix missed ci_hdrc_remove_device()
    usb: core: add option of only authorizing internal devices
    usb: typec: tps6598x: handle block writes separately with plain-I2C adapters
    usb: xhci: Fix for Enabling USB ROLE SWITCH QUIRK on INTEL_SUNRISEPOINT_LP_XHCI
    usb: xhci: fix build warning - missing prototype
    usb: xhci: dbc: Fixing typo error.
    usb: xhci: remove unused member 'parent' in xhci_regset struct
    xhci: tegra: Prevent error pointer dereference
    USB: serial: option: add Telit ME910 ECM composition
    usb: core: Replace hardcoded check with inline function from usb.h
    usb: core: skip interfaces disabled in devicetree
    usb: typec: mux: remove redundant check on variable match
    ...

    Linus Torvalds