lkml.org 
[lkml]   [2008]   [Feb]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectIs netif_tx_lock() SMP PREEMPT safe?
Date
Hi all,

As in: include/linux/netdevice.h (kernel-2.6.24.2) one finds:

static inline void __netif_tx_lock(struct net_device *dev, int cpu)
{
spin_lock(&dev->_xmit_lock);
dev->xmit_lock_owner = cpu;
}

static inline void netif_tx_lock(struct net_device *dev)
{
__netif_tx_lock(dev, smp_processor_id());
}

Does netif_tx_lock(struct net_device *dev) expands into:

cpu = smp_processor_id();
<preempt & shift to another cpu (bogus)>
spin_lock(&dev->_xmit_lock);
dev->xmit_lock_owner = cpu; /* cpu is not the lock owner */

Or to:

spin_lock(&dev->_xmit_lock);
dev->xmit_lock_owner = smp_processor_id();

which is correct?

Thanks in advance for your answer.

Regards

Marin Mitov




\
 
 \ /
  Last update: 2008-02-15 16:45    [W:0.098 / U:0.052 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site