1. 15 Jul, 2017 10 commits
    • Linus Torvalds's avatar
      Merge tag 'xfs-4.13-merge-6' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux · a80099a1
      Linus Torvalds authored
      Pull XFS fixes from Darrick Wong:
       "Largely debugging and regression fixes.
      
         - Add some locking assertions for the _ilock helpers.
      
         - Revert the XFS_QMOPT_NOLOCK patch; after discussion with hch the
           online fsck patch that would have needed it has been redesigned and
           no longer needs it.
      
         - Fix behavioral regression of SEEK_HOLE/DATA with negative offsets
           to match 4.12-era XFS behavior"
      
      * tag 'xfs-4.13-merge-6' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux:
        vfs: in iomap seek_{hole,data}, return -ENXIO for negative offsets
        Revert "xfs: grab dquots without taking the ilock"
        xfs: assert locking precondition in xfs_readlink_bmap_ilocked
        xfs: assert locking precondіtion in xfs_attr_list_int_ilocked
        xfs: fixup xfs_attr_get_ilocked
      a80099a1
    • Linus Torvalds's avatar
      Merge branch 'for-4.13-part2' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux · bc243704
      Linus Torvalds authored
      Pull btrfs fixes from David Sterba:
       "We've identified and fixed a silent corruption (introduced by code in
        the first pull), a fixup after the blk_status_t merge and two fixes to
        incremental send that Filipe has been hunting for some time"
      
      * 'for-4.13-part2' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux:
        Btrfs: fix unexpected return value of bio_readpage_error
        btrfs: btrfs_create_repair_bio never fails, skip error handling
        btrfs: cloned bios must not be iterated by bio_for_each_segment_all
        Btrfs: fix write corruption due to bio cloning on raid5/6
        Btrfs: incremental send, fix invalid memory access
        Btrfs: incremental send, fix invalid path for link commands
      bc243704
    • Linus Torvalds's avatar
      Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input · 0ffff118
      Linus Torvalds authored
      Pull a few more input updates from Dmitry Torokhov:
      
       - multi-touch handling for Xen
      
       - fix for long-standing bug causing crashes in i8042 on boot
      
       - change to gpio_keys to better handle key presses during system state
         transition
      
      * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input:
        Input: i8042 - fix crash at boot time
        Input: gpio_keys - handle the missing key press event in resume phase
        Input: xen-kbdfront - add multi-touch support
      0ffff118
    • Linus Torvalds's avatar
      Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6 · dcf903d0
      Linus Torvalds authored
      Pull crypto fixes from Herbert Xu:
      
       - fix new compiler warnings in cavium
      
       - set post-op IV properly in caam (this fixes chaining)
      
       - fix potential use-after-free in atmel in case of EBUSY
      
       - fix sleeping in softirq path in chcr
      
       - disable buggy sha1-avx2 driver (may overread and page fault)
      
       - fix use-after-free on signals in caam
      
      * 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6:
        crypto: cavium - make several functions static
        crypto: chcr - Avoid algo allocation in softirq.
        crypto: caam - properly set IV after {en,de}crypt
        crypto: atmel - only treat EBUSY as transient if backlog
        crypto: af_alg - Avoid sock_graft call warning
        crypto: caam - fix signals handling
        crypto: sha1-ssse3 - Disable avx2
      dcf903d0
    • Linus Torvalds's avatar
      Merge tag 'devprop-fix-4.13-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm · 96d0d831
      Linus Torvalds authored
      Pull device properties framework fix from Rafael Wysocki:
       "This fixes a problem with bool properties that could be seen as "true"
        when the property was not present at all by adding a special helper
        for bool properties with checks for all of the requisute conditions
        (Sakari Ailus)"
      
      * tag 'devprop-fix-4.13-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
        device property: Introduce fwnode_call_bool_op() for ops that return bool
      96d0d831
    • Linus Torvalds's avatar
      Merge tag 'acpi-fixes-4.13-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm · 1ef27400
      Linus Torvalds authored
      Pull ACPI fixes from Rafael Wysocki:
       "These fix the return value of an IRQ mapping routine in the ACPI core,
        fix an EC driver issue causing abnormal fan behavior after system
        resume on some systems and add quirks for ACPI device objects that
        need to be treated as "always present" to work around bogus
        implementations of the _STA control method.
      
        Specifics:
      
         - Fix the return value of acpi_gsi_to_irq() to make the GSI to IRQ
           mapping work on the Mustang (ARM64) platform (Mark Salter).
      
         - Fix an EC driver issue that causes fans to behave abnormally after
           system resume on some systems which turns out to be related to
           switching over the EC into the polling mode during the noirq stages
           of system suspend and resume (Lv Zheng).
      
         - Add quirks for ACPI device objects that need to be treated as
           "always present", because their _STA methods are designed to work
           around Windows driver bugs and return garbage from our perspective
           (Hans de Goede)"
      
      * tag 'acpi-fixes-4.13-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
        ACPI / x86: Add KIOX000A accelerometer on GPD win to always_present_ids array
        ACPI / x86: Add Dell Venue 11 Pro 7130 touchscreen to always_present_ids
        ACPI / x86: Allow matching always_present_id array entries by DMI
        Revert "ACPI / EC: Enable event freeze mode..." to fix a regression
        ACPI / EC: Drop EC noirq hooks to fix a regression
        ACPI / irq: Fix return code of acpi_gsi_to_irq()
      1ef27400
    • Linus Torvalds's avatar
      Merge tag 'pm-fixes-4.13-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm · e37720e2
      Linus Torvalds authored
      Pull power management fixes from Rafael Wysocki:
       "These fix a recently exposed issue in the PCI device wakeup code and
        one older problem related to PCI device wakeup that has been reported
        recently, modify one more piece of computations in intel_pstate to get
        rid of a rounding error, fix a possible race in the schedutil cpufreq
        governor, fix the device PM QoS sysfs interface to correctly handle
        invalid user input, fix return values of two probe routines in devfreq
        drivers and constify an attribute_group structure in devfreq.
      
        Specifics:
      
         - Avoid clearing the PCI PME Enable bit for devices as a result of
           config space restoration which confuses AML executed afterward and
           causes wakeup events to be lost on some systems (Rafael Wysocki).
      
         - Fix the native PCIe PME interrupts handling in the cases when the
           PME IRQ is set up as a system wakeup one so that runtime PM remote
           wakeup works as expected after system resume on systems where that
           happens (Rafael Wysocki).
      
         - Fix the device PM QoS sysfs interface to handle invalid user input
           correctly instead of using an unititialized variable value as the
           latency tolerance for the device at hand (Dan Carpenter).
      
         - Get rid of one more rounding error from intel_pstate computations
           (Srinivas Pandruvada).
      
         - Fix the schedutil cpufreq governor to prevent it from possibly
           accessing unititialized data structures from governor callbacks in
           some cases on systems when multiple CPUs share a single cpufreq
           policy object (Vikram Mulukutla).
      
         - Fix the return values of probe routines in two devfreq drivers
           (Gustavo Silva).
      
         - Constify an attribute_group structure in devfreq (Arvind Yadav)"
      
      * tag 'pm-fixes-4.13-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
        PCI / PM: Fix native PME handling during system suspend/resume
        PCI / PM: Restore PME Enable after config space restoration
        cpufreq: schedutil: Fix sugov_start() versus sugov_update_shared() race
        PM / QoS: return -EINVAL for bogus strings
        cpufreq: intel_pstate: Fix ratio setting for min_perf_pct
        PM / devfreq: constify attribute_group structures.
        PM / devfreq: tegra: fix error return code in tegra_devfreq_probe()
        PM / devfreq: rk3399_dmc: fix error return code in rk3399_dmcfreq_probe()
      e37720e2
    • Linus Torvalds's avatar
      Merge branch 'akpm' (patches from Andrew) · 867eacd7
      Linus Torvalds authored
      Merge even more updates from Andrew Morton:
      
       - a few leftovers
      
       - fault-injector rework
      
       - add a module loader test driver
      
      * emailed patches from Andrew Morton <akpm@linux-foundation.org>:
        kmod: throttle kmod thread limit
        kmod: add test driver to stress test the module loader
        MAINTAINERS: give kmod some maintainer love
        xtensa: use generic fb.h
        fault-inject: add /proc/<pid>/fail-nth
        fault-inject: simplify access check for fail-nth
        fault-inject: make fail-nth read/write interface symmetric
        fault-inject: parse as natural 1-based value for fail-nth write interface
        fault-inject: automatically detect the number base for fail-nth write interface
        kernel/watchdog.c: use better pr_fmt prefix
        MAINTAINERS: move the befs tree to kernel.org
        lib/atomic64_test.c: add a test that atomic64_inc_not_zero() returns an int
        mm: fix overflow check in expand_upwards()
      867eacd7
    • Daniel Micay's avatar
      replace incorrect strscpy use in FORTIFY_SOURCE · 077d2ba5
      Daniel Micay authored
      Using strscpy was wrong because FORTIFY_SOURCE is passing the maximum
      possible size of the outermost object, but strscpy defines the count
      parameter as the exact buffer size, so this could copy past the end of
      the source.  This would still be wrong with the planned usage of
      __builtin_object_size(p, 1) for intra-object overflow checks since it's
      the maximum possible size of the specified object with no guarantee of
      it being that large.
      
      Reuse of the fortified functions like this currently makes the runtime
      error reporting less precise but that can be improved later on.
      
      Noticed by Dave Jones and KASAN.
      Signed-off-by: default avatarDaniel Micay <danielmicay@gmail.com>
      Acked-by: default avatarKees Cook <keescook@chromium.org>
      Reported-by: default avatarDave Jones <davej@codemonkey.org.uk>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      077d2ba5
    • Linus Torvalds's avatar
      Merge git://git.kernel.org/pub/scm/linux/kernel/git/cmetcalf/linux-tile · 01ea9177
      Linus Torvalds authored
      Pull arch/tile updates from Chris Metcalf:
       "This adds support for an <arch/intreg.h> to help with removing
        __need_xxx #defines from glibc, and removes some dead code in
        arch/tile/mm/init.c"
      
      * git://git.kernel.org/pub/scm/linux/kernel/git/cmetcalf/linux-tile:
        mm, tile: drop arch_{add,remove}_memory
        tile: prefer <arch/intreg.h> to __need_int_reg_t
      01ea9177
  2. 14 Jul, 2017 30 commits
    • Linus Torvalds's avatar
      Merge tag 'powerpc-4.13-2' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux · deed9deb
      Linus Torvalds authored
      Pull powerpc fixes from Michael Ellerman:
       "Nothing that really stands out, just a bunch of fixes that have come
        in in the last couple of weeks.
      
        None of these are actually fixes for code that is new in 4.13. It's
        roughly half older bugs, with fixes going to stable, and half
        fixes/updates for Power9.
      
        Thanks to: Aneesh Kumar K.V, Anton Blanchard, Balbir Singh, Benjamin
        Herrenschmidt, Madhavan Srinivasan, Michael Neuling, Nicholas Piggin,
        Oliver O'Halloran"
      
      * tag 'powerpc-4.13-2' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux:
        powerpc/64: Fix atomic64_inc_not_zero() to return an int
        powerpc: Fix emulation of mfocrf in emulate_step()
        powerpc: Fix emulation of mcrf in emulate_step()
        powerpc/perf: Add POWER9 alternate PM_RUN_CYC and PM_RUN_INST_CMPL events
        powerpc/perf: Fix SDAR_MODE value for continous sampling on Power9
        powerpc/asm: Mark cr0 as clobbered in mftb()
        powerpc/powernv: Fix local TLB flush for boot and MCE on POWER9
        powerpc/mm/radix: Synchronize updates to the process table
        powerpc/mm/radix: Properly clear process table entry
        powerpc/powernv: Tell OPAL about our MMU mode on POWER9
        powerpc/kexec: Fix radix to hash kexec due to IAMR/AMOR
      deed9deb
    • Luis R. Rodriguez's avatar
      kmod: throttle kmod thread limit · 6d7964a7
      Luis R. Rodriguez authored
      If we reach the limit of modprobe_limit threads running the next
      request_module() call will fail.  The original reason for adding a kill
      was to do away with possible issues with in old circumstances which would
      create a recursive series of request_module() calls.
      
      We can do better than just be super aggressive and reject calls once we've
      reached the limit by simply making pending callers wait until the
      threshold has been reduced, and then throttling them in, one by one.
      
      This throttling enables requests over the kmod concurrent limit to be
      processed once a pending request completes.  Only the first item queued up
      to wait is woken up.  The assumption here is once a task is woken it will
      have no other option to also kick the queue to check if there are more
      pending tasks -- regardless of whether or not it was successful.
      
      By throttling and processing only max kmod concurrent tasks we ensure we
      avoid unexpected fatal request_module() calls, and we keep memory
      consumption on module loading to a minimum.
      
      With x86_64 qemu, with 4 cores, 4 GiB of RAM it takes the following run
      time to run both tests:
      
      time ./kmod.sh -t 0008
      real    0m16.366s
      user    0m0.883s
      sys     0m8.916s
      
      time ./kmod.sh -t 0009
      real    0m50.803s
      user    0m0.791s
      sys     0m9.852s
      
      Link: http://lkml.kernel.org/r/20170628223155.26472-4-mcgrof@kernel.orgSigned-off-by: default avatarLuis R. Rodriguez <mcgrof@kernel.org>
      Reviewed-by: default avatarPetr Mladek <pmladek@suse.com>
      Cc: Jessica Yu <jeyu@redhat.com>
      Cc: Shuah Khan <shuah@kernel.org>
      Cc: Rusty Russell <rusty@rustcorp.com.au>
      Cc: Michal Marek <mmarek@suse.com>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      6d7964a7
    • Luis R. Rodriguez's avatar
      kmod: add test driver to stress test the module loader · d9c6a72d
      Luis R. Rodriguez authored
      This adds a new stress test driver for kmod: the kernel module loader.
      The new stress test driver, test_kmod, is only enabled as a module right
      now.  It should be possible to load this as built-in and load tests
      early (refer to the force_init_test module parameter), however since a
      lot of test can get a system out of memory fast we leave this disabled
      for now.
      
      Using a system with 1024 MiB of RAM can *easily* get your kernel OOM
      fast with this test driver.
      
      The test_kmod driver exposes API knobs for us to fine tune simple
      request_module() and get_fs_type() calls.  Since these API calls only
      allow each one parameter a test driver for these is rather simple.
      Other factors that can help out test driver though are the number of
      calls we issue and knowing current limitations of each.  This exposes
      configuration as much as possible through userspace to be able to build
      tests directly from userspace.
      
      Since it allows multiple misc devices its will eventually (once we add a
      knob to let us create new devices at will) also be possible to perform
      more tests in parallel, provided you have enough memory.
      
      We only enable tests we know work as of right now.
      
      Demo screenshots:
      
       # tools/testing/selftests/kmod/kmod.sh
      kmod_test_0001_driver: OK! - loading kmod test
      kmod_test_0001_driver: OK! - Return value: 256 (MODULE_NOT_FOUND), expected MODULE_NOT_FOUND
      kmod_test_0001_fs: OK! - loading kmod test
      kmod_test_0001_fs: OK! - Return value: -22 (-EINVAL), expected -EINVAL
      kmod_test_0002_driver: OK! - loading kmod test
      kmod_test_0002_driver: OK! - Return value: 256 (MODULE_NOT_FOUND), expected MODULE_NOT_FOUND
      kmod_test_0002_fs: OK! - loading kmod test
      kmod_test_0002_fs: OK! - Return value: -22 (-EINVAL), expected -EINVAL
      kmod_test_0003: OK! - loading kmod test
      kmod_test_0003: OK! - Return value: 0 (SUCCESS), expected SUCCESS
      kmod_test_0004: OK! - loading kmod test
      kmod_test_0004: OK! - Return value: 0 (SUCCESS), expected SUCCESS
      kmod_test_0005: OK! - loading kmod test
      kmod_test_0005: OK! - Return value: 0 (SUCCESS), expected SUCCESS
      kmod_test_0006: OK! - loading kmod test
      kmod_test_0006: OK! - Return value: 0 (SUCCESS), expected SUCCESS
      kmod_test_0005: OK! - loading kmod test
      kmod_test_0005: OK! - Return value: 0 (SUCCESS), expected SUCCESS
      kmod_test_0006: OK! - loading kmod test
      kmod_test_0006: OK! - Return value: 0 (SUCCESS), expected SUCCESS
      XXX: add test restult for 0007
      Test completed
      
      You can also request for specific tests:
      
       # tools/testing/selftests/kmod/kmod.sh -t 0001
      kmod_test_0001_driver: OK! - loading kmod test
      kmod_test_0001_driver: OK! - Return value: 256 (MODULE_NOT_FOUND), expected MODULE_NOT_FOUND
      kmod_test_0001_fs: OK! - loading kmod test
      kmod_test_0001_fs: OK! - Return value: -22 (-EINVAL), expected -EINVAL
      Test completed
      
      Lastly, the current available number of tests:
      
       # tools/testing/selftests/kmod/kmod.sh --help
      Usage: tools/testing/selftests/kmod/kmod.sh [ -t <4-number-digit> ]
      Valid tests: 0001-0009
      
      0001 - Simple test - 1 thread  for empty string
      0002 - Simple test - 1 thread  for modules/filesystems that do not exist
      0003 - Simple test - 1 thread  for get_fs_type() only
      0004 - Simple test - 2 threads for get_fs_type() only
      0005 - multithreaded tests with default setup - request_module() only
      0006 - multithreaded tests with default setup - get_fs_type() only
      0007 - multithreaded tests with default setup test request_module() and get_fs_type()
      0008 - multithreaded - push kmod_concurrent over max_modprobes for request_module()
      0009 - multithreaded - push kmod_concurrent over max_modprobes for get_fs_type()
      
      The following test cases currently fail, as such they are not currently
      enabled by default:
      
       # tools/testing/selftests/kmod/kmod.sh -t 0008
       # tools/testing/selftests/kmod/kmod.sh -t 0009
      
      To be sure to run them as intended please unload both of the modules:
      
        o test_module
        o xfs
      
      And ensure they are not loaded on your system prior to testing them.  If
      you use these paritions for your rootfs you can change the default test
      driver used for get_fs_type() by exporting it into your environment.  For
      example of other test defaults you can override refer to kmod.sh
      allow_user_defaults().
      
      Behind the scenes this is how we fine tune at a test case prior to
      hitting a trigger to run it:
      
      cat /sys/devices/virtual/misc/test_kmod0/config
      echo -n "2" > /sys/devices/virtual/misc/test_kmod0/config_test_case
      echo -n "ext4" > /sys/devices/virtual/misc/test_kmod0/config_test_fs
      echo -n "80" > /sys/devices/virtual/misc/test_kmod0/config_num_threads
      cat /sys/devices/virtual/misc/test_kmod0/config
      echo -n "1" > /sys/devices/virtual/misc/test_kmod0/config_num_threads
      
      Finally to trigger:
      
      echo -n "1" > /sys/devices/virtual/misc/test_kmod0/trigger_config
      
      The kmod.sh script uses the above constructs to build different test cases.
      
      A bit of interpretation of the current failures follows, first two
      premises:
      
      a) When request_module() is used userspace figures out an optimized
         version of module order for us.  Once it finds the modules it needs, as
         per depmod symbol dep map, it will finit_module() the respective
         modules which are needed for the original request_module() request.
      
      b) We have an optimization in place whereby if a kernel uses
         request_module() on a module already loaded we never bother userspace
         as the module already is loaded.  This is all handled by kernel/kmod.c.
      
      A few things to consider to help identify root causes of issues:
      
      0) kmod 19 has a broken heuristic for modules being assumed to be
         built-in to your kernel and will return 0 even though request_module()
         failed.  Upgrade to a newer version of kmod.
      
      1) A get_fs_type() call for "xfs" will request_module() for "fs-xfs",
         not for "xfs".  The optimization in kernel described in b) fails to
         catch if we have a lot of consecutive get_fs_type() calls.  The reason
         is the optimization in place does not look for aliases.  This means two
         consecutive get_fs_type() calls will bump kmod_concurrent, whereas
         request_module() will not.
      
      This one explanation why test case 0009 fails at least once for
      get_fs_type().
      
      2) If a module fails to load --- for whatever reason (kmod_concurrent
         limit reached, file not yet present due to rootfs switch, out of
         memory) we have a period of time during which module request for the
         same name either with request_module() or get_fs_type() will *also*
         fail to load even if the file for the module is ready.
      
      This explains why *multiple* NULLs are possible on test 0009.
      
      3) finit_module() consumes quite a bit of memory.
      
      4) Filesystems typically also have more dependent modules than other
         modules, its important to note though that even though a get_fs_type()
         call does not incur additional kmod_concurrent bumps, since userspace
         loads dependencies it finds it needs via finit_module_fd(), it *will*
         take much more memory to load a module with a lot of dependencies.
      
      Because of 3) and 4) we will easily run into out of memory failures with
      certain tests.  For instance test 0006 fails on qemu with 1024 MiB of RAM.
      It panics a box after reaping all userspace processes and still not
      having enough memory to reap.
      
      [arnd@arndb.de: add dependencies for test module]
        Link: http://lkml.kernel.org/r/20170630154834.3689272-1-arnd@arndb.de
      Link: http://lkml.kernel.org/r/20170628223155.26472-3-mcgrof@kernel.orgSigned-off-by: default avatarLuis R. Rodriguez <mcgrof@kernel.org>
      Cc: Jessica Yu <jeyu@redhat.com>
      Cc: Shuah Khan <shuah@kernel.org>
      Cc: Rusty Russell <rusty@rustcorp.com.au>
      Cc: Michal Marek <mmarek@suse.com>
      Cc: Petr Mladek <pmladek@suse.com>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      d9c6a72d
    • Luis R. Rodriguez's avatar
      MAINTAINERS: give kmod some maintainer love · 062b8740
      Luis R. Rodriguez authored
      As suggested by Jessica, I've been actively working on kmod, so might as
      well reflect its maintained status.
      
      Changes are expected to go through akpm's tree.
      
      Link: http://lkml.kernel.org/r/20170628223155.26472-2-mcgrof@kernel.orgSigned-off-by: default avatarLuis R. Rodriguez <mcgrof@kernel.org>
      Suggested-by: default avatarJessica Yu <jeyu@redhat.com>
      Cc: Shuah Khan <shuah@kernel.org>
      Cc: Rusty Russell <rusty@rustcorp.com.au>
      Cc: Michal Marek <mmarek@suse.com>
      Cc: Petr Mladek <pmladek@suse.com>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      062b8740
    • Tobias Klauser's avatar
      xtensa: use generic fb.h · 20cf0c54
      Tobias Klauser authored
      The arch uses a verbatim copy of the asm-generic version and does not
      add any own implementations to the header, so use asm-generic/fb.h
      instead of duplicating code.
      
      Link: http://lkml.kernel.org/r/20170517083545.2115-1-tklauser@distanz.chSigned-off-by: default avatarTobias Klauser <tklauser@distanz.ch>
      Acked-by: default avatarMax Filippov <jcmvbkbc@gmail.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      20cf0c54
    • Akinobu Mita's avatar
      fault-inject: add /proc/<pid>/fail-nth · 168c42bc
      Akinobu Mita authored
      fail-nth interface is only created in /proc/self/task/<current-tid>/.
      This change also adds it in /proc/<pid>/.
      
      This makes shell based tool a bit simpler.
      
      	$ bash -c "builtin echo 100 > /proc/self/fail-nth && exec ls /"
      
      Link: http://lkml.kernel.org/r/1491490561-10485-6-git-send-email-akinobu.mita@gmail.comSigned-off-by: default avatarAkinobu Mita <akinobu.mita@gmail.com>
      Cc: Dmitry Vyukov <dvyukov@google.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      168c42bc
    • Akinobu Mita's avatar
      fault-inject: simplify access check for fail-nth · 1203c8e6
      Akinobu Mita authored
      The fail-nth file is created with 0666 and the access is permitted if
      and only if the task is current.
      
      This file is owned by the currnet user.  So we can create it with 0644
      and allow the owner to write it.  This enables to watch the status of
      task->fail_nth from another processes.
      
      [akinobu.mita@gmail.com: don't convert unsigned type value as signed int]
        Link: http://lkml.kernel.org/r/1492444483-9239-1-git-send-email-akinobu.mita@gmail.com
      [akinobu.mita@gmail.com: avoid unwanted data race to task->fail_nth]
        Link: http://lkml.kernel.org/r/1499962492-8931-1-git-send-email-akinobu.mita@gmail.com
      Link: http://lkml.kernel.org/r/1491490561-10485-5-git-send-email-akinobu.mita@gmail.comSigned-off-by: default avatarAkinobu Mita <akinobu.mita@gmail.com>
      Acked-by: default avatarDmitry Vyukov <dvyukov@google.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      1203c8e6
    • Akinobu Mita's avatar
      fault-inject: make fail-nth read/write interface symmetric · bfc74093
      Akinobu Mita authored
      The read interface for fail-nth looks a bit odd.  Read from this file
      returns "NYYYY..." or "YYYYY..." (this makes me surprise when cat this
      file).  Because there is no EOF condition.  The first character
      indicates current->fail_nth is zero or not, and then current->fail_nth
      is reset to zero.
      
      Just returning task->fail_nth value is more natural to understand.
      
      Link: http://lkml.kernel.org/r/1491490561-10485-4-git-send-email-akinobu.mita@gmail.comSigned-off-by: default avatarAkinobu Mita <akinobu.mita@gmail.com>
      Cc: Dmitry Vyukov <dvyukov@google.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      bfc74093
    • Akinobu Mita's avatar
      fault-inject: parse as natural 1-based value for fail-nth write interface · 9049f2f6
      Akinobu Mita authored
      The value written to fail-nth file is parsed as 0-based.  Parsing as
      one-based is more natural to understand and it enables to cancel the
      previous setup by simply writing '0'.
      
      This change also converts task->fail_nth from signed to unsigned int.
      
      Link: http://lkml.kernel.org/r/1491490561-10485-3-git-send-email-akinobu.mita@gmail.comSigned-off-by: default avatarAkinobu Mita <akinobu.mita@gmail.com>
      Cc: Dmitry Vyukov <dvyukov@google.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      9049f2f6
    • Akinobu Mita's avatar
      fault-inject: automatically detect the number base for fail-nth write interface · ecaad81c
      Akinobu Mita authored
      Automatically detect the number base to use when writing to fail-nth
      file instead of always parsing as a decimal number.
      
      Link: http://lkml.kernel.org/r/1491490561-10485-2-git-send-email-akinobu.mita@gmail.comSigned-off-by: default avatarAkinobu Mita <akinobu.mita@gmail.com>
      Cc: Dmitry Vyukov <dvyukov@google.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      ecaad81c
    • Kefeng Wang's avatar
      kernel/watchdog.c: use better pr_fmt prefix · 5f92a7b0
      Kefeng Wang authored
      After commit 73ce0511 ("kernel/watchdog.c: move hardlockup
      detector to separate file"), 'NMI watchdog' is inappropriate in
      kernel/watchdog.c, using 'watchdog' only.
      
      Link: http://lkml.kernel.org/r/1499928642-48983-1-git-send-email-wangkefeng.wang@huawei.comSigned-off-by: default avatarKefeng Wang <wangkefeng.wang@huawei.com>
      Cc: Babu Moger <babu.moger@oracle.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      5f92a7b0
    • Luis de Bethencourt's avatar
      5624a8b0
    • Michael Ellerman's avatar
      lib/atomic64_test.c: add a test that atomic64_inc_not_zero() returns an int · ffba19cc
      Michael Ellerman authored
      atomic64_inc_not_zero() returns a "truth value" which in C is
      traditionally an int.  That means callers are likely to expect the
      result will fit in an int.
      
      If an implementation returns a "true" value which does not fit in an
      int, then there's a possibility that callers will truncate it when they
      store it in an int.
      
      In fact this happened in practice, see commit 966d2b04
      ("percpu-refcount: fix reference leak during percpu-atomic transition").
      
      So add a test that the result fits in an int, even when the input
      doesn't.  This catches the case where an implementation just passes the
      non-zero input value out as the result.
      
      Link: http://lkml.kernel.org/r/1499775133-1231-1-git-send-email-mpe@ellerman.id.auSigned-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      Cc: Douglas Miller <dougmill@linux.vnet.ibm.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      ffba19cc
    • Helge Deller's avatar
      mm: fix overflow check in expand_upwards() · 37511fb5
      Helge Deller authored
      Jörn Engel noticed that the expand_upwards() function might not return
      -ENOMEM in case the requested address is (unsigned long)-PAGE_SIZE and
      if the architecture didn't defined TASK_SIZE as multiple of PAGE_SIZE.
      
      Affected architectures are arm, frv, m68k, blackfin, h8300 and xtensa
      which all define TASK_SIZE as 0xffffffff, but since none of those have
      an upwards-growing stack we currently have no actual issue.
      
      Nevertheless let's fix this just in case any of the architectures with
      an upward-growing stack (currently parisc, metag and partly ia64) define
      TASK_SIZE similar.
      
      Link: http://lkml.kernel.org/r/20170702192452.GA11868@p100.box
      Fixes: bd726c90 ("Allow stack to grow up to address space limit")
      Signed-off-by: default avatarHelge Deller <deller@gmx.de>
      Reported-by: default avatarJörn Engel <joern@purestorage.com>
      Cc: Hugh Dickins <hughd@google.com>
      Cc: Oleg Nesterov <oleg@redhat.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      37511fb5
    • Linus Torvalds's avatar
      Merge tag 'ntb-4.13' of git://github.com/jonmason/ntb · ccd5d1b9
      Linus Torvalds authored
      Pull NTB updates from Jon Mason:
       "The major change in the series is a rework of the NTB infrastructure
        to all for IDT hardware to be supported (and resulting fallout from
        that). There are also a few clean-ups, etc.
      
        New IDT NTB driver and changes to the NTB infrastructure to allow for
        this different kind of NTB HW, some style fixes (per Greg KH
        recommendation), and some ntb_test tweaks"
      
      * tag 'ntb-4.13' of git://github.com/jonmason/ntb:
        ntb_netdev: set the net_device's parent
        ntb: Add error path/handling to Debug FS entry creation
        ntb: Add more debugfs support for ntb_perf testing options
        ntb: Remove debug-fs variables from the context structure
        ntb: Add a module option to control affinity of DMA channels
        NTB: Add IDT 89HPESxNTx PCIe-switches support
        ntb_hw_intel: Style fixes: open code macros that just obfuscate code
        ntb_hw_amd: Style fixes: open code macros that just obfuscate code
        NTB: Add ntb.h comments
        NTB: Add PCIe Gen4 link speed
        NTB: Add new Memory Windows API documentation
        NTB: Add Messaging NTB API
        NTB: Alter Scratchpads API to support multi-ports devices
        NTB: Alter MW API to support multi-ports devices
        NTB: Alter link-state API to support multi-port devices
        NTB: Add indexed ports NTB API
        NTB: Make link-state API being declared first
        NTB: ntb_test: add parameter for doorbell bitmask
        NTB: ntb_test: modprobe on remote host
      ccd5d1b9
    • Linus Torvalds's avatar
      Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux · 4d25ec19
      Linus Torvalds authored
      Pull thermal management updates from Zhang Rui:
      
       - Improve thermal cpu_cooling interaction with cpufreq core.
      
         The cpu_cooling driver is designed to use CPU frequency scaling to
         avoid high thermal states for a platform. But it wasn't glued really
         well with cpufreq core.
      
         For example clipped-cpus is copied from the policy structure and its
         much better to use the policy->cpus (or related_cpus) fields directly
         as they may have got updated. Not that things were broken before this
         series, but they can be optimized a bit more.
      
         This series tries to improve interactions between cpufreq core and
         cpu_cooling driver and does some fixes/cleanups to the cpu_cooling
         driver. (Viresh Kumar)
      
       - A couple of fixes and cleanups in thermal core and imx, hisilicon,
         bcm_2835, int340x thermal drivers. (Arvind Yadav, Dan Carpenter,
         Sumeet Pawnikar, Srinivas Pandruvada, Willy WOLFF)
      
      * 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux: (24 commits)
        thermal: bcm2835: fix an error code in probe()
        thermal: hisilicon: Handle return value of clk_prepare_enable
        thermal: imx: Handle return value of clk_prepare_enable
        thermal: int340x: check for sensor when PTYP is missing
        Thermal/int340x: Fix few typos and kernel-doc style
        thermal: fix source code documentation for parameters
        thermal: cpu_cooling: Replace kmalloc with kmalloc_array
        thermal: cpu_cooling: Rearrange struct cpufreq_cooling_device
        thermal: cpu_cooling: 'freq' can't be zero in cpufreq_state2power()
        thermal: cpu_cooling: don't store cpu_dev in cpufreq_cdev
        thermal: cpu_cooling: get_level() can't fail
        thermal: cpu_cooling: create structure for idle time stats
        thermal: cpu_cooling: merge frequency and power tables
        thermal: cpu_cooling: get rid of 'allowed_cpus'
        thermal: cpu_cooling: OPPs are registered for all CPUs
        thermal: cpu_cooling: store cpufreq policy
        cpufreq: create cpufreq_table_count_valid_entries()
        thermal: cpu_cooling: use cpufreq_policy to register cooling device
        thermal: cpu_cooling: get rid of a variable in cpufreq_set_cur_state()
        thermal: cpu_cooling: remove cpufreq_cooling_get_level()
        ...
      4d25ec19
    • Linus Torvalds's avatar
      Merge tag 'mmc-v4.13-2' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc · 907afe59
      Linus Torvalds authored
      Pull MMC fixes from Ulf Hansson:
       "Here are a couple of mmc fixes intended for v4.13 rc1.
      
        MMC core:
         - Restore some behaviour of MMC_IOC_MULTI_CMD commands
         - Fix using un-initialized variable in mmc_blk_issue_drv_op()
         - Fix mmc block queue cleanup
      
        MMC host:
         - sdhci-acpi: Workaround conflict with PCI wifi on GPD Win handheld
         - tmio-mmc: Fix bad pointer math"
      
      * tag 'mmc-v4.13-2' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc:
        mmc: tmio-mmc: fix bad pointer math
        mmc: block: Prevent new req entering queue after its cleanup
        mmc: block: Let MMC_IOC_MULTI_CMD return zero again for zero entries
        mmc: block: Initialize ret in mmc_blk_issue_drv_op() for MMC_DRV_OP_IOCTL
        mmc: sdhci-acpi: Workaround conflict with PCI wifi on GPD Win handheld
      907afe59
    • Linus Torvalds's avatar
      Merge tag 'sound-fix-4.13-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound · 0a264b6d
      Linus Torvalds authored
      Pull sound fixes from Takashi Iwai:
       "Small last-minute fixes for 4.13-rc1: a couple of PCM fixes for m68k,
        a cleanup work for legacy ISA msnd driver, and a few HD-audio new IDs
        and quirks"
      
      * tag 'sound-fix-4.13-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound:
        ALSA: hda - Add hdmi id for a Geminilake variant
        ALSA: hda/realtek - New codec device ID for ALC1220
        ALSA: pcm: Simplify check for dma_mmap_coherent() availability
        ALSA: pcm: Protect call to dma_mmap_coherent() by check for HAS_DMA
        ALSA: msnd: Optimize / harden DSP and MIDI loops
        ALSA: hda/realtek - change the location for one of two front microphones
        ALSA: opl4: Move inline before return type
      0a264b6d
    • Linus Torvalds's avatar
      Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security · 1e5a2b1f
      Linus Torvalds authored
      Pull key handling fixes from James Morris:
       "A minor fix and documentation updates"
      
      * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security:
        KEYS: Add documentation for asymmetric keyring restrictions
        KEYS: DH: validate __spare field
        modsign: add markers to endif-statements in certs/Makefile
      1e5a2b1f
    • Linus Torvalds's avatar
      Merge tag 'clk-bulk-get-prep-enable' of git://git.kernel.org/pub/scm/linux/kernel/git/clk/linux · 1430858f
      Linus Torvalds authored
      Pull clk api update from Stephen Boyd:
       "Small patch to add the clk_bulk_prepare_enable() and
        clk_bulk_disable_unprepare() API to the newly introduced
        clk bulk APIs.
      
        It would be good to get this into the -rc1 so that other
        driver trees can use it for code targeted for the next
        merge window"
      
      * tag 'clk-bulk-get-prep-enable' of git://git.kernel.org/pub/scm/linux/kernel/git/clk/linux:
        clk: Provide bulk prepare_enable disable_unprepare variants
      1430858f
    • Linus Torvalds's avatar
      Merge tag 'pci-v4.13-fixes-1' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci · 2931dc7d
      Linus Torvalds authored
      Pull PCI fixes from Bjorn Helgaas:
      
       - fix a typo that broke Rockchip enumeration
      
       - fix a new memory leak in the ARM host bridge failure path
      
      * tag 'pci-v4.13-fixes-1' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci:
        PCI: rockchip: Check for pci_scan_root_bus_bridge() failure correctly
        ARM/PCI: Fix pcibios_init_resource() struct pci_host_bridge leak
      2931dc7d
    • Linus Torvalds's avatar
      Merge tag 'befs-v4.13-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/luisbg/linux-befs · d3c329c7
      Linus Torvalds authored
      Pull single befs fix from Luis de Bethencourt:
       "Very little activity in the befs file system this time since I'm busy
        settling into a new job"
      
      * tag 'befs-v4.13-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/luisbg/linux-befs:
        befs: add kernel-doc formatting for befs_bt_read_super()
      d3c329c7
    • Liu Bo's avatar
      Btrfs: fix unexpected return value of bio_readpage_error · c3cfb656
      Liu Bo authored
      With blk_status_t conversion (that are now present in master),
      bio_readpage_error() may return 1 as now ->submit_bio_hook() may not set
      %ret if it runs without problems.
      
      This fixes that unexpected return value by changing
      btrfs_check_repairable() to return a bool instead of updating %ret, and
      patch is applicable to both codebases with and without blk_status_t.
      Signed-off-by: default avatarLiu Bo <bo.li.liu@oracle.com>
      Reviewed-by: default avatarNikolay Borisov <nborisov@suse.com>
      Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
      Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
      c3cfb656
    • David Sterba's avatar
      btrfs: btrfs_create_repair_bio never fails, skip error handling · e8f5b395
      David Sterba authored
      As the function uses the non-failing bio allocation, we can remove error
      handling from the callers as well.
      Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
      Reviewed-by: default avatarLiu Bo <bo.li.liu@oracle.com>
      Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
      e8f5b395
    • David Sterba's avatar
      btrfs: cloned bios must not be iterated by bio_for_each_segment_all · c09abff8
      David Sterba authored
      We've started using cloned bios more in 4.13, there are some specifics
      regarding the iteration.  Filipe found [1] that the raid56 iterated a
      cloned bio using bio_for_each_segment_all, which is incorrect. The
      cloned bios have wrong bi_vcnt and this could lead to silent
      corruptions.  This patch adds assertions to all remaining
      bio_for_each_segment_all cases.
      
      [1] https://patchwork.kernel.org/patch/9838535/Reviewed-by: default avatarLiu Bo <bo.li.liu@oracle.com>
      Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
      c09abff8
    • David Sterba's avatar
      Merge branch 'next/filipe' into for-4.13-part2 · 1014f3d6
      David Sterba authored
      - incremental send fixes
      - raid56 corruption fix (cloned bio iteration)
      1014f3d6
    • Rafael J. Wysocki's avatar
      Merge branches 'acpi-ec', 'acpi-irq' and 'acpi-quirks' · 9636603d
      Rafael J. Wysocki authored
      * acpi-ec:
        Revert "ACPI / EC: Enable event freeze mode..." to fix a regression
        ACPI / EC: Drop EC noirq hooks to fix a regression
      
      * acpi-irq:
        ACPI / irq: Fix return code of acpi_gsi_to_irq()
      
      * acpi-quirks:
        ACPI / x86: Add KIOX000A accelerometer on GPD win to always_present_ids array
        ACPI / x86: Add Dell Venue 11 Pro 7130 touchscreen to always_present_ids
        ACPI / x86: Allow matching always_present_id array entries by DMI
      9636603d
    • Rafael J. Wysocki's avatar
      Merge branches 'pm-qos' and 'pm-devfreq' · 6df609b2
      Rafael J. Wysocki authored
      * pm-qos:
        PM / QoS: return -EINVAL for bogus strings
      
      * pm-devfreq:
        PM / devfreq: constify attribute_group structures.
        PM / devfreq: tegra: fix error return code in tegra_devfreq_probe()
        PM / devfreq: rk3399_dmc: fix error return code in rk3399_dmcfreq_probe()
      6df609b2
    • Rafael J. Wysocki's avatar
      Merge branches 'pm-cpufreq-sched' and 'intel_pstate' · a252c258
      Rafael J. Wysocki authored
      * pm-cpufreq-sched:
        cpufreq: schedutil: Fix sugov_start() versus sugov_update_shared() race
      
      * intel_pstate:
        cpufreq: intel_pstate: Fix ratio setting for min_perf_pct
      a252c258
    • Rafael J. Wysocki's avatar
      Merge branch 'pm-pci' · ec4b8ddc
      Rafael J. Wysocki authored
      * pm-pci:
        PCI / PM: Fix native PME handling during system suspend/resume
        PCI / PM: Restore PME Enable after config space restoration
      ec4b8ddc