|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [xen staging] xen/spinlock: Don't perpetuate broken API in new logic
commit a3373a82f890bd920270e6ae16dc3d275ae1c429
Author: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
AuthorDate: Tue Mar 19 11:17:16 2024 +0000
Commit: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
CommitDate: Tue Mar 4 12:53:15 2025 +0000
xen/spinlock: Don't perpetuate broken API in new logic
The single user wants this the sane way around. Write it as a normal static
inline just like rspin_lock().
Fixes: cc3e8df542ed ("xen/spinlock: add rspin_[un]lock_irq[save|restore]()")
Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
Reviewed-by: Juergen Gross <jgross@xxxxxxxx>
---
xen/drivers/char/console.c | 6 +-----
xen/include/xen/spinlock.h | 14 ++++++++------
2 files changed, 9 insertions(+), 11 deletions(-)
diff --git a/xen/drivers/char/console.c b/xen/drivers/char/console.c
index 2f48001a44..b3bc4bc963 100644
--- a/xen/drivers/char/console.c
+++ b/xen/drivers/char/console.c
@@ -1158,11 +1158,7 @@ void console_end_log_everything(void)
unsigned long console_lock_recursive_irqsave(void)
{
- unsigned long flags;
-
- rspin_lock_irqsave(&console_lock, flags);
-
- return flags;
+ return rspin_lock_irqsave(&console_lock);
}
void console_unlock_recursive_irqrestore(unsigned long flags)
diff --git a/xen/include/xen/spinlock.h b/xen/include/xen/spinlock.h
index 8825affb25..ca9d8c7ec0 100644
--- a/xen/include/xen/spinlock.h
+++ b/xen/include/xen/spinlock.h
@@ -303,12 +303,6 @@ static always_inline void spin_lock_if(bool condition,
spinlock_t *l)
*/
bool _rspin_trylock(rspinlock_t *lock);
void _rspin_lock(rspinlock_t *lock);
-#define rspin_lock_irqsave(l, f) \
- ({ \
- BUILD_BUG_ON(sizeof(f) != sizeof(unsigned long)); \
- (f) = _rspin_lock_irqsave(l); \
- block_lock_speculation(); \
- })
unsigned long _rspin_lock_irqsave(rspinlock_t *lock);
void _rspin_unlock(rspinlock_t *lock);
void _rspin_unlock_irqrestore(rspinlock_t *lock, unsigned long flags);
@@ -321,6 +315,14 @@ static always_inline void rspin_lock(rspinlock_t *lock)
block_lock_speculation();
}
+static always_inline unsigned long rspin_lock_irqsave(rspinlock_t *lock)
+{
+ unsigned long flags = _rspin_lock_irqsave(lock);
+
+ block_lock_speculation();
+ return flags;
+}
+
#define rspin_trylock(l) lock_evaluate_nospec(_rspin_trylock(l))
#define rspin_unlock(l) _rspin_unlock(l)
#define rspin_unlock_irqrestore(l, f) _rspin_unlock_irqrestore(l, f)
--
generated by git-patchbot for /home/xen/git/xen.git#staging
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |