lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241125085314.1iSDFulg@linutronix.de>
Date: Mon, 25 Nov 2024 09:53:14 +0100
From: Sebastian Andrzej Siewior <bigeasy@...utronix.de>
To: Guenter Roeck <linux@...ck-us.net>, sparclinux@...r.kernel.org
Cc: linux-kernel@...r.kernel.org, Boqun Feng <boqun.feng@...il.com>,
	Ingo Molnar <mingo@...hat.com>,
	Peter Zijlstra <peterz@...radead.org>,
	Thomas Gleixner <tglx@...utronix.de>,
	Waiman Long <longman@...hat.com>, Will Deacon <will@...nel.org>,
	"David S. Miller" <davem@...emloft.net>,
	Andreas Larsson <andreas@...sler.com>
Subject: [PATCH] sparc/pci: Make pci_poke_lock a raw_spinlock_t.

The pci_poke_lock is used underneath of the pci_lock. The pci_lock is a
low level lock used by the core code in sections with disabled
insterrupts. Therefore the pci_poke_lock must be a raw_spinlock_t.

Make pci_poke_lock a raw_spinlock_t.

Reported-by: Guenter Roeck <linux@...ck-us.net>
Closes: https://lore.kernel.org/7656395b-58fc-4874-a9f3-6d934e2ef7ee@roeck-us.net
Fixes: 560af5dc839ee ("lockdep: Enable PROVE_RAW_LOCK_NESTING with PROVE_LOCKING.")
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@...utronix.de>
---
On 2024-11-23 08:27:08 [-0800], Guenter Roeck wrote:
> 
> Is this a problem with the test or with the platform ?

platform. The patch below should fix it. It makes no difference unless
used on PREEMPT_RT. Since sparc does not support it I made the fixes
where the default option changed.

Could you test it, please? I don't have a even a compiler for sparc
right now.

 arch/sparc/kernel/pci.c | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/arch/sparc/kernel/pci.c b/arch/sparc/kernel/pci.c
index 50a0927a84a6f..12e0b78cded55 100644
--- a/arch/sparc/kernel/pci.c
+++ b/arch/sparc/kernel/pci.c
@@ -42,14 +42,14 @@ volatile int pci_poke_in_progress;
 volatile int pci_poke_cpu = -1;
 volatile int pci_poke_faulted;
 
-static DEFINE_SPINLOCK(pci_poke_lock);
+static DEFINE_RAW_SPINLOCK(pci_poke_lock);
 
 void pci_config_read8(u8 *addr, u8 *ret)
 {
 	unsigned long flags;
 	u8 byte;
 
-	spin_lock_irqsave(&pci_poke_lock, flags);
+	raw_spin_lock_irqsave(&pci_poke_lock, flags);
 	pci_poke_cpu = smp_processor_id();
 	pci_poke_in_progress = 1;
 	pci_poke_faulted = 0;
@@ -63,7 +63,7 @@ void pci_config_read8(u8 *addr, u8 *ret)
 	pci_poke_cpu = -1;
 	if (!pci_poke_faulted)
 		*ret = byte;
-	spin_unlock_irqrestore(&pci_poke_lock, flags);
+	raw_spin_unlock_irqrestore(&pci_poke_lock, flags);
 }
 
 void pci_config_read16(u16 *addr, u16 *ret)
@@ -71,7 +71,7 @@ void pci_config_read16(u16 *addr, u16 *ret)
 	unsigned long flags;
 	u16 word;
 
-	spin_lock_irqsave(&pci_poke_lock, flags);
+	raw_spin_lock_irqsave(&pci_poke_lock, flags);
 	pci_poke_cpu = smp_processor_id();
 	pci_poke_in_progress = 1;
 	pci_poke_faulted = 0;
@@ -85,7 +85,7 @@ void pci_config_read16(u16 *addr, u16 *ret)
 	pci_poke_cpu = -1;
 	if (!pci_poke_faulted)
 		*ret = word;
-	spin_unlock_irqrestore(&pci_poke_lock, flags);
+	raw_spin_unlock_irqrestore(&pci_poke_lock, flags);
 }
 
 void pci_config_read32(u32 *addr, u32 *ret)
@@ -93,7 +93,7 @@ void pci_config_read32(u32 *addr, u32 *ret)
 	unsigned long flags;
 	u32 dword;
 
-	spin_lock_irqsave(&pci_poke_lock, flags);
+	raw_spin_lock_irqsave(&pci_poke_lock, flags);
 	pci_poke_cpu = smp_processor_id();
 	pci_poke_in_progress = 1;
 	pci_poke_faulted = 0;
@@ -107,14 +107,14 @@ void pci_config_read32(u32 *addr, u32 *ret)
 	pci_poke_cpu = -1;
 	if (!pci_poke_faulted)
 		*ret = dword;
-	spin_unlock_irqrestore(&pci_poke_lock, flags);
+	raw_spin_unlock_irqrestore(&pci_poke_lock, flags);
 }
 
 void pci_config_write8(u8 *addr, u8 val)
 {
 	unsigned long flags;
 
-	spin_lock_irqsave(&pci_poke_lock, flags);
+	raw_spin_lock_irqsave(&pci_poke_lock, flags);
 	pci_poke_cpu = smp_processor_id();
 	pci_poke_in_progress = 1;
 	pci_poke_faulted = 0;
@@ -126,14 +126,14 @@ void pci_config_write8(u8 *addr, u8 val)
 			     : "memory");
 	pci_poke_in_progress = 0;
 	pci_poke_cpu = -1;
-	spin_unlock_irqrestore(&pci_poke_lock, flags);
+	raw_spin_unlock_irqrestore(&pci_poke_lock, flags);
 }
 
 void pci_config_write16(u16 *addr, u16 val)
 {
 	unsigned long flags;
 
-	spin_lock_irqsave(&pci_poke_lock, flags);
+	raw_spin_lock_irqsave(&pci_poke_lock, flags);
 	pci_poke_cpu = smp_processor_id();
 	pci_poke_in_progress = 1;
 	pci_poke_faulted = 0;
@@ -145,14 +145,14 @@ void pci_config_write16(u16 *addr, u16 val)
 			     : "memory");
 	pci_poke_in_progress = 0;
 	pci_poke_cpu = -1;
-	spin_unlock_irqrestore(&pci_poke_lock, flags);
+	raw_spin_unlock_irqrestore(&pci_poke_lock, flags);
 }
 
 void pci_config_write32(u32 *addr, u32 val)
 {
 	unsigned long flags;
 
-	spin_lock_irqsave(&pci_poke_lock, flags);
+	raw_spin_lock_irqsave(&pci_poke_lock, flags);
 	pci_poke_cpu = smp_processor_id();
 	pci_poke_in_progress = 1;
 	pci_poke_faulted = 0;
@@ -164,7 +164,7 @@ void pci_config_write32(u32 *addr, u32 val)
 			     : "memory");
 	pci_poke_in_progress = 0;
 	pci_poke_cpu = -1;
-	spin_unlock_irqrestore(&pci_poke_lock, flags);
+	raw_spin_unlock_irqrestore(&pci_poke_lock, flags);
 }
 
 static int ofpci_verbose;
-- 
2.45.2


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