07 Oct, 2020

2 commits


04 Apr, 2020

1 commit

  • Pull SPDX updates from Greg KH:
    "Here are three SPDX patches for 5.7-rc1.

    One fixes up the SPDX tag for a single driver, while the other two go
    through the tree and add SPDX tags for all of the .gitignore files as
    needed.

    Nothing too complex, but you will get a merge conflict with your
    current tree, that should be trivial to handle (one file modified by
    two things, one file deleted.)

    All three of these have been in linux-next for a while, with no
    reported issues other than the merge conflict"

    * tag 'spdx-5.7-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/spdx:
    ASoC: MT6660: make spdxcheck.py happy
    .gitignore: add SPDX License Identifier
    .gitignore: remove too obvious comments

    Linus Torvalds
     

25 Mar, 2020

1 commit


13 Mar, 2020

1 commit

  • xas_for_each_marked() is using entry == NULL as a termination condition
    of the iteration. When xas_for_each_marked() is used protected only by
    RCU, this can however race with xas_store(xas, NULL) in the following
    way:

    TASK1 TASK2
    page_cache_delete() find_get_pages_range_tag()
    xas_for_each_marked()
    xas_find_marked()
    off = xas_find_chunk()

    xas_store(&xas, NULL)
    xas_init_marks(&xas);
    ...
    rcu_assign_pointer(*slot, NULL);
    entry = xa_entry(off);

    And thus xas_for_each_marked() terminates prematurely possibly leading
    to missed entries in the iteration (translating to missing writeback of
    some pages or a similar problem).

    If we find a NULL entry that has been marked, skip it (unless we're trying
    to allocate an entry).

    Reported-by: Jan Kara
    CC: stable@vger.kernel.org
    Fixes: ef8e5717db01 ("page cache: Convert delete_batch to XArray")
    Signed-off-by: Matthew Wilcox (Oracle)

    Matthew Wilcox (Oracle)
     

28 Feb, 2020

1 commit


09 Jul, 2019

1 commit

  • Pull RCU updates from Ingo Molnar:
    "The changes in this cycle are:

    - RCU flavor consolidation cleanups and optmizations

    - Documentation updates

    - Miscellaneous fixes

    - SRCU updates

    - RCU-sync flavor consolidation

    - Torture-test updates

    - Linux-kernel memory-consistency-model updates, most notably the
    addition of plain C-language accesses"

    * 'core-rcu-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (61 commits)
    tools/memory-model: Improve data-race detection
    tools/memory-model: Change definition of rcu-fence
    tools/memory-model: Expand definition of barrier
    tools/memory-model: Do not use "herd" to refer to "herd7"
    tools/memory-model: Fix comment in MP+poonceonces.litmus
    Documentation: atomic_t.txt: Explain ordering provided by smp_mb__{before,after}_atomic()
    rcu: Don't return a value from rcu_assign_pointer()
    rcu: Force inlining of rcu_read_lock()
    rcu: Fix irritating whitespace error in rcu_assign_pointer()
    rcu: Upgrade sync_exp_work_done() to smp_mb()
    rcutorture: Upper case solves the case of the vanishing NULL pointer
    torture: Suppress propagating trace_printk() warning
    rcutorture: Dump trace buffer for callback pipe drain failures
    torture: Add --trust-make to suppress "make clean"
    torture: Make --cpus override idleness calculations
    torture: Run kernel build in source directory
    torture: Add function graph-tracing cheat sheet
    torture: Capture qemu output
    rcutorture: Tweak kvm options
    rcutorture: Add trivial RCU implementation
    ...

    Linus Torvalds
     

29 Jun, 2019

2 commits

  • Pull XArray fixes from Matthew Wilcox:

    - Account XArray nodes for the page cache to the appropriate cgroup
    (Johannes Weiner)

    - Fix idr_get_next() when called under the RCU lock (Matthew Wilcox)

    - Add a test for xa_insert() (Matthew Wilcox)

    * tag 'xarray-5.2-rc6' of git://git.infradead.org/users/willy/linux-dax:
    XArray tests: Add check_insert
    idr: Fix idr_get_next race with idr_remove
    mm: fix page cache convergence regression

    Linus Torvalds
     
  • …k/linux-rcu into core/rcu

    Pull rcu/next + tools/memory-model changes from Paul E. McKenney:

    - RCU flavor consolidation cleanups and optmizations
    - Documentation updates
    - Miscellaneous fixes
    - SRCU updates
    - RCU-sync flavor consolidation
    - Torture-test updates
    - Linux-kernel memory-consistency-model updates, most notably the addition of plain C-language accesses

    Signed-off-by: Ingo Molnar <mingo@kernel.org>

    Ingo Molnar
     

14 Jun, 2019

1 commit

  • Quoting Paul [1]:

    "Given that a quick (and perhaps error-prone) search of the uses
    of rcu_assign_pointer() in v5.1 didn't find a single use of the
    return value, let's please instead change the documentation and
    implementation to eliminate the return value."

    [1] https://lkml.kernel.org/r/20190523135013.GL28207@linux.ibm.com

    Signed-off-by: Andrea Parri
    Cc: "Paul E. McKenney"
    Cc: Josh Triplett
    Cc: Steven Rostedt
    Cc: Mathieu Desnoyers
    Cc: Lai Jiangshan
    Cc: Joel Fernandes
    Cc: rcu@vger.kernel.org
    Cc: Peter Zijlstra
    Cc: Will Deacon
    Cc: Mark Rutland
    Cc: Matthew Wilcox
    Cc: Sasha Levin
    Signed-off-by: Paul E. McKenney

    Andrea Parri
     

