Skip to contentSkip to conversation

is it useful testing __LINK_STATE_RX_SCHED in dev_close()?

DISCUSSION [email protected] 2 participants 4 messages Nov 21, 2007

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cpu0 calling netif_rx_schedule_prep(), cpu1 calling dev_close():

cpu0: testing __LINK_STATE_START, already set
cpu1: clear__LINK_STATE_START
cpu1: testing __LINK_STATE_RX_SCHED, not set
cpu0: set __LINK_STATE_RX_SCHED
cpu0: enter net poll, ...

when cpu1 return from dev_close(),__LINK_STATE_RX_SCHED is still set, the testing maybe of no use.

#1 lore raw
Quoted 10 lines · [email protected] wrote:

cpu0 calling netif_rx_schedule_prep(), cpu1 calling dev_close():

cpu0: testing __LINK_STATE_START, already set
cpu1: clear__LINK_STATE_START
cpu1: testing __LINK_STATE_RX_SCHED, not set
cpu0: set __LINK_STATE_RX_SCHED
cpu0: enter net poll, ...

when cpu1 return from dev_close(),__LINK_STATE_RX_SCHED is still set, the testing maybe of no use.

Can you please check whether this still happens with the current kernel since RX_SCHED no longer exists there?

Thanks,

Signature · 4 lines
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
#2 lore raw

__LINK_STATE_RX_SCHED still exist in kernel 2.6.23.8.

Netdevice.h:

/* Test if receive needs to be scheduled */
static inline int __netif_rx_schedule_prep(struct net_device *dev)

{
	return !test_and_set_bit(__LINK_STATE_RX_SCHED, &dev->state);
}

/* Test if receive needs to be scheduled but only if up */ static inline int netif_rx_schedule_prep(struct net_device *dev)

{
	return netif_running(dev) && __netif_rx_schedule_prep(dev);
}

Dev.c:
int dev_close(struct net_device *dev)

{
	...
	while (test_bit(__LINK_STATE_RX_SCHED, &dev->state)) {
     	/* No hurry. */
         msleep(1);
    }
	...
}

Test_bit() in dev_close() maybe between the calling of netif_running() and __netif_rx_schedule_prep() in netif_rx_schedule_prep.

#3 lore raw
Quoted 2 lines · On Wed, Nov 21, 2007 at 03:09:52PM +0800, [email protected] wrote:

__LINK_STATE_RX_SCHED still exist in kernel 2.6.23.8.

You'll find that it's gone in 2.6.24-rc3. In any case, the code was racy but it's too unlikely (and the fix too intrusive) to be worth fixing in 2.6.23 at this stage.

Thanks,

Signature · 4 lines
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt