Commit 47ebb0cf authored by Santiago Leon's avatar Santiago Leon Committed by Linus Torvalds

[PATCH] ibmveth: add memory barrier for hypervisor synchronisation

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.
Signed-off-by: default avatarSantiago Leon <santil@us.ibm.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent b56e3ff0
...@@ -271,7 +271,6 @@ static void ibmveth_replenish_task(struct ibmveth_adapter *adapter) ...@@ -271,7 +271,6 @@ static void ibmveth_replenish_task(struct ibmveth_adapter *adapter)
adapter->rx_no_buffer = *(u64*)(((char*)adapter->buffer_list_addr) + 4096 - 8); adapter->rx_no_buffer = *(u64*)(((char*)adapter->buffer_list_addr) + 4096 - 8);
atomic_inc(&adapter->not_replenishing); 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 */ /* kick the replenish tasklet if we need replenishing and it isn't already running */
...@@ -734,6 +733,8 @@ static int ibmveth_poll(struct net_device *netdev, int *budget) ...@@ -734,6 +733,8 @@ static int ibmveth_poll(struct net_device *netdev, int *budget)
if(ibmveth_rxq_pending_buffer(adapter)) { if(ibmveth_rxq_pending_buffer(adapter)) {
struct sk_buff *skb; struct sk_buff *skb;
rmb();
if(!ibmveth_rxq_buffer_valid(adapter)) { if(!ibmveth_rxq_buffer_valid(adapter)) {
wmb(); /* suggested by larson1 */ wmb(); /* suggested by larson1 */
adapter->rx_invalid_buffer++; adapter->rx_invalid_buffer++;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment