Skip to content
Permalink
Sai-Prakash-Ra…
Switch branches/tags

Commits on Jan 15, 2022

  1. asm-generic/io: Add logging support for MMIO accessors

    Add logging support for MMIO high level accessors such as read{b,w,l,q}
    and their relaxed versions to aid in debugging unexpected crashes/hangs
    caused by the corresponding MMIO operation. Also add a generic flag
    (__DISABLE_TRACE_MMIO__) which is used to disable MMIO tracing in nVHE KVM
    and if required can be used to disable MMIO tracing for specific drivers.
    
    Signed-off-by: Sai Prakash Ranjan <quic_saipraka@quicinc.com>
    Sai Prakash Ranjan authored and intel-lab-lkp committed Jan 15, 2022
  2. lib: Add register read/write tracing support

    Generic MMIO read/write i.e., __raw_{read,write}{b,l,w,q} accessors
    are typically used to read/write from/to memory mapped registers
    and can cause hangs or some undefined behaviour in following few
    cases,
    
    * If the access to the register space is unclocked, for example: if
      there is an access to multimedia(MM) block registers without MM
      clocks.
    
    * If the register space is protected and not set to be accessible from
      non-secure world, for example: only EL3 (EL: Exception level) access
      is allowed and any EL2/EL1 access is forbidden.
    
    * If xPU(memory/register protection units) is controlling access to
      certain memory/register space for specific clients.
    
    and more...
    
    Such cases usually results in instant reboot/SErrors/NOC or interconnect
    hangs and tracing these register accesses can be very helpful to debug
    such issues during initial development stages and also in later stages.
    
    So use ftrace trace events to log such MMIO register accesses which
    provides rich feature set such as early enablement of trace events,
    filtering capability, dumping ftrace logs on console and many more.
    
    Sample output:
    
    rwmmio_write: __qcom_geni_serial_console_write+0x160/0x1e0 width=32 val=0xa0d5d addr=0xfffffbfffdbff700
    rwmmio_post_write: __qcom_geni_serial_console_write+0x160/0x1e0 width=32 val=0xa0d5d addr=0xfffffbfffdbff700
    rwmmio_read: qcom_geni_serial_poll_bit+0x94/0x138 width=32 addr=0xfffffbfffdbff610
    rwmmio_post_read: qcom_geni_serial_poll_bit+0x94/0x138 width=32 val=0x0 addr=0xfffffbfffdbff610
    
    Signed-off-by: Prasad Sodagudi <psodagud@codeaurora.org>
    Co-developed-by: Sai Prakash Ranjan <quic_saipraka@quicinc.com>
    Signed-off-by: Sai Prakash Ranjan <quic_saipraka@quicinc.com>
    Prasad Sodagudi authored and intel-lab-lkp committed Jan 15, 2022
  3. drm/meson: Fix overflow implicit truncation warnings

    Fix -Woverflow warnings for drm/meson driver which is a result
    of moving arm64 custom MMIO accessor macros to asm-generic function
    implementations giving a bonus type-checking now and uncovering these
    overflow warnings.
    
    drivers/gpu/drm/meson/meson_viu.c: In function ‘meson_viu_init’:
    drivers/gpu/drm/meson/meson_registers.h:1826:48: error: large integer implicitly truncated to unsigned type [-Werror=overflow]
     #define  VIU_OSD_BLEND_REORDER(dest, src)      ((src) << (dest * 4))
                                                    ^
    drivers/gpu/drm/meson/meson_viu.c:472:18: note: in expansion of macro ‘VIU_OSD_BLEND_REORDER’
       writel_relaxed(VIU_OSD_BLEND_REORDER(0, 1) |
                      ^~~~~~~~~~~~~~~~~~~~~
    
    Cc: Arnd Bergmann <arnd@arndb.de>
    Cc: Neil Armstrong <narmstrong@baylibre.com>
    Reported-by: kernel test robot <lkp@intel.com>
    Signed-off-by: Sai Prakash Ranjan <quic_saipraka@quicinc.com>
    Sai Prakash Ranjan authored and intel-lab-lkp committed Jan 15, 2022
  4. irqchip/tegra: Fix overflow implicit truncation warnings

    Fix -Woverflow warnings for tegra irqchip driver which is a result
    of moving arm64 custom MMIO accessor macros to asm-generic function
    implementations giving a bonus type-checking now and uncovering these
    overflow warnings.
    
    drivers/irqchip/irq-tegra.c: In function ‘tegra_ictlr_suspend’:
    drivers/irqchip/irq-tegra.c:151:18: warning: large integer implicitly truncated to unsigned type [-Woverflow]
       writel_relaxed(~0ul, ictlr + ICTLR_COP_IER_CLR);
                      ^
    
    Cc: Marc Zyngier <maz@kernel.org>
    Reviewed-by: Arnd Bergmann <arnd@arndb.de>
    Signed-off-by: Sai Prakash Ranjan <quic_saipraka@quicinc.com>
    Sai Prakash Ranjan authored and intel-lab-lkp committed Jan 15, 2022
  5. arm64: io: Use asm-generic high level MMIO accessors

    Remove custom arm64 MMIO accessors read{b,w,l,q} and their relaxed
    versions in support to use asm-generic defined accessors. Also define
    one set of IO barriers (ar/bw version) used by asm-generic code to
    override the arm64 specific variants.
    
    Suggested-by: Arnd Bergmann <arnd@arndb.de>
    Signed-off-by: Sai Prakash Ranjan <quic_saipraka@quicinc.com>
    Sai Prakash Ranjan authored and intel-lab-lkp committed Jan 15, 2022
  6. Add linux-next specific files for 20220115

    Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
    sfrothwell committed Jan 15, 2022
  7. Merge branch 'akpm/master'

    sfrothwell committed Jan 15, 2022
  8. mm: hide the FRONTSWAP Kconfig symbol

    Select FRONTSWAP from ZSWAP instead of prompting for it.
    
    Link: https://lkml.kernel.org/r/20211224062246.1258487-14-hch@lst.de
    Signed-off-by: Christoph Hellwig <hch@lst.de>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    Cc: Dan Streetman <ddstreet@ieee.org>
    Cc: Geert Uytterhoeven <geert@linux-m68k.org>
    Cc: Hugh Dickins <hughd@google.com>
    Cc: Konrad Rzeszutek Wilk <Konrad.wilk@oracle.com>
    Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
    Cc: Seth Jennings <sjenning@redhat.com>
    Cc: Vitaly Wool <vitaly.wool@konsulko.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
    Christoph Hellwig authored and sfrothwell committed Jan 15, 2022
  9. frontswap: remove support for multiple ops

    There is only a single instance of frontswap ops in the kernel, so
    simplify the frontswap code by removing support for multiple operations.
    
    Link: https://lkml.kernel.org/r/20211224062246.1258487-13-hch@lst.de
    Signed-off-by: Christoph Hellwig <hch@lst.de>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    Cc: Dan Streetman <ddstreet@ieee.org>
    Cc: Geert Uytterhoeven <geert@linux-m68k.org>
    Cc: Hugh Dickins <hughd@google.com>
    Cc: Konrad Rzeszutek Wilk <Konrad.wilk@oracle.com>
    Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
    Cc: Seth Jennings <sjenning@redhat.com>
    Cc: Vitaly Wool <vitaly.wool@konsulko.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
    Christoph Hellwig authored and sfrothwell committed Jan 15, 2022
  10. mm: mark swap_lock and swap_active_head static

    swap_lock and swap_active_head are only used in swapfile.c, so mark them
    static.
    
    Link: https://lkml.kernel.org/r/20211224062246.1258487-12-hch@lst.de
    Signed-off-by: Christoph Hellwig <hch@lst.de>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    Cc: Dan Streetman <ddstreet@ieee.org>
    Cc: Geert Uytterhoeven <geert@linux-m68k.org>
    Cc: Hugh Dickins <hughd@google.com>
    Cc: Konrad Rzeszutek Wilk <Konrad.wilk@oracle.com>
    Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
    Cc: Seth Jennings <sjenning@redhat.com>
    Cc: Vitaly Wool <vitaly.wool@konsulko.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
    Christoph Hellwig authored and sfrothwell committed Jan 15, 2022
  11. frontswap: simplify frontswap_register_ops

    Given that frontswap_register_ops must be called from built-in code,
    there is no need to handle the case of swapfiles coming online before
    or during it, so delete the code that deals with that case.
    
    Link: https://lkml.kernel.org/r/20211224062246.1258487-11-hch@lst.de
    Signed-off-by: Christoph Hellwig <hch@lst.de>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    Cc: Dan Streetman <ddstreet@ieee.org>
    Cc: Geert Uytterhoeven <geert@linux-m68k.org>
    Cc: Hugh Dickins <hughd@google.com>
    Cc: Konrad Rzeszutek Wilk <Konrad.wilk@oracle.com>
    Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
    Cc: Seth Jennings <sjenning@redhat.com>
    Cc: Vitaly Wool <vitaly.wool@konsulko.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
    Christoph Hellwig authored and sfrothwell committed Jan 15, 2022
  12. frontswap: remove frontswap_test

    frontswap_test is unused now, remove it.
    
    Link: https://lkml.kernel.org/r/20211224062246.1258487-10-hch@lst.de
    Signed-off-by: Christoph Hellwig <hch@lst.de>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    Cc: Dan Streetman <ddstreet@ieee.org>
    Cc: Geert Uytterhoeven <geert@linux-m68k.org>
    Cc: Hugh Dickins <hughd@google.com>
    Cc: Konrad Rzeszutek Wilk <Konrad.wilk@oracle.com>
    Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
    Cc: Seth Jennings <sjenning@redhat.com>
    Cc: Vitaly Wool <vitaly.wool@konsulko.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
    Christoph Hellwig authored and sfrothwell committed Jan 15, 2022
  13. mm-simplify-try_to_unuse-fix

    fix shmem_unuse() stub, per Matthew
    
    Reported-by: Naresh Kamboju <naresh.kamboju@linaro.org>
    Cc: Christoph Hellwig <hch@lst.de>
    Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
    Cc: Stephen Rothwell <sfr@canb.auug.org.au>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
    akpm00 authored and sfrothwell committed Jan 15, 2022
  14. mm: simplify try_to_unuse

    Remove the unused frontswap and pages_to_unuse arguments, and mark
    the function static now that the caller in frontswap is gone.
    
    Link: https://lkml.kernel.org/r/20211224062246.1258487-9-hch@lst.de
    Signed-off-by: Christoph Hellwig <hch@lst.de>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    Cc: Dan Streetman <ddstreet@ieee.org>
    Cc: Geert Uytterhoeven <geert@linux-m68k.org>
    Cc: Hugh Dickins <hughd@google.com>
    Cc: Konrad Rzeszutek Wilk <Konrad.wilk@oracle.com>
    Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
    Cc: Seth Jennings <sjenning@redhat.com>
    Cc: Vitaly Wool <vitaly.wool@konsulko.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
    Christoph Hellwig authored and sfrothwell committed Jan 15, 2022
  15. frontswap: remove the frontswap exports

    None of the frontswap API is called from modular code.
    
    Link: https://lkml.kernel.org/r/20211224062246.1258487-8-hch@lst.de
    Signed-off-by: Christoph Hellwig <hch@lst.de>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    Cc: Dan Streetman <ddstreet@ieee.org>
    Cc: Geert Uytterhoeven <geert@linux-m68k.org>
    Cc: Hugh Dickins <hughd@google.com>
    Cc: Konrad Rzeszutek Wilk <Konrad.wilk@oracle.com>
    Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
    Cc: Seth Jennings <sjenning@redhat.com>
    Cc: Vitaly Wool <vitaly.wool@konsulko.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
    Christoph Hellwig authored and sfrothwell committed Jan 15, 2022
  16. frontswap: simplify frontswap_init

    Just use IS_ENABLED() and remove the __frontswap_init indirection.
    Also remove the unused export.
    
    Link: https://lkml.kernel.org/r/20211224062246.1258487-7-hch@lst.de
    Signed-off-by: Christoph Hellwig <hch@lst.de>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    Cc: Dan Streetman <ddstreet@ieee.org>
    Cc: Geert Uytterhoeven <geert@linux-m68k.org>
    Cc: Hugh Dickins <hughd@google.com>
    Cc: Konrad Rzeszutek Wilk <Konrad.wilk@oracle.com>
    Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
    Cc: Seth Jennings <sjenning@redhat.com>
    Cc: Vitaly Wool <vitaly.wool@konsulko.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
    Christoph Hellwig authored and sfrothwell committed Jan 15, 2022
  17. frontswap: remove frontswap_curr_pages

    frontswap_curr_pages is never called, so remove it.
    
    Link: https://lkml.kernel.org/r/20211224062246.1258487-6-hch@lst.de
    Signed-off-by: Christoph Hellwig <hch@lst.de>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    Cc: Dan Streetman <ddstreet@ieee.org>
    Cc: Geert Uytterhoeven <geert@linux-m68k.org>
    Cc: Hugh Dickins <hughd@google.com>
    Cc: Konrad Rzeszutek Wilk <Konrad.wilk@oracle.com>
    Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
    Cc: Seth Jennings <sjenning@redhat.com>
    Cc: Vitaly Wool <vitaly.wool@konsulko.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
    Christoph Hellwig authored and sfrothwell committed Jan 15, 2022
  18. frontswap: remove frontswap_shrink

    frontswap_shrink is never called, so remove it.
    
    Link: https://lkml.kernel.org/r/20211224062246.1258487-5-hch@lst.de
    Signed-off-by: Christoph Hellwig <hch@lst.de>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    Cc: Dan Streetman <ddstreet@ieee.org>
    Cc: Geert Uytterhoeven <geert@linux-m68k.org>
    Cc: Hugh Dickins <hughd@google.com>
    Cc: Konrad Rzeszutek Wilk <Konrad.wilk@oracle.com>
    Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
    Cc: Seth Jennings <sjenning@redhat.com>
    Cc: Vitaly Wool <vitaly.wool@konsulko.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
    Christoph Hellwig authored and sfrothwell committed Jan 15, 2022
  19. frontswap: remove frontswap_tmem_exclusive_gets

    frontswap_tmem_exclusive_gets is never called, so remove it.
    
    Link: https://lkml.kernel.org/r/20211224062246.1258487-4-hch@lst.de
    Signed-off-by: Christoph Hellwig <hch@lst.de>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    Cc: Dan Streetman <ddstreet@ieee.org>
    Cc: Geert Uytterhoeven <geert@linux-m68k.org>
    Cc: Hugh Dickins <hughd@google.com>
    Cc: Konrad Rzeszutek Wilk <Konrad.wilk@oracle.com>
    Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
    Cc: Seth Jennings <sjenning@redhat.com>
    Cc: Vitaly Wool <vitaly.wool@konsulko.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
    Christoph Hellwig authored and sfrothwell committed Jan 15, 2022
  20. frontswap: remove frontswap_writethrough

    frontswap_writethrough is never called, so remove it.
    
    Link: https://lkml.kernel.org/r/20211224062246.1258487-3-hch@lst.de
    Signed-off-by: Christoph Hellwig <hch@lst.de>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    Cc: Dan Streetman <ddstreet@ieee.org>
    Cc: Geert Uytterhoeven <geert@linux-m68k.org>
    Cc: Hugh Dickins <hughd@google.com>
    Cc: Konrad Rzeszutek Wilk <Konrad.wilk@oracle.com>
    Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
    Cc: Seth Jennings <sjenning@redhat.com>
    Cc: Vitaly Wool <vitaly.wool@konsulko.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
    Christoph Hellwig authored and sfrothwell committed Jan 15, 2022
  21. mm: remove cleancache

    Patch series "remove Xen tmem leftovers".
    
    Since the removal of the Xen tmem driver in 2019, the cleancache hooks are
    entirely unused, as are large parts of frontswap.  This series against
    linux-next (with the folio changes included) removes cleancaches, and cuts
    down frontswap to the bits actually used by zswap.
    
    This patch (of 13):
    
    The cleancache subsystem is unused since the removal of Xen tmem driver in
    commit 814bbf4 ("xen: remove tmem driver").
    
    Link: https://lkml.kernel.org/r/20211224062246.1258487-1-hch@lst.de
    Link: https://lkml.kernel.org/r/20211224062246.1258487-2-hch@lst.de
    Signed-off-by: Christoph Hellwig <hch@lst.de>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>
    Cc: Konrad Rzeszutek Wilk <Konrad.wilk@oracle.com>
    Cc: Hugh Dickins <hughd@google.com>
    Cc: Seth Jennings <sjenning@redhat.com>
    Cc: Dan Streetman <ddstreet@ieee.org>
    Cc: Vitaly Wool <vitaly.wool@konsulko.com>
    Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
    Christoph Hellwig authored and sfrothwell committed Jan 15, 2022
  22. lib/stackdepot: always do filter_irq_stacks() in stack_depot_save()

    The non-interrupt portion of interrupt stack traces before interrupt entry
    is usually arbitrary.  Therefore, saving stack traces of interrupts (that
    include entries before interrupt entry) to stack depot leads to unbounded
    stackdepot growth.
    
    As such, use of filter_irq_stacks() is a requirement to ensure stackdepot
    can efficiently deduplicate interrupt stacks.
    
    Looking through all current users of stack_depot_save(), none (except
    KASAN) pass the stack trace through filter_irq_stacks() before passing it
    on to stack_depot_save().
    
    Rather than adding filter_irq_stacks() to all current users of
    stack_depot_save(), it became clear that stack_depot_save() should simply
    do filter_irq_stacks().
    
    Link: https://lkml.kernel.org/r/20211130095727.2378739-1-elver@google.com
    Signed-off-by: Marco Elver <elver@google.com>
    Reviewed-by: Alexander Potapenko <glider@google.com>
    Acked-by: Vlastimil Babka <vbabka@suse.cz>
    Reviewed-by: Andrey Konovalov <andreyknvl@gmail.com>
    Cc: Andrey Ryabinin <ryabinin.a.a@gmail.com>
    Cc: Dmitry Vyukov <dvyukov@google.com>
    Cc: Vijayanand Jitta <vjitta@codeaurora.org>
    Cc: "Gustavo A. R. Silva" <gustavoars@kernel.org>
    Cc: Imran Khan <imran.f.khan@oracle.com>
    Cc: Chris Wilson <chris@chris-wilson.co.uk>
    Cc: Jani Nikula <jani.nikula@intel.com>
    Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
    melver authored and sfrothwell committed Jan 15, 2022
  23. lib/stackdepot: allow optional init and stack_table allocation by kvm…

    …alloc() - fixup4
    
    Due to 4e66934 ("lib: add reference counting tracking
    infrastructure") landing recently to net-next adding a new stack depot
    user in lib/ref_tracker.c we need to add an appropriate call to
    stack_depot_init() there as well.
    
    Link: https://lkml.kernel.org/r/45c1b738-1a2f-5b5f-2f6d-86fab206d01c@suse.cz
    Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
    Reviewed-by: Eric Dumazet <edumazet@google.com>
    Cc: Jiri Slab <jirislaby@gmail.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
    tehcaster authored and sfrothwell committed Jan 15, 2022
  24. lib/stackdepot: allow optional init and stack_table allocation by kvm…

    …alloc() - fixup3
    
    Due to cd06ab2 ("drm/locking: add backtrace for locking contended
    locks without backoff") landing recently to -next adding a new stack depot
    user in drivers/gpu/drm/drm_modeset_lock.c we need to add an appropriate
    call to stack_depot_init() there as well.
    
    Link: https://lkml.kernel.org/r/2a692365-cfa1-64f2-34e0-8aa5674dce5e@suse.cz
    Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
    Cc: Jani Nikula <jani.nikula@intel.com>
    Cc: Naresh Kamboju <naresh.kamboju@linaro.org>
    Cc: Marco Elver <elver@google.com>
    Cc: Vijayanand Jitta <vjitta@codeaurora.org>
    Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
    Cc: Maxime Ripard <mripard@kernel.org>
    Cc: Thomas Zimmermann <tzimmermann@suse.de>
    Cc: David Airlie <airlied@linux.ie>
    Cc: Daniel Vetter <daniel@ffwll.ch>
    Cc: Andrey Ryabinin <ryabinin.a.a@gmail.com>
    Cc: Alexander Potapenko <glider@google.com>
    Cc: Andrey Konovalov <andreyknvl@gmail.com>
    Cc: Dmitry Vyukov <dvyukov@google.com>
    Cc: Geert Uytterhoeven <geert@linux-m68k.org>
    Cc: Oliver Glitta <glittao@gmail.com>
    Cc: Imran Khan <imran.f.khan@oracle.com>
    Cc: Stephen Rothwell <sfr@canb.auug.org.au>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
    tehcaster authored and sfrothwell committed Jan 15, 2022
  25. lib/stackdepot: allow optional init and stack_table allocation by kvm…

    …alloc() - fixup
    
    On FLATMEM, we call page_ext_init_flatmem_late() just before
    kmem_cache_init() which means stack_depot_init() (called by page owner
    init) will not recognize properly it should use kvmalloc() and not
    memblock_alloc().  memblock_alloc() will also not issue a warning and
    return a block memory that can be invalid and cause kernel page fault when
    saving stacks, as reported by the kernel test robot [1].
    
    Fix this by moving page_ext_init_flatmem_late() below kmem_cache_init() so
    that slab_is_available() is true during stack_depot_init().  SPARSEMEM
    doesn't have this issue, as it doesn't do page_ext_init_flatmem_late(),
    but a different page_ext_init() even later in the boot process.
    
    Thanks to Mike Rapoport for pointing out the FLATMEM init ordering issue.
    
    While at it, also actually resolve a checkpatch warning in stack_depot_init()
    from DRM CI, which was supposed to be in the original patch already.
    
    [1] https://lore.kernel.org/all/20211014085450.GC18719@xsang-OptiPlex-9020/
    
    Link: https://lkml.kernel.org/r/6abd9213-19a9-6d58-cedc-2414386d2d81@suse.cz
    Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
    Reported-by: kernel test robot <oliver.sang@intel.com>
    Cc: Mike Rapoport <rppt@kernel.org>
    Cc: Stephen Rothwell <sfr@canb.auug.org.au>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
    tehcaster authored and sfrothwell committed Jan 15, 2022
  26. lib/stackdepot: fix spelling mistake and grammar in pr_err message

    There is a spelling mistake of the work allocation so fix this and
    re-phrase the message to make it easier to read.
    
    Link: https://lkml.kernel.org/r/20211015104159.11282-1-colin.king@canonical.com
    Signed-off-by: Colin Ian King <colin.king@canonical.com>
    Cc: Vlastimil Babka <vbabka@suse.cz>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
    Colin Ian King authored and sfrothwell committed Jan 15, 2022
  27. lib/stackdepot: allow optional init and stack_table allocation by kvm…

    …alloc()
    
    Currently, enabling CONFIG_STACKDEPOT means its stack_table will be
    allocated from memblock, even if stack depot ends up not actually used.
    The default size of stack_table is 4MB on 32-bit, 8MB on 64-bit.
    
    This is fine for use-cases such as KASAN which is also a config option and
    has overhead on its own.  But it's an issue for functionality that has to
    be actually enabled on boot (page_owner) or depends on hardware (GPU
    drivers) and thus the memory might be wasted.  This was raised as an issue
    [1] when attempting to add stackdepot support for SLUB's debug object
    tracking functionality.  It's common to build kernels with
    CONFIG_SLUB_DEBUG and enable slub_debug on boot only when needed, or
    create only specific kmem caches with debugging for testing purposes.
    
    It would thus be more efficient if stackdepot's table was allocated only
    when actually going to be used.  This patch thus makes the allocation (and
    whole stack_depot_init() call) optional:
    
    - Add a CONFIG_STACKDEPOT_ALWAYS_INIT flag to keep using the current
      well-defined point of allocation as part of mem_init(). Make CONFIG_KASAN
      select this flag.
    - Other users have to call stack_depot_init() as part of their own init when
      it's determined that stack depot will actually be used. This may depend on
      both config and runtime conditions. Convert current users which are
      page_owner and several in the DRM subsystem. Same will be done for SLUB
      later.
    - Because the init might now be called after the boot-time memblock allocation
      has given all memory to the buddy allocator, change stack_depot_init() to
      allocate stack_table with kvmalloc() when memblock is no longer available.
      Also handle allocation failure by disabling stackdepot (could have
      theoretically happened even with memblock allocation previously), and don't
      unnecessarily align the memblock allocation to its own size anymore.
    
    [1] https://lore.kernel.org/all/CAMuHMdW=eoVzM1Re5FVoEN87nKfiLmM2+Ah7eNu2KXEhCvbZyA@mail.gmail.com/
    
    Link: https://lkml.kernel.org/r/20211013073005.11351-1-vbabka@suse.cz
    Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
    Acked-by: Dmitry Vyukov <dvyukov@google.com>
    Reviewed-by: Marco Elver <elver@google.com> # stackdepot
    Cc: Marco Elver <elver@google.com>
    Cc: Vijayanand Jitta <vjitta@codeaurora.org>
    Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
    Cc: Maxime Ripard <mripard@kernel.org>
    Cc: Thomas Zimmermann <tzimmermann@suse.de>
    Cc: David Airlie <airlied@linux.ie>
    Cc: Daniel Vetter <daniel@ffwll.ch>
    Cc: Andrey Ryabinin <ryabinin.a.a@gmail.com>
    Cc: Alexander Potapenko <glider@google.com>
    Cc: Andrey Konovalov <andreyknvl@gmail.com>
    Cc: Dmitry Vyukov <dvyukov@google.com>
    Cc: Geert Uytterhoeven <geert@linux-m68k.org>
    Cc: Oliver Glitta <glittao@gmail.com>
    Cc: Imran Khan <imran.f.khan@oracle.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
    tehcaster authored and sfrothwell committed Jan 15, 2022
  28. proc-remove-pde_data-completely-fix-fix

    Cc: Muchun Song <songmuchun@bytedance.com>
    Cc: Stephen Rothwell <sfr@canb.auug.org.au>
    Reported-by: kernel test robot <lkp@intel.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
    akpm00 authored and sfrothwell committed Jan 15, 2022
  29. proc-remove-pde_data-completely-fix

    fix naming clash in drivers/nubus/proc.c
    
    Cc: Alexey Dobriyan <adobriyan@gmail.com>
    Cc: Alexey Gladkov <gladkov.alexey@gmail.com>
    Cc: Christian Brauner <christian.brauner@ubuntu.com>
    Cc: Muchun Song <songmuchun@bytedance.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
    akpm00 authored and sfrothwell committed Jan 15, 2022
  30. proc: remove PDE_DATA() completely

    Remove PDE_DATA() completely and replace it with pde_data().
    
    Link: https://lkml.kernel.org/r/20211124081956.87711-2-songmuchun@bytedance.com
    Signed-off-by: Muchun Song <songmuchun@bytedance.com>
    Acked-by: Christian Brauner <christian.brauner@ubuntu.com>
    Cc: Alexey Dobriyan <adobriyan@gmail.com>
    Cc: Alexey Gladkov <gladkov.alexey@gmail.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
    Muchun Song authored and sfrothwell committed Jan 15, 2022
  31. fs: proc: store PDE()->data into inode->i_private

    PDE_DATA(inode) is introduced to get user private data and hide the layout
    of struct proc_dir_entry.  The inode->i_private is used to do the same
    thing as well.  Save a copy of user private data to inode-> i_private when
    proc inode is allocated.  This means the user also can get their private
    data by inode->i_private.
    
    Introduce pde_data() to wrap inode->i_private so that we can remove
    PDE_DATA() from fs/proc/generic.c and make PTE_DATE() as a wrapper of
    pde_data().  It will be easier if we decide to remove PDE_DATE() in the
    future.
    
    Link: https://lkml.kernel.org/r/20211124081956.87711-1-songmuchun@bytedance.com
    Signed-off-by: Muchun Song <songmuchun@bytedance.com>
    Acked-by: Christian Brauner <christian.brauner@ubuntu.com>
    Cc: Alexey Dobriyan <adobriyan@gmail.com>
    Cc: Alexey Gladkov <gladkov.alexey@gmail.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
    Muchun Song authored and sfrothwell committed Jan 15, 2022
  32. sysctl: returns -EINVAL when a negative value is passed to proc_doulo…

    …ngvec_minmax
    
    When we pass a negative value to the proc_doulongvec_minmax() function,
    the function returns 0, but the corresponding interface value does not
    change.
    
    we can easily reproduce this problem with the following commands:
        cd /proc/sys/fs/epoll
        echo -1 > max_user_watches; echo $?; cat max_user_watches
    
    This function requires a non-negative number to be passed in, so when
    a negative number is passed in, -EINVAL is returned.
    
    Link: https://lkml.kernel.org/r/20211220092627.3744624-1-libaokun1@huawei.com
    Signed-off-by: Baokun Li <libaokun1@huawei.com>
    Reported-by: Hulk Robot <hulkci@huawei.com>
    Acked-by: Luis Chamberlain <mcgrof@kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
    Baokun Li authored and sfrothwell committed Jan 15, 2022
  33. kernel/sysctl.c: remove unused variable ten_thousand

    The const variable ten_thousand is not used, it is redundant and can be
    removed.
    
    Cleans up clang warning:
    kernel/sysctl.c:99:18: warning: unused variable 'ten_thousand' [-Wunused-const-variable]
    static const int ten_thousand = 10000;
    
    Link: https://lkml.kernel.org/r/20211221184501.574670-1-colin.i.king@gmail.com
    Fixes: c26da54 ("printk: move printk sysctl to printk/sysctl.c")
    Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
    Acked-by: Luis Chamberlain <mcgrof@kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
    ColinIanKing authored and sfrothwell committed Jan 15, 2022
  34. kprobe: move sysctl_kprobes_optimization to kprobes.c

    kernel/sysctl.c is a kitchen sink where everyone leaves their dirty
    dishes, this makes it very difficult to maintain.
    
    To help with this maintenance let's start by moving sysctls to places
    where they actually belong.  The proc sysctl maintainers do not want to
    know what sysctl knobs you wish to add for your own piece of code, we just
    care about the core logic.
    
    Move sysctl_kprobes_optimization from kernel/sysctl.c to kernel/kprobes.c.
    Use register_sysctl() to register the sysctl interface.
    
    [mcgrof@kernel.org: fix compile issue when CONFIG_OPTPROBES is disabled]
    Link: https://lkml.kernel.org/r/20211129211943.640266-7-mcgrof@kernel.org
    Signed-off-by: Xiaoming Ni <nixiaoming@huawei.com>
    Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
    Cc: Al Viro <viro@zeniv.linux.org.uk>
    Cc: Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com>
    Cc: Antti Palosaari <crope@iki.fi>
    Cc: Christian Brauner <christian.brauner@ubuntu.com>
    Cc: "David S. Miller" <davem@davemloft.net>
    Cc: Eric Biederman <ebiederm@xmission.com>
    Cc: Eric Biggers <ebiggers@google.com>
    Cc: Iurii Zaikin <yzaikin@google.com>
    Cc: Kees Cook <keescook@chromium.org>
    Cc: Lukas Middendorf <kernel@tuxforce.de>
    Cc: Masami Hiramatsu <mhiramat@kernel.org>
    Cc: "Naveen N. Rao" <naveen.n.rao@linux.ibm.com>
    Cc: Stephen Kitt <steve@sk2.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
    nixiaoming authored and sfrothwell committed Jan 15, 2022
  35. fs/coredump: move coredump sysctls into its own file

    This moves the fs/coredump.c respective sysctls to its own file.
    
    Link: https://lkml.kernel.org/r/20211129211943.640266-6-mcgrof@kernel.org
    Signed-off-by: Xiaoming Ni <nixiaoming@huawei.com>
    Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
    Cc: Al Viro <viro@zeniv.linux.org.uk>
    Cc: Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com>
    Cc: Antti Palosaari <crope@iki.fi>
    Cc: Christian Brauner <christian.brauner@ubuntu.com>
    Cc: "David S. Miller" <davem@davemloft.net>
    Cc: Eric Biederman <ebiederm@xmission.com>
    Cc: Eric Biggers <ebiggers@google.com>
    Cc: Iurii Zaikin <yzaikin@google.com>
    Cc: Kees Cook <keescook@chromium.org>
    Cc: Lukas Middendorf <kernel@tuxforce.de>
    Cc: Masami Hiramatsu <mhiramat@kernel.org>
    Cc: "Naveen N. Rao" <naveen.n.rao@linux.ibm.com>
    Cc: Stephen Kitt <steve@sk2.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
    nixiaoming authored and sfrothwell committed Jan 15, 2022
Older