public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2.6] ibmveth bug fixes 4/4
@ 2004-08-10 18:06 Santiago Leon
  2004-08-11  0:40 ` Santiago Leon
  2004-08-15 20:01 ` Andrew Morton
  0 siblings, 2 replies; 4+ messages in thread
From: Santiago Leon @ 2004-08-10 18:06 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Linux Kernel list

[-- Attachment #1: Type: text/plain, Size: 445 bytes --]

Andrew,

This patch adds a memory barrier to ensure synchronization with the 
hypervisor (and avoid a panic when the hypervisor is halfway through 
writing to the descriptor). It also removes an unnecessary check that is 
flawed anyway because the value can change between the atomic_inc() and 
the assert. Please apply.

Signed-off-by: Santiago Leon <santil@us.ibm.com>

-- 
Santiago A. Leon
Power Linux Development
IBM Linux Technology Center

[-- Attachment #2: ibmveth_rmb.patch --]
[-- Type: text/plain, Size: 656 bytes --]

===== drivers/net/ibmveth.c 1.16 vs edited =====
--- 1.16/drivers/net/ibmveth.c	Tue Aug 10 12:00:57 2004
+++ edited/drivers/net/ibmveth.c	Tue Aug 10 12:01:46 2004
@@ -271,7 +271,6 @@
 	adapter->rx_no_buffer = *(u64*)(((char*)adapter->buffer_list_addr) + 4096 - 8);
 
 	atomic_inc(&adapter->not_replenishing);
-	ibmveth_assert(atomic_read(&adapter->not_replenishing) == 1);
 }
 
 /* kick the replenish tasklet if we need replenishing and it isn't already running */
@@ -733,6 +732,8 @@
 
 		if(ibmveth_rxq_pending_buffer(adapter)) {
 			struct sk_buff *skb;
+
+			rmb();
 
 			if(!ibmveth_rxq_buffer_valid(adapter)) {
 				wmb(); /* suggested by larson1 */

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 2.6] ibmveth bug fixes 4/4
  2004-08-10 18:06 [PATCH 2.6] ibmveth bug fixes 4/4 Santiago Leon
@ 2004-08-11  0:40 ` Santiago Leon
  2004-08-11  1:30   ` Santiago Leon
  2004-08-15 20:01 ` Andrew Morton
  1 sibling, 1 reply; 4+ messages in thread
From: Santiago Leon @ 2004-08-11  0:40 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Linux Kernel list

[-- Attachment #1: Type: text/plain, Size: 289 bytes --]

Andrew...

I had discussion over email with Dave Hansen about this patch and after 
I explained the bug and the fix, he recommended that I include a comment 
in the patch.  So here's an updated patch. Please apply.

-- 
Santiago A. Leon
Power Linux Development
IBM Linux Technology Center

[-- Attachment #2: ibmveth_rmb.patch --]
[-- Type: text/plain, Size: 941 bytes --]

===== drivers/net/ibmveth.c 1.14 vs edited =====
--- 1.14/drivers/net/ibmveth.c	Tue Aug 10 19:09:45 2004
+++ edited/drivers/net/ibmveth.c	Tue Aug 10 19:30:10 2004
@@ -271,7 +271,6 @@
 	adapter->rx_no_buffer = *(u64*)(((char*)adapter->buffer_list_addr) + 4096 - 8);
 
 	atomic_inc(&adapter->not_replenishing);
-	ibmveth_assert(atomic_read(&adapter->not_replenishing) == 1);
 }
 
 /* kick the replenish tasklet if we need replenishing and it isn't already running */
@@ -733,6 +732,14 @@
 
 		if(ibmveth_rxq_pending_buffer(adapter)) {
 			struct sk_buff *skb;
+
+			/* This barrier is necessary because we might be 
+			   reading a control dword and then reading an old 
+			   cached correlator dword. Also, the hypervisor
+			   guarantees that the control field will be globally
+			   visible after all the other fields are visible, 
+			*/
+			rmb();
 
 			if(!ibmveth_rxq_buffer_valid(adapter)) {
 				wmb(); /* suggested by larson1 */

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 2.6] ibmveth bug fixes 4/4
  2004-08-11  0:40 ` Santiago Leon
@ 2004-08-11  1:30   ` Santiago Leon
  0 siblings, 0 replies; 4+ messages in thread
From: Santiago Leon @ 2004-08-11  1:30 UTC (permalink / raw)
  To: Santiago Leon; +Cc: Andrew Morton, Linux Kernel list

[-- Attachment #1: Type: text/plain, Size: 392 bytes --]

> I had discussion over email with Dave Hansen about this patch and after 
> I explained the bug and the fix, he recommended that I include a comment 
> in the patch.  So here's an updated patch. Please apply.

Ooops.. forgot the signed stuff... Here it goes again...

Signed-off-by: Santiago Leon <santil@us.ibm.com>

-- 
Santiago A. Leon
Power Linux Development
IBM Linux Technology Center

[-- Attachment #2: ibmveth_rmb.patch --]
[-- Type: text/plain, Size: 941 bytes --]

===== drivers/net/ibmveth.c 1.14 vs edited =====
--- 1.14/drivers/net/ibmveth.c	Tue Aug 10 19:09:45 2004
+++ edited/drivers/net/ibmveth.c	Tue Aug 10 19:30:10 2004
@@ -271,7 +271,6 @@
 	adapter->rx_no_buffer = *(u64*)(((char*)adapter->buffer_list_addr) + 4096 - 8);
 
 	atomic_inc(&adapter->not_replenishing);
-	ibmveth_assert(atomic_read(&adapter->not_replenishing) == 1);
 }
 
 /* kick the replenish tasklet if we need replenishing and it isn't already running */
@@ -733,6 +732,14 @@
 
 		if(ibmveth_rxq_pending_buffer(adapter)) {
 			struct sk_buff *skb;
+
+			/* This barrier is necessary because we might be 
+			   reading a control dword and then reading an old 
+			   cached correlator dword. Also, the hypervisor
+			   guarantees that the control field will be globally
+			   visible after all the other fields are visible, 
+			*/
+			rmb();
 
 			if(!ibmveth_rxq_buffer_valid(adapter)) {
 				wmb(); /* suggested by larson1 */

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 2.6] ibmveth bug fixes 4/4
  2004-08-10 18:06 [PATCH 2.6] ibmveth bug fixes 4/4 Santiago Leon
  2004-08-11  0:40 ` Santiago Leon
@ 2004-08-15 20:01 ` Andrew Morton
  1 sibling, 0 replies; 4+ messages in thread
From: Andrew Morton @ 2004-08-15 20:01 UTC (permalink / raw)
  To: Santiago Leon; +Cc: linux-kernel

Santiago Leon <santil@us.ibm.com> wrote:
>
> his patch adds a memory barrier to ensure synchronization with the 
>  hypervisor (and avoid a panic when the hypervisor is halfway through 
>  writing to the descriptor). It also removes an unnecessary check that is 
>  flawed anyway because the value can change between the atomic_inc() and 
>  the assert. Please apply.
> 
> ...
>  @@ -733,6 +732,8 @@
>   
>   		if(ibmveth_rxq_pending_buffer(adapter)) {
>   			struct sk_buff *skb;
>  +
>  +			rmb();

Please always add a comment when adding such a barrier - it is otherwise
quite impossible for the reader to work out what it is doing in there.

Also, please in future avoid giving your patches subjects such as "ibmveth
bug fixes 4/4".  Remember that the Subject: in your email will be carried
through into kernel bitkeeper and it should be meaningful.

I relabelled these four patches as

	ibmveth: module tag fixes
	ibmveth: race fixes
	ibmveth: hypervisor return value fix
	ibmveth: add memory barrier for hypervisor synchronisation

Thanks.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2004-08-15 20:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-08-10 18:06 [PATCH 2.6] ibmveth bug fixes 4/4 Santiago Leon
2004-08-11  0:40 ` Santiago Leon
2004-08-11  1:30   ` Santiago Leon
2004-08-15 20:01 ` Andrew Morton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox