diff options
author | arybchik <arybchik@FreeBSD.org> | 2015-03-25 13:05:33 +0000 |
---|---|---|
committer | arybchik <arybchik@FreeBSD.org> | 2015-03-25 13:05:33 +0000 |
commit | 2f95e74aa7fc02e9ffa1bec17a970d1ac3e63175 (patch) | |
tree | fc67c7fb032eeae3c0f47ff730529d433ad4ae1a | |
parent | 59a10077f4085106c8e09c46896dbe3a3d1d003d (diff) | |
download | FreeBSD-src-2f95e74aa7fc02e9ffa1bec17a970d1ac3e63175.zip FreeBSD-src-2f95e74aa7fc02e9ffa1bec17a970d1ac3e63175.tar.gz |
MFC: 279178
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.
Sponsored by: Solarflare Communications, Inc.
Approved by: gnn (mentor)
-rw-r--r-- | sys/dev/sfxge/common/efsys.h | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/sys/dev/sfxge/common/efsys.h b/sys/dev/sfxge/common/efsys.h index f8d4e5c..a1e1edf 100644 --- a/sys/dev/sfxge/common/efsys.h +++ b/sys/dev/sfxge/common/efsys.h @@ -941,7 +941,11 @@ typedef clock_t efsys_timestamp_t; #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) |