RE: RE: RE: timer_function+timer_list

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




-----Original Message-----
From: kiran kumar [mailto:kiran07_nitk@xxxxxxxxxxxxxx]
Sent: Tuesday, February 28, 2006 2:12 PM
To: Abu M.Muttalib
Cc: kernelnewbies@xxxxxxxxxxxx
Subject: Re: RE: RE: timer_function+timer_list


the kernel i am using is 2.4.20. the code where i am using the timer is as follows:

this function is defined in:
        /usr/src/linux 2.4.20-8/net/ipv4/tcp_input.c

static __inline__ void __tcp_ack_snd_check(struct sock *sk, int ofo_possible)
{
      int i=0;
      // pkt_cnt++;
                                                                                                                                  struct tcp_opt *tp = &(sk->tp_pinfo.af_tcp);
                                                                                                                           
            /* More than one full frame received... */
        if (((tp->rcv_nxt - tp->rcv_wup) > tp->ack.rcv_mss
            /* ... and right edge of window advances far enough.
              * (tcp_recvmsg() will send ACK otherwise). Or...
              */
            && __tcp_select_window(sk) >= tp->rcv_wnd) ||
            /* We ACK each frame or... */
            tcp_in_quickack_mode(tp) ||
            /* We have out of order data. */
            (ofo_possible &&
            skb_peek(&tp->out_of_order_queue) != NULL)&&(stop_ack==0)) {
                pkt_cnt++;
                if(pkt_cnt<10)
                {
                    tcp_send_ack(sk);
                }
                                                                                                                           
                else if(pkt_cnt == 10)
                {
                          for(i=0;i<=10;i++)
                          {
                            dcount++;/*-----------modified for the timer from here----*/
                          init_timer(&my_timer);
                          my_timer.expires = jiffies + .01*HZ*i;
                          my_timer.data = "">                          my_timer.function = (void *)timer_function;
                          add_timer(&my_timer);
  /*---------------------------------modified till here -------*/
                          /*---- tcp_send_ack(sk);-----was called here in the original kernel---*/
                          }
                        stop_ack =1;
                }
the timer is used in tcp_ack_snd_check as shown where the function to be executed after the expiration of time is tcp_send_ack(sk) which i have called in timer_function as follows:

void timer_function(unsigned long x)
{
                                                                                                                           
      printk("current time is %lu \n",jiffies);
      struct sock *sk;
      tcp_send_ack(sk);
      del_timer(&my_timer);
[Abu M Muttalib] don't use del_timer here..... You need to call del_timer when you are either closing the device or unloading the device. you are deleting the timer when its active/being serviced.

[Abu M Muttalib]  Any comment Arjan.....
      //printk("this is timer_delay function\n");
}

as u said i used del_timer here!
for these modifications kernel compiles & boots successfully but when i run an application like FTP the kernel panics!

where i have gone wrong!
pls let me know!

On Wed, 01 Mar 2006 Abu M.Muttalib wrote :
>  -----Original Message-----
>  From: kernelnewbies-bounce@xxxxxxxxxxxx
>[mailto:kernelnewbies-bounce@xxxxxxxxxxxx]On Behalf Of kiran kumar
>  Sent: Tuesday, February 28, 2006 1:11 PM
>  To: Abu M.Muttalib
>  Cc: kernelnewbies@xxxxxxxxxxxx
>  Subject: Re: RE: timer_function+timer_list
>
>
>  as for as i know there is no need to deactivate the timer!
>  is it required to explicitly deactivate the timer!
>  [Abu M Muttalib] Yes, as far as we have observed in kernel 2.6.13 version.
>On second run the driver was generating an OOPS. On first run it was all OK.
>Seems there is some issue with the "timer_base" in timer.c.
>  if reqd where to deactivate the timer!
>  [Abu M Muttalib] If you are using the timer function in some driver then
>you can deactivate timer inside the close/release call or at module unload
>time.
>
>
>  On Tue, 28 Feb 2006 Abu M.Muttalib wrote :
>  >Hi,
>  >
>  >Please see that you have used corresponding del_timer.
>  >
>  >~Abu
>  >Abu M. Muttalib
>  >Sr. Engineer, Embedded System,
>  >Aftek Infosys Ltd.,
>  >Pune, India
>  >Office: 91-20-25449260-65 X-256
>  >Mobile: (0)9881322820
>  >Email: abum@xxxxxxxxx
>  >
>  >
>  >
>  >  -----Original Message-----
>  >  From: kernelnewbies-bounce@xxxxxxxxxxxx
>  >[mailto:kernelnewbies-bounce@xxxxxxxxxxxx]On Behalf Of kiran kumar
>  >  Sent: Monday, February 27, 2006 12:01 PM
>  >  To: kernelnewbies@xxxxxxxxxxxx
>  >  Subject: timer_function+timer_list
>  >
>  >
>  >  hi all,
>  >    i have used struct timer_list function in tcp_ack_snd_check() defined
>in
>  >tcp_input.c to introduce the delay b/w acks!
>  >  the kernel compiled & booted successfully but when i run an application
>  >like ftp the kernel panics giving the oops msg as follows:
>  >      (i am only listing the end portion of the oops)
>  >    code:  89 5a 04 89 13 89 43 04 89 18 5b c3 8d 76 00 81 f9 ff 3f 00
>  >  <0> kernel panic : Aiee, kernel interrupt handler !
>  >  In interrupt handler - not syncing!
>  >
>  >  what might be the problem!
>  >
>  >  earlier i used mdelay to introduce the delay, it worked fine!
>  >    but i want to use struvt timer_list function!
>  >
>  >  pls help me in this regard!
>  >
>  >
>  >  warm regards,
>  >  kiran kumar s.k
>  >  N.I.T.K,surathkal
>  >
>  >
>
>
>  warm regards,
>  kiran kumar s.k
>  N.I.T.K,surathkal
>
>

warm regards,
kiran kumar s.k
N.I.T.K,surathkal


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux