Skip to content
  1. Dec 05, 2019
    • Andy Shevchenko's avatar
      lib/bitmap: introduce bitmap_replace() helper · 30544ed5
      Andy Shevchenko authored
      
      
      In some drivers we want to have a single operation over bitmap which is
      an equivalent to:
      
      	*dst = (*old & ~(*mask)) | (*new & *mask)
      
      Introduce bitmap_replace() helper for this.
      
      Link: http://lkml.kernel.org/r/20191022172922.61232-8-andriy.shevchenko@linux.intel.com
      Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Acked-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk>
      Cc: Bartosz Golaszewski <bgolaszewski@baylibre.com>
      Cc: Geert Uytterhoeven <geert@linux-m68k.org>
      Cc: Marek Vasut <marek.vasut+renesas@gmail.com>
      Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
      Cc: William Breathitt Gray <vilhelm.gray@gmail.com>
      Cc: Yury Norov <yury.norov@gmail.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      30544ed5
    • Andy Shevchenko's avatar
      lib/test_bitmap: fix comment about this file · 780ff33b
      Andy Shevchenko authored
      
      
      This test case file is about bitmap API, and not printf() facility.
      
      Link: http://lkml.kernel.org/r/20191022172922.61232-7-andriy.shevchenko@linux.intel.com
      Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Acked-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      Cc: Bartosz Golaszewski <bgolaszewski@baylibre.com>
      Cc: Geert Uytterhoeven <geert@linux-m68k.org>
      Cc: Marek Vasut <marek.vasut+renesas@gmail.com>
      Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk>
      Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
      Cc: William Breathitt Gray <vilhelm.gray@gmail.com>
      Cc: Yury Norov <yury.norov@gmail.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      780ff33b
    • Andy Shevchenko's avatar
      lib/test_bitmap: move exp1 and exp2 upper for others to use · c21dd8a7
      Andy Shevchenko authored
      
      
      Some test cases may re-use predefined exp1 and exp2 bitmaps.  Move them
      upper in the file.
      
      Link: http://lkml.kernel.org/r/20191022172922.61232-6-andriy.shevchenko@linux.intel.com
      Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Acked-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      Cc: Bartosz Golaszewski <bgolaszewski@baylibre.com>
      Cc: Geert Uytterhoeven <geert@linux-m68k.org>
      Cc: Marek Vasut <marek.vasut+renesas@gmail.com>
      Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk>
      Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
      Cc: William Breathitt Gray <vilhelm.gray@gmail.com>
      Cc: Yury Norov <yury.norov@gmail.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      c21dd8a7
    • Andy Shevchenko's avatar
      lib/test_bitmap: rename exp to exp1 to avoid ambiguous name · 0ee312e3
      Andy Shevchenko authored
      
      
      One function is using exp as local variable.  Avoid ambiguous naming by
      rename global one to exp1.
      
      Link: http://lkml.kernel.org/r/20191022172922.61232-5-andriy.shevchenko@linux.intel.com
      Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Acked-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      Cc: Bartosz Golaszewski <bgolaszewski@baylibre.com>
      Cc: Geert Uytterhoeven <geert@linux-m68k.org>
      Cc: Marek Vasut <marek.vasut+renesas@gmail.com>
      Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk>
      Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
      Cc: William Breathitt Gray <vilhelm.gray@gmail.com>
      Cc: Yury Norov <yury.norov@gmail.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      0ee312e3
    • Andy Shevchenko's avatar
      lib/test_bitmap: name EXP_BYTES properly · a4881d1c
      Andy Shevchenko authored
      
      
      EXP_BYTES has been wrongly named.  It's a size of the exp array in bits.
      
      While here, go ahead and rename to EXP1_IN_BITS to avoid double renaming
      when exp will be renamed to exp1 in the next patch
      
      Link: http://lkml.kernel.org/r/20191022172922.61232-4-andriy.shevchenko@linux.intel.com
      Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Acked-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      Cc: Bartosz Golaszewski <bgolaszewski@baylibre.com>
      Cc: Geert Uytterhoeven <geert@linux-m68k.org>
      Cc: Marek Vasut <marek.vasut+renesas@gmail.com>
      Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk>
      Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
      Cc: William Breathitt Gray <vilhelm.gray@gmail.com>
      Cc: Yury Norov <yury.norov@gmail.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      a4881d1c
    • Andy Shevchenko's avatar
      lib/test_bitmap: undefine macros after use · 54224044
      Andy Shevchenko authored
      
      
      There is no need to keep step and ptest macros defined in entire file.
      
      Link: http://lkml.kernel.org/r/20191022172922.61232-3-andriy.shevchenko@linux.intel.com
      Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Acked-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      Cc: Bartosz Golaszewski <bgolaszewski@baylibre.com>
      Cc: Geert Uytterhoeven <geert@linux-m68k.org>
      Cc: Marek Vasut <marek.vasut+renesas@gmail.com>
      Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk>
      Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
      Cc: William Breathitt Gray <vilhelm.gray@gmail.com>
      Cc: Yury Norov <yury.norov@gmail.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      54224044
    • Andy Shevchenko's avatar
      lib/test_bitmap: force argument of bitmap_parselist_user() to proper address space · 17b6753f
      Andy Shevchenko authored
      
      
      Patch series "gpio: pca953x: Convert to bitmap (extended) API", v2.
      
      While converting gpio-pca953x driver to bitmap API, I noticed that we
      have no function to replace bits.
      
      So, that's how patch 7 appears.
      
      First 6 patches are preparatory of the test suite (including some
      warning fixes, etc).
      
      Patches 8-9 are preparatory for the GPIO driver to be easier converted
      to bitmap API, conversion to which happens in patch 10.
      
      Patch 11 contains simple indentation fixes.
      
      This patch (of 11):
      
      Sparse complains:
      
        lib/test_bitmap.c:345:58: warning: incorrect type in argument 1 (different address spaces)
        lib/test_bitmap.c:345:58:    expected char const [noderef] <asn:1> *ubuf
        lib/test_bitmap.c:345:58:    got char const *const in
      
      Force argument of bitmap_parselist_user() to proper address space.
      
      Link: http://lkml.kernel.org/r/20191022172922.61232-2-andriy.shevchenko@linux.intel.com
      Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Acked-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      Cc: Bartosz Golaszewski <bgolaszewski@baylibre.com>
      Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk>
      Cc: Yury Norov <yury.norov@gmail.com>
      Cc: William Breathitt Gray <vilhelm.gray@gmail.com>
      Cc: Geert Uytterhoeven <geert@linux-m68k.org>
      Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
      Cc: Marek Vasut <marek.vasut+renesas@gmail.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      17b6753f
    • Masahiro Yamada's avatar
      arch: sembuf.h: make uapi asm/sembuf.h self-contained · 0fb9dc28
      Masahiro Yamada authored
      
      
      Userspace cannot compile <asm/sembuf.h> due to some missing type
      definitions.  For example, building it for x86 fails as follows:
      
          CC      usr/include/asm/sembuf.h.s
        In file included from <command-line>:32:0:
        usr/include/asm/sembuf.h:17:20: error: field `sem_perm' has incomplete type
          struct ipc64_perm sem_perm; /* permissions .. see ipc.h */
                            ^~~~~~~~
        usr/include/asm/sembuf.h:24:2: error: unknown type name `__kernel_time_t'
          __kernel_time_t sem_otime; /* last semop time */
          ^~~~~~~~~~~~~~~
        usr/include/asm/sembuf.h:25:2: error: unknown type name `__kernel_ulong_t'
          __kernel_ulong_t __unused1;
          ^~~~~~~~~~~~~~~~
        usr/include/asm/sembuf.h:26:2: error: unknown type name `__kernel_time_t'
          __kernel_time_t sem_ctime; /* last change time */
          ^~~~~~~~~~~~~~~
        usr/include/asm/sembuf.h:27:2: error: unknown type name `__kernel_ulong_t'
          __kernel_ulong_t __unused2;
          ^~~~~~~~~~~~~~~~
        usr/include/asm/sembuf.h:29:2: error: unknown type name `__kernel_ulong_t'
          __kernel_ulong_t sem_nsems; /* no. of semaphores in array */
          ^~~~~~~~~~~~~~~~
        usr/include/asm/sembuf.h:30:2: error: unknown type name `__kernel_ulong_t'
          __kernel_ulong_t __unused3;
          ^~~~~~~~~~~~~~~~
        usr/include/asm/sembuf.h:31:2: error: unknown type name `__kernel_ulong_t'
          __kernel_ulong_t __unused4;
          ^~~~~~~~~~~~~~~~
      
      It is just a matter of missing include directive.
      
      Include <asm/ipcbuf.h> to make it self-contained, and add it to
      the compile-test coverage.
      
      Link: http://lkml.kernel.org/r/20191030063855.9989-3-yamada.masahiro@socionext.com
      Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      0fb9dc28
    • Masahiro Yamada's avatar
      arch: msgbuf.h: make uapi asm/msgbuf.h self-contained · 9ef0e004
      Masahiro Yamada authored
      
      
      Userspace cannot compile <asm/msgbuf.h> due to some missing type
      definitions.  For example, building it for x86 fails as follows:
      
          CC      usr/include/asm/msgbuf.h.s
        In file included from usr/include/asm/msgbuf.h:6:0,
                         from <command-line>:32:
        usr/include/asm-generic/msgbuf.h:25:20: error: field `msg_perm' has incomplete type
          struct ipc64_perm msg_perm;
                            ^~~~~~~~
        usr/include/asm-generic/msgbuf.h:27:2: error: unknown type name `__kernel_time_t'
          __kernel_time_t msg_stime; /* last msgsnd time */
          ^~~~~~~~~~~~~~~
        usr/include/asm-generic/msgbuf.h:28:2: error: unknown type name `__kernel_time_t'
          __kernel_time_t msg_rtime; /* last msgrcv time */
          ^~~~~~~~~~~~~~~
        usr/include/asm-generic/msgbuf.h:29:2: error: unknown type name `__kernel_time_t'
          __kernel_time_t msg_ctime; /* last change time */
          ^~~~~~~~~~~~~~~
        usr/include/asm-generic/msgbuf.h:41:2: error: unknown type name `__kernel_pid_t'
          __kernel_pid_t msg_lspid; /* pid of last msgsnd */
          ^~~~~~~~~~~~~~
        usr/include/asm-generic/msgbuf.h:42:2: error: unknown type name `__kernel_pid_t'
          __kernel_pid_t msg_lrpid; /* last receive pid */
          ^~~~~~~~~~~~~~
      
      It is just a matter of missing include directive.
      
      Include <asm/ipcbuf.h> to make it self-contained, and add it to
      the compile-test coverage.
      
      Link: http://lkml.kernel.org/r/20191030063855.9989-2-yamada.masahiro@socionext.com
      Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      9ef0e004
    • Masahiro Yamada's avatar
      arch: ipcbuf.h: make uapi asm/ipcbuf.h self-contained · 5b009673
      Masahiro Yamada authored
      
      
      Userspace cannot compile <asm/ipcbuf.h> due to some missing type
      definitions.  For example, building it for x86 fails as follows:
      
          CC      usr/include/asm/ipcbuf.h.s
        In file included from usr/include/asm/ipcbuf.h:1:0,
                         from <command-line>:32:
        usr/include/asm-generic/ipcbuf.h:21:2: error: unknown type name `__kernel_key_t'
          __kernel_key_t  key;
          ^~~~~~~~~~~~~~
        usr/include/asm-generic/ipcbuf.h:22:2: error: unknown type name `__kernel_uid32_t'
          __kernel_uid32_t uid;
          ^~~~~~~~~~~~~~~~
        usr/include/asm-generic/ipcbuf.h:23:2: error: unknown type name `__kernel_gid32_t'
          __kernel_gid32_t gid;
          ^~~~~~~~~~~~~~~~
        usr/include/asm-generic/ipcbuf.h:24:2: error: unknown type name `__kernel_uid32_t'
          __kernel_uid32_t cuid;
          ^~~~~~~~~~~~~~~~
        usr/include/asm-generic/ipcbuf.h:25:2: error: unknown type name `__kernel_gid32_t'
          __kernel_gid32_t cgid;
          ^~~~~~~~~~~~~~~~
        usr/include/asm-generic/ipcbuf.h:26:2: error: unknown type name `__kernel_mode_t'
          __kernel_mode_t  mode;
          ^~~~~~~~~~~~~~~
        usr/include/asm-generic/ipcbuf.h:28:35: error: `__kernel_mode_t' undeclared here (not in a function)
          unsigned char  __pad1[4 - sizeof(__kernel_mode_t)];
                                           ^~~~~~~~~~~~~~~
        usr/include/asm-generic/ipcbuf.h:31:2: error: unknown type name `__kernel_ulong_t'
          __kernel_ulong_t __unused1;
          ^~~~~~~~~~~~~~~~
        usr/include/asm-generic/ipcbuf.h:32:2: error: unknown type name `__kernel_ulong_t'
          __kernel_ulong_t __unused2;
          ^~~~~~~~~~~~~~~~
      
      It is just a matter of missing include directive.
      
      Include <linux/posix_types.h> to make it self-contained, and add it to
      the compile-test coverage.
      
      Link: http://lkml.kernel.org/r/20191030063855.9989-1-yamada.masahiro@socionext.com
      Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      5b009673
    • Julien Grall's avatar
      lib/ubsan: don't serialize UBSAN report · ce5c31db
      Julien Grall authored
      
      
      At the moment, UBSAN report will be serialized using a spin_lock().  On
      RT-systems, spinlocks are turned to rt_spin_lock and may sleep.  This
      will result to the following splat if the undefined behavior is in a
      context that can sleep:
      
        BUG: sleeping function called from invalid context at /src/linux/kernel/locking/rtmutex.c:968
        in_atomic(): 1, irqs_disabled(): 128, pid: 3447, name: make
        1 lock held by make/3447:
         #0: 000000009a966332 (&mm->mmap_sem){++++}, at: do_page_fault+0x140/0x4f8
        irq event stamp: 6284
        hardirqs last  enabled at (6283): [<ffff000011326520>] _raw_spin_unlock_irqrestore+0x90/0xa0
        hardirqs last disabled at (6284): [<ffff0000113262b0>] _raw_spin_lock_irqsave+0x30/0x78
        softirqs last  enabled at (2430): [<ffff000010088ef8>] fpsimd_restore_current_state+0x60/0xe8
        softirqs last disabled at (2427): [<ffff000010088ec0>] fpsimd_restore_current_state+0x28/0xe8
        Preemption disabled at:
        [<ffff000011324a4c>] rt_mutex_futex_unlock+0x4c/0xb0
        CPU: 3 PID: 3447 Comm: make Tainted: G        W         5.2.14-rt7-01890-ge6e057589653 #911
        Call trace:
          dump_backtrace+0x0/0x148
          show_stack+0x14/0x20
          dump_stack+0xbc/0x104
          ___might_sleep+0x154/0x210
          rt_spin_lock+0x68/0xa0
          ubsan_prologue+0x30/0x68
          handle_overflow+0x64/0xe0
          __ubsan_handle_add_overflow+0x10/0x18
          __lock_acquire+0x1c28/0x2a28
          lock_acquire+0xf0/0x370
          _raw_spin_lock_irqsave+0x58/0x78
          rt_mutex_futex_unlock+0x4c/0xb0
          rt_spin_unlock+0x28/0x70
          get_page_from_freelist+0x428/0x2b60
          __alloc_pages_nodemask+0x174/0x1708
          alloc_pages_vma+0x1ac/0x238
          __handle_mm_fault+0x4ac/0x10b0
          handle_mm_fault+0x1d8/0x3b0
          do_page_fault+0x1c8/0x4f8
          do_translation_fault+0xb8/0xe0
          do_mem_abort+0x3c/0x98
          el0_da+0x20/0x24
      
      The spin_lock() will protect against multiple CPUs to output a report
      together, I guess to prevent them from being interleaved.  However, they
      can still interleave with other messages (and even splat from
      __might_sleep).
      
      So the lock usefulness seems pretty limited.  Rather than trying to
      accomodate RT-system by switching to a raw_spin_lock(), the lock is now
      completely dropped.
      
      Link: http://lkml.kernel.org/r/20190920100835.14999-1-julien.grall@arm.com
      Signed-off-by: default avatarJulien Grall <julien.grall@arm.com>
      Reported-by: default avatarAndre Przywara <andre.przywara@arm.com>
      Acked-by: default avatarAndrey Ryabinin <aryabinin@virtuozzo.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      ce5c31db
    • Andrey Konovalov's avatar
      vhost, kcov: collect coverage from vhost_worker · 8f6a7f96
      Andrey Konovalov authored
      
      
      Add kcov_remote_start()/kcov_remote_stop() annotations to the
      vhost_worker() function, which is responsible for processing vhost
      works.
      
      Since vhost_worker() threads are spawned per vhost device instance the
      common kcov handle is used for kcov_remote_start()/stop() annotations
      (see Documentation/dev-tools/kcov.rst for details).  As the result kcov
      can now be used to collect coverage from vhost worker threads.
      
      Link: http://lkml.kernel.org/r/e49d5d154e5da6c9ada521d2b7ce10a49ce9f98b.1572366574.git.andreyknvl@google.com
      Signed-off-by: default avatarAndrey Konovalov <andreyknvl@google.com>
      Cc: Alan Stern <stern@rowland.harvard.edu>
      Cc: Alexander Potapenko <glider@google.com>
      Cc: Anders Roxell <anders.roxell@linaro.org>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: David Windsor <dwindsor@gmail.com>
      Cc: Dmitry Vyukov <dvyukov@google.com>
      Cc: Elena Reshetova <elena.reshetova@intel.com>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Jason Wang <jasowang@redhat.com>
      Cc: Marco Elver <elver@google.com>
      Cc: "Michael S. Tsirkin" <mst@redhat.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      8f6a7f96
    • Andrey Konovalov's avatar
      usb, kcov: collect coverage from hub_event · 95d23dc2
      Andrey Konovalov authored
      
      
      Add kcov_remote_start()/kcov_remote_stop() annotations to the
      hub_event() function, which is responsible for processing events on USB
      buses, in particular events that happen during USB device enumeration.
      
      Since hub_event() is run in a global background kernel thread (see
      Documentation/dev-tools/kcov.rst for details), each USB bus gets a
      unique global handle from the USB subsystem kcov handle range.  As the
      result kcov can now be used to collect coverage from events that happen
      on a particular USB bus.
      
      [akpm@linux-foundation.org: avoid patch conflicts to make life easier for Andrew]
      Link: http://lkml.kernel.org/r/de4fe1c219db2d002d905dc1736e2a3bfa1db997.1572366574.git.andreyknvl@google.com
      Signed-off-by: default avatarAndrey Konovalov <andreyknvl@google.com>
      Reviewed-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Alan Stern <stern@rowland.harvard.edu>
      Cc: Alexander Potapenko <glider@google.com>
      Cc: Anders Roxell <anders.roxell@linaro.org>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: David Windsor <dwindsor@gmail.com>
      Cc: Dmitry Vyukov <dvyukov@google.com>
      Cc: Elena Reshetova <elena.reshetova@intel.com>
      Cc: Jason Wang <jasowang@redhat.com>
      Cc: Marco Elver <elver@google.com>
      Cc: "Michael S. Tsirkin" <mst@redhat.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      95d23dc2
    • Andrey Konovalov's avatar
      kcov: remote coverage support · eec028c9
      Andrey Konovalov authored
      
      
      Patch series " kcov: collect coverage from usb and vhost", v3.
      
      This patchset extends kcov to allow collecting coverage from backgound
      kernel threads.  This extension requires custom annotations for each of
      the places where coverage collection is desired.  This patchset
      implements this for hub events in the USB subsystem and for vhost
      workers.  See the first patch description for details about the kcov
      extension.  The other two patches apply this kcov extension to USB and
      vhost.
      
      Examples of other subsystems that might potentially benefit from this
      when custom annotations are added (the list is based on
      process_one_work() callers for bugs recently reported by syzbot):
      
      1. fs: writeback wb_workfn() worker,
      2. net: addrconf_dad_work()/addrconf_verify_work() workers,
      3. net: neigh_periodic_work() worker,
      4. net/p9: p9_write_work()/p9_read_work() workers,
      5. block: blk_mq_run_work_fn() worker.
      
      These patches have been used to enable coverage-guided USB fuzzing with
      syzkaller for the last few years, see the details here:
      
        https://github.com/google/syzkaller/blob/master/docs/linux/external_fuzzing_usb.md
      
      This patchset has been pushed to the public Linux kernel Gerrit
      instance:
      
        https://linux-review.googlesource.com/c/linux/kernel/git/torvalds/linux/+/1524
      
      This patch (of 3):
      
      Add background thread coverage collection ability to kcov.
      
      With KCOV_ENABLE coverage is collected only for syscalls that are issued
      from the current process.  With KCOV_REMOTE_ENABLE it's possible to
      collect coverage for arbitrary parts of the kernel code, provided that
      those parts are annotated with kcov_remote_start()/kcov_remote_stop().
      
      This allows to collect coverage from two types of kernel background
      threads: the global ones, that are spawned during kernel boot in a
      limited number of instances (e.g.  one USB hub_event() worker thread is
      spawned per USB HCD); and the local ones, that are spawned when a user
      interacts with some kernel interface (e.g.  vhost workers).
      
      To enable collecting coverage from a global background thread, a unique
      global handle must be assigned and passed to the corresponding
      kcov_remote_start() call.  Then a userspace process can pass a list of
      such handles to the KCOV_REMOTE_ENABLE ioctl in the handles array field
      of the kcov_remote_arg struct.  This will attach the used kcov device to
      the code sections, that are referenced by those handles.
      
      Since there might be many local background threads spawned from
      different userspace processes, we can't use a single global handle per
      annotation.  Instead, the userspace process passes a non-zero handle
      through the common_handle field of the kcov_remote_arg struct.  This
      common handle gets saved to the kcov_handle field in the current
      task_struct and needs to be passed to the newly spawned threads via
      custom annotations.  Those threads should in turn be annotated with
      kcov_remote_start()/kcov_remote_stop().
      
      Internally kcov stores handles as u64 integers.  The top byte of a
      handle is used to denote the id of a subsystem that this handle belongs
      to, and the lower 4 bytes are used to denote the id of a thread instance
      within that subsystem.  A reserved value 0 is used as a subsystem id for
      common handles as they don't belong to a particular subsystem.  The
      bytes 4-7 are currently reserved and must be zero.  In the future the
      number of bytes used for the subsystem or handle ids might be increased.
      
      When a particular userspace process collects coverage by via a common
      handle, kcov will collect coverage for each code section that is
      annotated to use the common handle obtained as kcov_handle from the
      current task_struct.  However non common handles allow to collect
      coverage selectively from different subsystems.
      
      Link: http://lkml.kernel.org/r/e90e315426a384207edbec1d6aa89e43008e4caf.1572366574.git.andreyknvl@google.com
      Signed-off-by: default avatarAndrey Konovalov <andreyknvl@google.com>
      Cc: Dmitry Vyukov <dvyukov@google.com>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Alan Stern <stern@rowland.harvard.edu>
      Cc: "Michael S. Tsirkin" <mst@redhat.com>
      Cc: Jason Wang <jasowang@redhat.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: David Windsor <dwindsor@gmail.com>
      Cc: Elena Reshetova <elena.reshetova@intel.com>
      Cc: Anders Roxell <anders.roxell@linaro.org>
      Cc: Alexander Potapenko <glider@google.com>
      Cc: Marco Elver <elver@google.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      eec028c9
    • Kees Cook's avatar
      uaccess: disallow > INT_MAX copy sizes · 6d13de14
      Kees Cook authored
      
      
      As we've done with VFS, string operations, etc, reject usercopy sizes
      larger than INT_MAX, which would be nice to have for catching bugs
      related to size calculation overflows[1].
      
      This adds 10 bytes to x86_64 defconfig text and 1980 bytes to the data
      section:
      
           text    data     bss     dec     hex filename
        19691167        5134320 1646664 26472151        193eed7 vmlinux.before
        19691177        5136300 1646664 26474141        193f69d vmlinux.after
      
      [1] https://marc.info/?l=linux-s390&m=156631939010493&w=2
      
      Link: http://lkml.kernel.org/r/201908251612.F9902D7A@keescook
      Signed-off-by: default avatarKees Cook <keescook@chromium.org>
      Suggested-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
      Cc: Alexander Viro <viro@zeniv.linux.org.uk>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      6d13de14
    • Daniel Vetter's avatar
      drm: limit to INT_MAX in create_blob ioctl · 5bf8bec3
      Daniel Vetter authored
      
      
      The hardened usercpy code is too paranoid ever since commit 6a30afa8c1fb
      ("uaccess: disallow > INT_MAX copy sizes")
      
      Code itself should have been fine as-is.
      
      Link: http://lkml.kernel.org/r/20191106164755.31478-1-daniel.vetter@ffwll.ch
      Signed-off-by: default avatarDaniel Vetter <daniel.vetter@intel.com>
      Reported-by: default avatar <syzbot+fb77e97ebf0612ee6914@syzkaller.appspotmail.com>
      Fixes: 6a30afa8c1fb ("uaccess: disallow > INT_MAX copy sizes")
      Cc: Kees Cook <keescook@chromium.org>
      Cc: Alexander Viro <viro@zeniv.linux.org.uk>
      Cc: Stephen Rothwell <sfr@canb.auug.org.au>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      5bf8bec3
    • Ben Dooks (Codethink)'s avatar
      drivers/rapidio/rio-access.c: fix missing include of <linux/rio_drv.h> · bd7bca43
      Ben Dooks (Codethink) authored
      
      
      Include <linux/rio_drv.h> for the missing declarations of functions
      exported from this file.  Fixes the following sparse warnings:
      
        drivers/rapidio/rio-access.c:59:1: warning: symbol '__rio_local_read_config_8' was not declared. Should it be static?
        drivers/rapidio/rio-access.c:60:1: warning: symbol '__rio_local_read_config_16' was not declared. Should it be static?
        drivers/rapidio/rio-access.c:61:1: warning: symbol '__rio_local_read_config_32' was not declared. Should it be static?
        drivers/rapidio/rio-access.c:62:1: warning: symbol '__rio_local_write_config_8' was not declared. Should it be static?
        drivers/rapidio/rio-access.c:63:1: warning: symbol '__rio_local_write_config_16' was not declared. Should it be static?
        drivers/rapidio/rio-access.c:64:1: warning: symbol '__rio_local_write_config_32' was not declared. Should it be static?
        drivers/rapidio/rio-access.c:112:1: warning: symbol 'rio_mport_read_config_8' was not declared. Should it be static?
        drivers/rapidio/rio-access.c:113:1: warning: symbol 'rio_mport_read_config_16' was not declared. Should it be static?
        drivers/rapidio/rio-access.c:114:1: warning: symbol 'rio_mport_read_config_32' was not declared. Should it be static?
        drivers/rapidio/rio-access.c:115:1: warning: symbol 'rio_mport_write_config_8' was not declared. Should it be static?
        drivers/rapidio/rio-access.c:116:1: warning: symbol 'rio_mport_write_config_16' was not declared. Should it be static?
        drivers/rapidio/rio-access.c:117:1: warning: symbol 'rio_mport_write_config_32' was not declared. Should it be static?
        drivers/rapidio/rio-access.c:136:5: warning: symbol 'rio_mport_send_doorbell' was not declared. Should it be static?
      
      Link: http://lkml.kernel.org/r/20191017115103.684-1-ben.dooks@codethink.co.uk
      Signed-off-by: default avatarBen Dooks <ben.dooks@codethink.co.uk>
      Cc: Matt Porter <mporter@kernel.crashing.org>
      Cc: Alexandre Bounine <alex.bou9@gmail.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      bd7bca43
    • Ben Dooks (Codethink)'s avatar
      drivers/rapidio/rio-driver.c: fix missing include of <linux/rio_drv.h> · 48d6b4dd
      Ben Dooks (Codethink) authored
      
      
      Include <linux/rio_drv.h> for the missing declarations of functions
      exported from this file.  Fixes the following sparse warnings:
      
        drivers/rapidio/rio-driver.c:53:16: warning: symbol 'rio_dev_get' was not declared. Should it be static?
        drivers/rapidio/rio-driver.c:70:6: warning: symbol 'rio_dev_put' was not declared. Should it be static?
        drivers/rapidio/rio-driver.c:150:5: warning: symbol 'rio_register_driver' was not declared. Should it be static?
        drivers/rapidio/rio-driver.c:169:6: warning: symbol 'rio_unregister_driver' was not declared. Should it be static?
      
      Link: http://lkml.kernel.org/r/20191017114923.10888-1-ben.dooks@codethink.co.uk
      Signed-off-by: default avatarBen Dooks <ben.dooks@codethink.co.uk>
      Cc: Matt Porter <mporter@kernel.crashing.org>
      Cc: Alexandre Bounine <alex.bou9@gmail.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      48d6b4dd
    • Krzysztof Kozlowski's avatar
      init/Kconfig: fix indentation · e8cf4e9c
      Krzysztof Kozlowski authored
      
      
      Adjust indentation from spaces to tab (+optional two spaces) as in
      coding style with command like:
      	$ sed -e 's/^        /	/' -i */Kconfig
      
      Link: http://lkml.kernel.org/r/1574306670-30234-1-git-send-email-krzk@kernel.org
      Signed-off-by: default avatarKrzysztof Kozlowski <krzk@kernel.org>
      Cc: Jiri Kosina <trivial@kernel.org>
      Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: David Hildenbrand <david@redhat.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      e8cf4e9c
    • Alexey Dobriyan's avatar
      fs/binfmt_elf.c: extract elf_read() function · 658c0335
      Alexey Dobriyan authored
      
      
      ELF reads done by the kernel have very complicated error detection code
      which better live in one place.
      
      Link: http://lkml.kernel.org/r/20191005165215.GB26927@avx2
      Signed-off-by: default avatarAlexey Dobriyan <adobriyan@gmail.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      658c0335
    • Alexey Dobriyan's avatar
      fs/binfmt_elf.c: delete unused "interp_map_addr" argument · 81696d5d
      Alexey Dobriyan authored
      
      
      Link: http://lkml.kernel.org/r/20191005165049.GA26927@avx2
      Signed-off-by: default avatarAlexey Dobriyan <adobriyan@gmail.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      81696d5d
    • Heiher's avatar
      selftests: add epoll selftests · f2728fe8
      Heiher authored
      
      
      This adds the promised selftest for epoll.  It will verify the wakeups
      of epoll.  Including leaf and nested mode, epoll_wait() and poll() and
      multi-threads.
      
      Link: http://lkml.kernel.org/r/20191009121518.4027-1-r@hev.cc
      Signed-off-by: default avatarhev <r@hev.cc>
      Reviewed-by: default avatarRoman Penyaev <rpenyaev@suse.de>
      Cc: Jason Baron <jbaron@akamai.com>
      Cc: Shuah Khan <shuah@kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      f2728fe8
    • Heiher's avatar
      fs/epoll: remove unnecessary wakeups of nested epoll · 339ddb53
      Heiher authored
      
      
      Take the case where we have:
      
              t0
               | (ew)
              e0
               | (et)
              e1
               | (lt)
              s0
      
      t0: thread 0
      e0: epoll fd 0
      e1: epoll fd 1
      s0: socket fd 0
      ew: epoll_wait
      et: edge-trigger
      lt: level-trigger
      
      We remove unnecessary wakeups to prevent the nested epoll that working in edge-
      triggered mode to waking up continuously.
      
      Test code:
       #include <unistd.h>
       #include <sys/epoll.h>
       #include <sys/socket.h>
      
       int main(int argc, char *argv[])
       {
       	int sfd[2];
       	int efd[2];
       	struct epoll_event e;
      
       	if (socketpair(AF_UNIX, SOCK_STREAM, 0, sfd) < 0)
       		goto out;
      
       	efd[0] = epoll_create(1);
       	if (efd[0] < 0)
       		goto out;
      
       	efd[1] = epoll_create(1);
       	if (efd[1] < 0)
       		goto out;
      
       	e.events = EPOLLIN;
       	if (epoll_ctl(efd[1], EPOLL_CTL_ADD, sfd[0], &e) < 0)
       		goto out;
      
       	e.events = EPOLLIN | EPOLLET;
       	if (epoll_ctl(efd[0], EPOLL_CTL_ADD, efd[1], &e) < 0)
       		goto out;
      
       	if (write(sfd[1], "w", 1) != 1)
       		goto out;
      
       	if (epoll_wait(efd[0], &e, 1, 0) != 1)
       		goto out;
      
       	if (epoll_wait(efd[0], &e, 1, 0) != 0)
       		goto out;
      
       	close(efd[0]);
       	close(efd[1]);
       	close(sfd[0]);
       	close(sfd[1]);
      
       	return 0;
      
       out:
       	return -1;
       }
      
      More tests:
       https://github.com/heiher/epoll-wakeup
      
      Link: http://lkml.kernel.org/r/20191009060516.3577-1-r@hev.cc
      Signed-off-by: default avatarhev <r@hev.cc>
      Reviewed-by: default avatarRoman Penyaev <rpenyaev@suse.de>
      Cc: Al Viro <viro@ZenIV.linux.org.uk>
      Cc: Davide Libenzi <davidel@xmailserver.org>
      Cc: Davidlohr Bueso <dave@stgolabs.net>
      Cc: Dominik Brodowski <linux@dominikbrodowski.net>
      Cc: Eric Wong <e@80x24.org>
      Cc: Jason Baron <jbaron@akamai.com>
      Cc: Sridhar Samudrala <sridhar.samudrala@intel.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      339ddb53
    • Jason Baron's avatar
      epoll: simplify ep_poll_safewake() for CONFIG_DEBUG_LOCK_ALLOC · f6520c52
      Jason Baron authored
      Currently, ep_poll_safewake() in the CONFIG_DEBUG_LOCK_ALLOC case uses
      ep_call_nested() in order to pass the correct subclass argument to
      spin_lock_irqsave_nested().  However, ep_call_nested() adds unnecessary
      checks for epoll depth and loops that are already verified when doing
      EPOLL_CTL_ADD.  This mirrors a conversion that was done for
      !CONFIG_DEBUG_LOCK_ALLOC in: commit 37b5e521
      
       ("epoll: remove
      ep_call_nested() from ep_eventpoll_poll()")
      
      Link: http://lkml.kernel.org/r/1567628549-11501-1-git-send-email-jbaron@akamai.com
      Signed-off-by: default avatarJason Baron <jbaron@akamai.com>
      Reviewed-by: default avatarRoman Penyaev <rpenyaev@suse.de>
      Cc: Davidlohr Bueso <dave@stgolabs.net>
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      Cc: Eric Wong <normalperson@yhbt.net>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      f6520c52
    • Joe Perches's avatar
      checkpatch: reduce is_maintained_obsolete lookup runtime · cd28b119
      Joe Perches authored
      
      
      The is_maintained_obsolete function can be called twice using the same
      filename.  This function spawns a process using get_maintainer.pl.
      Store the status of each filename when spawned and use the stored result
      to eliminate the spawning of unnecessary duplicate child processes.
      
      Example:
      
      old:
      
        $ time ./scripts/checkpatch.pl hp100-Move-to-staging.patch > /dev/null
      
        real	0m1.767s
        user	0m1.634s
        sys	0m0.141s
      
      new:
      
        $ time ./scripts/checkpatch.pl hp100-Move-to-staging.patch > /dev/null
      
        real	0m1.184s
        user	0m1.085s
        sys	0m0.103s
      
      Link: http://lkml.kernel.org/r/b982566a2b9b4825badce36fdfc3032bd0005151.camel@perches.com
      Signed-off-by: default avatarJoe Perches <joe@perches.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      cd28b119
    • Joe Perches's avatar
      checkpatch: improve ignoring CamelCase SI style variants like mA · d439e6a5
      Joe Perches authored
      
      
      Ignore all upper-case variants before and after SI units like mA, mV and
      uV so uses like RANGE_mA do not emit a CAMELCASE message.
      
      Link: http://lkml.kernel.org/r/5ce6f9131327fd2e12d7a0e20a55f588448de090.camel@perches.com
      Signed-off-by: default avatarJoe Perches <joe@perches.com>
      Cc: Jules Irenge <jbi.octave@gmail.com>
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      d439e6a5
    • Huang Shijie's avatar
      lib/genalloc.c: rename addr_in_gen_pool to gen_pool_has_addr · 964975ac
      Huang Shijie authored
      
      
      Follow the kernel conventions, rename addr_in_gen_pool to
      gen_pool_has_addr.
      
      [sjhuang@iluvatar.ai: fix Documentation/ too]
       Link: http://lkml.kernel.org/r/20181229015914.5573-1-sjhuang@iluvatar.ai
      Link: http://lkml.kernel.org/r/20181228083950.20398-1-sjhuang@iluvatar.ai
      Signed-off-by: default avatarHuang Shijie <sjhuang@iluvatar.ai>
      Reviewed-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Cc: Russell King <linux@armlinux.org.uk>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Marek Szyprowski <m.szyprowski@samsung.com>
      Cc: Robin Murphy <robin.murphy@arm.com>
      Cc: Stephen Rothwell <sfr@canb.auug.org.au>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      964975ac
    • Huang Shijie's avatar
      lib/genalloc.c: export symbol addr_in_gen_pool · fd7eb251
      Huang Shijie authored
      
      
      We use addr_in_gen_pool() in a driver module.  So export it.
      
      Link: http://lkml.kernel.org/r/20181224070622.22197-2-sjhuang@iluvatar.ai
      Signed-off-by: default avatarHuang Shijie <sjhuang@iluvatar.ai>
      Reviewed-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Cc: Alexey Skidanov <alexey.skidanov@intel.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      fd7eb251
    • Trent Piepho's avatar
      lib/math/rational.c: fix possible incorrect result from rational fractions helper · 323dd2c3
      Trent Piepho authored
      
      
      In some cases the previous algorithm would not return the closest
      approximation.  This would happen when a semi-convergent was the
      closest, as the previous algorithm would only consider convergents.
      
      As an example, consider an initial value of 5/4, and trying to find the
      closest approximation with a maximum of 4 for numerator and denominator.
      The previous algorithm would return 1/1 as the closest approximation,
      while this version will return the correct answer of 4/3.
      
      To do this, the main loop performs effectively the same operations as it
      did before.  It must now keep track of the last three approximations,
      n2/d2 ..  n0/d0, while before it only needed the last two.
      
      If an exact answer is not found, the algorithm will now calculate the
      best semi-convergent term, t, which is a single expression with two
      divisions:
      
          min((max_numerator - n0) / n1, (max_denominator - d0) / d1)
      
      This will be used if it is better than previous convergent.  The test
      for this is generally a simple comparison, 2*t > a.  But in an edge
      case, where the convergent's final term is even and the best allowable
      semi-convergent has a final term of exactly half the convergent's final
      term, the more complex comparison (d0*dp > d1*d) is used.
      
      I also wrote some comments explaining the code.  While one still needs
      to look up the math elsewhere, they should help a lot to follow how the
      code relates to that math.
      
      This routine is used in two places in the video4linux code, but in those
      cases it is only used to reduce a fraction to lowest terms, which the
      existing code will do correctly.  This could be done more efficiently
      with a different library routine but it would still be the Euclidean
      alogrithm at its heart.  So no change.
      
      The remain users are places where a fractional PLL divider is
      programmed.  What would happen is something asked for a clock of X MHz
      but instead gets Y MHz, where Y is close to X but not exactly due to the
      hardware limitations.  After this change they might, in some cases, get
      Y' MHz, where Y' is a little closer to X then Y was.
      
      Users like this are: Three UARTs, in 8250_mid, 8250_lpss, and imx.  One
      GPU in vp4_hdmi.  And three clock drivers, clk-cdce706, clk-si5351, and
      clk-fractional-divider.  The last is a generic clock driver and so would
      have more users referenced via device tree entries.
      
      I think there's a bug in that one, it's limiting an N bit field that is
      offset-by-1 to the range 0 ..  (1<<N)-2, when it should be (1<<N)-1 as
      the upper limit.
      
      I have an IMX system, one of the UARTs using this, so I can provide a
      real example.  If I request a custom baud rate of 1499978, the driver
      will program the PLL to produce a baud rate of 1500000.  After this
      change, the fractional divider in the UART is programmed to a ratio of
      65535/65536, which produces a baud rate of 1499977.0625.  Closer to the
      requested value.
      
      Link: http://lkml.kernel.org/r/20190330205855.19396-1-tpiepho@gmail.com
      Signed-off-by: default avatarTrent Piepho <tpiepho@gmail.com>
      Cc: Oskar Schirmer <oskar@scara.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      323dd2c3
    • Laura Abbott's avatar
      lib/test_meminit.c: add bulk alloc/free tests · dc5c5ad7
      Laura Abbott authored
      
      
      kmem_cache_alloc_bulk/kmem_cache_free_bulk are used to make multiple
      allocations of the same size to avoid the overhead of multiple
      kmalloc/kfree calls.  Extend the kmem_cache tests to make some calls to
      these APIs.
      
      Link: http://lkml.kernel.org/r/20191107191447.23058-1-labbott@redhat.com
      Signed-off-by: default avatarLaura Abbott <labbott@redhat.com>
      Reviewed-by: default avatarKees Cook <keescook@chromium.org>
      Tested-by: default avatarAlexander Potapenko <glider@google.com>
      Cc: Laura Abbott <labbott@redhat.com>
      Cc: Christoph Lameter <cl@linux.com>
      Cc: Nick Desaulniers <ndesaulniers@google.com>
      Cc: Kostya Serebryany <kcc@google.com>
      Cc: Dmitry Vyukov <dvyukov@google.com>
      Cc: Sandeep Patil <sspatil@android.com>
      Cc: Jann Horn <jannh@google.com>
      Cc: Marco Elver <elver@google.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      dc5c5ad7
    • Wei Yang's avatar
      lib/rbtree: get successor's color directly · 8b7569a2
      Wei Yang authored
      
      
      After move parent assignment out, we can check the color directly.
      
      Link: http://lkml.kernel.org/r/20191028021442.5450-2-richardw.yang@linux.intel.com
      Signed-off-by: default avatarWei Yang <richardw.yang@linux.intel.com>
      Acked-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Reviewed-by: default avatarMichel Lespinasse <walken@google.com>
      Reviewed-by: default avatarDavidlohr Bueso <dbueso@suse.de>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      8b7569a2
    • Wei Yang's avatar
      lib/rbtree: set successor's parent unconditionally · 11d43e62
      Wei Yang authored
      
      
      Both in Case 2 and 3, we exchange n and s.  This mean no matter whether
      child2 is NULL or not, successor's parent should be assigned to node's.
      
      This patch takes this step out to make it explicit and reduce the
      ambiguity.
      
      Besides, this step reduces some symbol size like rb_erase().
      
         KERN_CONFIG       upstream       patched
         OPT_FOR_PERF      877            870
         OPT_FOR_SIZE      635            621
      
      Link: http://lkml.kernel.org/r/20191028021442.5450-1-richardw.yang@linux.intel.com
      Signed-off-by: default avatarWei Yang <richardw.yang@linux.intel.com>
      Acked-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Reviewed-by: default avatarMichel Lespinasse <walken@google.com>
      Reviewed-by: default avatarDavidlohr Bueso <dbueso@suse.de>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      11d43e62
    • William Breathitt Gray's avatar
      gpio: pca953x: utilize the for_each_set_clump8 macro · ae81217e
      William Breathitt Gray authored
      
      
      Replace verbose implementation in set_multiple callback with
      for_each_set_clump8 macro to simplify code and improve clarity.
      
      Link: http://lkml.kernel.org/r/3543ffc3668ad4ed4c00e8ebaf14a5559fd6ddf2.1570641097.git.vilhelm.gray@gmail.com
      Signed-off-by: default avatarWilliam Breathitt Gray <vilhelm.gray@gmail.com>
      Tested-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Cc: Phil Reid <preid@electromag.com.au>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Bartosz Golaszewski <bgolaszewski@baylibre.com>
      Cc: Geert Uytterhoeven <geert@linux-m68k.org>
      Cc: Geert Uytterhoeven <geert+renesas@glider.be>
      Cc: Linus Walleij <linus.walleij@linaro.org>
      Cc: Lukas Wunner <lukas@wunner.de>
      Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
      Cc: Mathias Duckeck <m.duckeck@kunbus.de>
      Cc: Morten Hein Tiljeset <morten.tiljeset@prevas.dk>
      Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk>
      Cc: Sean Nyekjaer <sean.nyekjaer@prevas.dk>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      ae81217e
    • William Breathitt Gray's avatar
      gpio: max3191x: utilize the for_each_set_clump8 macro · d077c78b
      William Breathitt Gray authored
      
      
      Replace verbose implementation in get_multiple callback with
      for_each_set_clump8 macro to simplify code and improve clarity.
      
      Link: http://lkml.kernel.org/r/c2b1ed62caf6fce6e5681809a50c05ce6acdf2a6.1570641097.git.vilhelm.gray@gmail.com
      Signed-off-by: default avatarWilliam Breathitt Gray <vilhelm.gray@gmail.com>
      Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
      Cc: Mathias Duckeck <m.duckeck@kunbus.de>
      Cc: Lukas Wunner <lukas@wunner.de>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Bartosz Golaszewski <bgolaszewski@baylibre.com>
      Cc: Geert Uytterhoeven <geert@linux-m68k.org>
      Cc: Geert Uytterhoeven <geert+renesas@glider.be>
      Cc: Linus Walleij <linus.walleij@linaro.org>
      Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
      Cc: Morten Hein Tiljeset <morten.tiljeset@prevas.dk>
      Cc: Phil Reid <preid@electromag.com.au>
      Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk>
      Cc: Sean Nyekjaer <sean.nyekjaer@prevas.dk>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      d077c78b
    • William Breathitt Gray's avatar
      gpio: pisosr: utilize the for_each_set_clump8 macro · 608bd5fd
      William Breathitt Gray authored
      
      
      Replace verbose implementation in get_multiple callback with
      for_each_set_clump8 macro to simplify code and improve clarity.
      
      Link: http://lkml.kernel.org/r/8a39ee772247d4b7d752b32dbacc06c1cdcb60b5.1570641097.git.vilhelm.gray@gmail.com
      Signed-off-by: default avatarWilliam Breathitt Gray <vilhelm.gray@gmail.com>
      Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
      Cc: Morten Hein Tiljeset <morten.tiljeset@prevas.dk>
      Cc: Sean Nyekjaer <sean.nyekjaer@prevas.dk>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Bartosz Golaszewski <bgolaszewski@baylibre.com>
      Cc: Geert Uytterhoeven <geert@linux-m68k.org>
      Cc: Geert Uytterhoeven <geert+renesas@glider.be>
      Cc: Linus Walleij <linus.walleij@linaro.org>
      Cc: Lukas Wunner <lukas@wunner.de>
      Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
      Cc: Mathias Duckeck <m.duckeck@kunbus.de>
      Cc: Phil Reid <preid@electromag.com.au>
      Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      608bd5fd
    • William Breathitt Gray's avatar
      thermal: intel: intel_soc_dts_iosf: Utilize for_each_set_clump8 macro · 9f00ebf5
      William Breathitt Gray authored
      
      
      Utilize for_each_set_clump8 macro, and the bitmap_set_value8 and
      bitmap_get_value8 functions, where appropriate.  In addition, remove the
      now unnecessary temp_mask and temp_shift members of the
      intel_soc_dts_sensor_entry structure.
      
      Link: http://lkml.kernel.org/r/2d3c74e9a00a52954f31d19e04623a7f4bc85520.1570641097.git.vilhelm.gray@gmail.com
      Signed-off-by: default avatarWilliam Breathitt Gray <vilhelm.gray@gmail.com>
      Suggested-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Bartosz Golaszewski <bgolaszewski@baylibre.com>
      Cc: Geert Uytterhoeven <geert@linux-m68k.org>
      Cc: Geert Uytterhoeven <geert+renesas@glider.be>
      Cc: Linus Walleij <linus.walleij@linaro.org>
      Cc: Lukas Wunner <lukas@wunner.de>
      Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
      Cc: Mathias Duckeck <m.duckeck@kunbus.de>
      Cc: Morten Hein Tiljeset <morten.tiljeset@prevas.dk>
      Cc: Phil Reid <preid@electromag.com.au>
      Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk>
      Cc: Sean Nyekjaer <sean.nyekjaer@prevas.dk>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      9f00ebf5
    • William Breathitt Gray's avatar
      gpio: 74x164: utilize the for_each_set_clump8 macro · b2ca9ebf
      William Breathitt Gray authored
      
      
      Replace verbose implementation in set_multiple callback with
      for_each_set_clump8 macro to simplify code and improve clarity.
      
      Link: http://lkml.kernel.org/r/7ea2df7182a50a1136ca36edc46dffcb2446fd27.1570641097.git.vilhelm.gray@gmail.com
      Signed-off-by: default avatarWilliam Breathitt Gray <vilhelm.gray@gmail.com>
      Suggested-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Tested-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Cc: Geert Uytterhoeven <geert+renesas@glider.be>
      Cc: Phil Reid <preid@electromag.com.au>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Bartosz Golaszewski <bgolaszewski@baylibre.com>
      Cc: Geert Uytterhoeven <geert@linux-m68k.org>
      Cc: Linus Walleij <linus.walleij@linaro.org>
      Cc: Lukas Wunner <lukas@wunner.de>
      Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
      Cc: Mathias Duckeck <m.duckeck@kunbus.de>
      Cc: Morten Hein Tiljeset <morten.tiljeset@prevas.dk>
      Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk>
      Cc: Sean Nyekjaer <sean.nyekjaer@prevas.dk>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      b2ca9ebf
    • William Breathitt Gray's avatar
      gpio: uniphier: utilize for_each_set_clump8 macro · 17b60389
      William Breathitt Gray authored
      
      
      Replace verbose implementation in set_multiple callback with
      for_each_set_clump8 macro to simplify code and improve clarity.  An
      improvement in this case is that banks that are not masked will now be
      skipped.
      
      Link: http://lkml.kernel.org/r/5b24887e97f3093e4832d7c50a1093f537e91ab4.1570641097.git.vilhelm.gray@gmail.com
      Signed-off-by: default avatarWilliam Breathitt Gray <vilhelm.gray@gmail.com>
      Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
      Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Bartosz Golaszewski <bgolaszewski@baylibre.com>
      Cc: Geert Uytterhoeven <geert@linux-m68k.org>
      Cc: Geert Uytterhoeven <geert+renesas@glider.be>
      Cc: Linus Walleij <linus.walleij@linaro.org>
      Cc: Lukas Wunner <lukas@wunner.de>
      Cc: Mathias Duckeck <m.duckeck@kunbus.de>
      Cc: Morten Hein Tiljeset <morten.tiljeset@prevas.dk>
      Cc: Phil Reid <preid@electromag.com.au>
      Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk>
      Cc: Sean Nyekjaer <sean.nyekjaer@prevas.dk>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      17b60389
    • William Breathitt Gray's avatar
      gpio: pcie-idio-24: utilize for_each_set_clump8 macro · c586aa8f
      William Breathitt Gray authored
      
      
      Replace verbose implementation in get_multiple/set_multiple callbacks
      with for_each_set_clump8 macro to simplify code and improve clarity.
      
      Link: http://lkml.kernel.org/r/d5d22fa9809dcf8330f4381dbe7e7ca37990e79f.1570641097.git.vilhelm.gray@gmail.com
      Signed-off-by: default avatarWilliam Breathitt Gray <vilhelm.gray@gmail.com>
      Reviewed-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Bartosz Golaszewski <bgolaszewski@baylibre.com>
      Cc: Geert Uytterhoeven <geert@linux-m68k.org>
      Cc: Geert Uytterhoeven <geert+renesas@glider.be>
      Cc: Lukas Wunner <lukas@wunner.de>
      Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
      Cc: Mathias Duckeck <m.duckeck@kunbus.de>
      Cc: Morten Hein Tiljeset <morten.tiljeset@prevas.dk>
      Cc: Phil Reid <preid@electromag.com.au>
      Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk>
      Cc: Sean Nyekjaer <sean.nyekjaer@prevas.dk>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      c586aa8f
    • William Breathitt Gray's avatar
      gpio: pci-idio-16: utilize for_each_set_clump8 macro · 2dc7c3c1
      William Breathitt Gray authored
      
      
      Replace verbose implementation in get_multiple/set_multiple callbacks
      with for_each_set_clump8 macro to simplify code and improve clarity.
      
      Link: http://lkml.kernel.org/r/b30f131b4634caf5a70f12e01496f71631a17305.1570641097.git.vilhelm.gray@gmail.com
      Signed-off-by: default avatarWilliam Breathitt Gray <vilhelm.gray@gmail.com>
      Reviewed-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Bartosz Golaszewski <bgolaszewski@baylibre.com>
      Cc: Geert Uytterhoeven <geert@linux-m68k.org>
      Cc: Geert Uytterhoeven <geert+renesas@glider.be>
      Cc: Lukas Wunner <lukas@wunner.de>
      Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
      Cc: Mathias Duckeck <m.duckeck@kunbus.de>
      Cc: Morten Hein Tiljeset <morten.tiljeset@prevas.dk>
      Cc: Phil Reid <preid@electromag.com.au>
      Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk>
      Cc: Sean Nyekjaer <sean.nyekjaer@prevas.dk>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      2dc7c3c1