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
This is a multi-part message in MIME format. --------------030702020709090005030108 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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. --------------030702020709090005030108 Content-Type: text/x-patch; name="alloc_nowait.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="alloc_nowait.patch" 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) --------------030702020709090005030108--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?537B27BF.7000800>