title: What might cause preempt_count to change or workqueue to run in atomic context?
body: <p>I've been doing some module work and I'm having crashes that occur randomly (usually within 10 hours after boot).</p>
  
  <p>The kernel log messages can vary from one crash to the next, but in some cases I get this:</p>
  
  <pre><code>&lt;4&gt;huh, entered c90390a8 with preempt_count 0000010d, exited with c0340000?
  </code></pre>
  
  <p>The code that generates this log is from the 2.6.14 kernel, kernel/timer.c:</p>
  
  <pre><code>            int preempt_count = preempt_count();
              fn(data);
              if (preempt_count != preempt_count()) {
                  printk(KERN_WARNING "huh, entered %p "
                         "with preempt_count %08x, exited"
                         " with %08x?\n",
                         fn, preempt_count,
                         preempt_count());
                  BUG();
              }
  </code></pre>
  
  <p>For this condition to happen, what would have had to have occurred (obviously preempt_count changed, but what might cause that)?</p>
  
  <p>The other symptom of the crash is that I'm seeing a <code>scheduling while atomic</code> while doing i2c from a workqueue (which should certainly not be atomic, right?).  What might cause this?</p>
  
  <p>I figure this post is a long shot but I'm really just looking for anything to troubleshoot at this point.</p>