Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 1 Dec 2016 21:08:50 +0000
From:      "rstone (Ryan Stone)" <phabric-noreply@FreeBSD.org>
To:        freebsd-net@freebsd.org
Subject:   [Differential] D8685: Fix a false positive in a buf_ring assert
Message-ID:  <23e98bd4e5fac48d220a1f5375bb3309@localhost.localdomain>
In-Reply-To: <differential-rev-PHID-DREV-7bpwu3y3lzsbz4zoj3jc-req@FreeBSD.org>
References:  <differential-rev-PHID-DREV-7bpwu3y3lzsbz4zoj3jc-req@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help

[-- Attachment #1 --]
This revision was automatically updated to reflect the committed changes.
rstone marked an inline comment as done.
Closed by commit rS309372: Fix a false positive in a buf_ring assert (authored by rstone).

CHANGED PRIOR TO COMMIT
  https://reviews.freebsd.org/D8685?vs=22633&id=22651#toc

REPOSITORY
  rS FreeBSD src repository

CHANGES SINCE LAST UPDATE
  https://reviews.freebsd.org/D8685?vs=22633&id=22651

REVISION DETAIL
  https://reviews.freebsd.org/D8685

AFFECTED FILES
  head/sys/sys/buf_ring.h

CHANGE DETAILS

diff --git a/head/sys/sys/buf_ring.h b/head/sys/sys/buf_ring.h
--- a/head/sys/sys/buf_ring.h
+++ b/head/sys/sys/buf_ring.h
@@ -67,11 +67,13 @@
 	uint32_t prod_head, prod_next, cons_tail;
 #ifdef DEBUG_BUFRING
 	int i;
-	for (i = br->br_cons_head; i != br->br_prod_head;
-	     i = ((i + 1) & br->br_cons_mask))
-		if(br->br_ring[i] == buf)
-			panic("buf=%p already enqueue at %d prod=%d cons=%d",
-			    buf, i, br->br_prod_tail, br->br_cons_tail);
+	if (br->br_cons_head != br->br_prod_head) {
+		for (i = (br->br_cons_head + 1) & br->br_cons_mask; i != br->br_prod_head;
+		    i = ((i + 1) & br->br_cons_mask))
+			if(br->br_ring[i] == buf)
+				panic("buf=%p already enqueue at %d prod=%d cons=%d",
+				    buf, i, br->br_prod_tail, br->br_cons_tail);
+	}
 #endif	
 	critical_enter();
 	do {



EMAIL PREFERENCES
  https://reviews.freebsd.org/settings/panel/emailpreferences/

To: rstone, hselasky
Cc: hselasky, freebsd-net-list, emaste

[-- Attachment #2 --]
diff --git a/head/sys/sys/buf_ring.h b/head/sys/sys/buf_ring.h
--- a/head/sys/sys/buf_ring.h
+++ b/head/sys/sys/buf_ring.h
@@ -67,11 +67,13 @@
 	uint32_t prod_head, prod_next, cons_tail;
 #ifdef DEBUG_BUFRING
 	int i;
-	for (i = br->br_cons_head; i != br->br_prod_head;
-	     i = ((i + 1) & br->br_cons_mask))
-		if(br->br_ring[i] == buf)
-			panic("buf=%p already enqueue at %d prod=%d cons=%d",
-			    buf, i, br->br_prod_tail, br->br_cons_tail);
+	if (br->br_cons_head != br->br_prod_head) {
+		for (i = (br->br_cons_head + 1) & br->br_cons_mask; i != br->br_prod_head;
+		    i = ((i + 1) & br->br_cons_mask))
+			if(br->br_ring[i] == buf)
+				panic("buf=%p already enqueue at %d prod=%d cons=%d",
+				    buf, i, br->br_prod_tail, br->br_cons_tail);
+	}
 #endif	
 	critical_enter();
 	do {


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