{
int i;
+ might_sleep();
for (i = 0; i < chain->n_tables; i++) {
struct sw_table *t = chain->tables[i];
if (t->insert(t, flow))
int count = 0;
int i;
+ might_sleep();
for (i = 0; i < chain->n_tables; i++) {
struct sw_table *t = chain->tables[i];
count += t->delete(t, key, priority, strict);
int count = 0;
int i;
+ might_sleep();
for (i = 0; i < chain->n_tables; i++) {
struct sw_table *t = chain->tables[i];
count += t->timeout(chain->dp, t);
#define __LINUX_KERNEL_WRAPPER_H 1
#include_next <linux/kernel.h>
+#include <linux/config.h>
/**
* container_of - cast a member of a structure out to the containing structure
/* Force a compilation error if condition is true */
#define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)]))
+/**
+ * might_sleep - annotation for functions that can sleep
+ *
+ * this macro will print a stack trace if it is executed in an atomic
+ * context (spinlock, irq-handler, ...).
+ *
+ * This is a useful debugging help to be able to catch problems early and not
+ * be bitten later when the calling function happens to sleep when it is not
+ * supposed to.
+ */
+#define might_resched() do { } while (0)
+
+#ifdef CONFIG_DEBUG_SPINLOCK
+ void __might_sleep(char *file, int line);
+# define might_sleep() \
+ do { __might_sleep(__FILE__, __LINE__); might_resched(); } while (0)
+#else
+# define might_sleep() do { might_resched(); } while (0)
+#endif
+
+#define might_sleep_if(cond) do { if (cond) might_sleep(); } while (0)
+
#endif
* Distributed under the terms of the GNU GPL version 2.
*/
+#include <linux/config.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/slab.h>
+#include <asm/hardirq.h>
int vprintk(const char *msg, ...)
{
}
EXPORT_SYMBOL(vprintk);
+
+#ifdef CONFIG_DEBUG_SPINLOCK
+void __might_sleep(char *file, int line)
+{
+ static unsigned long prev_jiffy; /* ratelimiting */
+
+ if ((in_interrupt()) && !oops_in_progress) {
+ if (time_before(jiffies, prev_jiffy + HZ) && prev_jiffy)
+ return;
+ prev_jiffy = jiffies;
+ printk(KERN_ERR "BUG: sleeping function called from invalid"
+ " context at %s:%d\n", file, line);
+ dump_stack();
+ }
+}
+EXPORT_SYMBOL(__might_sleep);
+#endif