<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1">
  <title></title>
</head>
<body text="#000000" bgcolor="#ffffff">
Sorry for the late reply. I was away for the long weekend. However, my
validation test ran all the way through the long weekend ! So, we can
consider this a fix.<br>
See the patch attached.<br>
<br>
Thanks,<br>
Guillaume.<br>
<br>
<br>
Guillaume Autran wrote:<br>
<blockquote type="cite" cite="mid42C3F978.2070305@mrv.com">
  <title></title>
Well, disabling preemption in the get_mmu_context() does not help
much... <br>
I'm trying to disable preemption only inside destroy_mmu_context() as
suggested.<br>
Will keep you posted.<br>
  <br>
Guillaume.<br>
  <br>
  <br>
  <br>
Marcelo Tosatti wrote:<br>
  <blockquote type="cite" cite="mid20050629193846.GA4748@logos.cnet">
    <pre wrap="">On Thu, Jun 30, 2005 at 09:26:07AM +1000, Benjamin Herrenschmidt wrote:
  </pre>
    <blockquote type="cite">
      <blockquote type="cite">
        <pre wrap="">Execution is resumed exactly where it has been interrupted.

      </pre>
        <blockquote type="cite">
          <pre wrap="">The idea behind my patch was to get rid of that nr_free_contexts counter 
that is (I thing) redundant with the context_map.
        </pre>
        </blockquote>
        <pre wrap="">Apparently its there to avoid the spinlock exactly on !FEW_CONTEXTS machines.

I suppose that what happens is that get_mmu_context() gets preempted after stealing
a context (so nr_free_contexts = 0), but before setting next_mmu_context to the 
next entry

next_mmu_context = (ctx + 1) &amp; LAST_CONTEXT;
      </pre>
      </blockquote>
      <pre wrap="">Ugh ? Can switch_mm() be preempted at all ? Did I miss yet another
"let's open 10 gazillion races for gun" Ingo patch ?
    </pre>
    </blockquote>
    <pre wrap=""><!---->
Doh nope it can't - my bad.

  </pre>
    <blockquote type="cite">
      <blockquote type="cite">
        <pre wrap="">So if the now running higher prio tasks calls switch_mm() (which is likely to happen)
it loops forever on atomic_dec_if_positive(&amp;nr_free_contexts), while steal_context()
sees "mm-&gt;context == CONTEXT".
      </pre>
      </blockquote>
      <pre wrap="">I think the race is only when destroy_context() is preempted, but maybe
I missed something.
    </pre>
    </blockquote>
    <pre wrap=""><!---->
Nope, I think you are right. My "theory" is obviously flawed now. 

There seem to be several contexts where destroy_context() could be called
with preempt enabled - I should have been shutup in the first place :)

Lets wait for Guillaume to test...

  </pre>
  </blockquote>
  <br>
  <pre class="moz-signature" cols="72">-- 
=======================================
Guillaume Autran
Senior Software Engineer
MRV Communications, Inc.
Tel: (978) 952-4932 office
E-mail: <a class="moz-txt-link-abbreviated"
 href="mailto:gautran@mrv.com">gautran@mrv.com</a>
======================================= </pre>
  <pre wrap="">
<hr width="90%" size="4">
_______________________________________________
Linuxppc-embedded mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Linuxppc-embedded@ozlabs.org">Linuxppc-embedded@ozlabs.org</a>
<a class="moz-txt-link-freetext" href="https://ozlabs.org/mailman/listinfo/linuxppc-embedded">https://ozlabs.org/mailman/listinfo/linuxppc-embedded</a></pre>
</blockquote>
<br>
<pre class="moz-signature" cols="72">-- 
=======================================
Guillaume Autran
Senior Software Engineer
MRV Communications, Inc.
Tel: (978) 952-4932 office
E-mail: <a class="moz-txt-link-abbreviated" href="mailto:gautran@mrv.com">gautran@mrv.com</a>
======================================= </pre>
</body>
</html>