rpms/kernel/devel linux-2.6-debug-list_debug_rcu.patch, NONE, 1.1 kernel.spec, 1.707, 1.708
Dave Jones (davej)
fedora-extras-commits at redhat.com
Mon Jun 23 21:50:02 UTC 2008
Author: davej
Update of /cvs/pkgs/rpms/kernel/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv25643
Modified Files:
kernel.spec
Added Files:
linux-2.6-debug-list_debug_rcu.patch
Log Message:
Add debug variants of the RCU linked list routines.
linux-2.6-debug-list_debug_rcu.patch:
--- NEW FILE linux-2.6-debug-list_debug_rcu.patch ---
list debug support for the rcu variants of the list helpers.
Also factor out the checking.
Signed-off-by: Dave Jones <davej at redhat.com>
diff --git a/include/linux/list.h b/include/linux/list.h
index 08cf4f6..f1bab0c 100644
--- a/include/linux/list.h
+++ b/include/linux/list.h
@@ -90,6 +90,7 @@ static inline void list_add_tail(struct list_head *new, struct list_head *head)
* This is only for internal list manipulation where we know
* the prev/next entries already!
*/
+#ifndef CONFIG_DEBUG_LIST
static inline void __list_add_rcu(struct list_head * new,
struct list_head * prev, struct list_head * next)
{
@@ -99,6 +100,10 @@ static inline void __list_add_rcu(struct list_head * new,
next->prev = new;
prev->next = new;
}
+#else
+extern void __list_add_rcu(struct list_head *new,
+ struct list_head *prev, struct list_head *next);
+#endif
/**
* list_add_rcu - add a new entry to rcu-protected list
@@ -197,11 +202,15 @@ extern void list_del(struct list_head *entry);
* or call_rcu() must be used to defer freeing until an RCU
* grace period has elapsed.
*/
+#ifndef CONFIG_DEBUG_LIST
static inline void list_del_rcu(struct list_head *entry)
{
__list_del(entry->prev, entry->next);
entry->prev = LIST_POISON2;
}
+#else
+extern void list_del_rcu(struct list_head *entry);
+#endif
/**
* list_replace - replace old entry by new one
diff --git a/lib/list_debug.c b/lib/list_debug.c
index 4350ba9..609e5a8 100644
--- a/lib/list_debug.c
+++ b/lib/list_debug.c
@@ -9,6 +9,39 @@
#include <linux/module.h>
#include <linux/list.h>
+static void listcheck_add(struct list_head *next,
+ struct list_head *prev, char *funcname)
+{
+ if (unlikely(next->prev != prev)) {
+ printk(KERN_ERR "%s corruption. next->prev should be "
+ "prev (%p), but was %p. (next=%p).\n",
+ funcname, prev, next->prev, next);
+ BUG();
+ }
+ if (unlikely(prev->next != next)) {
+ printk(KERN_ERR "%s corruption. prev->next should be "
+ "next (%p), but was %p. (prev=%p).\n",
+ funcname, next, prev->next, prev);
+ BUG();
+ }
+}
+
+static void listcheck_del(struct list_head *entry, char *funcname)
+{
+ if (unlikely(entry->prev->next != entry)) {
+ printk(KERN_ERR "%s corruption. prev->next should be %p, "
+ "but was %p\n",
+ funcname, entry, entry->prev->next);
+ BUG();
+ }
+ if (unlikely(entry->next->prev != entry)) {
+ printk(KERN_ERR "%s corruption. next->prev should be %p, "
+ "but was %p\n",
+ funcname, entry, entry->next->prev);
+ BUG();
+ }
+}
+
/*
* Insert a new entry between two known consecutive entries.
*
@@ -20,18 +53,7 @@ void __list_add(struct list_head *new,
struct list_head *prev,
struct list_head *next)
{
- if (unlikely(next->prev != prev)) {
- printk(KERN_ERR "list_add corruption. next->prev should be "
- "prev (%p), but was %p. (next=%p).\n",
- prev, next->prev, next);
- BUG();
- }
- if (unlikely(prev->next != next)) {
- printk(KERN_ERR "list_add corruption. prev->next should be "
- "next (%p), but was %p. (prev=%p).\n",
- next, prev->next, prev);
- BUG();
- }
+ listcheck_add(prev, next, "__list_add");
next->prev = new;
new->next = next;
new->prev = prev;
@@ -61,18 +83,42 @@ EXPORT_SYMBOL(list_add);
*/
void list_del(struct list_head *entry)
{
- if (unlikely(entry->prev->next != entry)) {
- printk(KERN_ERR "list_del corruption. prev->next should be %p, "
- "but was %p\n", entry, entry->prev->next);
- BUG();
- }
- if (unlikely(entry->next->prev != entry)) {
- printk(KERN_ERR "list_del corruption. next->prev should be %p, "
- "but was %p\n", entry, entry->next->prev);
- BUG();
- }
+ listcheck_del(entry, "list_del");
__list_del(entry->prev, entry->next);
entry->next = LIST_POISON1;
entry->prev = LIST_POISON2;
}
EXPORT_SYMBOL(list_del);
+
+/*
+ * Insert a new entry between two known consecutive entries.
+ *
+ * This is only for internal list manipulation where we know
+ * the prev/next entries already!
+ */
+void __list_add_rcu(struct list_head *new,
+ struct list_head *prev, struct list_head *next)
+{
+ listcheck_add(prev, next, "__list_add_rcu");
+
+ new->next = next;
+ new->prev = prev;
+ smp_wmb();
+ next->prev = new;
+ prev->next = new;
+}
+EXPORT_SYMBOL_GPL(__list_add_rcu);
+
+/**
+ * list_del_rcu - deletes entry from list without re-initialization
+ * @entry: the element to delete from the list.
+ *
+ * Note we can't poison the ->next pointer, see list.h for details.
+ */
+void list_del_rcu(struct list_head *entry)
+{
+ listcheck_del(entry, "list_del_rcu");
+ __list_del(entry->prev, entry->next);
+ entry->prev = LIST_POISON2;
+}
+EXPORT_SYMBOL_GPL(list_del_rcu);
Index: kernel.spec
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/devel/kernel.spec,v
retrieving revision 1.707
retrieving revision 1.708
diff -u -r1.707 -r1.708
--- kernel.spec 23 Jun 2008 21:41:57 -0000 1.707
+++ kernel.spec 23 Jun 2008 21:49:14 -0000 1.708
@@ -589,6 +589,7 @@
Patch270: linux-2.6-debug-taint-vm.patch
Patch280: linux-2.6-debug-spinlock-taint.patch
Patch340: linux-2.6-debug-vm-would-have-oomkilled.patch
+Patch350: linux-2.6-debug-list_debug_rcu.patch
Patch370: linux-2.6-crash-driver.patch
Patch380: linux-2.6-defaults-pci_no_msi.patch
Patch400: linux-2.6-scsi-cpqarray-set-master.patch
@@ -1060,6 +1061,7 @@
ApplyPatch linux-2.6-debug-taint-vm.patch
ApplyPatch linux-2.6-debug-spinlock-taint.patch
ApplyPatch linux-2.6-debug-vm-would-have-oomkilled.patch
+ApplyPatch linux-2.6-debug-list_debug_rcu.patch
#
# /dev/crash driver for the crashdump analysis tool
@@ -1786,6 +1788,9 @@
%changelog
* Mon Jun 23 2008 Dave Jones <davej at redhat.com>
+- Add debug variants of the RCU linked list routines.
+
+* Mon Jun 23 2008 Dave Jones <davej at redhat.com>
- Build LIBATA & the SCSI bits non-modular.
* Mon Jun 23 2008 Dave Jones <davej at redhat.com>
More information about the fedora-extras-commits
mailing list