Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 10 May 2018 09:25:51 +0000 (UTC)
From:      Marcin Wojtas <mw@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r333453 - head/sys/contrib/ena-com
Message-ID:  <201805100925.w4A9PpS3067683@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mw
Date: Thu May 10 09:25:51 2018
New Revision: 333453
URL: https://svnweb.freebsd.org/changeset/base/333453

Log:
  Apply fixes in ena-com
  
  * Change ena-com BIT macro to work on unsigned value.
    To make the shifting operations safer, they should be working on
    unsigned values.
  
  * Fix a mutex not owned ASSERT panic in ENA control path.
    A thread calling cv_broadcast()/cv_signal() must hold the mutex used for
    cv_wait(). Fix the ENA control path code that has this problem.
  
  Submitted by:   Krishna Yenduri <kyenduri@brkt.com>
  Reviewed by:    Michal Krawczyk <mk@semihalf.com>
  Tested by:      Michal Krawczyk <mk@semihalf.com>

Modified:
  head/sys/contrib/ena-com/ena_plat.h
Directory Properties:
  head/sys/contrib/ena-com/   (props changed)

Modified: head/sys/contrib/ena-com/ena_plat.h
==============================================================================
--- head/sys/contrib/ena-com/ena_plat.h	Thu May 10 09:21:49 2018	(r333452)
+++ head/sys/contrib/ena-com/ena_plat.h	Thu May 10 09:25:51 2018	(r333453)
@@ -165,7 +165,7 @@ static inline long PTR_ERR(const void *ptr)
 
 #define GENMASK(h, l)		(((1U << ((h) - (l) + 1)) - 1) << (l))
 #define GENMASK_ULL(h, l)	(((~0ULL) << (l)) & (~0ULL >> (64 - 1 - (h))))
-#define BIT(x)			(1 << (x))
+#define BIT(x)			(1UL << (x))
 
 #define ENA_ABORT() 		BUG()
 #define BUG() 			panic("ENA BUG")
@@ -244,7 +244,12 @@ static inline long PTR_ERR(const void *ptr)
 		    timeout_us * hz / 1000 / 1000 );			\
 		mtx_unlock(&((waitqueue).mtx));				\
 	} while (0)
-#define ENA_WAIT_EVENT_SIGNAL(waitqueue) cv_broadcast(&((waitqueue).wq))
+#define ENA_WAIT_EVENT_SIGNAL(waitqueue)		\
+	do {						\
+		mtx_lock(&((waitqueue).mtx));		\
+		cv_broadcast(&((waitqueue).wq));	\
+		mtx_unlock(&((waitqueue).mtx));		\
+	} while (0)
 
 #define dma_addr_t 	bus_addr_t
 #define u8 		uint8_t



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