Skip to contentSkip to conversation

idmaengine: make FSL_EDMA and INTEL_IDMA64 depends on HAS_IOMEM

PATCH In review Sasha Levin 2 participants 4 messages Aug 22, 2023

Subsystems (3)
lore
Share & tools
lore

Sasha Levin

author maintainer
#0 lore raw

PATCH 1/3 idmaengine: make FSL_EDMA and INTEL_IDMA64 depends on HAS_IOMEM

From: Baoquan He <[email protected]>

[ Upstream commit b1e213a9e31c20206f111ec664afcf31cbfe0dbb ]

On s390 systems (aka mainframes), it has classic channel devices for networking and permanent storage that are currently even more common than PCI devices. Hence it could have a fully functional s390 kernel with CONFIG_PCI=n, then the relevant iomem mapping functions [including ioremap(), devm_ioremap(), etc.] are not available.

Here let FSL_EDMA and INTEL_IDMA64 depend on HAS_IOMEM so that it won't be built to cause below compiling error if PCI is unset.

--------
ERROR: modpost: "devm_platform_ioremap_resource" [drivers/dma/fsl-edma.ko] undefined!
ERROR: modpost: "devm_platform_ioremap_resource" [drivers/dma/idma64.ko] undefined!
--------

---
 drivers/dma/Kconfig | 2 ++
 1 file changed, 2 insertions(+)
drivers/dma/Kconfig +2 -0
index 08013345d1f24..7e1bd79fbee8f 100644
@@ -208,6 +208,7 @@ config FSL_DMA
 config FSL_EDMA
 	tristate "Freescale eDMA engine support"
 	depends on OF
+	depends on HAS_IOMEM
 	select DMA_ENGINE
 	select DMA_VIRTUAL_CHANNELS
 	help
@@ -277,6 +278,7 @@ config IMX_SDMA
 
 config INTEL_IDMA64
 	tristate "Intel integrated DMA 64-bit support"
+	depends on HAS_IOMEM
 	select DMA_ENGINE
 	select DMA_VIRTUAL_CHANNELS
 	help
Signature · 1 line
2.40.1
author maintainer
#1 lore raw

PATCH 2/3 scsi: qedi: Fix potential deadlock on &qedi_percpu->p_work_lock

From: Chengfeng Ye <[email protected]>

[ Upstream commit dd64f80587190265ca8a0f4be6c64c2fda6d3ac2 ]

As &qedi_percpu->p_work_lock is acquired by hard IRQ qedi_msix_handler(), other acquisitions of the same lock under process context should disable IRQ, otherwise deadlock could happen if the IRQ preempts the execution while the lock is held in process context on the same CPU.

qedi_cpu_offline() is one such function which acquires the lock in process context.

[Deadlock Scenario]
qedi_cpu_offline()

    ->spin_lock(&p->p_work_lock)
        <irq>
        ->qedi_msix_handler()
        ->edi_process_completions()
        ->spin_lock_irqsave(&p->p_work_lock, flags); (deadlock here)

This flaw was found by an experimental static analysis tool I am developing for IRQ-related deadlocks.

The tentative patch fix the potential deadlock by spin_lock_irqsave() under process context.

---
 drivers/scsi/qedi/qedi_main.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/scsi/qedi/qedi_main.c +3 -2
index cc2152c56d355..96e470746767a 100644
@@ -1981,8 +1981,9 @@ static int qedi_cpu_offline(unsigned int cpu)
 	struct qedi_percpu_s *p = this_cpu_ptr(&qedi_percpu);
 	struct qedi_work *work, *tmp;
 	struct task_struct *thread;
+	unsigned long flags;
 
-	spin_lock_bh(&p->p_work_lock);
+	spin_lock_irqsave(&p->p_work_lock, flags);
 	thread = p->iothread;
 	p->iothread = NULL;
 
@@ -1993,7 +1994,7 @@ static int qedi_cpu_offline(unsigned int cpu)
 			kfree(work);
 	}
 
-	spin_unlock_bh(&p->p_work_lock);
+	spin_unlock_irqrestore(&p->p_work_lock, flags);
 	if (thread)
 		kthread_stop(thread);
 	return 0;
Signature · 1 line
2.40.1
author maintainer
#2 lore raw

PATCH 3/3 drm/amdkfd: ignore crat by default

In reply to Sasha Levin

From: Alex Deucher <[email protected]>

[ Upstream commit a6dea2d64ff92851e68cd4e20a35f6534286e016 ]

We are dropping the IOMMUv2 path, so no need to enable this. It's often buggy on consumer platforms anyway.

---
 drivers/gpu/drm/amd/amdkfd/kfd_crat.c | 4 ----
 1 file changed, 4 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_crat.c +0 -4
index 86b4dadf772e3..61fea0d268b96 100644
@@ -749,11 +749,7 @@ static bool kfd_ignore_crat(void)
 	if (ignore_crat)
 		return true;
 
-#ifndef KFD_SUPPORT_IOMMU_V2
 	ret = true;
-#else
-	ret = false;
-#endif
 
 	return ret;
 }
Signature · 1 line
2.40.1
#3 lore raw

RE: [PATCH AUTOSEL 5.10 3/3] drm/amdkfd: ignore crat by default

[Public]

Quoted 11 lines

-----Original Message-----
From: Sasha Levin <[email protected]>
Sent: Tuesday, August 22, 2023 7:37 AM
To: [email protected]; [email protected]
Cc: Deucher, Alexander <[email protected]>; Kuehling, Felix <[email protected]>; Koenig, Christian <[email protected]>; Mike Lothian <[email protected]>; Sasha Levin <[email protected]>; Pan, Xinhui <[email protected]>; [email protected]; [email protected]; amd- [email protected]; [email protected]
Subject: [PATCH AUTOSEL 5.10 3/3] drm/amdkfd: ignore crat by default

Quoted 6 lines

From: Alex Deucher <[email protected]>

[ Upstream commit a6dea2d64ff92851e68cd4e20a35f6534286e016 ]

We are dropping the IOMMUv2 path, so no need to enable this. It's often buggy on consumer platforms anyway.

This is not needed for stable.

Alex

Quoted 29 lines
---
 drivers/gpu/drm/amd/amdkfd/kfd_crat.c | 4 ----
 1 file changed, 4 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_crat.c +0 -5
index 86b4dadf772e3..61fea0d268b96 100644
@@ -749,11 +749,7 @@ static bool kfd_ignore_crat(void)
      if (ignore_crat)
              return true;
 
-#ifndef KFD_SUPPORT_IOMMU_V2
      ret = true;
-#else
-     ret = false;
-#endif
 
      return ret;
 }
--

2.40.1