1. 20 10月, 2021 1 次提交
  2. 19 10月, 2021 3 次提交
    • J
      nvme: wire up completion batching for the IRQ path · 4f502245
      Jens Axboe 提交于
      Trivial to do now, just need our own io_comp_batch on the stack and pass
      that in to the usual command completion handling.
      
      I pondered making this dependent on how many entries we had to process,
      but even for a single entry there's no discernable difference in
      performance or latency. Running a sync workload over io_uring:
      
      t/io_uring -b512 -d1 -s1 -c1 -p0 -F1 -B1 -n2 /dev/nvme1n1 /dev/nvme2n1
      
      yields the below performance before the patch:
      
      IOPS=254820, BW=124MiB/s, IOS/call=1/1, inflight=(1 1)
      IOPS=251174, BW=122MiB/s, IOS/call=1/1, inflight=(1 1)
      IOPS=250806, BW=122MiB/s, IOS/call=1/1, inflight=(1 1)
      
      and the following after:
      
      IOPS=255972, BW=124MiB/s, IOS/call=1/1, inflight=(1 1)
      IOPS=251920, BW=123MiB/s, IOS/call=1/1, inflight=(1 1)
      IOPS=251794, BW=122MiB/s, IOS/call=1/1, inflight=(1 1)
      
      which definitely isn't slower, about the same if you factor in a bit of
      variance. For peak performance workloads, benchmarking shows a 2%
      improvement.
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NJens Axboe <axboe@kernel.dk>
      4f502245
    • J
      nvme: add support for batched completion of polled IO · c234a653
      Jens Axboe 提交于
      Take advantage of struct io_comp_batch, if passed in to the nvme poll
      handler. If it's set, rather than complete each request individually
      inline, store them in the io_comp_batch list. We only do so for requests
      that will complete successfully, anything else will be completed inline as
      before.
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NJens Axboe <axboe@kernel.dk>
      c234a653
    • J
      block: add a struct io_comp_batch argument to fops->iopoll() · 5a72e899
      Jens Axboe 提交于
      struct io_comp_batch contains a list head and a completion handler, which
      will allow completions to more effciently completed batches of IO.
      
      For now, no functional changes in this patch, we just define the
      io_comp_batch structure and add the argument to the file_operations iopoll
      handler.
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NJens Axboe <axboe@kernel.dk>
      5a72e899
  3. 18 10月, 2021 13 次提交
  4. 17 10月, 2021 1 次提交
  5. 16 10月, 2021 4 次提交
  6. 15 10月, 2021 7 次提交
  7. 14 10月, 2021 11 次提交
    • I
      mlxsw: thermal: Fix out-of-bounds memory accesses · 332fdf95
      Ido Schimmel 提交于
      Currently, mlxsw allows cooling states to be set above the maximum
      cooling state supported by the driver:
      
       # cat /sys/class/thermal/thermal_zone2/cdev0/type
       mlxsw_fan
       # cat /sys/class/thermal/thermal_zone2/cdev0/max_state
       10
       # echo 18 > /sys/class/thermal/thermal_zone2/cdev0/cur_state
       # echo $?
       0
      
      This results in out-of-bounds memory accesses when thermal state
      transition statistics are enabled (CONFIG_THERMAL_STATISTICS=y), as the
      transition table is accessed with a too large index (state) [1].
      
      According to the thermal maintainer, it is the responsibility of the
      driver to reject such operations [2].
      
      Therefore, return an error when the state to be set exceeds the maximum
      cooling state supported by the driver.
      
      To avoid dead code, as suggested by the thermal maintainer [3],
      partially revert commit a421ce08 ("mlxsw: core: Extend cooling
      device with cooling levels") that tried to interpret these invalid
      cooling states (above the maximum) in a special way. The cooling levels
      array is not removed in order to prevent the fans going below 20% PWM,
      which would cause them to get stuck at 0% PWM.
      
      [1]
      BUG: KASAN: slab-out-of-bounds in thermal_cooling_device_stats_update+0x271/0x290
      Read of size 4 at addr ffff8881052f7bf8 by task kworker/0:0/5
      
      CPU: 0 PID: 5 Comm: kworker/0:0 Not tainted 5.15.0-rc3-custom-45935-gce1adf704b14 #122
      Hardware name: Mellanox Technologies Ltd. "MSN2410-CB2FO"/"SA000874", BIOS 4.6.5 03/08/2016
      Workqueue: events_freezable_power_ thermal_zone_device_check
      Call Trace:
       dump_stack_lvl+0x8b/0xb3
       print_address_description.constprop.0+0x1f/0x140
       kasan_report.cold+0x7f/0x11b
       thermal_cooling_device_stats_update+0x271/0x290
       __thermal_cdev_update+0x15e/0x4e0
       thermal_cdev_update+0x9f/0xe0
       step_wise_throttle+0x770/0xee0
       thermal_zone_device_update+0x3f6/0xdf0
       process_one_work+0xa42/0x1770
       worker_thread+0x62f/0x13e0
       kthread+0x3ee/0x4e0
       ret_from_fork+0x1f/0x30
      
      Allocated by task 1:
       kasan_save_stack+0x1b/0x40
       __kasan_kmalloc+0x7c/0x90
       thermal_cooling_device_setup_sysfs+0x153/0x2c0
       __thermal_cooling_device_register.part.0+0x25b/0x9c0
       thermal_cooling_device_register+0xb3/0x100
       mlxsw_thermal_init+0x5c5/0x7e0
       __mlxsw_core_bus_device_register+0xcb3/0x19c0
       mlxsw_core_bus_device_register+0x56/0xb0
       mlxsw_pci_probe+0x54f/0x710
       local_pci_probe+0xc6/0x170
       pci_device_probe+0x2b2/0x4d0
       really_probe+0x293/0xd10
       __driver_probe_device+0x2af/0x440
       driver_probe_device+0x51/0x1e0
       __driver_attach+0x21b/0x530
       bus_for_each_dev+0x14c/0x1d0
       bus_add_driver+0x3ac/0x650
       driver_register+0x241/0x3d0
       mlxsw_sp_module_init+0xa2/0x174
       do_one_initcall+0xee/0x5f0
       kernel_init_freeable+0x45a/0x4de
       kernel_init+0x1f/0x210
       ret_from_fork+0x1f/0x30
      
      The buggy address belongs to the object at ffff8881052f7800
       which belongs to the cache kmalloc-1k of size 1024
      The buggy address is located 1016 bytes inside of
       1024-byte region [ffff8881052f7800, ffff8881052f7c00)
      The buggy address belongs to the page:
      page:0000000052355272 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1052f0
      head:0000000052355272 order:3 compound_mapcount:0 compound_pincount:0
      flags: 0x200000000010200(slab|head|node=0|zone=2)
      raw: 0200000000010200 ffffea0005034800 0000000300000003 ffff888100041dc0
      raw: 0000000000000000 0000000000100010 00000001ffffffff 0000000000000000
      page dumped because: kasan: bad access detected
      
      Memory state around the buggy address:
       ffff8881052f7a80: 00 00 00 00 00 00 04 fc fc fc fc fc fc fc fc fc
       ffff8881052f7b00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
      >ffff8881052f7b80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
                                                                      ^
       ffff8881052f7c00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
       ffff8881052f7c80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
      
      [2] https://lore.kernel.org/linux-pm/9aca37cb-1629-5c67-1895-1fdc45c0244e@linaro.org/
      [3] https://lore.kernel.org/linux-pm/af9857f2-578e-de3a-e62b-6baff7e69fd4@linaro.org/
      
      CC: Daniel Lezcano <daniel.lezcano@linaro.org>
      Fixes: a50c1e35 ("mlxsw: core: Implement thermal zone")
      Fixes: a421ce08 ("mlxsw: core: Extend cooling device with cooling levels")
      Signed-off-by: NIdo Schimmel <idosch@nvidia.com>
      Tested-by: NVadim Pasternak <vadimp@nvidia.com>
      Link: https://lore.kernel.org/r/20211012174955.472928-1-idosch@idosch.orgSigned-off-by: NJakub Kicinski <kuba@kernel.org>
      332fdf95
    • A
      ethernet: s2io: fix setting mac address during resume · 40507e7a
      Arnd Bergmann 提交于
      After recent cleanups, gcc started warning about a suspicious
      memcpy() call during the s2io_io_resume() function:
      
      In function '__dev_addr_set',
          inlined from 'eth_hw_addr_set' at include/linux/etherdevice.h:318:2,
          inlined from 's2io_set_mac_addr' at drivers/net/ethernet/neterion/s2io.c:5205:2,
          inlined from 's2io_io_resume' at drivers/net/ethernet/neterion/s2io.c:8569:7:
      arch/x86/include/asm/string_32.h:182:25: error: '__builtin_memcpy' accessing 6 bytes at offsets 0 and 2 overlaps 4 bytes at offset 2 [-Werror=restrict]
        182 | #define memcpy(t, f, n) __builtin_memcpy(t, f, n)
            |                         ^~~~~~~~~~~~~~~~~~~~~~~~~
      include/linux/netdevice.h:4648:9: note: in expansion of macro 'memcpy'
       4648 |         memcpy(dev->dev_addr, addr, len);
            |         ^~~~~~
      
      What apparently happened is that an old cleanup changed the calling
      conventions for s2io_set_mac_addr() from taking an ethernet address
      as a character array to taking a struct sockaddr, but one of the
      callers was not changed at the same time.
      
      Change it to instead call the low-level do_s2io_prog_unicast() function
      that still takes the old argument type.
      
      Fixes: 2fd37688 ("S2io: Added support set_mac_address driver entry point")
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Link: https://lore.kernel.org/r/20211013143613.2049096-1-arnd@kernel.orgSigned-off-by: NJakub Kicinski <kuba@kernel.org>
      40507e7a
    • U
      spi-mux: Fix false-positive lockdep splats · 16a8e2fb
      Uwe Kleine-König 提交于
      io_mutex is taken by spi_setup() and spi-mux's .setup() callback calls
      spi_setup() which results in a nested lock of io_mutex.
      
      add_lock is taken by spi_add_device(). The device_add() call in there
      can result in calling spi-mux's .probe() callback which registers its
      own spi controller which in turn results in spi_add_device() being
      called again.
      
      To fix this initialize the controller's locks already in
      spi_alloc_controller() to give spi_mux_probe() a chance to set the
      lockdep subclass.
      Signed-off-by: NUwe Kleine-König <u.kleine-koenig@pengutronix.de>
      Link: https://lore.kernel.org/r/20211013133710.2679703-2-u.kleine-koenig@pengutronix.deSigned-off-by: NMark Brown <broonie@kernel.org>
      16a8e2fb
    • M
      spi: Fix deadlock when adding SPI controllers on SPI buses · 6098475d
      Mark Brown 提交于
      Currently we have a global spi_add_lock which we take when adding new
      devices so that we can check that we're not trying to reuse a chip
      select that's already controlled.  This means that if the SPI device is
      itself a SPI controller and triggers the instantiation of further SPI
      devices we trigger a deadlock as we try to register and instantiate
      those devices while in the process of doing so for the parent controller
      and hence already holding the global spi_add_lock.  Since we only care
      about concurrency within a single SPI bus move the lock to be per
      controller, avoiding the deadlock.
      
      This can be easily triggered in the case of spi-mux.
      Reported-by: NUwe Kleine-König <u.kleine-koenig@pengutronix.de>
      Signed-off-by: NMark Brown <broonie@kernel.org>
      6098475d
    • H
      EDAC/armada-xp: Fix output of uncorrectable error counter · d9b7748f
      Hans Potsch 提交于
      The number of correctable errors is displayed as uncorrectable
      errors because the "SBE" error count is passed to both calls of
      edac_mc_handle_error().
      
      Pass the correct uncorrectable error count to the second
      edac_mc_handle_error() call when logging uncorrectable errors.
      
       [ bp: Massage commit message. ]
      
      Fixes: 7f6998a4 ("ARM: 8888/1: EDAC: Add driver for the Marvell Armada XP SDRAM and L2 cache ECC")
      Signed-off-by: NHans Potsch <hans.potsch@nokia.com>
      Signed-off-by: NBorislav Petkov <bp@suse.de>
      Cc: <stable@vger.kernel.org>
      Link: https://lkml.kernel.org/r/20211006121332.58788-1-hans.potsch@nokia.com
      d9b7748f
    • A
      nvme: fix per-namespace chardev deletion · be5eb933
      Adam Manzanares 提交于
      Decrease reference count of chardevice during char device deletion in
      order to fix a memory leak.  Add a release callabck for the device
      associated chardev and move ida_simple_remove into the release function.
      
      Fixes: 2637baed ("nvme: introduce generic per-namespace chardev")
      Reported-by: NYi Zhang <yi.zhang@redhat.com>
      Suggested-by: NSagi Grimberg <sagi@grimberg.me>
      Signed-off-by: NAdam Manzanares <a.manzanares@samsung.com>
      Reviewed-by: NJavier González <javier@javigon.com>
      Tested-by: NYi Zhang <yi.zhang@redhat.com>
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      be5eb933
    • W
      ata: ahci_platform: fix null-ptr-deref in ahci_platform_enable_regulators() · 776c7501
      Wang Hai 提交于
      I got a null-ptr-deref report:
      
      KASAN: null-ptr-deref in range [0x0000000000000090-0x0000000000000097]
      ...
      RIP: 0010:regulator_enable+0x84/0x260
      ...
      Call Trace:
       ahci_platform_enable_regulators+0xae/0x320
       ahci_platform_enable_resources+0x1a/0x120
       ahci_probe+0x4f/0x1b9
       platform_probe+0x10b/0x280
      ...
       entry_SYSCALL_64_after_hwframe+0x44/0xae
      
      If devm_regulator_get() in ahci_platform_get_resources() fails,
      hpriv->phy_regulator will point to NULL, when enabling or disabling it,
      null-ptr-deref will occur.
      
      ahci_probe()
      	ahci_platform_get_resources()
      		devm_regulator_get(, "phy") // failed, let phy_regulator = NULL
      	ahci_platform_enable_resources()
      		ahci_platform_enable_regulators()
      			regulator_enable(hpriv->phy_regulator) // null-ptr-deref
      
      commit 962399bb ("ata: libahci_platform: Fix regulator_get_optional()
      misuse") replaces devm_regulator_get_optional() with devm_regulator_get(),
      but PHY regulator omits to delete "hpriv->phy_regulator = NULL;" like AHCI.
      Delete it like AHCI regulator to fix this bug.
      
      Fixes: commit 962399bb ("ata: libahci_platform: Fix regulator_get_optional() misuse")
      Reported-by: NHulk Robot <hulkci@huawei.com>
      Signed-off-by: NWang Hai <wanghai38@huawei.com>
      Reviewed-by: NHans de Goede <hdegoede@redhat.com>
      Signed-off-by: NDamien Le Moal <damien.lemoal@wdc.com>
      776c7501
    • N
      net: encx24j600: check error in devm_regmap_init_encx24j600 · f03dca0c
      Nanyong Sun 提交于
      devm_regmap_init may return error which caused by like out of memory,
      this will results in null pointer dereference later when reading
      or writing register:
      
      general protection fault in encx24j600_spi_probe
      KASAN: null-ptr-deref in range [0x0000000000000090-0x0000000000000097]
      CPU: 0 PID: 286 Comm: spi-encx24j600- Not tainted 5.15.0-rc2-00142-g9978db750e31-dirty #11 9c53a778c1306b1b02359f3c2bbedc0222cba652
      Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.13.0-1ubuntu1.1 04/01/2014
      RIP: 0010:regcache_cache_bypass drivers/base/regmap/regcache.c:540
      Code: 54 41 89 f4 55 53 48 89 fb 48 83 ec 08 e8 26 94 a8 fe 48 8d bb a0 00 00 00 48 b8 00 00 00 00 00 fc ff df 48 89 fa 48 c1 ea 03 <80> 3c 02 00 0f 85 4a 03 00 00 4c 8d ab b0 00 00 00 48 8b ab a0 00
      RSP: 0018:ffffc900010476b8 EFLAGS: 00010207
      RAX: dffffc0000000000 RBX: fffffffffffffff4 RCX: 0000000000000000
      RDX: 0000000000000012 RSI: ffff888002de0000 RDI: 0000000000000094
      RBP: ffff888013c9a000 R08: 0000000000000000 R09: fffffbfff3f9cc6a
      R10: ffffc900010476e8 R11: fffffbfff3f9cc69 R12: 0000000000000001
      R13: 000000000000000a R14: ffff888013c9af54 R15: ffff888013c9ad08
      FS:  00007ffa984ab580(0000) GS:ffff88801fe00000(0000) knlGS:0000000000000000
      CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      CR2: 000055a6384136c8 CR3: 000000003bbe6003 CR4: 0000000000770ef0
      DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
      PKRU: 55555554
      Call Trace:
       encx24j600_spi_probe drivers/net/ethernet/microchip/encx24j600.c:459
       spi_probe drivers/spi/spi.c:397
       really_probe drivers/base/dd.c:517
       __driver_probe_device drivers/base/dd.c:751
       driver_probe_device drivers/base/dd.c:782
       __device_attach_driver drivers/base/dd.c:899
       bus_for_each_drv drivers/base/bus.c:427
       __device_attach drivers/base/dd.c:971
       bus_probe_device drivers/base/bus.c:487
       device_add drivers/base/core.c:3364
       __spi_add_device drivers/spi/spi.c:599
       spi_add_device drivers/spi/spi.c:641
       spi_new_device drivers/spi/spi.c:717
       new_device_store+0x18c/0x1f1 [spi_stub 4e02719357f1ff33f5a43d00630982840568e85e]
       dev_attr_store drivers/base/core.c:2074
       sysfs_kf_write fs/sysfs/file.c:139
       kernfs_fop_write_iter fs/kernfs/file.c:300
       new_sync_write fs/read_write.c:508 (discriminator 4)
       vfs_write fs/read_write.c:594
       ksys_write fs/read_write.c:648
       do_syscall_64 arch/x86/entry/common.c:50
       entry_SYSCALL_64_after_hwframe arch/x86/entry/entry_64.S:113
      
      Add error check in devm_regmap_init_encx24j600 to avoid this situation.
      
      Fixes: 04fbfce7 ("net: Microchip encx24j600 driver")
      Reported-by: NHulk Robot <hulkci@huawei.com>
      Signed-off-by: NNanyong Sun <sunnanyong@huawei.com>
      Link: https://lore.kernel.org/r/20211012125901.3623144-1-sunnanyong@huawei.comSigned-off-by: NJakub Kicinski <kuba@kernel.org>
      f03dca0c
    • V
      net: korina: select CRC32 · 427f974d
      Vegard Nossum 提交于
      Fix the following build/link error by adding a dependency on the CRC32
      routines:
      
        ld: drivers/net/ethernet/korina.o: in function `korina_multicast_list':
        korina.c:(.text+0x1af): undefined reference to `crc32_le'
      
      Fixes: ef11291b ("Add support the Korina (IDT RC32434) Ethernet MAC")
      Cc: Arnd Bergmann <arnd@arndb.de>
      Signed-off-by: NVegard Nossum <vegard.nossum@oracle.com>
      Acked-by: NFlorian fainelli <f.fainelli@gmail.com>
      Link: https://lore.kernel.org/r/20211012152509.21771-1-vegard.nossum@oracle.comSigned-off-by: NJakub Kicinski <kuba@kernel.org>
      427f974d
    • A
      iommu/arm: fix ARM_SMMU_QCOM compilation · 0f0f80d9
      Arnd Bergmann 提交于
      My previous bugfix ended up making things worse for the QCOM IOMMU
      driver when it forgot to add the Kconfig symbol that is getting used to
      control the compilation of the SMMU implementation specific code
      for Qualcomm.
      
      Fixes: 424953cf ("qcom_scm: hide Kconfig symbol")
      Reported-by: NDaniel Lezcano <daniel.lezcano@linaro.org>
      Reported-by: NDmitry Baryshkov <dmitry.baryshkov@linaro.org>
      Reported-by: NJohn Stultz <john.stultz@linaro.org>
      Link: https://lore.kernel.org/lkml/20211010023350.978638-1-dmitry.baryshkov@linaro.org/Acked-by: NWill Deacon <will@kernel.org>
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      0f0f80d9
    • L
      clk: qcom: add select QCOM_GDSC for SM6350 · 92c02ff1
      Luca Weiss 提交于
      QCOM_GDSC is needed for the gcc driver to probe.
      
      Fixes: 131abae9 ("clk: qcom: Add SM6350 GCC driver")
      Signed-off-by: NLuca Weiss <luca@z3ntu.xyz>
      Reviewed-by: NKonrad Dybcio <konrad.dybcio@somainline.org>
      Link: https://lore.kernel.org/r/20211007212444.328034-2-luca@z3ntu.xyzSigned-off-by: NStephen Boyd <sboyd@kernel.org>
      92c02ff1