Re: Need some help in interpreting a code snippet

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

 



On Thu, Dec 10, 2009 at 5:24 PM, Nagaprabhanjan Bellari
<nagp.knb@xxxxxxxxx> wrote:
> The code snippet is in linux/kernel/softirq.c:__do_softirq():
> ==
>     do {
>         if (pending & 1) {
>             int preempt_count = preempt_count();
>             h->action(h);
>             if (preempt_count != preempt_count()) {
>                 printk(KERN_CRIT "BUG: softirq: %p, %x,%x\n",
>                     h->action, preempt_count, preempt_count());
>                 dump_crit_stack();
>             }
>             rcu_bh_qsctr_inc(cpu);
>         }
> ==
> What I am trying to understand is the preempt_count check after
> h->action(h); statement. Can somebody tell me why such a prempt_count
> mismatch check is made and why a mismatch is critical?
> Thanks,
> -nagp



This code checks whether the handler of softirq (h->action()) is
releasing every spin lock that it takes. If not, then preempt count
before and after calling handler will be different therefore softirq
thread will panic and dump the stack. Hope this answers your question.


-Vinit

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ



[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