igb_down from bottom half context

3 messages, 3 authors, 2013-03-06 · open the first message on its own page

igb_down from bottom half context

From: ratheesh kannoth <hidden>
Date: 2013-03-06 04:08:05

I  have kernel timer which  check for flag.

if(flag ) {
          igb_down(adapter);
 } else {
         igb_up(adapter);
 }


I could see a kernel crash; because  there are a lot of  msleep() in
igb_down function.

#define msleep(x)    do { set_current_state(TASK_UNINTERRUPTIBLE); \
                                schedule_timeout((x * HZ)/1000 + 2); \
                              } while (0)

sleep() is called from bottom half context; this is the cause of kernel crash.

1) Since timer call back dont have process context associated with it;
i think , "current" points to the last preempted task ?
2) How can i introduce delays in interrupt context to avoid the kernel
crash. mdelay()  will work ?
3) is there any better mechanism to do this job ?

Thanks,
Ratheesh

Re: igb_down from bottom half context

From: Ben Hutchings <hidden>
Date: 2013-03-06 17:38:27

On Wed, 2013-03-06 at 09:38 +0530, ratheesh kannoth wrote:
I  have kernel timer which  check for flag.

if(flag ) {
          igb_down(adapter);
 } else {
         igb_up(adapter);
 }


I could see a kernel crash; because  there are a lot of  msleep() in
igb_down function.

#define msleep(x)    do { set_current_state(TASK_UNINTERRUPTIBLE); \
                                schedule_timeout((x * HZ)/1000 + 2); \
                              } while (0)

sleep() is called from bottom half context; this is the cause of kernel crash.

1) Since timer call back dont have process context associated with it;
i think , "current" points to the last preempted task ?
2) How can i introduce delays in interrupt context to avoid the kernel
crash. mdelay()  will work ?
3) is there any better mechanism to do this job ?
Use a work item and schedule_work().

Ben.

-- 
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.

Re: igb_down from bottom half context

From: anil dahiya <hidden>
Date: 2013-03-06 18:48:07

You know, you are doing wrong thing i.e sleeping in interrupt context.

As suggested by Ben, move code work queue or somewhere else. Other option
is dont sleep here.

--Anil
On Wed, Mar 6, 2013 at 11:08 PM, Ben Hutchings [off-list ref]wrote:
On Wed, 2013-03-06 at 09:38 +0530, ratheesh kannoth wrote:
quoted
I  have kernel timer which  check for flag.

if(flag ) {
          igb_down(adapter);
 } else {
         igb_up(adapter);
 }


I could see a kernel crash; because  there are a lot of  msleep() in
igb_down function.

#define msleep(x)    do { set_current_state(TASK_UNINTERRUPTIBLE); \
                                schedule_timeout((x * HZ)/1000 + 2); \
                              } while (0)

sleep() is called from bottom half context; this is the cause of kernel
crash.
quoted
1) Since timer call back dont have process context associated with it;
i think , "current" points to the last preempted task ?
2) How can i introduce delays in interrupt context to avoid the kernel
crash. mdelay()  will work ?
3) is there any better mechanism to do this job ?
Use a work item and schedule_work().

Ben.

--
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.

--
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help