public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* the race condition will occur in below code ?
@ 2005-08-28 16:16 mandy london
  0 siblings, 0 replies; only message in thread
From: mandy london @ 2005-08-28 16:16 UTC (permalink / raw)
  To: linux-kernel

below is my  script in brief, when it runs for several minutes , the
computer will reboot quickly without any information  , so I can not
get knowledge form oops and something else .

I use timer and hook respectively, first , using hook to receive
packets from ICP/IP stack on wired interface, the store it in a queue
, then , when the timer arrive , the timer will invoke the
dev_queue_xmit() to send the whole  packets from wireless interface.

void timer_ack(unsigned long no_used){
     int i ;
     struct sk_buff * skb;
     struct net_device * wireless;
     wireless = dev_get_by_name("eth1");//eth1 is wireless interface
     while((skb=skb_dequeue(packet_queue))!=NULL){// get out a packet
from the queue
          dev_queue_xmit(skb);
     }
    
     mod_timer(&timer,100);// change time for polling one time per second

}

unsigned int hook_func(unsigned int hooknum,struct sk_buff **skb,
const struct net_device *in,const struct net_device *out,int
(*okfn)(struct sk_buff *)){
     
// there , I omit some the code handling the packet for the purpose of
forwording like NAT , that means I will handle the packet firstly then
I will insert it to the packet_queue

      struct sk_buff *sb = *skb;
      skb_queue_tail(packet_queue,sb);
}

I test it , normally it can run for about five minutes , then died
without anyting info.
I analyze whether my improper handling on queue leads to it. maybe
there are some race conditions I can not find out.

the most important is whether the case below have the posibility to occur?
       when the kernel run in timer then an interrupt comes , after
the interrupt return results in scheule or the hook_func()'s running ,
then the race condition will occur , I am not clear in this .

any help will be appreciated , thx~
:)

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2005-08-28 17:23 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-08-28 16:16 the race condition will occur in below code ? mandy london

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