1. 25 Oct, 2021 6 commits
    • Dave Jiang's avatar
      dmanegine: idxd: fix resource free ordering on driver removal · 98da0106
      Dave Jiang authored
      Fault triggers on ioread32() when pci driver unbind is envoked. The
      placement of idxd sub-driver removal causes the probing of the device mmio
      region after the mmio mapping being torn down. The driver needs the
      sub-drivers to be unbound but not release the idxd context until all
      shutdown activities has been done. Move the sub-driver unregistering up
      before the remove() calls shutdown(). But take a device ref on the
      idxd->conf_dev so that the memory does not get freed in ->release(). When
      all cleanup activities has been done, release the ref to allow the idxd
      memory to be freed.
      
      [57159.542766] RIP: 0010:ioread32+0x27/0x60
      [57159.547097] Code: 00 66 90 48 81 ff ff ff 03 00 77 1e 48 81 ff 00 00 01 00 76 05 0f
       b7 d7 ed c3 8b 15 03 50 41 01 b8 ff ff ff ff 85 d2 75 04 c3 <8b> 07 c3 55 83 ea 01 48
       89 fe 48 c7 c7 00 70 5f 82 48 89 e5 48 83
      [57159.566647] RSP: 0018:ffffc900011abb60 EFLAGS: 00010292
      [57159.572295] RAX: ffffc900011e0000 RBX: ffff888107d39800 RCX: 0000000000000000
      [57159.579842] RDX: 0000000000000000 RSI: ffffffff82b1e448 RDI: ffffc900011e0090
      [57159.587421] RBP: ffffc900011abb88 R08: 0000000000000000 R09: 0000000000000001
      [57159.594972] R10: 0000000000000001 R11: 0000000000000000 R12: ffff8881019840d0
      [57159.602533] R13: ffff8881097e9000 R14: ffffffffa08542a0 R15: 00000000000003a8
      [57159.610093] FS:  00007f991e0a8740(0000) GS:ffff888459900000(0000) knlGS:00000000000
      00000
      [57159.618614] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      [57159.624814] CR2: ffffc900011e0090 CR3: 000000010862a002 CR4: 00000000003706e0
      [57159.632397] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      [57159.639973] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
      [57159.647601] Call Trace:
      [57159.650502]  ? idxd_device_disable+0x41/0x110 [idxd]
      [57159.655948]  idxd_device_drv_remove+0x2b/0x80 [idxd]
      [57159.661374]  idxd_config_bus_remove+0x16/0x20
      [57159.666191]  __device_release_driver+0x163/0x240
      [57159.671320]  device_release_driver+0x2b/0x40
      [57159.676052]  bus_remove_device+0xf5/0x160
      [57159.680524]  device_del+0x19c/0x400
      [57159.684440]  device_unregister+0x18/0x60
      [57159.688792]  idxd_remove+0x140/0x1c0 [idxd]
      [57159.693406]  pci_device_remove+0x3e/0xb0
      [57159.697758]  __device_release_driver+0x163/0x240
      [57159.702788]  device_driver_detach+0x43/0xb0
      [57159.707424]  unbind_store+0x11e/0x130
      [57159.711537]  drv_attr_store+0x24/0x30
      [57159.715646]  sysfs_kf_write+0x4b/0x60
      [57159.719710]  kernfs_fop_write_iter+0x153/0x1e0
      [57159.724563]  new_sync_write+0x120/0x1b0
      [57159.728812]  vfs_write+0x23e/0x350
      [57159.732624]  ksys_write+0x70/0xf0
      [57159.736335]  __x64_sys_write+0x1a/0x20
      [57159.740492]  do_syscall_64+0x3b/0x90
      [57159.744465]  entry_SYSCALL_64_after_hwframe+0x44/0xae
      [57159.749908] RIP: 0033:0x7f991e19c387
      [57159.753898] Code: 0d 00 f7 d8 64 89 02 48 c7 c0 ff ff ff ff eb b7 0f 1f 00 f3 0f 1e
       fa 64 8b 04 25 18 00 00 00 85 c0 75 10 b8 01 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 51
       c3 48 83 ec 28 48 89 54 24 18 48 89 74 24
      [57159.773564] RSP: 002b:00007ffc2ce2d6a8 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
      [57159.781550] RAX: ffffffffffffffda RBX: 000000000000000c RCX: 00007f991e19c387
      [57159.789133] RDX: 000000000000000c RSI: 000055ee2630e140 RDI: 0000000000000001
      [57159.796695] RBP: 000055ee2630e140 R08: 0000000000000000 R09: 00007f991e2324e0
      [57159.804246] R10: 00007f991e2323e0 R11: 0000000000000246 R12: 000000000000000c
      [57159.811800] R13: 00007f991e26f520 R14: 000000000000000c R15: 00007f991e26f700
      [57159.819373] Modules linked in: idxd bridge stp llc bnep sunrpc nls_iso8859_1 intel_
      rapl_msr intel_rapl_common x86_pkg_temp_thermal intel_powerclamp coretemp snd_hda_code
      c_realtek iTCO_wdt 8250_dw snd_hda_codec_generic kvm_intel ledtrig_audio iTCO_vendor_s
      upport snd_hda_intel snd_intel_dspcfg ppdev kvm snd_hda_codec intel_wmi_thunderbolt sn
      d_hwdep irqbypass iwlwifi btusb snd_hda_core rapl btrtl intel_cstate snd_seq btbcm snd
      _seq_device btintel snd_pcm cfg80211 bluetooth pcspkr psmouse input_leds snd_timer int
      el_lpss_pci mei_me intel_lpss snd ecdh_generic ecc mei ucsi_acpi i2c_i801 idma64 i2c_s
      mbus virt_dma soundcore typec_ucsi typec wmi parport_pc parport video mac_hid acpi_pad
       sch_fq_codel drm ip_tables x_tables crct10dif_pclmul crc32_pclmul ghash_clmulni_intel
       usbkbd hid_generic usbmouse aesni_intel usbhid crypto_simd cryptd e1000e hid serio_ra
      w ahci libahci pinctrl_sunrisepoint fuse msr autofs4 [last unloaded: idxd]
      [57159.904082] CR2: ffffc900011e0090
      [57159.907877] ---[ end trace b4e32f49ce9176a4 ]---
      
      Fixes: 49c4959f ("dmaengine: idxd: fix sequence for pci driver remove() and shutdown()")
      Reported-by: default avatarZiye Yang <ziye.yang@intel.com>
      Signed-off-by: default avatarDave Jiang <dave.jiang@intel.com>
      Link: https://lore.kernel.org/r/163225535868.4152687.9318737776682088722.stgit@djiang5-desk3.ch.intel.comSigned-off-by: default avatarVinod Koul <vkoul@kernel.org>
      98da0106
    • Dave Jiang's avatar
      dmaengine: idxd: remove kernel wq type set when load configuration · 15af8408
      Dave Jiang authored
      Remove setting of wq type on guest kernel during configuration load on RO
      device config. The user will set the kernel wq type and this setting based
      on config is not necessary.
      Signed-off-by: default avatarDave Jiang <dave.jiang@intel.com>
      Link: https://lore.kernel.org/r/163474724511.2607444.1876715711451990426.stgit@djiang5-desk3.ch.intel.comSigned-off-by: default avatarVinod Koul <vkoul@kernel.org>
      15af8408
    • Dongliang Mu's avatar
      dmaengine: tegra210-adma: fix pm runtime unbalance in tegra_adma_remove · 2f802d0a
      Dongliang Mu authored
      Since pm_runtime_put is done when tegra_adma_probe is successful, we
      cannot do pm_runtime_put_sync again in tegra_adma_remove.
      
      Fix this by removing the pm_runtime_put_sync in tegra_adma_remove.
      Signed-off-by: default avatarDongliang Mu <mudongliangabcd@gmail.com>
      Reviewed-by: default avatarJon Hunter <jonathanh@nvidia.com>
      Link: https://lore.kernel.org/r/20211021031432.3466261-1-mudongliangabcd@gmail.comSigned-off-by: default avatarVinod Koul <vkoul@kernel.org>
      2f802d0a
    • Dongliang Mu's avatar
      dmaengine: tegra210-adma: fix pm runtime unbalance · c5a51fc8
      Dongliang Mu authored
      The previous commit 059e969c ("dmaengine: tegra210-adma: Using
      pm_runtime_resume_and_get to replace open coding") forgets to replace
      the pm_runtime_get_sync in the tegra_adma_probe, but removes the
      pm_runtime_put_noidle.
      
      Fix this by continuing to replace pm_runtime_get_sync with
      pm_runtime_resume_and_get in tegra_adma_probe.
      
      Fixes: 059e969c ("dmaengine: tegra210-adma: Using pm_runtime_resume_and_get to replace open coding")
      Signed-off-by: default avatarDongliang Mu <mudongliangabcd@gmail.com>
      Reviewed-by: default avatarJon Hunter <jonathanh@nvidia.com>
      Link: https://lore.kernel.org/r/20211021030538.3465287-1-mudongliangabcd@gmail.comSigned-off-by: default avatarVinod Koul <vkoul@kernel.org>
      c5a51fc8
    • Dongliang Mu's avatar
      dmaengine: rcar-dmac: refactor the error handling code of rcar_dmac_probe · 05f4fae9
      Dongliang Mu authored
      In rcar_dmac_probe, if pm_runtime_resume_and_get fails, it forgets to
      disable runtime PM. And of_dma_controller_free should only be invoked
      after the success of of_dma_controller_register.
      
      Fix this by refactoring the error handling code.
      Signed-off-by: default avatarDongliang Mu <mudongliangabcd@gmail.com>
      Reviewed-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
      Reviewed-by: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
      Link: https://lore.kernel.org/r/20211020143546.3436205-1-mudongliangabcd@gmail.comSigned-off-by: default avatarVinod Koul <vkoul@kernel.org>
      05f4fae9
    • Lars-Peter Clausen's avatar
      dmaengine: dmaengine_desc_callback_valid(): Check for `callback_result` · e7e1e880
      Lars-Peter Clausen authored
      Before the `callback_result` callback was introduced drivers coded their
      invocation to the callback in a similar way to:
      
      	if (cb->callback) {
      		spin_unlock(&dma->lock);
      		cb->callback(cb->callback_param);
      		spin_lock(&dma->lock);
      	}
      
      With the introduction of `callback_result` two helpers where introduced to
      transparently handle both types of callbacks. And drivers where updated to
      look like this:
      
      	if (dmaengine_desc_callback_valid(cb)) {
      		spin_unlock(&dma->lock);
      		dmaengine_desc_callback_invoke(cb, ...);
      		spin_lock(&dma->lock);
      	}
      
      dmaengine_desc_callback_invoke() correctly handles both `callback_result`
      and `callback`. But we forgot to update the dmaengine_desc_callback_valid()
      function to check for `callback_result`. As a result DMA descriptors that
      use the `callback_result` rather than `callback` don't have their callback
      invoked by drivers that follow the pattern above.
      
      Fix this by checking for both `callback` and `callback_result` in
      dmaengine_desc_callback_valid().
      
      Fixes: f067025b ("dmaengine: add support to provide error result from a DMA transation")
      Signed-off-by: default avatarLars-Peter Clausen <lars@metafoo.de>
      Acked-by: default avatarDave Jiang <dave.jiang@intel.com>
      Link: https://lore.kernel.org/r/20211023134101.28042-1-lars@metafoo.deSigned-off-by: default avatarVinod Koul <vkoul@kernel.org>
      e7e1e880
  2. 18 Oct, 2021 24 commits
  3. 01 Oct, 2021 9 commits
  4. 12 Sep, 2021 1 commit