1. 08 Dec, 2016 9 commits
    • Bart Van Assche's avatar
      dm ioctl: use offsetof() instead of open-coding it · 6080758d
      Bart Van Assche authored
      Subtracting sizes is a fragile approach because the result is only
      correct if the compiler has not added any padding at the end of the
      structure. Hence use offsetof() instead of size subtraction. An
      additional advantage of offsetof() is that it makes the intent more
      clear.
      Signed-off-by: default avatarBart Van Assche <bart.vanassche@sandisk.com>
      Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
      6080758d
    • Bart Van Assche's avatar
      dm rq: simplify use_blk_mq initialization · b23df0d0
      Bart Van Assche authored
      Use a single statement to declare and initialize 'use_blk_mq' instead
      of two statements.
      Signed-off-by: default avatarBart Van Assche <bart.vanassche@sandisk.com>
      Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
      b23df0d0
    • Bart Van Assche's avatar
      dm: use blk_set_queue_dying() in __dm_destroy() · 2e91c369
      Bart Van Assche authored
      After QUEUE_FLAG_DYING has been set any code that is waiting in
      get_request() should be woken up.  But to get this behaviour
      blk_set_queue_dying() must be used instead of only setting
      QUEUE_FLAG_DYING.
      Signed-off-by: default avatarBart Van Assche <bart.vanassche@sandisk.com>
      Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
      2e91c369
    • Mikulas Patocka's avatar
      dm bufio: drop the lock when doing GFP_NOIO allocation · 41c73a49
      Mikulas Patocka authored
      If the first allocation attempt using GFP_NOWAIT fails, drop the lock
      and retry using GFP_NOIO allocation (lock is dropped because the
      allocation can take some time).
      
      Note that we won't do GFP_NOIO allocation when we loop for the second
      time, because the lock shouldn't be dropped between __wait_for_free_buffer
      and __get_unclaimed_buffer.
      Signed-off-by: default avatarMikulas Patocka <mpatocka@redhat.com>
      Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
      41c73a49
    • Mikulas Patocka's avatar
      dm bufio: don't take the lock in dm_bufio_shrink_count · d12067f4
      Mikulas Patocka authored
      dm_bufio_shrink_count() is called from do_shrink_slab to find out how many
      freeable objects are there. The reported value doesn't have to be precise,
      so we don't need to take the dm-bufio lock.
      Suggested-by: default avatarDavid Rientjes <rientjes@google.com>
      Signed-off-by: default avatarMikulas Patocka <mpatocka@redhat.com>
      Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
      d12067f4
    • Douglas Anderson's avatar
      dm bufio: avoid sleeping while holding the dm_bufio lock · 9ea61cac
      Douglas Anderson authored
      We've seen in-field reports showing _lots_ (18 in one case, 41 in
      another) of tasks all sitting there blocked on:
      
        mutex_lock+0x4c/0x68
        dm_bufio_shrink_count+0x38/0x78
        shrink_slab.part.54.constprop.65+0x100/0x464
        shrink_zone+0xa8/0x198
      
      In the two cases analyzed, we see one task that looks like this:
      
        Workqueue: kverityd verity_prefetch_io
      
        __switch_to+0x9c/0xa8
        __schedule+0x440/0x6d8
        schedule+0x94/0xb4
        schedule_timeout+0x204/0x27c
        schedule_timeout_uninterruptible+0x44/0x50
        wait_iff_congested+0x9c/0x1f0
        shrink_inactive_list+0x3a0/0x4cc
        shrink_lruvec+0x418/0x5cc
        shrink_zone+0x88/0x198
        try_to_free_pages+0x51c/0x588
        __alloc_pages_nodemask+0x648/0xa88
        __get_free_pages+0x34/0x7c
        alloc_buffer+0xa4/0x144
        __bufio_new+0x84/0x278
        dm_bufio_prefetch+0x9c/0x154
        verity_prefetch_io+0xe8/0x10c
        process_one_work+0x240/0x424
        worker_thread+0x2fc/0x424
        kthread+0x10c/0x114
      
      ...and that looks to be the one holding the mutex.
      
      The problem has been reproduced on fairly easily:
      0. Be running Chrome OS w/ verity enabled on the root filesystem
      1. Pick test patch: http://crosreview.com/412360
      2. Install launchBalloons.sh and balloon.arm from
           http://crbug.com/468342
         ...that's just a memory stress test app.
      3. On a 4GB rk3399 machine, run
           nice ./launchBalloons.sh 4 900 100000
         ...that tries to eat 4 * 900 MB of memory and keep accessing.
      4. Login to the Chrome web browser and restore many tabs
      
      With that, I've seen printouts like:
        DOUG: long bufio 90758 ms
      ...and stack trace always show's we're in dm_bufio_prefetch().
      
      The problem is that we try to allocate memory with GFP_NOIO while
      we're holding the dm_bufio lock.  Instead we should be using
      GFP_NOWAIT.  Using GFP_NOIO can cause us to sleep while holding the
      lock and that causes the above problems.
      
      The current behavior explained by David Rientjes:
      
        It will still try reclaim initially because __GFP_WAIT (or
        __GFP_KSWAPD_RECLAIM) is set by GFP_NOIO.  This is the cause of
        contention on dm_bufio_lock() that the thread holds.  You want to
        pass GFP_NOWAIT instead of GFP_NOIO to alloc_buffer() when holding a
        mutex that can be contended by a concurrent slab shrinker (if
        count_objects didn't use a trylock, this pattern would trivially
        deadlock).
      
      This change significantly increases responsiveness of the system while
      in this state.  It makes a real difference because it unblocks kswapd.
      In the bug report analyzed, kswapd was hung:
      
         kswapd0         D ffffffc000204fd8     0    72      2 0x00000000
         Call trace:
         [<ffffffc000204fd8>] __switch_to+0x9c/0xa8
         [<ffffffc00090b794>] __schedule+0x440/0x6d8
         [<ffffffc00090bac0>] schedule+0x94/0xb4
         [<ffffffc00090be44>] schedule_preempt_disabled+0x28/0x44
         [<ffffffc00090d900>] __mutex_lock_slowpath+0x120/0x1ac
         [<ffffffc00090d9d8>] mutex_lock+0x4c/0x68
         [<ffffffc000708e7c>] dm_bufio_shrink_count+0x38/0x78
         [<ffffffc00030b268>] shrink_slab.part.54.constprop.65+0x100/0x464
         [<ffffffc00030dbd8>] shrink_zone+0xa8/0x198
         [<ffffffc00030e578>] balance_pgdat+0x328/0x508
         [<ffffffc00030eb7c>] kswapd+0x424/0x51c
         [<ffffffc00023f06c>] kthread+0x10c/0x114
         [<ffffffc000203dd0>] ret_from_fork+0x10/0x40
      
      By unblocking kswapd memory pressure should be reduced.
      Suggested-by: default avatarDavid Rientjes <rientjes@google.com>
      Reviewed-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Signed-off-by: default avatarDouglas Anderson <dianders@chromium.org>
      Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
      9ea61cac
    • Bart Van Assche's avatar
      dm table: simplify dm_table_determine_type() · 5b8c01f7
      Bart Van Assche authored
      Use a single loop instead of two loops to determine whether or not
      all_blk_mq has to be set.
      Signed-off-by: default avatarBart Van Assche <bart.vanassche@sandisk.com>
      Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
      5b8c01f7
    • Bart Van Assche's avatar
      dm table: an 'all_blk_mq' table must be loaded for a blk-mq DM device · 301fc3f5
      Bart Van Assche authored
      When dm_table_set_type() is used by a target to establish a DM table's
      type (e.g. DM_TYPE_MQ_REQUEST_BASED in the case of DM multipath) the
      DM core must go on to verify that the devices in the table are
      compatible with the established type.
      
      Fixes: e83068a5 ("dm mpath: add optional "queue_mode" feature")
      Cc: stable@vger.kernel.org # 4.8+
      Signed-off-by: default avatarBart Van Assche <bart.vanassche@sandisk.com>
      Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
      301fc3f5
    • Mike Snitzer's avatar
      dm table: fix 'all_blk_mq' inconsistency when an empty table is loaded · 6936c12c
      Mike Snitzer authored
      An earlier DM multipath table could have been build ontop of underlying
      devices that were all using blk-mq.  In that case, if that active
      multipath table is replaced with an empty DM multipath table (that
      reflects all paths have failed) then it is important that the
      'all_blk_mq' state of the active table is transfered to the new empty DM
      table.  Otherwise dm-rq.c:dm_old_prep_tio() will incorrectly clone a
      request that isn't needed by the DM multipath target when it is to issue
      IO to an underlying blk-mq device.
      
      Fixes: e83068a5 ("dm mpath: add optional "queue_mode" feature")
      Cc: stable@vger.kernel.org # 4.8+
      Reported-by: default avatarBart Van Assche <bart.vanassche@sandisk.com>
      Tested-by: default avatarBart Van Assche <bart.vanassche@sandisk.com>
      Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
      6936c12c
  2. 21 Nov, 2016 17 commits
  3. 14 Nov, 2016 2 commits
  4. 13 Nov, 2016 12 commits
    • Linus Torvalds's avatar
      Linux 4.9-rc5 · a25f0944
      Linus Torvalds authored
      a25f0944
    • Linus Torvalds's avatar
      Merge tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm · e234832a
      Linus Torvalds authored
      Pull KVM fixes from Paolo Bonzini:
       "ARM fixes.  There are a couple pending x86 patches but they'll have to
        wait for next week"
      
      * tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm:
        KVM: arm/arm64: vgic: Kick VCPUs when queueing already pending IRQs
        KVM: arm/arm64: vgic: Prevent access to invalid SPIs
        arm/arm64: KVM: Perform local TLB invalidation when multiplexing vcpus on a single CPU
      e234832a
    • Linus Torvalds's avatar
      Merge branch 'media-fixes' (patches from Mauro) · e861d890
      Linus Torvalds authored
      Merge media fixes from Mauro Carvalho Chehab:
       "This contains two patches fixing problems with my patch series meant
        to make USB drivers to work again after the DMA on stack changes.
      
        The last patch on this series is actually not related to DMA on stack.
        It solves a longstanding bug affecting module unload, causing
        module_put() to be called twice. It was reported by the user who
        reported and tested the issues with the gp8psk driver with the DMA
        fixup patches. As we're late at -rc cycle, maybe you prefer to not
        apply it right now. If this is the case, I'll add to the pile of
        patches for 4.10.
      
        Exceptionally this time, I'm sending the patches via e-mail, because
        I'm on another trip, and won't be able to use the usual procedure
        until Monday. Also, it is only three patches, and you followed already
        the discussions about the first one"
      
      * emailed patches from Mauro Carvalho Chehab <mchehab@osg.samsung.com>:
        gp8psk: Fix DVB frontend attach
        gp8psk: fix gp8psk_usb_in_op() logic
        dvb-usb: move data_mutex to struct dvb_usb_device
      e861d890
    • Linus Torvalds's avatar
      Merge tag 'char-misc-4.9-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc · acb57b75
      Linus Torvalds authored
      Pull char/misc fixes from Greg KH:
       "Here are three small driver fixes for some reported issues for
        4.9-rc5.
      
        One for the hyper-v subsystem, fixing up a naming issue that showed up
        in 4.9-rc1, one mei driver fix, and one fix for parallel ports,
        resolving a reported regression.
      
        All have been in linux-next with no reported issues"
      
      * tag 'char-misc-4.9-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc:
        ppdev: fix double-free of pp->pdev->name
        vmbus: make sysfs names consistent with PCI
        mei: bus: fix received data size check in NFC fixup
      acb57b75
    • Linus Torvalds's avatar
      Merge tag 'driver-core-4.9-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core · cf2b191c
      Linus Torvalds authored
      Pull driver core fixes from Greg KH:
       "Here are two driver core fixes for 4.9-rc5.
      
        The first resolves an issue with some drivers not liking to be unbound
        and bound again (if CONFIG_DEBUG_TEST_DRIVER_REMOVE is enabled), which
        solves some reported problems with graphics and storage drivers. The
        other resolves a smatch error with the 4.9-rc1 driver core changes
        around this feature.
      
        Both have been in linux-next with no reported issues"
      
      * tag 'driver-core-4.9-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core:
        driver core: fix smatch warning on dev->bus check
        driver core: skip removal test for non-removable drivers
      cf2b191c
    • Linus Torvalds's avatar
      Merge tag 'staging-4.9-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging · 85b9df7a
      Linus Torvalds authored
      Pull staging/IIO fixes from Grek KH:
       "Here are a few small staging and iio driver fixes for reported issues.
      
        The last one was cherry-picked from my -next branch to resolve a build
        warning that Arnd fixed, in his quest to be able to turn
        -Wmaybe-uninitialized back on again. That patch, and all of the
        others, have been in linux-next for a while with no reported issues"
      
      * tag 'staging-4.9-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging:
        iio: maxim_thermocouple: detect invalid storage size in read()
        staging: nvec: remove managed resource from PS2 driver
        Revert "staging: nvec: ps2: change serio type to passthrough"
        drivers: staging: nvec: remove bogus reset command for PS/2 interface
        staging: greybus: arche-platform: fix device reference leak
        staging: comedi: ni_tio: fix buggy ni_tio_clock_period_ps() return value
        staging: sm750fb: Fix bugs introduced by early commits
        iio: hid-sensors: Increase the precision of scale to fix wrong reading interpretation.
        iio: orientation: hid-sensor-rotation: Add PM function (fix non working driver)
        iio: st_sensors: fix scale configuration for h3lis331dl
        staging: iio: ad5933: avoid uninitialized variable in error case
      85b9df7a
    • Linus Torvalds's avatar
      Merge tag 'usb-4.9-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb · befdfffd
      Linus Torvalds authored
      Pull USB / PHY fixes from Greg KH:
       "Here are a number of small USB and PHY driver fixes for 4.9-rc5
      
        Nothing major, just small fixes for reported issues, all of these have
        been in linux-next for a while with no reported issues"
      
      * tag 'usb-4.9-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb:
        USB: cdc-acm: fix TIOCMIWAIT
        cdc-acm: fix uninitialized variable
        drivers/usb: Skip auto handoff for TI and RENESAS usb controllers
        usb: musb: remove duplicated actions
        usb: musb: da8xx: Don't print phy error on -EPROBE_DEFER
        phy: sun4i: check PMU presence when poking unknown bit of pmu
        phy-rockchip-pcie: remove deassert of phy_rst from exit callback
        phy: da8xx-usb: rename the ohci device to ohci-da8xx
        phy: Add reset callback for not generic phy
        uwb: fix device reference leaks
        usb: gadget: u_ether: remove interrupt throttling
        usb: dwc3: st: add missing <linux/pinctrl/consumer.h> include
        usb: dwc3: Fix error handling for core init
      befdfffd
    • Linus Torvalds's avatar
      Merge branch 'for-linus' of git://git.kernel.dk/linux-block · 348ce85b
      Linus Torvalds authored
      Pull more block fixes from Jens Axboe:
       "Since I mistakenly left out the lightnvm regression fix yesterday and
        the aoeblk seems adequately tested at this point, might as well send
        out another pull to make -rc5"
      
      * 'for-linus' of git://git.kernel.dk/linux-block:
        aoe: fix crash in page count manipulation
        lightnvm: invalid offset calculation for lba_shift
      348ce85b
    • Linus Torvalds's avatar
      Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi · 980221d1
      Linus Torvalds authored
      Pull SCSI fixes from James Bottomley:
       "The megaraid_sas patch in here fixes a major regression in the last
        fix set that made all megaraid_sas cards unusable. It turns out no-one
        had actually tested such an "obvious" fix, sigh. The fix for the fix
        has been tested ...
      
        The next most serious is the vmw_pvscsi abort problem which basically
        means that aborts don't work on the vmware paravirt devices and error
        handling always escalates to reset.
      
        The rest are an assortment of missed reference counting in certain
        paths and corner case bugs that show up on some architectures"
      
      * tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi:
        scsi: megaraid_sas: fix macro MEGASAS_IS_LOGICAL to avoid regression
        scsi: qla2xxx: fix invalid DMA access after command aborts in PCI device remove
        scsi: qla2xxx: do not queue commands when unloading
        scsi: libcxgbi: fix incorrect DDP resource cleanup
        scsi: qla2xxx: Fix scsi scan hang triggered if adapter fails during init
        scsi: scsi_dh_alua: Fix a reference counting bug
        scsi: vmw_pvscsi: return SUCCESS for successful command aborts
        scsi: mpt3sas: Fix for block device of raid exists even after deleting raid disk
        scsi: scsi_dh_alua: fix missing kref_put() in alua_rtpg_work()
      980221d1
    • Linus Torvalds's avatar
      Merge tag 'clk-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/clk/linux · d41bd8f3
      Linus Torvalds authored
      Pull clk fixes from Stephen Boyd:
       "The typical collection of minor bug fixes in clk drivers. We don't
        have anything in the core framework here, just driver fixes.
      
        There's a boot fix for Samsung devices and a safety measure for qoriq
        to prevent CPUs from running too fast. There's also a fix for i.MX6Q
        to properly handle audio clock rates. We also have some "that's
        obviously wrong" fixes like bad NULL pointer checks in the MPP driver
        and a poor usage of __pa in the xgene clk driver that are fixed here"
      
      * tag 'clk-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/clk/linux:
        clk: mmp: pxa910: fix return value check in pxa910_clk_init()
        clk: mmp: pxa168: fix return value check in pxa168_clk_init()
        clk: mmp: mmp2: fix return value check in mmp2_clk_init()
        clk: qoriq: Don't allow CPU clocks higher than starting value
        clk: imx: fix integer overflow in AV PLL round rate
        clk: xgene: Don't call __pa on ioremaped address
        clk/samsung: Use CLK_OF_DECLARE_DRIVER initialization method for CLKOUT
        clk: rockchip: don't return NULL when failing to register ddrclk branch
      d41bd8f3
    • Mauro Carvalho Chehab's avatar
      gp8psk: Fix DVB frontend attach · 7a0786c1
      Mauro Carvalho Chehab authored
      The DVB binding schema at the DVB core assumes that the frontend is a
      separate driver.  Faling to do that causes OOPS when the module is
      removed, as it tries to do a symbol_put_addr on an internal symbol,
      causing craches like:
      
          WARNING: CPU: 1 PID: 28102 at kernel/module.c:1108 module_put+0x57/0x70
          Modules linked in: dvb_usb_gp8psk(-) dvb_usb dvb_core nvidia_drm(PO) nvidia_modeset(PO) snd_hda_codec_hdmi snd_hda_intel snd_hda_codec snd_hwdep snd_hda_core snd_pcm snd_timer snd soundcore nvidia(PO) [last unloaded: rc_core]
          CPU: 1 PID: 28102 Comm: rmmod Tainted: P        WC O 4.8.4-build.1 #1
          Hardware name: MSI MS-7309/MS-7309, BIOS V1.12 02/23/2009
          Call Trace:
             dump_stack+0x44/0x64
             __warn+0xfa/0x120
             module_put+0x57/0x70
             module_put+0x57/0x70
             warn_slowpath_null+0x23/0x30
             module_put+0x57/0x70
             gp8psk_fe_set_frontend+0x460/0x460 [dvb_usb_gp8psk]
             symbol_put_addr+0x27/0x50
             dvb_usb_adapter_frontend_exit+0x3a/0x70 [dvb_usb]
      
      From Derek's tests:
          "Attach bug is fixed, tuning works, module unloads without
           crashing. Everything seems ok!"
      Reported-by: default avatarDerek <user.vdr@gmail.com>
      Tested-by: default avatarDerek <user.vdr@gmail.com>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      7a0786c1
    • Mauro Carvalho Chehab's avatar
      gp8psk: fix gp8psk_usb_in_op() logic · 1596c387
      Mauro Carvalho Chehab authored
      Commit bc29131ecb10 ("[media] gp8psk: don't do DMA on stack") fixed the
      usage of DMA on stack, but the memcpy was wrong for gp8psk_usb_in_op().
      Fix it.
      
      From Derek's email:
          "Fix confirmed using 2 different Skywalker models with
           HD mpeg4, SD mpeg2."
      Suggested-by: default avatarJohannes Stezenbach <js@linuxtv.org>
      Fixes: bc29131ecb10 ("[media] gp8psk: don't do DMA on stack")
      Tested-by: default avatarDerek <user.vdr@gmail.com>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      1596c387