Skip to content
Permalink
Zi-Yan/Use-pag…
Switch branches/tags

Commits on Feb 11, 2022

  1. arch: powerpc: adjust fadump alignment to be pageblock aligned.

    CMA only requires pageblock alignment now. Change CMA alignment in
    fadump too.
    
    Signed-off-by: Zi Yan <ziy@nvidia.com>
    x-y-z authored and intel-lab-lkp committed Feb 11, 2022
  2. drivers: virtio_mem: use pageblock size as the minimum virtio_mem size.

    alloc_contig_range() now only needs to be aligned to pageblock_order,
    drop virtio_mem size requirement that it needs to be the max of
    pageblock_order and MAX_ORDER.
    
    Signed-off-by: Zi Yan <ziy@nvidia.com>
    x-y-z authored and intel-lab-lkp committed Feb 11, 2022
  3. mm: cma: use pageblock_order as the single alignment

    Now alloc_contig_range() works at pageblock granularity. Change CMA
    allocation, which uses alloc_contig_range(), to use pageblock_order
    alignment.
    
    Signed-off-by: Zi Yan <ziy@nvidia.com>
    x-y-z authored and intel-lab-lkp committed Feb 11, 2022
  4. mm: make alloc_contig_range work at pageblock granularity

    alloc_contig_range() worked at MAX_ORDER-1 granularity to avoid merging
    pageblocks with different migratetypes. It might unnecessarily convert
    extra pageblocks at the beginning and at the end of the range. Change
    alloc_contig_range() to work at pageblock granularity.
    
    Special handling is needed for free pages and in-use pages across the
    boundaries of the range specified alloc_contig_range(). Because these
    partially isolated pages causes free page accounting issues. The free
    pages will be split and freed into separate migratetype lists; the
    in-use pages will be migrated then the freed pages will be handled.
    
    Signed-off-by: Zi Yan <ziy@nvidia.com>
    x-y-z authored and intel-lab-lkp committed Feb 11, 2022
  5. mm: page_isolation: check specified range for unmovable pages

    Enable set_migratetype_isolate() to check specified sub-range for
    unmovable pages during isolation. Page isolation is done
    at max(MAX_ORDER_NR_PAEGS, pageblock_nr_pages) granularity, but not all
    pages within that granularity are intended to be isolated. For example,
    alloc_contig_range(), which uses page isolation, allows ranges without
    alignment. This commit makes unmovable page check only look for
    interesting pages, so that page isolation can succeed for any
    non-overlapping ranges.
    
    Signed-off-by: Zi Yan <ziy@nvidia.com>
    x-y-z authored and intel-lab-lkp committed Feb 11, 2022
  6. mm: page_isolation: move has_unmovable_pages() to mm/page_isolation.c

    has_unmovable_pages() is only used in mm/page_isolation.c. Move it from
    mm/page_alloc.c and make it static.
    
    Signed-off-by: Zi Yan <ziy@nvidia.com>
    Reviewed-by: Oscar Salvador <osalvador@suse.de>
    x-y-z authored and intel-lab-lkp committed Feb 11, 2022

Commits on Feb 9, 2022

  1. pci: test for unexpectedly disabled bridges

    The all-ones value is not just a "device didn't exist" case, it's also
    potentially a quite valid value, so not restoring it would be wrong.
    
    What *would* be interesting is to hear where the bad values came from in
    the first place.  It sounds like the device state is saved after the PCI
    bus controller in front of the device has been crapped on, resulting in the
    PCI config cycles never reaching the device at all.
    
    Something along this patch (together with suspend/resume debugging output)
    migth help pinpoint it.  But it really sounds like something totally
    brokenly turned off the PCI bridge (some ACPI shutdown crud?  I wouldn't be
    entirely surprised)
    
    Cc: Greg KH <greg@kroah.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    torvalds authored and hnaz committed Feb 9, 2022
  2. kernel/fork.c: export kernel_thread() to modules

    mutex-subsystem-synchro-test-module.patch needs this
    
    Cc: Al Viro <viro@zeniv.linux.org.uk>
    Cc: Stephen Rothwell <sfr@canb.auug.org.au>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    akpm00 authored and hnaz committed Feb 9, 2022
  3. mutex-subsystem-synchro-test-module-fix

    Cc: Adrian Bunk <bunk@stusta.de>
    Cc: David Howells <dhowells@redhat.com>
    Cc: Ingo Molnar <mingo@elte.hu>
    Cc: Michel Lespinasse <walken@google.com>
    Cc: Randy Dunlap <rdunlap@xenotime.net>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    akpm00 authored and hnaz committed Feb 9, 2022
  4. mutex subsystem, synchro-test module

    The attached patch adds a module for testing and benchmarking mutexes,
    semaphores and R/W semaphores.
    
    Using it is simple:
    
    	insmod synchro-test.ko <args>
    
    It will exit with error ENOANO after running the tests and printing the
    results to the kernel console log.
    
    The available arguments are:
    
     (*) mx=N
    
    	Start up to N mutex thrashing threads, where N is at most 20. All will
    	try and thrash the same mutex.
    
     (*) sm=N
    
    	Start up to N counting semaphore thrashing threads, where N is at most
    	20. All will try and thrash the same semaphore.
    
     (*) ism=M
    
    	Initialise the counting semaphore with M, where M is any positive
    	integer greater than zero. The default is 4.
    
     (*) rd=N
     (*) wr=O
     (*) dg=P
    
    	Start up to N reader thrashing threads, O writer thrashing threads and
    	P downgrader thrashing threads, where N, O and P are at most 20
    	apiece. All will try and thrash the same read/write semaphore.
    
     (*) elapse=N
    
    	Run the tests for N seconds. The default is 5.
    
     (*) load=N
    
    	Each thread delays for N uS whilst holding the lock. The dfault is 0.
    
     (*) interval=N
    
    	Each thread delays for N uS whilst not holding the lock. The default
    	is 0.
    
     (*) do_sched=1
    
    	Each thread will call schedule if required after each iteration.
    
     (*) v=1
    
    	Print more verbose information, including a thread iteration
    	distribution list.
    
    The module should be enabled by turning on CONFIG_DEBUG_SYNCHRO_TEST to "m".
    
    [randy.dunlap@oracle.com: fix build errors, add <sched.h> header file]
    [akpm@linux-foundation.org: remove smp_lock.h inclusion]
    [viro@ZenIV.linux.org.uk: kill daemonize() calls]
    [rdunlap@xenotime.net: fix printk format warrnings]
    [walken@google.com: add spinlock test]
    [walken@google.com: document default load and interval values]
    Signed-off-by: David Howells <dhowells@redhat.com>
    Signed-off-by: Ingo Molnar <mingo@elte.hu>
    Signed-off-by: Adrian Bunk <bunk@stusta.de>
    Signed-off-by: Randy Dunlap <rdunlap@xenotime.net>
    Signed-off-by: Michel Lespinasse <walken@google.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    dhowells authored and hnaz committed Feb 9, 2022
  5. Releasing resources with children

    What does it mean to release a resource with children?  Should the children
    become children of the released resource's parent?  Should they be released
    too?  Should we fail the release?
    
    I bet we have no callers who expect this right now, but with
    insert_resource() we may get some.  At the point where someone hits this
    BUG we can figure out what semantics we want.
    
    Signed-off-by: Matthew Wilcox <willy@parisc-linux.org>
    Cc: Matthew Wilcox <willy@infradead.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Matthew Wilcox authored and hnaz committed Feb 9, 2022
  6. Make sure nobody's leaking resources

    Currently, releasing a resource also releases all of its children.  That
    made sense when request_resource was the main method of dividing up the
    memory map.  With the increased use of insert_resource, it seems to me that
    we should instead reparent the newly orphaned resources.  Before we do
    that, let's make sure that nobody's actually relying on the current
    semantics.
    
    Signed-off-by: Matthew Wilcox <matthew@wil.cx>
    Cc: Greg KH <greg@kroah.com>
    Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
    Cc: Dominik Brodowski <linux@dominikbrodowski.net>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Matthew Wilcox authored and hnaz committed Feb 9, 2022
  7. linux-next-rejects

    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    akpm00 authored and hnaz committed Feb 9, 2022
  8. linux-next

    GIT 2dd4d1a
    
    
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    akpm00 authored and hnaz committed Feb 9, 2022
  9. ipc/mqueue: use get_tree_nodev() in mqueue_get_tree()

    When running the stress-ng clone benchmark with multiple testing threads,
    it was found that there were significant spinlock contention in sget_fc().
    The contended spinlock was the sb_lock.  It is under heavy contention
    because the following code in the critcal section of sget_fc():
    
      hlist_for_each_entry(old, &fc->fs_type->fs_supers, s_instances) {
          if (test(old, fc))
              goto share_extant_sb;
      }
    
    After testing with added instrumentation code, it was found that the the
    benchmark could generate thousands of ipc namespaces with the
    corresponding number of entries in the mqueue's fs_supers list where the
    namespaces are the key for the search.  This leads to excessive time in
    scanning the list for a match.
    
    Looking back at the mqueue calling sequence leading to sget_fc():
    
      mq_init_ns()
      => mq_create_mount()
      => fc_mount()
      => vfs_get_tree()
      => mqueue_get_tree()
      => get_tree_keyed()
      => vfs_get_super()
      => sget_fc()
    
    Currently, mq_init_ns() is the only mqueue function that will indirectly
    call mqueue_get_tree() with a newly allocated ipc namespace as the key for
    searching.  As a result, there will never be a match with the exising ipc
    namespaces stored in the mqueue's fs_supers list.
    
    So using get_tree_keyed() to do an existing ipc namespace search is just a
    waste of time.  Instead, we could use get_tree_nodev() to eliminate the
    useless search.  By doing so, we can greatly reduce the sb_lock hold time
    and avoid the spinlock contention problem in case a large number of ipc
    namespaces are present.
    
    Of course, if the code is modified in the future to allow
    mqueue_get_tree() to be called with an existing ipc namespace instead of a
    new one, we will have to use get_tree_keyed() in this case.
    
    The following stress-ng clone benchmark command was run on a 2-socket
    48-core Intel system:
    
    ./stress-ng --clone 32 --verbose --oomable --metrics-brief -t 20
    
    The "bogo ops/s" increased from 5948.45 before patch to 9137.06 after
    patch. This is an increase of 54% in performance.
    
    Link: https://lkml.kernel.org/r/20220121172315.19652-1-longman@redhat.com
    Fixes: 935c691 ("ipc: Convert mqueue fs to fs_context")
    Signed-off-by: Waiman Long <longman@redhat.com>
    Cc: Al Viro <viro@zeniv.linux.org.uk>
    Cc: David Howells <dhowells@redhat.com>
    Cc: Manfred Spraul <manfred@colorfullife.com>
    Cc: Davidlohr Bueso <dave@stgolabs.net>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Waiman Long authored and hnaz committed Feb 9, 2022
  10. Revert "ubsan, kcsan: Don't combine sanitizer with kcov on clang"

    This reverts commit ea91a1d.
    
    Since df05c0e ("Documentation: Raise the minimum supported version
    of LLVM to 11.0.0") the minimum Clang version is now 11.0, which fixed
    the UBSAN/KCSAN vs. KCOV incompatibilities.
    
    Link: https://bugs.llvm.org/show_bug.cgi?id=45831
    Link: https://lkml.kernel.org/r/YaodyZzu0MTCJcvO@elver.google.com
    Link: https://lkml.kernel.org/r/20220128105631.509772-1-elver@google.com
    Signed-off-by: Marco Elver <elver@google.com>
    Reviewed-by: Nathan Chancellor <nathan@kernel.org>
    Reviewed-by: Kees Cook <keescook@chromium.org>
    Cc: Alexander Potapenko <glider@google.com>
    Cc: Dmitry Vyukov <dvyukov@google.com>
    Cc: Nathan Chancellor <nathan@kernel.org>
    Cc: Nick Desaulniers <ndesaulniers@google.com>
    Cc: Arnd Bergmann <arnd@arndb.de>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    melver authored and hnaz committed Feb 9, 2022
  11. selftests: kselftest framework: provide "finished" helper

    Instead of having each time that wants to use ksft_exit() have to figure
    out the internals of kselftest.h, add the helper ksft_finished() that
    makes sure the passes, xfails, and skips are equal to the test plan count.
    
    Link: https://lkml.kernel.org/r/20220201013717.2464392-1-keescook@chromium.org
    Signed-off-by: Kees Cook <keescook@chromium.org>
    Cc: Shuah Khan <shuah@kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    kees authored and hnaz committed Feb 9, 2022
  12. selftests: vm: remove dependecy from internal kernel macros

    The defination of swap() is used from kernel's internal header when this
    test is built in source tree.  The build fails when this test is built out
    of source tree as defination of swap() isn't found.  Selftests shouldn't
    depend on kernel's internal header files.  They can only depend on uapi
    header files.  Add the defination of swap() to fix the build error:
    
    	gcc -Wall  -I/linux_mainline2/build/usr/include -no-pie    userfaultfd.c -lrt -lpthread -o /linux_mainline2/build/kselftest/vm/userfaultfd
    	userfaultfd.c: In function `userfaultfd_stress':
    	userfaultfd.c:1530:3: warning: implicit declaration of function `swap'; did you mean `swab'? [-Wimplicit-function-declaration]
    	 1530 |   swap(area_src, area_dst);
    	      |   ^~~~
    	      |   swab
    	/usr/bin/ld: /tmp/cclUUH7V.o: in function `userfaultfd_stress':
    	userfaultfd.c:(.text+0x4d64): undefined reference to `swap'
    	/usr/bin/ld: userfaultfd.c:(.text+0x4d82): undefined reference to `swap'
    	collect2: error: ld returned 1 exit status
    
    Link: https://lkml.kernel.org/r/20220119101531.2850400-11-usama.anjum@collabora.com
    Fixes: 2c769ed ("tools/testing/selftests/vm/userfaultfd.c: use swap() to make code cleaner")
    Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
    Reviewed-by: Alistair Popple <apopple@nvidia.com>
    Cc: Andr Almeida <andrealmeid@collabora.com>
    Cc: Darren Hart <dvhart@infradead.org>
    Cc: Davidlohr Bueso <dave@stgolabs.net>
    Cc: "David S. Miller" <davem@davemloft.net>
    Cc: Ingo Molnar <mingo@redhat.com>
    Cc: Jakub Kicinski <kuba@kernel.org>
    Cc: Mat Martineau <mathew.j.martineau@linux.intel.com>
    Cc: Matthieu Baerts <matthieu.baerts@tessares.net>
    Cc: Mickal Salan <mic@digikod.net>
    Cc: Minghao Chi <chi.minghao@zte.com.cn>
    Cc: Paolo Bonzini <pbonzini@redhat.com>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Shuah Khan <shuah@kernel.org>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    musamaanjum authored and hnaz committed Feb 9, 2022
  13. selftests: vm: add the uapi headers include variable

    Out of tree build of this test fails if relative path of the output
    directory is specified.  Add the KHDR_INCLUDES to correctly reach the
    headers.
    
    Link: https://lkml.kernel.org/r/20220119101531.2850400-10-usama.anjum@collabora.com
    Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
    Acked-by: Paolo Bonzini <pbonzini@redhat.com>
    Tested-by: Alistair Popple <apopple@nvidia.com>
    Cc: Andr Almeida <andrealmeid@collabora.com>
    Cc: Darren Hart <dvhart@infradead.org>
    Cc: Davidlohr Bueso <dave@stgolabs.net>
    Cc: "David S. Miller" <davem@davemloft.net>
    Cc: Ingo Molnar <mingo@redhat.com>
    Cc: Jakub Kicinski <kuba@kernel.org>
    Cc: Mat Martineau <mathew.j.martineau@linux.intel.com>
    Cc: Matthieu Baerts <matthieu.baerts@tessares.net>
    Cc: Mickal Salan <mic@digikod.net>
    Cc: Minghao Chi <chi.minghao@zte.com.cn>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Shuah Khan <shuah@kernel.org>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    musamaanjum authored and hnaz committed Feb 9, 2022
  14. selftests: mptcp: add the uapi headers include variable

    Out of tree build of this test fails if relative path of the output
    directory is specified.  Add the KHDR_INCLUDES to correctly reach the
    headers.
    
    Link: https://lkml.kernel.org/r/20220119101531.2850400-9-usama.anjum@collabora.com
    Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
    Reviewed-by: Matthieu Baerts <matthieu.baerts@tessares.net>
    Cc: Alistair Popple <apopple@nvidia.com>
    Cc: Andr Almeida <andrealmeid@collabora.com>
    Cc: Darren Hart <dvhart@infradead.org>
    Cc: Davidlohr Bueso <dave@stgolabs.net>
    Cc: "David S. Miller" <davem@davemloft.net>
    Cc: Ingo Molnar <mingo@redhat.com>
    Cc: Jakub Kicinski <kuba@kernel.org>
    Cc: Mat Martineau <mathew.j.martineau@linux.intel.com>
    Cc: Mickal Salan <mic@digikod.net>
    Cc: Minghao Chi <chi.minghao@zte.com.cn>
    Cc: Paolo Bonzini <pbonzini@redhat.com>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Shuah Khan <shuah@kernel.org>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    musamaanjum authored and hnaz committed Feb 9, 2022
  15. selftests: net: add the uapi headers include variable

    Out of tree build of this test fails if relative path of the output
    directory is specified.  Add the KHDR_INCLUDES to correctly reach the
    headers.
    
    Link: https://lkml.kernel.org/r/20220119101531.2850400-8-usama.anjum@collabora.com
    Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
    Cc: Alistair Popple <apopple@nvidia.com>
    Cc: Andr Almeida <andrealmeid@collabora.com>
    Cc: Darren Hart <dvhart@infradead.org>
    Cc: Davidlohr Bueso <dave@stgolabs.net>
    Cc: "David S. Miller" <davem@davemloft.net>
    Cc: Ingo Molnar <mingo@redhat.com>
    Cc: Jakub Kicinski <kuba@kernel.org>
    Cc: Mat Martineau <mathew.j.martineau@linux.intel.com>
    Cc: Matthieu Baerts <matthieu.baerts@tessares.net>
    Cc: Mickal Salan <mic@digikod.net>
    Cc: Minghao Chi <chi.minghao@zte.com.cn>
    Cc: Paolo Bonzini <pbonzini@redhat.com>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Shuah Khan <shuah@kernel.org>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    musamaanjum authored and hnaz committed Feb 9, 2022
  16. selftests: landlock: add the uapi headers include variable

    Out of tree build of this test fails if relative path of the output
    directory is specified.  Add the KHDR_INCLUDES to correctly reach the
    headers.
    
    Link: https://lkml.kernel.org/r/20220119101531.2850400-7-usama.anjum@collabora.com
    Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
    Cc: Alistair Popple <apopple@nvidia.com>
    Cc: Andr Almeida <andrealmeid@collabora.com>
    Cc: Darren Hart <dvhart@infradead.org>
    Cc: Davidlohr Bueso <dave@stgolabs.net>
    Cc: "David S. Miller" <davem@davemloft.net>
    Cc: Ingo Molnar <mingo@redhat.com>
    Cc: Jakub Kicinski <kuba@kernel.org>
    Cc: Mat Martineau <mathew.j.martineau@linux.intel.com>
    Cc: Matthieu Baerts <matthieu.baerts@tessares.net>
    Cc: Mickal Salan <mic@digikod.net>
    Cc: Minghao Chi <chi.minghao@zte.com.cn>
    Cc: Paolo Bonzini <pbonzini@redhat.com>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Shuah Khan <shuah@kernel.org>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    musamaanjum authored and hnaz committed Feb 9, 2022
  17. selftests: kvm: add the uapi headers include variable

    Out of tree build of this test fails if relative path of the output
    directory is specified.  Add KHDR_INCLUDES to correctly reach the headers.
    
    Link: https://lkml.kernel.org/r/20220119101531.2850400-6-usama.anjum@collabora.com
    Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
    Cc: Alistair Popple <apopple@nvidia.com>
    Cc: Andr Almeida <andrealmeid@collabora.com>
    Cc: Darren Hart <dvhart@infradead.org>
    Cc: Davidlohr Bueso <dave@stgolabs.net>
    Cc: "David S. Miller" <davem@davemloft.net>
    Cc: Ingo Molnar <mingo@redhat.com>
    Cc: Jakub Kicinski <kuba@kernel.org>
    Cc: Mat Martineau <mathew.j.martineau@linux.intel.com>
    Cc: Matthieu Baerts <matthieu.baerts@tessares.net>
    Cc: Mickal Salan <mic@digikod.net>
    Cc: Minghao Chi <chi.minghao@zte.com.cn>
    Cc: Paolo Bonzini <pbonzini@redhat.com>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Shuah Khan <shuah@kernel.org>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    musamaanjum authored and hnaz committed Feb 9, 2022
  18. selftests: futex: add the uapi headers include variable

    Out of tree build of this test fails if relative path of the output
    directory is specified.  KBUILD_OUTPUT also doesn't point to the correct
    directory when relative path is used.  Thus out of tree builds fail. 
    Remove the un-needed include paths and use KHDR_INCLUDES to correctly
    reach the headers.
    
    Link: https://lkml.kernel.org/r/20220119101531.2850400-5-usama.anjum@collabora.com
    Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
    Cc: Alistair Popple <apopple@nvidia.com>
    Cc: Andr Almeida <andrealmeid@collabora.com>
    Cc: Darren Hart <dvhart@infradead.org>
    Cc: Davidlohr Bueso <dave@stgolabs.net>
    Cc: "David S. Miller" <davem@davemloft.net>
    Cc: Ingo Molnar <mingo@redhat.com>
    Cc: Jakub Kicinski <kuba@kernel.org>
    Cc: Mat Martineau <mathew.j.martineau@linux.intel.com>
    Cc: Matthieu Baerts <matthieu.baerts@tessares.net>
    Cc: Mickal Salan <mic@digikod.net>
    Cc: Minghao Chi <chi.minghao@zte.com.cn>
    Cc: Paolo Bonzini <pbonzini@redhat.com>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Shuah Khan <shuah@kernel.org>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    musamaanjum authored and hnaz committed Feb 9, 2022
  19. selftests: correct the headers install path

    uapi headers should be installed at the top of the object tree,
    "<obj_tree>/usr/include".  There is no need for kernel headers to be
    present at kselftest build directory, "<obj_tree>/kselftest/usr/ include"
    as well.  This duplication can be avoided by correctly specifying the
    INSTALL_HDR_PATH.
    
    Link: https://lkml.kernel.org/r/20220119101531.2850400-4-usama.anjum@collabora.com
    Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
    Cc: Alistair Popple <apopple@nvidia.com>
    Cc: Andr Almeida <andrealmeid@collabora.com>
    Cc: Darren Hart <dvhart@infradead.org>
    Cc: Davidlohr Bueso <dave@stgolabs.net>
    Cc: "David S. Miller" <davem@davemloft.net>
    Cc: Ingo Molnar <mingo@redhat.com>
    Cc: Jakub Kicinski <kuba@kernel.org>
    Cc: Mat Martineau <mathew.j.martineau@linux.intel.com>
    Cc: Matthieu Baerts <matthieu.baerts@tessares.net>
    Cc: Mickal Salan <mic@digikod.net>
    Cc: Minghao Chi <chi.minghao@zte.com.cn>
    Cc: Paolo Bonzini <pbonzini@redhat.com>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Shuah Khan <shuah@kernel.org>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    musamaanjum authored and hnaz committed Feb 9, 2022
  20. selftests: add and export a kernel uapi headers path

    Kernel uapi headers can be present at different paths depending upon how
    the build was invoked.  It becomes impossible for the tests to include the
    correct headers directory.  Set and export KHDR_INCLUDES variable to make
    it possible for sub make files to include the header files.
    
    Link: https://lkml.kernel.org/r/20220119101531.2850400-3-usama.anjum@collabora.com
    Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
    Cc: Alistair Popple <apopple@nvidia.com>
    Cc: Andr Almeida <andrealmeid@collabora.com>
    Cc: Darren Hart <dvhart@infradead.org>
    Cc: Davidlohr Bueso <dave@stgolabs.net>
    Cc: "David S. Miller" <davem@davemloft.net>
    Cc: Ingo Molnar <mingo@redhat.com>
    Cc: Jakub Kicinski <kuba@kernel.org>
    Cc: Mat Martineau <mathew.j.martineau@linux.intel.com>
    Cc: Matthieu Baerts <matthieu.baerts@tessares.net>
    Cc: Mickal Salan <mic@digikod.net>
    Cc: Minghao Chi <chi.minghao@zte.com.cn>
    Cc: Paolo Bonzini <pbonzini@redhat.com>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Shuah Khan <shuah@kernel.org>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    musamaanjum authored and hnaz committed Feb 9, 2022
  21. selftests: set the BUILD variable to absolute path

    Patch series "selftests: Fix separate output directory builds", v2.
    
    Build of several selftests fail if separate output directory is
    specified by the following methods:
    1) make -C tools/testing/selftests O=<build_dir>
    2) export KBUILD_OUTPUT="build_dir"; make -C tools/testing/selftests
    
    Build fails because of several reasons:
    1) The kernel headers aren't found.
    2) The path of output objects is wrong and hence unaccessible.
    
    These problems can be solved by:
    1) Including the correct path of uapi header files
    2) By setting the BUILD variable correctly inside Makefile
    
    Following different build scenarios have been tested after making these
    changes to verify that nothing gets broken with these changes:
    make -C tools/testing/selftests
    make -C tools/testing/selftests/futex
    make -C tools/testing/selftests/kvm
    make -C tools/testing/selftests/landlock
    make -C tools/testing/selftests/net
    make -C tools/testing/selftests/net/mptcp
    make -C tools/testing/selftests/vm
    make -C tools/testing/selftests O=build
    make -C tools/testing/selftests o=/opt/build
    export KBUILD_OUTPUT="/opt/build"; make -C tools/testing/selftests
    export KBUILD_OUTPUT="build"; make -C tools/testing/selftests
    cd <any_dir>; make -C <src_path>/tools/testing/selftests
    cd <any_dir>; make -C <src_path>/tools/testing/selftests O=build
    
    
    This patch (of 10):
    
    The build of kselftests fails if relative path is specified through
    KBUILD_OUTPUT or O=<path> method.  BUILD variable is used to determine the
    path of the output objects.  When make is run from other directories with
    relative paths, the exact path of the build objects is ambiguous and build
    fails.
    
    	make[1]: Entering directory '/home/usama/repos/kernel/linux_mainline2/tools/testing/selftests/alsa'
    	gcc     mixer-test.c -L/usr/lib/x86_64-linux-gnu -lasound  -o build/kselftest/alsa/mixer-test
    	/usr/bin/ld: cannot open output file build/kselftest/alsa/mixer-test
    
    Set the BUILD variable to the absolute path of the output directory.  Make
    the logic readable and easy to follow.  Use spaces instead of tabs for
    indentation as if with tab indentation is considered recipe in make.
    
    Link: https://lkml.kernel.org/r/20220119101531.2850400-1-usama.anjum@collabora.com
    Link: https://lkml.kernel.org/r/20220119101531.2850400-2-usama.anjum@collabora.com
    Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
    Cc: Shuah Khan <shuah@kernel.org>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Cc: Ingo Molnar <mingo@redhat.com>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Darren Hart <dvhart@infradead.org>
    Cc: Davidlohr Bueso <dave@stgolabs.net>
    Cc: Andr Almeida <andrealmeid@collabora.com>
    Cc: Paolo Bonzini <pbonzini@redhat.com>
    Cc: Mickal Salan <mic@digikod.net>
    Cc: "David S. Miller" <davem@davemloft.net>
    Cc: Jakub Kicinski <kuba@kernel.org>
    Cc: Mat Martineau <mathew.j.martineau@linux.intel.com>
    Cc: Matthieu Baerts <matthieu.baerts@tessares.net>
    Cc: Minghao Chi <chi.minghao@zte.com.cn>
    Cc: Alistair Popple <apopple@nvidia.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    musamaanjum authored and hnaz committed Feb 9, 2022
  22. kcov: properly handle subsequent mmap calls

    Allocate the kcov buffer during KCOV_MODE_INIT in order to untie mmapping
    of a kcov instance and the actual coverage collection process. Modify
    kcov_mmap, so that it can be reliably used any number of times once
    KCOV_MODE_INIT has succeeded.
    
    These changes to the user-facing interface of the tool only weaken the
    preconditions, so all existing user space code should remain compatible
    with the new version.
    
    Link: https://lkml.kernel.org/r/20220117153634.150357-3-nogikh@google.com
    Signed-off-by: Aleksandr Nogikh <nogikh@google.com>
    Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
    Reviewed-by: Andrey Konovalov <andreyknvl@gmail.com>
    Cc: Alexander Potapenko <glider@google.com>
    Cc: Marco Elver <elver@google.com>
    Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
    Cc: Taras Madan <tarasmadan@google.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    a-nogikh authored and hnaz committed Feb 9, 2022
  23. kcov: split ioctl handling into locked and unlocked parts

    Patch series "kcov: improve mmap processing", v3.
    
    Subsequent mmaps of the same kcov descriptor currently do not update the
    virtual memory of the task and yet return 0 (success).  This is
    counter-intuitive and may lead to unexpected memory access errors.
    
    Also, this unnecessarily limits the functionality of kcov to only the
    simplest usage scenarios.  Kcov instances are effectively forever attached
    to their first address spaces and it becomes impossible to e.g.  reuse the
    same kcov handle in forked child processes without mmapping the memory
    first.  This is exactly what we tried to do in syzkaller and inadvertently
    came upon this behavior.
    
    This patch series addresses the problem described above.
    
    
    This patch (of 3):
    
    Currently all ioctls are de facto processed under a spinlock in order to
    serialise them.  This, however, prohibits the use of vmalloc and other
    memory management functions in the implementations of those ioctls,
    unnecessary complicating any further changes to the code.
    
    Let all ioctls first be processed inside the kcov_ioctl() function which
    should execute the ones that are not compatible with spinlock and then
    pass control to kcov_ioctl_locked() for all other ones. 
    KCOV_REMOTE_ENABLE is processed both in kcov_ioctl() and
    kcov_ioctl_locked() as the steps are easily separable.
    
    Although it is still compatible with a spinlock, move KCOV_INIT_TRACE
    handling to kcov_ioctl(), so that the changes from the next commit are
    easier to follow.
    
    Link: https://lkml.kernel.org/r/20220117153634.150357-1-nogikh@google.com
    Link: https://lkml.kernel.org/r/20220117153634.150357-2-nogikh@google.com
    Signed-off-by: Aleksandr Nogikh <nogikh@google.com>
    Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
    Reviewed-by: Andrey Konovalov <andreyknvl@gmail.com>
    Cc: Marco Elver <elver@google.com>
    Cc: Alexander Potapenko <glider@google.com>
    Cc: Taras Madan <tarasmadan@google.com>
    Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    a-nogikh authored and hnaz committed Feb 9, 2022
  24. panic: allow printing extra panic information on kdump

    Currently we have the "panic_print" parameter/sysctl to allow some extra
    information to be printed in a panic event.  On the other hand, the kdump
    mechanism allows to kexec a new kernel to collect a memory dump for the
    running kernel in case of panic.
    
    Right now these options are incompatible: the user either sets the kdump
    or makes use of "panic_print".  The code path of "panic_print" isn't
    reached when kdump is configured.
    
    There are situations though in which this would be interesting: for
    example, in systems that are very memory constrained, a handcrafted tiny
    kernel/initrd for kdump might be used in order to only collect the dmesg
    in kdump kernel.  Even more common, systems with no disk space for the
    full (compressed) memory dump might very well rely in this functionality
    too, dumping only the dmesg with the additional information provided by
    "panic_print".
    
    So, this is what the patch does: allows both functionality to co-exist; if
    "panic_print" is set and the system performs a kdump, the extra
    information is printed on dmesg before the kexec.  Some notes about the
    design choices here:
    
    (a) We could have introduced a sysctl or an extra bit on "panic_print"
        to allow enabling the co-existence of kdump and "panic_print", but
        seems that would be over-engineering; we have 3 cases, let's check how
        this patch change things:
    
      - if the user have kdump set and not "panic_print", nothing changes;
      - if the user have "panic_print" set and not kdump, nothing changes;
      - if both are enabled, now we print the extra information before kdump,
        which is exactly the goal of the patch (and should be the goal of the
        user, since they enabled both options).
    
    (b) We assume that the code path won't return from __crash_kexec() so
        we didn't guard against double execution of panic_print_sys_info().
    
    Link: https://lkml.kernel.org/r/20211109202848.610874-4-gpiccoli@igalia.com
    Signed-off-by: Guilherme G. Piccoli <gpiccoli@igalia.com>
    Cc: Feng Tang <feng.tang@intel.com>
    Cc: Iurii Zaikin <yzaikin@google.com>
    Cc: Kees Cook <keescook@chromium.org>
    Cc: Luis Chamberlain <mcgrof@kernel.org>
    Cc: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
    Cc: Dave Young <dyoung@redhat.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Guilherme G. Piccoli authored and hnaz committed Feb 9, 2022
  25. panic: add option to dump all CPUs backtraces in panic_print

    Currently the "panic_print" parameter/sysctl allows some interesting debug
    information to be printed during a panic event.  This is useful for
    example in cases the user cannot kdump due to resource limits, or if the
    user collects panic logs in a serial output (or pstore) and prefers a fast
    reboot instead of a kdump.
    
    Happens that currently there's no way to see all CPUs backtraces in a
    panic using "panic_print" on architectures that support that.  We do have
    "oops_all_cpu_backtrace" sysctl, but although partially overlapping in the
    functionality, they are orthogonal in nature: "panic_print" is a panic
    tuning (and we have panics without oopses, like direct calls to panic() or
    maybe other paths that don't go through oops_enter() function), and the
    original purpose of "oops_all_cpu_backtrace" is to provide more
    information on oopses for cases in which the users desire to continue
    running the kernel even after an oops, i.e., used in non-panic scenarios.
    
    So, we hereby introduce an additional bit for "panic_print" to allow
    dumping the CPUs backtraces during a panic event.
    
    Link: https://lkml.kernel.org/r/20211109202848.610874-3-gpiccoli@igalia.com
    Signed-off-by: Guilherme G. Piccoli <gpiccoli@igalia.com>
    Reviewed-by: Feng Tang <feng.tang@intel.com>
    Cc: Iurii Zaikin <yzaikin@google.com>
    Cc: Kees Cook <keescook@chromium.org>
    Cc: Luis Chamberlain <mcgrof@kernel.org>
    Cc: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Guilherme G. Piccoli authored and hnaz committed Feb 9, 2022
  26. sysctl: documentation: fix table format warning

    Fix malformed table warning in sysctl documentation:
    (don't use ':'s)
    
    Documentation/admin-guide/sysctl/kernel.rst:798: WARNING: Malformed table.
    Text in column margin in table line 7.
    
    =====  ============================================
    bit 0  print all tasks info
    bit 1  print system memory info
    bit 2  print timer info
    bit 3  print locks info if ``CONFIG_LOCKDEP`` is on
    bit 4  print ftrace buffer
    bit 5: print all printk messages in buffer
    bit 6: print all CPUs backtrace (if available in the arch)
    
    Link: https://lkml.kernel.org/r/20220109055635.6999-1-rdunlap@infradead.org
    Fixes: 934d51c ("docs: sysctl/kernel: add missing bit to panic_print")
    Fixes: addc649 ("panic: add option to dump all CPUs backtraces in panic_print")
    Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
    Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
    Reviewed-by: Guilherme G. Piccoli <gpiccoli@igalia.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    rddunlap authored and hnaz committed Feb 9, 2022
  27. docs: sysctl/kernel: add missing bit to panic_print

    Patch series "Some improvements on panic_print".
    
    This is a mix of a documentation fix with some additions to the
    "panic_print" syscall / parameter.  The goal here is being able to collect
    all CPUs backtraces during a panic event and also to enable "panic_print"
    in a kdump event - details of the reasoning and design choices in the
    patches.
    
    
    This patch (of 3):
    
    Commit de6da1e ("panic: add an option to replay all the printk
    message in buffer") added a new bit to the sysctl/kernel parameter
    "panic_print", but the documentation was added only in
    kernel-parameters.txt, not in the sysctl guide.
    
    Fix it here by adding bit 5 to sysctl admin-guide documentation.
    
    Link: https://lkml.kernel.org/r/20211109202848.610874-1-gpiccoli@igalia.com
    Link: https://lkml.kernel.org/r/20211109202848.610874-2-gpiccoli@igalia.com
    Fixes: de6da1e ("panic: add an option to replay all the printk message in buffer")
    Signed-off-by: Guilherme G. Piccoli <gpiccoli@igalia.com>
    Reviewed-by: Feng Tang <feng.tang@intel.com>
    Cc: Luis Chamberlain <mcgrof@kernel.org>
    Cc: Kees Cook <keescook@chromium.org>
    Cc: Iurii Zaikin <yzaikin@google.com>
    Cc: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Guilherme G. Piccoli authored and hnaz committed Feb 9, 2022
  28. kasan: no need to unset panic_on_warn in end_report()

    panic_on_warn is unset inside panic(), so no need to unset it before
    calling panic() in end_report().
    
    Link: https://lkml.kernel.org/r/1644324666-15947-6-git-send-email-yangtiezhu@loongson.cn
    Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
    Reviewed-by: Marco Elver <elver@google.com>
    Cc: Andrey Ryabinin <ryabinin.a.a@gmail.com>
    Cc: Baoquan He <bhe@redhat.com>
    Cc: Jonathan Corbet <corbet@lwn.net>
    Cc: Xuefeng Li <lixuefeng@loongson.cn>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Tiezhu Yang authored and hnaz committed Feb 9, 2022
  29. ubsan: no need to unset panic_on_warn in ubsan_epilogue()

    panic_on_warn is unset inside panic(), so no need to unset it before
    calling panic() in ubsan_epilogue().
    
    Link: https://lkml.kernel.org/r/1644324666-15947-5-git-send-email-yangtiezhu@loongson.cn
    Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
    Reviewed-by: Marco Elver <elver@google.com>
    Cc: Andrey Ryabinin <ryabinin.a.a@gmail.com>
    Cc: Baoquan He <bhe@redhat.com>
    Cc: Jonathan Corbet <corbet@lwn.net>
    Cc: Xuefeng Li <lixuefeng@loongson.cn>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Tiezhu Yang authored and hnaz committed Feb 9, 2022
Older