1. 10 Mar, 2017 2 commits
    • Linus Torvalds's avatar
      Merge tag 'pm-4.11-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm · c1aa905a
      Linus Torvalds authored
      Pull power management fixes from Rafael Wysocki:
       "These fix several issues in the intel_pstate driver and one issue in
        the schedutil cpufreq governor, clean up that governor a bit and hook
        up existing code for disabling cpufreq to a new kernel command line
        option.
      
        Specifics:
      
         - Three fixes for intel_pstate problems related to the passive mode
           (in which it acts as a regular cpufreq scaling driver), two for the
           handling of global P-state limits and one for the handling of the
           cpu_frequency tracepoint in that mode (Rafael Wysocki).
      
         - Three fixes for the handling of P-state limits in intel_pstate in
           the active mode (Rafael Wysocki).
      
         - Introduction of a new cpufreq.off=1 kernel command line argument
           that will disable cpufreq entirely if passed to the kernel and is
           simply hooked up to the existing code used by Xen (Len Brown).
      
         - Fix for the schedutil cpufreq governor to prevent it from using
           stale raw frequency values in configurations with mutiple CPUs
           sharing one policy object and a cleanup for it reducing its
           overhead slightly (Viresh Kumar)"
      
      * tag 'pm-4.11-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
        cpufreq: intel_pstate: Do not reinit performance limits in ->setpolicy
        cpufreq: intel_pstate: Fix intel_pstate_verify_policy()
        cpufreq: intel_pstate: Fix global settings in active mode
        cpufreq: Add the "cpufreq.off=1" cmdline option
        cpufreq: schedutil: Pass sg_policy to get_next_freq()
        cpufreq: schedutil: move cached_raw_freq to struct sugov_policy
        cpufreq: intel_pstate: Avoid triggering cpu_frequency tracepoint unnecessarily
        cpufreq: intel_pstate: Fix intel_cpufreq_verify_policy()
        cpufreq: intel_pstate: Do not use performance_limits in passive mode
      c1aa905a
    • Linus Torvalds's avatar
      Merge tag 'pci-v4.11-fixes-2' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci · 144c7666
      Linus Torvalds authored
      Pull PCI fixes from Bjorn Helgaas:
       "PCI fixes:
      
         - fix NULL pointer dereference in Exynos driver
      
         - fix NULL pointer dereference in ASPM with pre-1.1 PCIe devices
      
         - blacklist QLogic ISP2722 to prevent panics while reading VPD"
      
      * tag 'pci-v4.11-fixes-2' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci:
        PCI/ASPM: Always set link->downstream to avoid NULL dereference on remove
        PCI: Prevent VPD access for QLogic ISP2722
        PCI: exynos: Initialize elbi_base even when using PHY framework
      144c7666
  2. 09 Mar, 2017 5 commits
    • Linus Torvalds's avatar
      Merge branch 'for-linus' of git://git.kernel.dk/linux-block · 34bbce9e
      Linus Torvalds authored
      Pull block fixes from Jens Axboe:
       "Sending this a bit sooner than I otherwise would have, as a fix in the
        merge window had some unfortunate issues and side effects for some
        folks.
      
        This contains:
      
         - Fixes from Jan for the bdi registration/unregistration. These have
           been tested by the various parties reporting issues, and should be
           solid at this point.
      
         - Also from Jan, fix for axonram gendisk registration.
      
         - A stable fix for zram from Johannes.
      
         - A small series from Ming, fixing up some long standing issues with
           blk-mq hardware queue kobject initialization and registration.
      
         - A fix for sed opal from Jon, fixing a nonsensical range check and
           some set-but-not-used variables.
      
         - A fix from Neil for a long standing deadlock issue for stacking
           device drivers. With this in place, dm/md don't have to work around
           the issue anymore, and can be properly fixed up"
      
      * 'for-linus' of git://git.kernel.dk/linux-block:
        axonram: Fix gendisk handling
        blk: improve order of bio handling in generic_make_request()
        Revert "scsi, block: fix duplicate bdi name registration crashes"
        block: Make del_gendisk() safer for disks without queues
        bdi: Fix use-after-free in wb_congested_put()
        block: Allow bdi re-registration
        block/sed: Fix opal user range check and unused variables
        zram: set physical queue limits to avoid array out of bounds accesses
        blk-mq: free hctx->cpumask in release handler of hctx's kobject
        blk-mq: make lifetime consistent between hctx and its kobject
        blk-mq: make lifetime consitent between q/ctx and its kobject
        blk-mq: initialize mq kobjects in blk_mq_init_allocated_queue()
      34bbce9e
    • Linus Torvalds's avatar
      Merge tag 'media/v4.11-2' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media · bb61ce54
      Linus Torvalds authored
      Pull media fixes from Mauro Carvalho Chehab:
       "Media regression fixes:
      
         - serial_ir: fix a Kernel crash during boot on Kernel 4.11-rc1, due
           to an IRQ code called too early
      
         - other IR regression fixes at lirc and at the raw IR decoding
      
         - a deadlock fix at the RC nuvoton driver
      
         - fix another issue with DMA on stack at dw2102 driver
      
        There's an extra patch there that change a driver interface for the
        SoC VSP1 driver, with is shared between the DRM and V4L2 driver. The
        patch itself is trivial, and was acked by David Arlie"
      
      * tag 'media/v4.11-2' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media:
        [media] v4l: vsp1: Adapt vsp1_du_setup_lif() interface to use a structure
        [media] dw2102: don't do DMA on stack
        [media] rc: protocol is not set on register for raw IR devices
        [media] rc: raw decoder for keymap protocol is not loaded on register
        [media] rc: nuvoton: fix deadlock in nvt_write_wakeup_codes
        [media] lirc: fix dead lock between open and wakeup_filter
        [media] serial_ir: ensure we're ready to receive interrupts
      bb61ce54
    • Linus Torvalds's avatar
      Merge tag 'for-linus-4.11-rc1-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip · cb2113cb
      Linus Torvalds authored
      Pull xen fix and cleanup from Juergen Gross:
       "This contains one fix for MSIX handling under Xen and a trivial
        cleanup patch"
      
      * tag 'for-linus-4.11-rc1-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip:
        xenbus: Remove duplicate inclusion of linux/init.h
        xen: do not re-use pirq number cached in pci device msi msg data
      cb2113cb
    • Rafael J. Wysocki's avatar
      Merge branch 'pm-cpufreq-sched' · 32d3b06a
      Rafael J. Wysocki authored
      * pm-cpufreq-sched:
        cpufreq: schedutil: Pass sg_policy to get_next_freq()
        cpufreq: schedutil: move cached_raw_freq to struct sugov_policy
      32d3b06a
    • Rafael J. Wysocki's avatar
      Merge branch 'pm-cpufreq' · fd8e57d5
      Rafael J. Wysocki authored
      * pm-cpufreq:
        cpufreq: intel_pstate: Do not reinit performance limits in ->setpolicy
        cpufreq: intel_pstate: Fix intel_pstate_verify_policy()
        cpufreq: intel_pstate: Fix global settings in active mode
        cpufreq: Add the "cpufreq.off=1" cmdline option
        cpufreq: intel_pstate: Avoid triggering cpu_frequency tracepoint unnecessarily
        cpufreq: intel_pstate: Fix intel_cpufreq_verify_policy()
        cpufreq: intel_pstate: Do not use performance_limits in passive mode
      fd8e57d5
  3. 08 Mar, 2017 20 commits
    • Linus Torvalds's avatar
      Merge branch 'core-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · ea6200e8
      Linus Torvalds authored
      Pull sched.h split-up fixes for MIPS from Ingo Molnar:
       "These are the fixes for MIPS build failures due to the sched.h
        split-up, from Arnd Bergmann"
      
      * 'core-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        MIPS: Add missing include files
      ea6200e8
    • Tony Luck's avatar
      mm, page_alloc: Add missing check for memory holes · b4fb8f66
      Tony Luck authored
      Commit 13ad59df ("mm, page_alloc: avoid page_to_pfn() when merging
      buddies") moved the check for memory holes out of page_is_buddy() and
      had the callers do the check.
      
      But this wasn't done correctly in one place which caused ia64 to crash
      very early in boot.
      
      Update to fix that and make ia64 boot again.
      
      [ v2: Vlastimil pointed out we don't need to call page_to_pfn()
            since we already have the result of that in "buddy_pfn" ]
      
      Fixes: 13ad59df ("avoid page_to_pfn() when merging buddies")
      Cc: Mel Gorman <mgorman@techsingularity.net>
      Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
      Cc: Michal Hocko <mhocko@kernel.org>
      Cc: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
      Cc: Johannes Weiner <hannes@cmpxchg.org>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarTony Luck <tony.luck@intel.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      b4fb8f66
    • Linus Torvalds's avatar
      Merge tag 'ktest-v4.11-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-ktest · 8557b8e4
      Linus Torvalds authored
      Pull ktest fixes from Steven Rostedt:
       "Greg Kroah-Hartman reported to me that the ktest of v4.11-rc1 locked
        up in an infinite loop while doing the make mrproper.
      
        Looking into the cause I noticed that a recent update to the function
        run_command (used for running all shell commands, including "make
        mrproper") changed the internal loop to use the function
        wait_for_input.
      
        The wait_for_input function uses select to look at two file
        descriptors. One is the file descriptor of the command it is running,
        the other is STDIN. The STDIN check was not checking the return status
        of the sysread call, and was also just writing a lot of data into
        syswrite without regard to the size of the data read.
      
        Changing the code to check the return status of sysread, and also to
        still process the passed in descriptor data without looping back to
        the select fixed Greg's problem.
      
        While looking at this code I also realized that the loop did not honor
        the timeout if STDIN always had input (or for some reason return
        error). this could prevent wait_for_input to timeout on the file
        descriptor it is suppose to be waiting for. That is fixed too"
      
      * tag 'ktest-v4.11-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-ktest:
        ktest: Make sure wait_for_input does honor the timeout
        ktest: Fix while loop in wait_for_input
      8557b8e4
    • Linus Torvalds's avatar
      overlayfs: remove now unnecessary header file include · 04bb94b1
      Linus Torvalds authored
      This removes the extra include header file that was added in commit
      e58bc927 "Pull overlayfs updates from Miklos Szeredi" now that it
      is no longer needed.
      
      There are probably other such includes that got added during the
      scheduler header splitup series, but this is the one that annoyed me
      personally and I know about.
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      04bb94b1
    • Linus Torvalds's avatar
      sched/headers: fix up header file dependency on <linux/sched/signal.h> · bd0f9b35
      Linus Torvalds authored
      The scheduler header file split and cleanups ended up exposing a few
      nasty header file dependencies, and in particular it showed how we in
      <linux/wait.h> ended up depending on "signal_pending()", which now comes
      from <linux/sched/signal.h>.
      
      That's a very subtle and annoying dependency, which already caused a
      semantic merge conflict (see commit e58bc927 "Pull overlayfs updates
      from Miklos Szeredi", which added that fixup in the merge commit).
      
      It turns out that we can avoid this dependency _and_ improve code
      generation by moving the guts of the fairly nasty helper #define
      __wait_event_interruptible_locked() to out-of-line code.  The code that
      includes the signal_pending() check is all in the slow-path where we
      actually go to sleep waiting for the event anyway, so using a helper
      function is the right thing to do.
      
      Using a helper function is also what we already did for the non-locked
      versions, see the "__wait_event*()" macros and the "prepare_to_wait*()"
      set of helper functions.
      
      We might want to try to unify all these macro games, we have a _lot_ of
      subtly different wait-event loops.  But this is the minimal patch to fix
      the annoying header dependency.
      Acked-by: default avatarIngo Molnar <mingo@kernel.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      bd0f9b35
    • Jan Kara's avatar
      axonram: Fix gendisk handling · 672a2c87
      Jan Kara authored
      It is invalid to call del_gendisk() when disk->queue is NULL. Fix error
      handling in axon_ram_probe() to avoid doing that.
      
      Also del_gendisk() does not drop a reference to gendisk allocated by
      alloc_disk(). That has to be done by put_disk(). Add that call where
      needed.
      Reported-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
      Signed-off-by: default avatarJan Kara <jack@suse.cz>
      Signed-off-by: default avatarJens Axboe <axboe@fb.com>
      672a2c87
    • NeilBrown's avatar
      blk: improve order of bio handling in generic_make_request() · 79bd9959
      NeilBrown authored
      To avoid recursion on the kernel stack when stacked block devices
      are in use, generic_make_request() will, when called recursively,
      queue new requests for later handling.  They will be handled when the
      make_request_fn for the current bio completes.
      
      If any bios are submitted by a make_request_fn, these will ultimately
      be handled seqeuntially.  If the handling of one of those generates
      further requests, they will be added to the end of the queue.
      
      This strict first-in-first-out behaviour can lead to deadlocks in
      various ways, normally because a request might need to wait for a
      previous request to the same device to complete.  This can happen when
      they share a mempool, and can happen due to interdependencies
      particular to the device.  Both md and dm have examples where this happens.
      
      These deadlocks can be erradicated by more selective ordering of bios.
      Specifically by handling them in depth-first order.  That is: when the
      handling of one bio generates one or more further bios, they are
      handled immediately after the parent, before any siblings of the
      parent.  That way, when generic_make_request() calls make_request_fn
      for some particular device, we can be certain that all previously
      submited requests for that device have been completely handled and are
      not waiting for anything in the queue of requests maintained in
      generic_make_request().
      
      An easy way to achieve this would be to use a last-in-first-out stack
      instead of a queue.  However this will change the order of consecutive
      bios submitted by a make_request_fn, which could have unexpected consequences.
      Instead we take a slightly more complex approach.
      A fresh queue is created for each call to a make_request_fn.  After it completes,
      any bios for a different device are placed on the front of the main queue, followed
      by any bios for the same device, followed by all bios that were already on
      the queue before the make_request_fn was called.
      This provides the depth-first approach without reordering bios on the same level.
      
      This, by itself, it not enough to remove all deadlocks.  It just makes
      it possible for drivers to take the extra step required themselves.
      
      To avoid deadlocks, drivers must never risk waiting for a request
      after submitting one to generic_make_request.  This includes never
      allocing from a mempool twice in the one call to a make_request_fn.
      
      A common pattern in drivers is to call bio_split() in a loop, handling
      the first part and then looping around to possibly split the next part.
      Instead, a driver that finds it needs to split a bio should queue
      (with generic_make_request) the second part, handle the first part,
      and then return.  The new code in generic_make_request will ensure the
      requests to underlying bios are processed first, then the second bio
      that was split off.  If it splits again, the same process happens.  In
      each case one bio will be completely handled before the next one is attempted.
      
      With this is place, it should be possible to disable the
      punt_bios_to_recover() recovery thread for many block devices, and
      eventually it may be possible to remove it completely.
      
      Ref: http://www.spinics.net/lists/raid/msg54680.htmlTested-by: default avatarJinpu Wang <jinpu.wang@profitbricks.com>
      Inspired-by: default avatarLars Ellenberg <lars.ellenberg@linbit.com>
      Signed-off-by: default avatarNeilBrown <neilb@suse.com>
      Signed-off-by: default avatarJens Axboe <axboe@fb.com>
      79bd9959
    • Jan Kara's avatar
      Revert "scsi, block: fix duplicate bdi name registration crashes" · c01228db
      Jan Kara authored
      This reverts commit 0dba1314. It causes
      leaking of device numbers for SCSI when SCSI registers multiple gendisks
      for one request_queue in succession. It can be easily reproduced using
      Omar's script [1] on kernel with CONFIG_DEBUG_TEST_DRIVER_REMOVE.
      Furthermore the protection provided by this commit is not needed anymore
      as the problem it was fixing got also fixed by commit 165a5e22
      "block: Move bdi_unregister() to del_gendisk()".
      
      [1]: http://marc.info/?l=linux-block&m=148554717109098&w=2Signed-off-by: default avatarJan Kara <jack@suse.cz>
      Acked-by: default avatarDan Williams <dan.j.williams@intel.com>
      Tested-by: default avatarOmar Sandoval <osandov@fb.com>
      Signed-off-by: default avatarJens Axboe <axboe@fb.com>
      c01228db
    • Jan Kara's avatar
      block: Make del_gendisk() safer for disks without queues · 90f16fdd
      Jan Kara authored
      Commit 165a5e22 "block: Move bdi_unregister() to del_gendisk()"
      added disk->queue dereference to del_gendisk(). Although del_gendisk()
      is not supposed to be called without disk->queue valid and
      blk_unregister_queue() warns in that case, this change will make it oops
      instead. Return to the old more robust behavior of just warning when
      del_gendisk() gets called for gendisk with disk->queue being NULL.
      Reported-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
      Signed-off-by: default avatarJan Kara <jack@suse.cz>
      Tested-by: default avatarOmar Sandoval <osandov@fb.com>
      Signed-off-by: default avatarJens Axboe <axboe@fb.com>
      90f16fdd
    • Jan Kara's avatar
      bdi: Fix use-after-free in wb_congested_put() · df23de55
      Jan Kara authored
      bdi_writeback_congested structures get created for each blkcg and bdi
      regardless whether bdi is registered or not. When they are created in
      unregistered bdi and the request queue (and thus bdi) is then destroyed
      while blkg still holds reference to bdi_writeback_congested structure,
      this structure will be referencing freed bdi and last wb_congested_put()
      will try to remove the structure from already freed bdi.
      
      With commit 165a5e22 "block: Move bdi_unregister() to
      del_gendisk()", SCSI started to destroy bdis without calling
      bdi_unregister() first (previously it was calling bdi_unregister() even
      for unregistered bdis) and thus the code detaching
      bdi_writeback_congested in cgwb_bdi_destroy() was not triggered and we
      started hitting this use-after-free bug. It is enough to boot a KVM
      instance with virtio-scsi device to trigger this behavior.
      
      Fix the problem by detaching bdi_writeback_congested structures in
      bdi_exit() instead of bdi_unregister(). This is also more logical as
      they can get attached to bdi regardless whether it ever got registered
      or not.
      
      Fixes: 165a5e22Signed-off-by: default avatarJan Kara <jack@suse.cz>
      Tested-by: default avatarOmar Sandoval <osandov@fb.com>
      Signed-off-by: default avatarJens Axboe <axboe@fb.com>
      df23de55
    • Jan Kara's avatar
      block: Allow bdi re-registration · b6f8fec4
      Jan Kara authored
      SCSI can call device_add_disk() several times for one request queue when
      a device in unbound and bound, creating new gendisk each time. This will
      lead to bdi being repeatedly registered and unregistered. This was not a
      big problem until commit 165a5e22 "block: Move bdi_unregister() to
      del_gendisk()" since bdi was only registered repeatedly (bdi_register()
      handles repeated calls fine, only we ended up leaking reference to
      gendisk due to overwriting bdi->owner) but unregistered only in
      blk_cleanup_queue() which didn't get called repeatedly. After
      165a5e22 we were doing correct bdi_register() - bdi_unregister()
      cycles however bdi_unregister() is not prepared for it. So make sure
      bdi_unregister() cleans up bdi in such a way that it is prepared for
      a possible following bdi_register() call.
      
      An easy way to provoke this behavior is to enable
      CONFIG_DEBUG_TEST_DRIVER_REMOVE and use scsi_debug driver to create a
      scsi disk which immediately hangs without this fix.
      
      Fixes: 165a5e22Signed-off-by: default avatarJan Kara <jack@suse.cz>
      Tested-by: default avatarOmar Sandoval <osandov@fb.com>
      Signed-off-by: default avatarJens Axboe <axboe@fb.com>
      b6f8fec4
    • Jon Derrick's avatar
      block/sed: Fix opal user range check and unused variables · b0bfdfc2
      Jon Derrick authored
      Fixes check that the opal user is within the range, and cleans up unused
      method variables.
      Signed-off-by: default avatarJon Derrick <jonathan.derrick@intel.com>
      Reviewed-by: default avatarScott Bauer <scott.bauer@intel.com>
      Signed-off-by: default avatarJens Axboe <axboe@fb.com>
      b0bfdfc2
    • Johannes Thumshirn's avatar
      zram: set physical queue limits to avoid array out of bounds accesses · 0bc31538
      Johannes Thumshirn authored
      zram can handle at most SECTORS_PER_PAGE sectors in a bio's bvec. When using
      the NVMe over Fabrics loopback target which potentially sends a huge bulk of
      pages attached to the bio's bvec this results in a kernel panic because of
      array out of bounds accesses in zram_decompress_page().
      Signed-off-by: default avatarJohannes Thumshirn <jthumshirn@suse.de>
      Reviewed-by: default avatarHannes Reinecke <hare@suse.com>
      Reviewed-by: default avatarSergey Senozhatsky <sergey.senozhatsky@gmail.com>
      Signed-off-by: default avatarJens Axboe <axboe@fb.com>
      0bc31538
    • Ming Lei's avatar
      blk-mq: free hctx->cpumask in release handler of hctx's kobject · 01388df3
      Ming Lei authored
      It is obviously that hctx->cpumask is per hctx, and both
      share same lifetime, so this patch moves freeing of hctx->cpumask
      into release handler of hctx's kobject.
      Signed-off-by: default avatarMing Lei <tom.leiming@gmail.com>
      Tested-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Signed-off-by: default avatarJens Axboe <axboe@fb.com>
      01388df3
    • Ming Lei's avatar
      blk-mq: make lifetime consistent between hctx and its kobject · 6c8b232e
      Ming Lei authored
      This patch removes kobject_put() over hctx in __blk_mq_unregister_dev(),
      and trys to keep lifetime consistent between hctx and hctx's kobject.
      
      Now blk_mq_sysfs_register() and blk_mq_sysfs_unregister() become
      totally symmetrical, and kobject's refcounter drops to zero just
      when the hctx is freed.
      Signed-off-by: default avatarMing Lei <tom.leiming@gmail.com>
      Tested-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Signed-off-by: default avatarJens Axboe <axboe@fb.com>
      6c8b232e
    • Ming Lei's avatar
      blk-mq: make lifetime consitent between q/ctx and its kobject · 7ea5fe31
      Ming Lei authored
      Currently from kobject view, both q->mq_kobj and ctx->kobj can
      be released during one cycle of blk_mq_register_dev() and
      blk_mq_unregister_dev(). Actually, sw queue's lifetime is
      same with its request queue's, which is covered by request_queue->kobj.
      
      So we don't need to call kobject_put() for the two kinds of
      kobject in __blk_mq_unregister_dev(), instead we do that
      in release handler of request queue.
      Signed-off-by: default avatarMing Lei <tom.leiming@gmail.com>
      Tested-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Signed-off-by: default avatarJens Axboe <axboe@fb.com>
      7ea5fe31
    • Ming Lei's avatar
      blk-mq: initialize mq kobjects in blk_mq_init_allocated_queue() · 737f98cf
      Ming Lei authored
      Both q->mq_kobj and sw queues' kobjects should have been initialized
      once, instead of doing that each add_disk context.
      
      Also this patch removes clearing of ctx in blk_mq_init_cpu_queues()
      because percpu allocator fills zero to allocated variable.
      
      This patch fixes one issue[1] reported from Omar.
      
      [1] kernel wearning when doing unbind/bind on one scsi-mq device
      
      [   19.347924] kobject (ffff8800791ea0b8): tried to init an initialized object, something is seriously wrong.
      [   19.349781] CPU: 1 PID: 84 Comm: kworker/u8:1 Not tainted 4.10.0-rc7-00210-g53f39eeaa263 #34
      [   19.350686] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.10.1-20161122_114906-anatol 04/01/2014
      [   19.350920] Workqueue: events_unbound async_run_entry_fn
      [   19.350920] Call Trace:
      [   19.350920]  dump_stack+0x63/0x83
      [   19.350920]  kobject_init+0x77/0x90
      [   19.350920]  blk_mq_register_dev+0x40/0x130
      [   19.350920]  blk_register_queue+0xb6/0x190
      [   19.350920]  device_add_disk+0x1ec/0x4b0
      [   19.350920]  sd_probe_async+0x10d/0x1c0 [sd_mod]
      [   19.350920]  async_run_entry_fn+0x48/0x150
      [   19.350920]  process_one_work+0x1d0/0x480
      [   19.350920]  worker_thread+0x48/0x4e0
      [   19.350920]  kthread+0x101/0x140
      [   19.350920]  ? process_one_work+0x480/0x480
      [   19.350920]  ? kthread_create_on_node+0x60/0x60
      [   19.350920]  ret_from_fork+0x2c/0x40
      
      Cc: Omar Sandoval <osandov@osandov.com>
      Signed-off-by: default avatarMing Lei <tom.leiming@gmail.com>
      Tested-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Signed-off-by: default avatarJens Axboe <axboe@fb.com>
      737f98cf
    • Steven Rostedt (VMware)'s avatar
      ktest: Make sure wait_for_input does honor the timeout · f7c6401f
      Steven Rostedt (VMware) authored
      The function wait_for_input takes in a timeout, and even has a default
      timeout. But if for some reason the STDIN descriptor keeps sending in data,
      the function will never time out. The timout is to wait for the data from
      the passed in file descriptor, not for STDIN. Adding a test in the case
      where there's no data from the passed in file descriptor that checks to see
      if the timeout passed, will ensure that it will timeout properly even if
      there's input in STDIN.
      Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
      f7c6401f
    • Steven Rostedt (VMware)'s avatar
      ktest: Fix while loop in wait_for_input · 99c014a8
      Steven Rostedt (VMware) authored
      The run_command function was changed to use the wait_for_input function to
      allow having a timeout if the command to run takes too much time. There was
      a bug in the wait_for_input where it could end up going into an infinite
      loop. There's two issues here. One is that the return value of the sysread
      wasn't used for the write (to write a proper size), and that it should
      continue processing the passed in file descriptor too even if there was
      input. There was no check for error, if for some reason STDIN returned an
      error, the function would go into an infinite loop and never exit.
      Reported-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Tested-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Fixes: 6e98d1b4 ("ktest: Add timeout to ssh command")
      Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
      99c014a8
    • Arnd Bergmann's avatar
      MIPS: Add missing include files · fc69910f
      Arnd Bergmann authored
      After the split of linux/sched.h, several platforms in arch/mips stopped building.
      
      Add the respective additional #include statements to fix the problem I first
      tried adding these into asm/processor.h, but ran into circular header
      dependencies with that which I could not figure out.
      
      The commit I listed as causing the problem is the branch merge, as there is
      likely a combination of multiple patches in that branch.
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: linux-mips@linux-mips.org
      Cc: ralf@linux-mips.org
      Fixes: 1827adb1 ("Merge branch 'WIP.sched-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip")
      Link: http://lkml.kernel.org/r/20170308072931.3836696-1-arnd@arndb.deSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      fc69910f
  4. 07 Mar, 2017 13 commits
    • Linus Torvalds's avatar
      Merge branch 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · ec3b93ae
      Linus Torvalds authored
      Pull x86 fixes from Ingo Molnar:
       "Misc fixes and minor updates all over the place:
      
         - an SGI/UV fix
         - a defconfig update
         - a build warning fix
         - move the boot_params file to the arch location in debugfs
         - a pkeys fix
         - selftests fix
         - boot message fixes
         - sparse fixes
         - a resume warning fix
         - ioapic hotplug fixes
         - reboot quirks
      
        ... plus various minor cleanups"
      
      * 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        x86/build/x86_64_defconfig: Enable CONFIG_R8169
        x86/reboot/quirks: Add ASUS EeeBook X205TA/W reboot quirk
        x86/hpet: Prevent might sleep splat on resume
        x86/boot: Correct setup_header.start_sys name
        x86/purgatory: Fix sparse warning, symbol not declared
        x86/purgatory: Make functions and variables static
        x86/events: Remove last remnants of old filenames
        x86/pkeys: Check against max pkey to avoid overflows
        x86/ioapic: Split IOAPIC hot-removal into two steps
        x86/PCI: Implement pcibios_release_device to release IRQ from IOAPIC
        x86/intel_rdt: Remove duplicate inclusion of linux/cpu.h
        x86/vmware: Remove duplicate inclusion of asm/timer.h
        x86/hyperv: Hide unused label
        x86/reboot/quirks: Add ASUS EeeBook X205TA reboot quirk
        x86/platform/uv/BAU: Fix HUB errors by remove initial write to sw-ack register
        x86/selftests: Add clobbers for int80 on x86_64
        x86/apic: Simplify enable_IR_x2apic(), remove try_to_enable_IR()
        x86/apic: Fix a warning message in logical CPU IDs allocation
        x86/kdebugfs: Move boot params hierarchy under (debugfs)/x86/
      ec3b93ae
    • Linus Torvalds's avatar
      Merge branch 'timers-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 8a917235
      Linus Torvalds authored
      Pull timer fixes from Ingo Molnar:
       "This includes a fix for lockups caused by incorrect nsecs related
        cleanup, and a capabilities check fix for timerfd"
      
      * 'timers-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        jiffies: Revert bogus conversion of NSEC_PER_SEC to TICK_NSEC
        timerfd: Only check CAP_WAKE_ALARM when it is needed
      8a917235
    • Linus Torvalds's avatar
      Merge branch 'sched-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 609b07b7
      Linus Torvalds authored
      Pull scheduler fixes from Ingo Molnar:
       "A fix for KVM's scheduler clock which (erroneously) was always marked
        unstable, a fix for RT/DL load balancing, plus latency fixes"
      
      * 'sched-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        sched/clock, x86/tsc: Rework the x86 'unstable' sched_clock() interface
        sched/core: Fix pick_next_task() for RT,DL
        sched/fair: Make select_idle_cpu() more aggressive
      609b07b7
    • Linus Torvalds's avatar
      Merge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · c3abcabe
      Linus Torvalds authored
      Pull perf fixes from Ingo Molnar:
       "This includes a fix for a crash if certain special addresses are
        kprobed, plus does a rename of two Kconfig variables that were a minor
        misnomer"
      
      * 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        perf/core: Rename CONFIG_[UK]PROBE_EVENT to CONFIG_[UK]PROBE_EVENTS
        kprobes/x86: Fix kernel panic when certain exception-handling addresses are probed
      c3abcabe
    • Linus Torvalds's avatar
      Merge branch 'locking-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 500e1af2
      Linus Torvalds authored
      Pull locking fixes from Ingo Molnar:
      
       - Change the new refcount_t warnings from WARN() to WARN_ONCE()
      
       - two ww_mutex fixes
      
       - plus a new lockdep self-consistency check for a bug that triggered in
         practice
      
      * 'locking-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        locking/ww_mutex: Adjust the lock number for stress test
        locking/lockdep: Add nest_lock integrity test
        locking/ww_mutex: Replace cpu_relax() with cond_resched() for tests
        locking/refcounts: Change WARN() to WARN_ONCE()
      500e1af2
    • Linus Torvalds's avatar
      Merge branch 'irq-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 26db8f99
      Linus Torvalds authored
      Pull IRQ fix from Ingo Molnar:
       "Fix an ARM TI DRA7XX SoC irqchip driver local variables type
        bug/warning"
      
      * 'irq-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        irqchip/crossbar: Fix incorrect type of local variables
      26db8f99
    • Linus Torvalds's avatar
      Merge branch 'efi-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 21f85778
      Linus Torvalds authored
      Pull EFI fixes from Ingo Molnar:
       "A boot crash fix, and a secure boot related boot messages fix"
      
      * 'efi-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        efi/arm: Fix boot crash with CONFIG_CPUMASK_OFFSTACK=y
        efi/libstub: Treat missing SecureBoot variable as Secure Boot disabled
      21f85778
    • Linus Torvalds's avatar
      Merge branch 'core-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · c688f14c
      Linus Torvalds authored
      Pull core fixes from Ingo Molnar:
       "A couple of sched.h splitup related build fixes, plus an objtool fix"
      
      * 'core-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        objtool: Fix another GCC jump table detection issue
        drivers/char/nwbutton: Fix build breakage caused by include file reshuffling
        h8300: Fix build breakage caused by header file changes
        avr32: Fix build error caused by include file reshuffling
      c688f14c
    • Yinghai Lu's avatar
      PCI/ASPM: Always set link->downstream to avoid NULL dereference on remove · 3bd7db63
      Yinghai Lu authored
      We call pcie_aspm_exit_link_state() when we remove a device.  If the device
      is the last PCIe function to be removed below a bridge and the bridge has
      an ASPM link_state struct, we disable ASPM on the link.  Disabling ASPM
      requires link->downstream (used in pcie_config_aspm_link()).
      
      We previously set link->downstream in pcie_aspm_cap_init(), but only if the
      device was not blacklisted.  Removing the blacklisted device caused a NULL
      pointer dereference in the pcie_aspm_exit_link_state() ->
      pcie_config_aspm_link() path:
      
        # echo 1 > /sys/bus/pci/devices/0000\:0b\:00.0/remove
        ...
         BUG: unable to handle kernel NULL pointer dereference at 0000000000000080
         IP: pcie_config_aspm_link+0x5d/0x2b0
         Call Trace:
          pcie_aspm_exit_link_state+0x75/0x130
          pci_stop_bus_device+0xa4/0xb0
          pci_stop_and_remove_bus_device_locked+0x1a/0x30
          remove_store+0x50/0x70
          dev_attr_store+0x18/0x30
          sysfs_kf_write+0x44/0x60
          kernfs_fop_write+0x10e/0x190
          __vfs_write+0x28/0x110
          ? rcu_read_lock_sched_held+0x5d/0x80
          ? rcu_sync_lockdep_assert+0x2c/0x60
          ? __sb_start_write+0x173/0x1a0
          ? vfs_write+0xb3/0x180
          vfs_write+0xc4/0x180
          SyS_write+0x49/0xa0
          do_syscall_64+0xa6/0x1c0
          entry_SYSCALL64_slow_path+0x25/0x25
         ---[ end trace bd187ee0267df5d9 ]---
      
      To avoid this, set link->downstream in alloc_pcie_link_state(), so every
      pcie_link_state structure has a valid link->downstream pointer.
      
      [bhelgaas: changelog]
      Signed-off-by: default avatarYinghai Lu <yinghai@kernel.org>
      Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
      Acked-by: default avatarRajat Jain <rajatja@google.com>
      CC: stable@vger.kernel.org
      3bd7db63
    • Ethan Zhao's avatar
      PCI: Prevent VPD access for QLogic ISP2722 · 0d5370d1
      Ethan Zhao authored
      QLogic ISP2722-based 16/32Gb Fibre Channel to PCIe Adapter has the VPD
      access issue too, while read the common pci-sysfs access interface shown as
      
       /sys/devices/pci0000:00/0000:00:03.2/0000:0b:00.0/vpd
      
      with simple 'cat' could cause system hang and panic:
      
        Kernel panic - not syncing: An NMI occurred. Depending on your system the reason for the NMI is logged in any one of the following resources:
        1. Integrated Management Log (IML)
        2. OA Syslog
        3. OA Forward Progress Log
        4. iLO Event Log
        CPU: 0 PID: 15070 Comm: udevadm Not tainted 4.1.12
        Hardware name: HP ProLiant DL380 Gen9/ProLiant DL380 Gen9, BIOS P89 12/27/2015
         0000000000000086 000000007f0cdf51 ffff880c4fa05d58 ffffffff817193de
         ffffffffa00b42d8 0000000000000075 ffff880c4fa05dd8 ffffffff81714072
         0000000000000008 ffff880c4fa05de8 ffff880c4fa05d88 000000007f0cdf51
        Call Trace:
         <NMI>  [<ffffffff817193de>] dump_stack+0x63/0x81
         [<ffffffff81714072>] panic+0xd0/0x20e
         [<ffffffffa00b390d>] hpwdt_pretimeout+0xdd/0xe0 [hpwdt]
         [<ffffffff81021fc9>] ? sched_clock+0x9/0x10
         [<ffffffff8101c101>] nmi_handle+0x91/0x170
         [<ffffffff8101c10c>] ? nmi_handle+0x9c/0x170
         [<ffffffff8101c5fe>] io_check_error+0x1e/0xa0
         [<ffffffff8101c719>] default_do_nmi+0x99/0x140
         [<ffffffff8101c8b4>] do_nmi+0xf4/0x170
         [<ffffffff817232c5>] end_repeat_nmi+0x1a/0x1e
         [<ffffffff815d724b>] ? pci_conf1_read+0xeb/0x120
         [<ffffffff815d724b>] ? pci_conf1_read+0xeb/0x120
         [<ffffffff815d724b>] ? pci_conf1_read+0xeb/0x120
         <<EOE>>  [<ffffffff815db4b3>] raw_pci_read+0x23/0x40
         [<ffffffff815db4fc>] pci_read+0x2c/0x30
         [<ffffffff8136f612>] pci_user_read_config_word+0x72/0x110
         [<ffffffff8136f746>] pci_vpd_pci22_wait+0x96/0x130
         [<ffffffff8136ff9b>] pci_vpd_pci22_read+0xdb/0x1a0
         [<ffffffff8136ea30>] pci_read_vpd+0x20/0x30
         [<ffffffff8137d590>] read_vpd_attr+0x30/0x40
         [<ffffffff8128e037>] sysfs_kf_bin_read+0x47/0x70
         [<ffffffff8128d24e>] kernfs_fop_read+0xae/0x180
         [<ffffffff8120dd97>] __vfs_read+0x37/0x100
         [<ffffffff812ba7e4>] ? security_file_permission+0x84/0xa0
         [<ffffffff8120e366>] ? rw_verify_area+0x56/0xe0
         [<ffffffff8120e476>] vfs_read+0x86/0x140
         [<ffffffff8120f3f5>] SyS_read+0x55/0xd0
         [<ffffffff81720f2e>] system_call_fastpath+0x12/0x71
        Shutting down cpus with NMI
        Kernel Offset: disabled
        drm_kms_helper: panic occurred, switching back to text console
      
      So blacklist the access to its VPD.
      Signed-off-by: default avatarEthan Zhao <ethan.zhao@oracle.com>
      Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
      CC: stable@vger.kernel.org	# v4.6+
      0d5370d1
    • Linus Torvalds's avatar
      Merge branch 'idr-4.11' of git://git.infradead.org/users/willy/linux-dax · 9e91c144
      Linus Torvalds authored
      Pull idr fix (and new tests) from Matthew Wilcox:
       "One urgent patch in here; freeing the correct IDA bitmap.
      
        Everything else is changes to the test suite"
      
      * 'idr-4.11' of git://git.infradead.org/users/willy/linux-dax:
        radix tree test suite: Specify -m32 in LDFLAGS too
        ida: Free correct IDA bitmap
        radix tree test suite: Depend on Makefile and quieten grep
        radix tree test suite: Fix build with --as-needed
        radix tree test suite: Build 32 bit binaries
        radix tree test suite: Add performance test for radix_tree_join()
        radix tree test suite: Add performance test for radix_tree_split()
        radix tree test suite: Add performance benchmarks
        radix tree test suite: Add test for radix_tree_clear_tags()
        radix tree test suite: Add tests for ida_simple_get() and ida_simple_remove()
        radix tree test suite: Add test for idr_get_next()
      9e91c144
    • Jaehoon Chung's avatar
      PCI: exynos: Initialize elbi_base even when using PHY framework · 544714d8
      Jaehoon Chung authored
      Even when using the PHY framework, we need the elbi_base.  Before this
      patch, we didn't initialize elbi_base, which caused NULL pointer
      dereferences later.
      
      Fixes: e7cd7ef5 ("PCI: exynos: Support the PHY generic framework")
      Signed-off-by: default avatarJaehoon Chung <jh80.chung@samsung.com>
      Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
      544714d8
    • Linus Torvalds's avatar
      Merge tag 'powerpc-4.11-3' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux · f7d6a728
      Linus Torvalds authored
      Pull powerpc fixes from Michael Ellerman:
       "Five fairly small fixes for things that went in this cycle.
      
        A fairly large patch to rework the CAS logic on Power9, necessitated
        by a late change to the firmware API, and we can't boot without it.
      
        Three fixes going to stable, allowing more instructions to be emulated
        on LE, fixing a boot crash on 32-bit Freescale BookE machines, and the
        OPAL XICS workaround.
      
        And a patch from me to sort the selects under CONFIG PPC. Annoying
        churn, but worth it in the long run, and best for it to go in now to
        avoid conflicts.
      
        Thanks to:
          Alexey Kardashevskiy, Anton Blanchard, Balbir Singh, Gautham R.
          Shenoy, Laurentiu Tudor, Nicholas Piggin, Paul Mackerras, Ravi
          Bangoria, Sachin Sant, Shile Zhang, Suraj Jitindar Singh"
      
      * tag 'powerpc-4.11-3' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux:
        powerpc: Sort the selects under CONFIG_PPC
        powerpc/64: Fix L1D cache shape vector reporting L1I values
        powerpc/64: Avoid panic during boot due to divide by zero in init_cache_info()
        powerpc: Update to new option-vector-5 format for CAS
        powerpc: Parse the command line before calling CAS
        powerpc/xics: Work around limitations of OPAL XICS priority handling
        powerpc/64: Fix checksum folding in csum_add()
        powerpc/powernv: Fix opal tracepoints with JUMP_LABEL=n
        powerpc/booke: Fix boot crash due to null hugepd
        powerpc: Fix compiling a BE kernel with a powerpc64le toolchain
        selftest/powerpc: Fix false failures for skipped tests
        powerpc/powernv: Fix bug due to labeling ambiguity in power_enter_stop
        powerpc/64: Invalidate process table caching after setting process table
        powerpc: emulate_step() tests for load/store instructions
        powerpc: Emulation support for load/store instructions on LE
      f7d6a728