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
57#include <linux/stringify.h>57#include <linux/stringify.h>
58#include <linux/bottom_half.h>58#include <linux/bottom_half.h>
59#include <asm/barrier.h>59#include <asm/barrier.h>
60#include <asm/mmiowb.h>
60 61
61 62
62/*63/*
@@ -178,6 +179,7 @@ static inline void do_raw_spin_lock(raw_spinlock_t *lock) __acquires(lock) · 115 unmodified lines
178{179{
179 __acquire(lock);180 __acquire(lock);
180 arch_spin_lock(&lock->raw_lock);181 arch_spin_lock(&lock->raw_lock);
182 mmiowb_spin_lock();
181}183}
182 184
183#ifndef arch_spin_lock_flags185#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
189{191{
190 __acquire(lock);192 __acquire(lock);
191 arch_spin_lock_flags(&lock->raw_lock, *flags);193 arch_spin_lock_flags(&lock->raw_lock, *flags);
194 mmiowb_spin_lock();
192}195}
193 196
194static inline int do_raw_spin_trylock(raw_spinlock_t *lock)197static inline int do_raw_spin_trylock(raw_spinlock_t *lock)
195{198{
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;
197}205}
198 206
199static inline void do_raw_spin_unlock(raw_spinlock_t *lock) __releases(lock)207static inline void do_raw_spin_unlock(raw_spinlock_t *lock) __releases(lock)
200{208{
209 mmiowb_spin_unlock();
201 arch_spin_unlock(&lock->raw_lock);210 arch_spin_unlock(&lock->raw_lock);
202 __release(lock);211 __release(lock);
203}212}

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