1. 18 9月, 2018 1 次提交
    • F
      cpuidle: Remove unnecessary wrapper cpuidle_get_last_residency() · 6a5f95b5
      Fieah Lim 提交于
      cpuidle_get_last_residency() is just a wrapper for retrieving
      the last_residency member of struct cpuidle_device.  It's also
      weirdly the only wrapper function for accessing cpuidle_* struct
      member (by my best guess is it could be a leftover from v2.x).
      
      Anyhow, since the only two users (the ladder and menu governors)
      can access dev->last_residency directly, and it's more intuitive to
      do it that way, let's just get rid of the wrapper.
      
      This patch tidies up CPU idle code a bit without functional changes.
      Signed-off-by: NFieah Lim <kw@fieahl.im>
      [ rjw: Changelog cleanup ]
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      6a5f95b5
  2. 10 9月, 2018 1 次提交
  3. 07 9月, 2018 4 次提交
  4. 06 9月, 2018 5 次提交
  5. 05 9月, 2018 6 次提交
  6. 04 9月, 2018 8 次提交
  7. 03 9月, 2018 6 次提交
    • Z
      drm/i915/gvt: Give new born vGPU higher scheduling chance · 54ff01fd
      Zhenyu Wang 提交于
      This trys to give new born vGPU with higher scheduling chance
      not only with adding to sched list head and also have higher
      priority for workload sched for 2 seconds after starting to
      schedule it. In order for fast GPU execution during VM boot,
      and ensure guest driver setup with required state given in time.
      
      This fixes recent failure seen on one VM with multiple linux VMs
      running on kernel with commit 2621cefa("drm/i915: Provide a timeout to i915_gem_wait_for_idle() on setup"),
      which had shorter setup timeout that caused context state init failed.
      
      v2: change to 2s for higher scheduling period
      
      Cc: Yuan Hang <hang.yuan@intel.com>
      Reviewed-by: NHang Yuan <hang.yuan@intel.com>
      Signed-off-by: NZhenyu Wang <zhenyuw@linux.intel.com>
      54ff01fd
    • J
      net: cadence: Fix a sleep-in-atomic-context bug in macb_halt_tx() · 16fe10cf
      Jia-Ju Bai 提交于
      The kernel module may sleep with holding a spinlock.
      
      The function call paths (from bottom to top) in Linux-4.16 are:
      
      [FUNC] usleep_range
      drivers/net/ethernet/cadence/macb_main.c, 648:
      	usleep_range in macb_halt_tx
      drivers/net/ethernet/cadence/macb_main.c, 730:
      	macb_halt_tx in macb_tx_error_task
      drivers/net/ethernet/cadence/macb_main.c, 721:
      	_raw_spin_lock_irqsave in macb_tx_error_task
      
      To fix this bug, usleep_range() is replaced with udelay().
      
      This bug is found by my static analysis tool DSAC.
      Signed-off-by: NJia-Ju Bai <baijiaju1990@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      16fe10cf
    • F
      i2c: imx-lpi2c: Remove mx8dv compatible entry · 20fdcd76
      Fabio Estevam 提交于
      mx8dv never entered into production and there is no other place
      in the kernel referring to this SoC, so remove it from the
      driver's compatible entry.
      Signed-off-by: NFabio Estevam <fabio.estevam@nxp.com>
      Signed-off-by: NWolfram Sang <wsa@the-dreams.de>
      20fdcd76
    • M
      i2c: uniphier-f: issue STOP only for last message or I2C_M_STOP · 4c85609b
      Masahiro Yamada 提交于
      This driver currently emits a STOP if the next message is not
      I2C_MD_RD.  It should not do it because it disturbs the I2C_RDWR
      ioctl, where read/write transactions are combined without STOP
      between.
      
      Issue STOP only when the message is the last one _or_ flagged with
      I2C_M_STOP.
      
      Fixes: 6a62974b ("i2c: uniphier_f: add UniPhier FIFO-builtin I2C driver")
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      Signed-off-by: NWolfram Sang <wsa@the-dreams.de>
      4c85609b
    • M
      i2c: uniphier: issue STOP only for last message or I2C_M_STOP · 38f5d8d8
      Masahiro Yamada 提交于
      This driver currently emits a STOP if the next message is not
      I2C_MD_RD.  It should not do it because it disturbs the I2C_RDWR
      ioctl, where read/write transactions are combined without STOP
      between.
      
      Issue STOP only when the message is the last one _or_ flagged with
      I2C_M_STOP.
      
      Fixes: dd6fd4a3 ("i2c: uniphier: add UniPhier FIFO-less I2C driver")
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      Signed-off-by: NWolfram Sang <wsa@the-dreams.de>
      38f5d8d8
    • T
      net: ethernet: cpsw-phy-sel: prefer phandle for phy sel · 18eb8aea
      Tony Lindgren 提交于
      The cpsw-phy-sel device is not a child of the cpsw interconnect target
      module. It lives in the system control module.
      
      Let's fix this issue by trying to use cpsw-phy-sel phandle first if it
      exists and if not fall back to current usage of trying to find the
      cpsw-phy-sel child. That way the phy sel driver can be a child of the
      system control module where it belongs in the device tree.
      
      Without this fix, we cannot have a proper interconnect target module
      hierarchy in device tree for things like genpd.
      
      Note that deferred probe is mostly not supported by cpsw and this patch
      does not attempt to fix that. In case deferred probe support is needed,
      this could be added to cpsw_slave_open() and phy_connect() so they start
      handling and returning errors.
      
      For documenting it, looks like the cpsw-phy-sel is used for all cpsw device
      tree nodes. It's missing the related binding documentation, so let's also
      update the binding documentation accordingly.
      
      Cc: devicetree@vger.kernel.org
      Cc: Andrew Lunn <andrew@lunn.ch>
      Cc: Grygorii Strashko <grygorii.strashko@ti.com>
      Cc: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Murali Karicheri <m-karicheri2@ti.com>
      Cc: Rob Herring <robh+dt@kernel.org>
      Signed-off-by: NTony Lindgren <tony@atomide.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      18eb8aea
  8. 02 9月, 2018 2 次提交
    • L
      of/platform: initialise AMBA default DMA masks · 8c89ef7b
      Linus Walleij 提交于
      This addresses a v4.19-rc1 regression in the PL111 DRM driver in
      drivers/gpu/pl111/*
      
      The driver uses the CMA KMS helpers and will thus at some point call
      down to dma_alloc_attrs() to allocate a chunk of contigous DMA memory
      for the framebuffer.
      
      It appears that in v4.18, it was OK that this (and other DMA mastering
      AMBA devices) left dev->coherent_dma_mask blank (zero).
      
      In v4.19-rc1 the WARN_ON_ONCE(dev && !dev->coherent_dma_mask) in
      dma_alloc_attrs() in include/linux/dma-mapping.h is triggered.  The
      allocation later fails when get_coherent_dma_mask() is called from
      __dma_alloc() and __dma_alloc() returns NULL:
      
      drm-clcd-pl111 dev:20: coherent DMA mask is unset
      drm-clcd-pl111 dev:20: [drm:drm_fb_helper_fbdev_setup] *ERROR*
       	       	        Failed to set fbdev configuration
      
      It turns out that in commit 4d8bde88 ("OF: Don't set default
      coherent DMA mask") the OF core stops setting the default DMA mask on
      new devices, especially those lines of the patch:
      
      - if (!dev->coherent_dma_mask)
      -               dev->coherent_dma_mask = DMA_BIT_MASK(32);
      
      Robin Murphy solved a similar problem in a5516219 ("of/platform:
      Initialise default DMA masks") by simply assigning dev.coherent_dma_mask
      and the dev.dma_mask to point to the same when creating devices from the
      device tree, and introducing the same code into the code path creating
      AMBA/PrimeCell devices solved my problem, graphics now come up.
      
      The code simply assumes that the device can access all of the system
      memory by setting the coherent DMA mask to 0xffffffff when creating a
      device from the device tree, which is crude, but seems to be what kernel
      v4.18 assumed.
      
      The AMBA PrimeCells do not differ between coherent and streaming DMA so
      we can just assign the same to any DMA mask.
      
      Possibly drivers should augment their coherent DMA mask in accordance
      with "dma-ranges" from the device tree if more finegranular masking is
      needed.
      Reported-by: NRussell King <linux@armlinux.org.uk>
      Fixes: 4d8bde88 ("OF: Don't set default coherent DMA mask")
      Cc: Russell King <linux@armlinux.org.uk>
      Cc: Robin Murphy <robin.murphy@arm.com>
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      8c89ef7b
    • K
      random: make CPU trust a boot parameter · 9b254366
      Kees Cook 提交于
      Instead of forcing a distro or other system builder to choose
      at build time whether the CPU is trusted for CRNG seeding via
      CONFIG_RANDOM_TRUST_CPU, provide a boot-time parameter for end users to
      control the choice. The CONFIG will set the default state instead.
      Signed-off-by: NKees Cook <keescook@chromium.org>
      Signed-off-by: NTheodore Ts'o <tytso@mit.edu>
      9b254366
  9. 01 9月, 2018 6 次提交
    • T
      ibmvnic: Include missing return code checks in reset function · f611a5b4
      Thomas Falcon 提交于
      Check the return codes of these functions and halt reset
      in case of failure. The driver will remain in a dormant state
      until the next reset event, when device initialization will be
      re-attempted.
      Signed-off-by: NThomas Falcon <tlfalcon@linux.vnet.ibm.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      f611a5b4
    • D
      hv_netvsc: Fix a deadlock by getting rtnl lock earlier in netvsc_probe() · e04e7a7b
      Dexuan Cui 提交于
      This patch fixes the race between netvsc_probe() and
      rndis_set_subchannel(), which can cause a deadlock.
      
      These are the related 3 paths which show the deadlock:
      
      path #1:
          Workqueue: hv_vmbus_con vmbus_onmessage_work [hv_vmbus]
          Call Trace:
           schedule
           schedule_preempt_disabled
           __mutex_lock
           __device_attach
           bus_probe_device
           device_add
           vmbus_device_register
           vmbus_onoffer
           vmbus_onmessage_work
           process_one_work
           worker_thread
           kthread
           ret_from_fork
      
      path #2:
          schedule
           schedule_preempt_disabled
           __mutex_lock
           netvsc_probe
           vmbus_probe
           really_probe
           __driver_attach
           bus_for_each_dev
           driver_attach_async
           async_run_entry_fn
           process_one_work
           worker_thread
           kthread
           ret_from_fork
      
      path #3:
          Workqueue: events netvsc_subchan_work [hv_netvsc]
          Call Trace:
           schedule
           rndis_set_subchannel
           netvsc_subchan_work
           process_one_work
           worker_thread
           kthread
           ret_from_fork
      
      Before path #1 finishes, path #2 can start to run, because just before
      the "bus_probe_device(dev);" in device_add() in path #1, there is a line
      "object_uevent(&dev->kobj, KOBJ_ADD);", so systemd-udevd can
      immediately try to load hv_netvsc and hence path #2 can start to run.
      
      Next, path #2 offloads the subchannal's initialization to a workqueue,
      i.e. path #3, so we can end up in a deadlock situation like this:
      
      Path #2 gets the device lock, and is trying to get the rtnl lock;
      Path #3 gets the rtnl lock and is waiting for all the subchannel messages
      to be processed;
      Path #1 is trying to get the device lock, but since #2 is not releasing
      the device lock, path #1 has to sleep; since the VMBus messages are
      processed one by one, this means the sub-channel messages can't be
      procedded, so #3 has to sleep with the rtnl lock held, and finally #2
      has to sleep... Now all the 3 paths are sleeping and we hit the deadlock.
      
      With the patch, we can make sure #2 gets both the device lock and the
      rtnl lock together, gets its job done, and releases the locks, so #1
      and #3 will not be blocked for ever.
      
      Fixes: 8195b139 ("hv_netvsc: fix deadlock on hotplug")
      Signed-off-by: NDexuan Cui <decui@microsoft.com>
      Cc: Stephen Hemminger <sthemmin@microsoft.com>
      Cc: K. Y. Srinivasan <kys@microsoft.com>
      Cc: Haiyang Zhang <haiyangz@microsoft.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      e04e7a7b
    • J
      nfp: wait for posted reconfigs when disabling the device · 9ad716b9
      Jakub Kicinski 提交于
      To avoid leaking a running timer we need to wait for the
      posted reconfigs after netdev is unregistered.  In common
      case the process of deinitializing the device will perform
      synchronous reconfigs which wait for posted requests, but
      especially with VXLAN ports being actively added and removed
      there can be a race condition leaving a timer running after
      adapter structure is freed leading to a crash.
      
      Add an explicit flush after deregistering and for a good
      measure a warning to check if timer is running just before
      structures are freed.
      
      Fixes: 3d780b92 ("nfp: add async reconfiguration mechanism")
      Signed-off-by: NJakub Kicinski <jakub.kicinski@netronome.com>
      Reviewed-by: NDirk van der Merwe <dirk.vandermerwe@netronome.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      9ad716b9
    • G
      md-cluster: release RESYNC lock after the last resync message · 41a95041
      Guoqing Jiang 提交于
      All the RESYNC messages are sent with resync lock held, the only
      exception is resync_finish which releases resync_lockres before
      send the last resync message, this should be changed as well.
      Otherwise, we can see deadlock issue as follows:
      
      clustermd2-gqjiang2:~ # cat /proc/mdstat
      Personalities : [raid10] [raid1]
      md0 : active raid1 sdg[0] sdf[1]
            134144 blocks super 1.2 [2/2] [UU]
            [===================>.]  resync = 99.6% (134144/134144) finish=0.0min speed=26K/sec
            bitmap: 1/1 pages [4KB], 65536KB chunk
      
      unused devices: <none>
      clustermd2-gqjiang2:~ # ps aux|grep md|grep D
      root     20497  0.0  0.0      0     0 ?        D    16:00   0:00 [md0_raid1]
      clustermd2-gqjiang2:~ # cat /proc/20497/stack
      [<ffffffffc05ff51e>] dlm_lock_sync+0x8e/0xc0 [md_cluster]
      [<ffffffffc05ff7e8>] __sendmsg+0x98/0x130 [md_cluster]
      [<ffffffffc05ff900>] sendmsg+0x20/0x30 [md_cluster]
      [<ffffffffc05ffc35>] resync_info_update+0xb5/0xc0 [md_cluster]
      [<ffffffffc0593e84>] md_reap_sync_thread+0x134/0x170 [md_mod]
      [<ffffffffc059514c>] md_check_recovery+0x28c/0x510 [md_mod]
      [<ffffffffc060c882>] raid1d+0x42/0x800 [raid1]
      [<ffffffffc058ab61>] md_thread+0x121/0x150 [md_mod]
      [<ffffffff9a0a5b3f>] kthread+0xff/0x140
      [<ffffffff9a800235>] ret_from_fork+0x35/0x40
      [<ffffffffffffffff>] 0xffffffffffffffff
      
      clustermd-gqjiang1:~ # ps aux|grep md|grep D
      root     20531  0.0  0.0      0     0 ?        D    16:00   0:00 [md0_raid1]
      root     20537  0.0  0.0      0     0 ?        D    16:00   0:00 [md0_cluster_rec]
      root     20676  0.0  0.0      0     0 ?        D    16:01   0:00 [md0_resync]
      clustermd-gqjiang1:~ # cat /proc/mdstat
      Personalities : [raid10] [raid1]
      md0 : active raid1 sdf[1] sdg[0]
            134144 blocks super 1.2 [2/2] [UU]
            [===================>.]  resync = 97.3% (131072/134144) finish=8076.8min speed=0K/sec
            bitmap: 1/1 pages [4KB], 65536KB chunk
      
      unused devices: <none>
      clustermd-gqjiang1:~ # cat /proc/20531/stack
      [<ffffffffc080974d>] metadata_update_start+0xcd/0xd0 [md_cluster]
      [<ffffffffc079c897>] md_update_sb.part.61+0x97/0x820 [md_mod]
      [<ffffffffc079f15b>] md_check_recovery+0x29b/0x510 [md_mod]
      [<ffffffffc0816882>] raid1d+0x42/0x800 [raid1]
      [<ffffffffc0794b61>] md_thread+0x121/0x150 [md_mod]
      [<ffffffff9e0a5b3f>] kthread+0xff/0x140
      [<ffffffff9e800235>] ret_from_fork+0x35/0x40
      [<ffffffffffffffff>] 0xffffffffffffffff
      clustermd-gqjiang1:~ # cat /proc/20537/stack
      [<ffffffffc0813222>] freeze_array+0xf2/0x140 [raid1]
      [<ffffffffc080a56e>] recv_daemon+0x41e/0x580 [md_cluster]
      [<ffffffffc0794b61>] md_thread+0x121/0x150 [md_mod]
      [<ffffffff9e0a5b3f>] kthread+0xff/0x140
      [<ffffffff9e800235>] ret_from_fork+0x35/0x40
      [<ffffffffffffffff>] 0xffffffffffffffff
      clustermd-gqjiang1:~ # cat /proc/20676/stack
      [<ffffffffc080951e>] dlm_lock_sync+0x8e/0xc0 [md_cluster]
      [<ffffffffc080957f>] lock_token+0x2f/0xa0 [md_cluster]
      [<ffffffffc0809622>] lock_comm+0x32/0x90 [md_cluster]
      [<ffffffffc08098f5>] sendmsg+0x15/0x30 [md_cluster]
      [<ffffffffc0809c0a>] resync_info_update+0x8a/0xc0 [md_cluster]
      [<ffffffffc08130ba>] raid1_sync_request+0xa9a/0xb10 [raid1]
      [<ffffffffc079b8ea>] md_do_sync+0xbaa/0xf90 [md_mod]
      [<ffffffffc0794b61>] md_thread+0x121/0x150 [md_mod]
      [<ffffffff9e0a5b3f>] kthread+0xff/0x140
      [<ffffffff9e800235>] ret_from_fork+0x35/0x40
      [<ffffffffffffffff>] 0xffffffffffffffff
      Reviewed-by: NNeilBrown <neilb@suse.com>
      Signed-off-by: NGuoqing Jiang <gqjiang@suse.com>
      Signed-off-by: NShaohua Li <shli@fb.com>
      41a95041
    • X
      RAID10 BUG_ON in raise_barrier when force is true and conf->barrier is 0 · 1d0ffd26
      Xiao Ni 提交于
      In raid10 reshape_request it gets max_sectors in read_balance. If the underlayer disks
      have bad blocks, the max_sectors is less than last. It will call goto read_more many
      times. It calls raise_barrier(conf, sectors_done != 0) every time. In this condition
      sectors_done is not 0. So the value passed to the argument force of raise_barrier is
      true.
      
      In raise_barrier it checks conf->barrier when force is true. If force is true and
      conf->barrier is 0, it panic. In this case reshape_request submits bio to under layer
      disks. And in the callback function of the bio it calls lower_barrier. If the bio
      finishes before calling raise_barrier again, it can trigger the BUG_ON.
      
      Add one pair of raise_barrier/lower_barrier to fix this bug.
      Signed-off-by: NXiao Ni <xni@redhat.com>
      Suggested-by: NNeil Brown <neilb@suse.com>
      Signed-off-by: NShaohua Li <shli@fb.com>
      1d0ffd26
    • S
      md/raid5-cache: disable reshape completely · e254de6b
      Shaohua Li 提交于
      We don't support reshape yet if an array supports log device. Previously we
      determine the fact by checking ->log. However, ->log could be NULL after a log
      device is removed, but the array is still marked to support log device. Don't
      allow reshape in this case too. User can disable log device support by setting
      'consistency_policy' to 'resync' then do reshape.
      Reported-by: NXiao Ni <xni@redhat.com>
      Tested-by: NXiao Ni <xni@redhat.com>
      Signed-off-by: NShaohua Li <shli@fb.com>
      e254de6b
  10. 31 8月, 2018 1 次提交
    • V
      gpio: Fix crash due to registration race · d49b48f0
      Vincent Whitchurch 提交于
      gpiochip_add_data_with_key() adds the gpiochip to the gpio_devices list
      before of_gpiochip_add() is called, but it's only the latter which sets
      the ->of_xlate function pointer.  gpiochip_find() can be called by
      someone else between these two actions, and it can find the chip and
      call of_gpiochip_match_node_and_xlate() which leads to the following
      crash due to a NULL ->of_xlate().
      
       Unhandled prefetch abort: page domain fault (0x01b) at 0x00000000
       Modules linked in: leds_gpio(+) gpio_generic(+)
       CPU: 0 PID: 830 Comm: insmod Not tainted 4.18.0+ #43
       Hardware name: ARM-Versatile Express
       PC is at   (null)
       LR is at of_gpiochip_match_node_and_xlate+0x2c/0x38
       Process insmod (pid: 830, stack limit = 0x(ptrval))
        (of_gpiochip_match_node_and_xlate) from  (gpiochip_find+0x48/0x84)
        (gpiochip_find) from  (of_get_named_gpiod_flags+0xa8/0x238)
        (of_get_named_gpiod_flags) from  (gpiod_get_from_of_node+0x2c/0xc8)
        (gpiod_get_from_of_node) from  (devm_fwnode_get_index_gpiod_from_child+0xb8/0x144)
        (devm_fwnode_get_index_gpiod_from_child) from  (gpio_led_probe+0x208/0x3c4 [leds_gpio])
        (gpio_led_probe [leds_gpio]) from  (platform_drv_probe+0x48/0x9c)
        (platform_drv_probe) from  (really_probe+0x1d0/0x3d4)
        (really_probe) from  (driver_probe_device+0x78/0x1c0)
        (driver_probe_device) from  (__driver_attach+0x120/0x13c)
        (__driver_attach) from  (bus_for_each_dev+0x68/0xb4)
        (bus_for_each_dev) from  (bus_add_driver+0x1a8/0x268)
        (bus_add_driver) from  (driver_register+0x78/0x10c)
        (driver_register) from  (do_one_initcall+0x54/0x1fc)
        (do_one_initcall) from  (do_init_module+0x64/0x1f4)
        (do_init_module) from  (load_module+0x2198/0x26ac)
        (load_module) from  (sys_finit_module+0xe0/0x110)
        (sys_finit_module) from  (ret_fast_syscall+0x0/0x54)
      
      One way to fix this would be to rework the hairy registration sequence
      in gpiochip_add_data_with_key(), but since I'd probably introduce a
      couple of new bugs if I attempted that, simply add a check for a
      non-NULL of_xlate function pointer in
      of_gpiochip_match_node_and_xlate().  This works since the driver looking
      for the gpio will simply fail to find the gpio and defer its probe and
      be reprobed when the driver which is registering the gpiochip has fully
      completed its probe.
      Signed-off-by: NVincent Whitchurch <vincent.whitchurch@axis.com>
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      d49b48f0