History

mmiowb: Hook up mmiowb helpers to spinlocks and generic I/O accessors

Removing explicit calls to mmiowb() from driver code means that we must now call into the generic mmiowb_spin_{lock,unlock}() functions from the core spinlock code. In order to elide barriers following critical sections without any I/O writes, we also hook into the asm-generic I/O routines.

Will Deacon committed 7 years ago

Commit 60ca1e51 parent fdcd06a3 files · +17 −3Browse files

Showing the changes to include/linux (1 of 3 files). Show all

Unified · Split

include/linux/spinlock.h+10−1
@@ -57,6 +57,7 @@ · 56 unmodified lines
5757 #include <linux/stringify.h>
5858 #include <linux/bottom_half.h>
5959 #include <asm/barrier.h>
60+#include <asm/mmiowb.h>
6061
6162
6263 /*
@@ -178,6 +179,7 @@ static inline void do_raw_spin_lock(raw_spinlock_t *lock) __acquires(lock) · 115 unmodified lines
178179 {
179180 __acquire(lock);
180181 arch_spin_lock(&lock->raw_lock);
182+ mmiowb_spin_lock();
181183 }
182184
183185 #ifndef arch_spin_lock_flags
@@ -189,15 +191,22 @@ do_raw_spin_lock_flags(raw_spinlock_t *lock, unsigned long *flags) __acquires(lo · 5 unmodified lines
189191 {
190192 __acquire(lock);
191193 arch_spin_lock_flags(&lock->raw_lock, *flags);
194+ mmiowb_spin_lock();
192195 }
193196
194197 static inline int do_raw_spin_trylock(raw_spinlock_t *lock)
195198 {
196− return arch_spin_trylock(&(lock)->raw_lock);
199+ int ret = arch_spin_trylock(&(lock)->raw_lock);
200+
201+ if (ret)
202+ mmiowb_spin_lock();
203+
204+ return ret;
197205 }
198206
199207 static inline void do_raw_spin_unlock(raw_spinlock_t *lock) __releases(lock)
200208 {
209+ mmiowb_spin_unlock();
201210 arch_spin_unlock(&lock->raw_lock);
202211 __release(lock);
203212 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t