netback commit history
Quoted 10 lines
Quoted 1 line
Quoted 1 line · Ian Campbell
Quoted 4 lines · Jan Beulich
One thing I wonder about in this context is whether the
netif_stop_queue()call fromxenvif_close()shouldn't happen beforexenvif_down()(not the least for reasons of symmetry withxenvif_open()).I seem to recall looking at that too, it was the same in the old kernels too and I didn't know why so I avoided touching it (I was doing too much other cleanup at the time to risk it).
After looking further I don't think that would help (though I still think it would be more correct), as netif_stop_queue() basically evaluates to a set_bit() without any other locks taken. So it's completely asynchronous wrt dev_hard_start_xmit() (and its callers, which are the ones looking at the bit with HARD_TX_LOCK() carried out).
Jan
Quoted 12 lines
Quoted 11 lines
Quoted 2 lines · Jan Beulich
Quoted 1 line · Ian Campbell
Quoted 4 lines · Jan Beulich
One thing I wonder about in this context is whether the
netif_stop_queue()call fromxenvif_close()shouldn't happen beforexenvif_down()(not the least for reasons of symmetry withxenvif_open()).I seem to recall looking at that too, it was the same in the old kernels too and I didn't know why so I avoided touching it (I was doing too much other cleanup at the time to risk it).
Quoted 5 lines
After looking further I don't think that would help (though I still think it would be more correct), as
netif_stop_queue()basically evaluates to aset_bit()without any other locks taken. So it's completely asynchronous wrtdev_hard_start_xmit()(and its callers, which are the ones looking at the bit withHARD_TX_LOCK()carried out).
Which in turn suggests that the upstream driver isn't safe either:
There's nothing preventing vif->netbk from becoming NULL between the early check in xenvif_start_xmit() and its actual use in xen_netbk_queue_tx_skb(). I think vif->netbk needs to be latched into a local variable, checked against NULL, and passed instead of vif to xen_netbk_queue_tx_skb().
Jan
Quoted 18 lines · Jan Beulich
Quoted 12 lines
Quoted 11 lines
Quoted 2 lines · Jan Beulich
Quoted 1 line · Ian Campbell
Quoted 4 lines · Jan Beulich
One thing I wonder about in this context is whether the
netif_stop_queue()call fromxenvif_close()shouldn't happen beforexenvif_down()(not the least for reasons of symmetry withxenvif_open()).I seem to recall looking at that too, it was the same in the old kernels too and I didn't know why so I avoided touching it (I was doing too much other cleanup at the time to risk it).
Quoted 5 lines
After looking further I don't think that would help (though I still think it would be more correct), as
netif_stop_queue()basically evaluates to aset_bit()without any other locks taken. So it's completely asynchronous wrtdev_hard_start_xmit()(and its callers, which are the ones looking at the bit withHARD_TX_LOCK()carried out).
Quoted 6 lines
Which in turn suggests that the upstream driver isn't safe either:
There's nothing preventingvif->netbkfrom becoming NULL between the early check inxenvif_start_xmit()and its actual use inxen_netbk_queue_tx_skb(). I thinkvif->netbkneeds to be latched into a local variable, checked against NULL, and passed instead of vif toxen_netbk_queue_tx_skb().
The xmit function is called with txq->_xmit_lock held.
I think we should be calling netif_tx_disable at some point before making vif->netbk == NULL. Need to figure out where (or if we are already doing it indirectly)
Ian.