Skip to content
Snippets Groups Projects
  1. May 27, 2013
  2. May 26, 2013
    • Nadav Har'El's avatar
      Fix comment · 0ad3e2e0
      Nadav Har'El authored
      The comment about unlocking the irq_lock was put on the wrong line.
      Move it (and rephrase it a bit - the word "release" immediately after
      calling an unrelated release() function - is confusing).
      0ad3e2e0
    • Nadav Har'El's avatar
      Fix two bugs in yield() · 19e52ce6
      Nadav Har'El authored
      yield() had two bugs - thanks to Avi for pinpointing them:
      
      1. It used runqueue.push_back() to put the thread on the run queue, but
         push_back() is a low-level function which can only be used if we're
         sure that the item we're pushing has the vruntime suitable for being
         *last* on the queue - and in the code we did nothing to ensure this
         is the case (we should...). So use insert_equal(), not push_back().
      
      2. It was wrongly divided into two separate sections with interrupts
         disabled. The scheduler code is run both at interrupt time (e.g.,
         preempt()) and at thread time (e.g., wait(), yield(), etc.) so to
         guarantee it does not get called in the middle of itself, it needs
         to disable interrupts while working on the (per-cpu) runqueue.
         In the broken yield() code, we disabled interupts while adding the
         current thread to the run queue, and then again to reschedule.
         Between those two critical sections, an interrupt could arrive and
         do something with this thread (e.g., migrate it to another CPU, or
         preempt it), yet when the interrupt returns yield continues to run
         reschedule_from_interrupt which assumes that this thread is still
         running, and definitely not on the run queue.
      
      Bug 2 is what caused the crashes in the tst-yield.so test. The fix is
      to hold the interrupts disabled throughout the entire yield().
      This is easiest done with with lock_guard, which simplifies the flow
      of this function.
      19e52ce6
    • Nadav Har'El's avatar
      sched: avoid unnecessary FPU saving · 947b49ee
      Nadav Har'El authored
      Because of Linux's calling convention, it should not be necessary to
      save the FPU state when a reschedule is caused by a function call.
      
      Because we had a bug and forgot to save the FPU state when calling
      a signal handler, and because this signal handler can cause a reschedule,
      we had to save the FPU on any reschedule. But after fixing that bug, we
      no longer need these unnecessary FPU saves.
      
      The "sunflow" benchmark still runs well after this patch.
      947b49ee
    • Guy Zana's avatar
    • Avi Kivity's avatar
    • Avi Kivity's avatar
      sched: fix preempt_enable() when interrupts are disabled · 84046f23
      Avi Kivity authored
      If interrupts are disabled, we must not call schedule() even if
      the preemption counter says we need to, as the context is not preemption
      safe.
      
      This manifested itself in a wake() within a timer causing a schedule(),
      which re-enabled interrupts, which caused further manipulation of the timer
      list to occur concurrently with the next interrupt, resulting in corruption.
      
      Fixes timer stress test failure.
      84046f23
    • Guy Zana's avatar
      tests: extend timer test, make it more stressful · 858f7666
      Guy Zana authored
      noticed an assert in the download file test that was related to timers,
      this test reproduce the same bug.
      858f7666
    • Nadav Har'El's avatar
      signal handling: fix FPU clobbering bug · 94a7015e
      Nadav Har'El authored
      This patch adds missing FPU-state saving when calling signal handlers.
      The state is saved on the stack, to allow nesting of signal handling
      (delivery of a second signal while a first signal's handler is running).
      
      In Linux calling conventions, the FPU state is caller-saved, i.e., a
      called function can use FPU at will because the caller is assumed to have
      saved it if needed. However, signal handlers are called asynchronously,
      possibly in the middle of some FPU computation without that computation
      getting a chance to save its state. So we must save this state before calling
      the signal handling function.
      
      Without this fix, we had problems even if the signal handlers themselves
      did not use the FPU. A typical scenario - which we encountered in the
      "sunflow" benchmark - is that the signal handler does something which uses
      a mutex (e.g., malloc()) and causes a reschedule. The reschedule, not a
      preempt(), thinks it does not need to save the FPU state, and the thread
      we switch to clobbers this state.
      94a7015e
    • Guy Zana's avatar
      tests: make the TCPDownloadFile test a bit more stressful · 1e66b4eb
      Guy Zana authored
      now it downloads a ~200MB file and validating md5 on it.
      1e66b4eb
    • Guy Zana's avatar
    • Guy Zana's avatar
      bbf0aa7b
    • Guy Zana's avatar
      bsd: rewrite callout mechanism to avoid a race · c5dbdcc8
      Guy Zana authored
      the old implementation used threads for dispatching callouts, each callout
      owned a thread and it suffered from a race where a callout structure could have
      been deleted before the callout thread even begun.
      
      the current implementation is dispatching all callouts in a single callout
      dispatcher thread, it maintains an ordered list of callouts to achieve that.
      
      this patch solve a crash with the TCPDownloadFile test, that now proceeds.
      c5dbdcc8
    • Guy Zana's avatar
      loader.py: make osv info threads more readable · 4a63055e
      Guy Zana authored
      4a63055e
    • Guy Zana's avatar
      uma: fix order to finit/dtor in uma_zfree() · 357d68d7
      Guy Zana authored
      the mbuf ext buffer is freed in the dtor, so it should be called before finit.
      this is fixing a crash that surfaced by using the conf-memory-debug=1
      357d68d7
    • Guy Zana's avatar
      bsd: zero a few uninitialized structures · 62712056
      Guy Zana authored
      this haven't caused a real bug, I just noticed it while tracing.
      it may be dangerous if in some flow, the stack will not be zeroed
      62712056
    • Guy Zana's avatar
      bsd: implement panic() · 91db62cf
      Guy Zana authored
      91db62cf
    • Guy Zana's avatar
      libc: fix strerror_r, should not appear as __xpg_strerror_r() · c481b94d
      Guy Zana authored
      strerror_r is needed by the JVM in order to print errors correctly.
      c481b94d
  3. May 25, 2013
  4. May 24, 2013
Loading