05 Jun, 2019

1 commit

  • Based on 1 normalized pattern(s):

    this program is free software you can redistribute it and or modify
    it under the terms and conditions of the gnu general public license
    version 2 as published by the free software foundation this program
    is distributed in the hope it will be useful but without any
    warranty without even the implied warranty of merchantability or
    fitness for a particular purpose see the gnu general public license
    for more details

    extracted by the scancode license scanner the SPDX license identifier

    GPL-2.0-only

    has been chosen to replace the boilerplate/reference in 263 file(s).

    Signed-off-by: Thomas Gleixner
    Reviewed-by: Allison Randal
    Reviewed-by: Alexios Zavras
    Cc: linux-spdx@vger.kernel.org
    Link: https://lkml.kernel.org/r/20190529141901.208660670@linutronix.de
    Signed-off-by: Greg Kroah-Hartman

    Thomas Gleixner
     

03 Jun, 2019

1 commit

  • If the entry is deleted from the IDR between the call to
    radix_tree_iter_find() and rcu_dereference_raw(), idr_get_next()
    will return NULL, which will end the iteration prematurely. We should
    instead continue to the next entry in the IDR. This only happens if the
    iteration is protected by the RCU lock. Most IDR users use a spinlock
    or semaphore to exclude simultaneous modifications. It was noticed once
    the PID allocator was converted to use the IDR, as it uses the RCU lock,
    but there may be other users elsewhere in the kernel.

    We can't use the normal pattern of calling radix_tree_deref_retry()
    (which catches both a retry entry in a leaf node and a node entry in
    the root) as the IDR supports storing entries which are unaligned,
    which will trigger an infinite loop if they are encountered. Instead,
    we have to explicitly check whether the entry is a retry entry.

    Fixes: 0a835c4f090a ("Reimplement IDR and IDA using the radix tree")
    Reported-by: Brendan Gregg
    Tested-by: Brendan Gregg
    Signed-off-by: Matthew Wilcox (Oracle)

    Matthew Wilcox (Oracle)
     

06 Dec, 2018

1 commit

  • Commit 66ee620f06f9 ("idr: Permit any valid kernel pointer to be stored")
    changed the radix tree lookup so that it stops when reaching the bottom
    of the tree. However, the condition was added in the wrong place,
    making it possible to return retry entries to the caller. Reorder the
    tests to check for the retry entry before checking whether we're at the
    bottom of the tree. The retry entry should never be found in the tree
    root, so it's safe to defer the check until the end of the loop.

    Add a regression test to the test-suite to be sure this doesn't come
    back.

    Fixes: 66ee620f06f9 ("idr: Permit any valid kernel pointer to be stored")
    Reported-by: Greg Kurz
    Signed-off-by: Matthew Wilcox

    Matthew Wilcox
     

21 Oct, 2018

23 commits


30 Sep, 2018

3 commits

  • Instead of storing a pointer to the slot containing the canonical entry,
    store the offset of the slot. Produces slightly more efficient code
    (~300 bytes) and simplifies the implementation.

    Signed-off-by: Matthew Wilcox
    Reviewed-by: Josef Bacik

    Matthew Wilcox
     
  • Introduce xarray value entries and tagged pointers to replace radix
    tree exceptional entries. This is a slight change in encoding to allow
    the use of an extra bit (we can now store BITS_PER_LONG - 1 bits in a
    value entry). It is also a change in emphasis; exceptional entries are
    intimidating and different. As the comment explains, you can choose
    to store values or pointers in the xarray and they are both first-class
    citizens.

    Signed-off-by: Matthew Wilcox
    Reviewed-by: Josef Bacik

    Matthew Wilcox
     
  • An upcoming change to the encoding of internal entries will set the bottom
    two bits to 0b10. Unfortunately, m68k only aligns some data structures
    to 2 bytes, so the IDR will interpret them as internal entries and things
    will go badly wrong.

    Change the radix tree so that it stops either when the node indicates
    that it's the bottom of the tree (shift == 0) or when the entry is not an
    internal entry. This means we cannot insert an arbitrary kernel pointer
    as a multiorder entry, but the IDR does not permit multiorder entries.

    Annoyingly, this means the IDR can no longer take advantage of the radix
    tree's ability to store a single entry at offset 0 without allocating
    memory. A pointer which is 2-byte aligned cannot be stored directly in
    the root as it would be indistinguishable from a node, so we must allocate
    a node in order to store a 2-byte pointer at index 0. The idr_replace()
    function does not take a GFP flags argument, so cannot allocate memory.
    If a user inserts a 4-byte aligned pointer at index 0 and then replaces
    it with a 2-byte aligned pointer, we must be able to store it.

    Arbitrary pointer values are still not permitted; pointers of the
    form 2 + (i * 4) for values of i between 0 and 1023 are reserved for
    the implementation. These are not valid kernel pointers as they would
    point into the zero page.

    This change does cause a runtime memory consumption regression for
    the IDA. I will recover that later.

    Signed-off-by: Matthew Wilcox
    Tested-by: Guenter Roeck

    Matthew Wilcox
     

22 Aug, 2018

1 commit