Date: Tue, 20 May 2014 14:00:31 +0400 From: Andrew Rybchenko <Andrew.Rybchenko@oktetlabs.ru> To: freebsd-net@freebsd.org Subject: sfxge: Do no allow EFSYS_MEM_ALLOC sleep Message-ID: <537B27BF.7000800@oktetlabs.ru>
next in thread | raw e-mail | index | archive | help
[-- Attachment #1 --]
It solves locking problem when EFSYS_MEM_ALLOC is called in
the context holding a mutex (not allowed to sleep).
E.g. on interface bring up or multicast addresses addition.
[-- Attachment #2 --]
sfxge: Do no allow EFSYS_MEM_ALLOC sleep
It solves locking problem when EFSYS_MEM_ALLOC is called in
the context holding a mutex (not allowed to sleep).
E.g. on interface bring up or multicast addresses addition.
Submitted by: Andrew Rybchenko <Andrew.Rybchenko at oktetlabs.ru>
Sponsored by: Solarflare Communications, Inc.
diff --git a/head/sys/dev/sfxge/common/efsys.h b/head/sys/dev/sfxge/common/efsys.h
--- a/head/sys/dev/sfxge/common/efsys.h
+++ b/head/sys/dev/sfxge/common/efsys.h
@@ -701,7 +701,11 @@
#define EFSYS_KMEM_ALLOC(_esip, _size, _p) \
do { \
(_esip) = (_esip); \
- (_p) = malloc((_size), M_SFXGE, M_WAITOK|M_ZERO); \
+ /* \
+ * The macro is used in non-sleepable contexts, for \
+ * example, holding a mutex. \
+ */ \
+ (_p) = malloc((_size), M_SFXGE, M_NOWAIT|M_ZERO); \
_NOTE(CONSTANTCONDITION) \
} while (B_FALSE)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?537B27BF.7000800>
