Page MenuHomeFreeBSD

D35021.diff
No OneTemporary

D35021.diff

diff --git a/sys/compat/linuxkpi/common/include/linux/seqlock.h b/sys/compat/linuxkpi/common/include/linux/seqlock.h
--- a/sys/compat/linuxkpi/common/include/linux/seqlock.h
+++ b/sys/compat/linuxkpi/common/include/linux/seqlock.h
@@ -30,6 +30,7 @@
#define _LINUXKPI_LINUX_SEQLOCK_H__
#include <sys/param.h>
+#include <sys/systm.h>
#include <sys/lock.h>
#include <sys/mutex.h>
#include <sys/seqc.h>
@@ -100,29 +101,52 @@
}
static inline void
-write_seqlock(struct seqlock *seqlock)
+lkpi_write_seqlock(struct seqlock *seqlock, const bool irqsave)
{
mtx_lock(&seqlock->seql_lock);
+ if (irqsave)
+ critical_enter();
write_seqcount_begin(&seqlock->seql_count);
}
static inline void
-write_sequnlock(struct seqlock *seqlock)
+write_seqlock(struct seqlock *seqlock)
+{
+ lkpi_write_seqlock(seqlock, false);
+}
+
+static inline void
+lkpi_write_sequnlock(struct seqlock *seqlock, const bool irqsave)
{
write_seqcount_end(&seqlock->seql_count);
+ if (irqsave)
+ critical_exit();
mtx_unlock(&seqlock->seql_lock);
}
+static inline void
+write_sequnlock(struct seqlock *seqlock)
+{
+ lkpi_write_sequnlock(seqlock, false);
+}
+
+/*
+ * Disable preemption when the consumer wants to disable interrupts. This
+ * ensures that the caller won't be starved if it is preempted by a
+ * higher-priority reader, but assumes that the caller won't perform any
+ * blocking operations while holding the write lock; probably a safe
+ * assumption.
+ */
#define write_seqlock_irqsave(seqlock, flags) do { \
(flags) = 0; \
- write_seqlock(seqlock); \
+ lkpi_write_seqlock(seqlock, true); \
} while (0)
static inline void
write_sequnlock_irqrestore(struct seqlock *seqlock,
unsigned long flags __unused)
{
- write_sequnlock(seqlock);
+ lkpi_write_sequnlock(seqlock, true);
}
static inline unsigned

File Metadata

Mime Type
text/plain
Expires
Thu, May 1, 1:20 PM (8 h, 22 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
17882362
Default Alt Text
D35021.diff (1 KB)

Event Timeline