Skip to content
Snippets Groups Projects
  • Nadav Har'El's avatar
    e5c98d46
    We had a bug where we forgot to zero the .tbss section (the zero part of · e5c98d46
    Nadav Har'El authored
    the TLS), which led to preempt_counter not being intialized to zero and
    therefore preemption not being enabled for new threads.
    
    Such non-preemptable threads can monopolize their CPU and cause other
    threads with the misfortune of being assigned to this CPU to never run.
    
    This patch adds a simple test reproducing this bug. Because we don't have
    an implementation of __tls_get_addr(), we can't "extern" a TLS symbol
    (here sched::preempt_counter) from the test, and so I had to create a
    new sched::get_preempt_counter() function which I can "extern" from the
    test.
    e5c98d46
    History
    We had a bug where we forgot to zero the .tbss section (the zero part of
    Nadav Har'El authored
    the TLS), which led to preempt_counter not being intialized to zero and
    therefore preemption not being enabled for new threads.
    
    Such non-preemptable threads can monopolize their CPU and cause other
    threads with the misfortune of being assigned to this CPU to never run.
    
    This patch adds a simple test reproducing this bug. Because we don't have
    an implementation of __tls_get_addr(), we can't "extern" a TLS symbol
    (here sched::preempt_counter) from the test, and so I had to create a
    new sched::get_preempt_counter() function which I can "extern" from the
    test.