Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 22 Feb 2015 18:54:17 +0000 (UTC)
From:      Andrew Rybchenko <arybchik@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r279178 - head/sys/dev/sfxge/common
Message-ID:  <201502221854.t1MIsHBk097335@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: arybchik
Date: Sun Feb 22 18:54:16 2015
New Revision: 279178
URL: https://svnweb.freebsd.org/changeset/base/279178

Log:
  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)

Modified:
  head/sys/dev/sfxge/common/efsys.h

Modified: head/sys/dev/sfxge/common/efsys.h
==============================================================================
--- head/sys/dev/sfxge/common/efsys.h	Sun Feb 22 18:52:15 2015	(r279177)
+++ head/sys/dev/sfxge/common/efsys.h	Sun Feb 22 18:54:16 2015	(r279178)
@@ -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)
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201502221854.t1MIsHBk097335>