1. 01 Apr, 2016 1 commit
    • Rusty Russell's avatar
      lguest, x86/entry/32: Fix handling of guest syscalls using interrupt gates · f87e0434
      Rusty Russell authored
      In a798f091 ("x86/entry/32: Change INT80 to be an interrupt gate")
      Andy broke lguest.  This is because lguest had special code to allow
      the 0x80 trap gate go straight into the guest itself; interrupts gates
      (without more work, as mentioned in the file's comments) bounce via
      the hypervisor.
      His change made them go via the hypervisor, but as it's in the range of
      normal hardware interrupts, they were not directed through to the guest
      at all.  Turns out the guest userspace isn't very effective if syscalls
      are all noops.
      I haven't ripped out all the now-useless trap-direct-to-guest-kernel
      code yet, since it will still be needed if someone decides to update
      this optimization.
      Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
      Cc: Andy Lutomirski <luto@amacapital.net>
      Cc: Andy Lutomirski <luto@kernel.org>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Brian Gerst <brgerst@gmail.com>
      Cc: Denys Vlasenko <dvlasenk@redhat.com>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Weisbecker <fweisbec@gmail.com>
      Cc: x86\@kernel.org
      Link: http://lkml.kernel.org/r/87fuv685kl.fsf@rustcorp.com.auSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
  2. 10 May, 2015 1 commit
  3. 31 Mar, 2015 1 commit
    • Rusty Russell's avatar
      lguest: handle traps on the "interrupt suppressed" iret instruction. · 3eebd233
      Rusty Russell authored
      Lguest's "iret" is non-atomic, as it needs to restore the interrupt
      state before the real iret (the guest can't actually suppress
      interrupts).  For this reason, the host discards an interrupt if it
      occurs in this (1-instruction) window.
      We can do better, by emulating the iret execution, then immediately
      setting up the interrupt handler.  In fact, we don't need to do much,
      as emulating the iret and setting up th stack for the interrupt handler
      basically cancel each other out.
      Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
  4. 23 Mar, 2015 1 commit
  5. 05 Sep, 2013 1 commit
  6. 21 Jul, 2011 2 commits
  7. 11 Oct, 2009 1 commit
  8. 30 Jul, 2009 1 commit
  9. 12 Jun, 2009 4 commits
    • Rusty Russell's avatar
      lguest: allow any process to send interrupts · 9f155a9b
      Rusty Russell authored
      We currently only allow the Launcher process to send interrupts, but it
      as we already send interrupts from the hrtimer, it's a simple matter of
      extracting that code into a common set_interrupt routine.
      As we switch to a thread per virtqueue, this avoids a bottleneck through the
      main Launcher process.
      Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
    • Rusty Russell's avatar
      lguest: improve interrupt handling, speed up stream networking · a32a8813
      Rusty Russell authored
      lguest never checked for pending interrupts when enabling interrupts, and
      things still worked.  However, it makes a significant difference to TCP
      performance, so it's time we fixed it by introducing a pending_irq flag
      and checking it on irq_restore and irq_enable.
      These two routines are now too big to patch into the 8/10 bytes
      patch space, so we drop that code.
      Note: The high latency on interrupt delivery had a very curious
      effect: once everything else was optimized, networking without GSO was
      faster than networking with GSO, since more interrupts were sent and
      hence a greater chance of one getting through to the Guest!
      Note2: (Almost) Closing the same loophole for iret doesn't have any
      measurable effect, so I'm leaving that patch for the moment.
      	1GB tcpblast Guest->Host:		30.7 seconds
      	1GB tcpblast Guest->Host (no GSO):	76.0 seconds
      	1GB tcpblast Guest->Host:		6.8 seconds
      	1GB tcpblast Guest->Host (no GSO):	27.8 seconds
      Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
    • Rusty Russell's avatar
      lguest: fix race in halt code · abd41f03
      Rusty Russell authored
      When the Guest does the LHCALL_HALT hypercall, we go to sleep, expecting
      that a timer or the Waker will wake_up_process() us.
      But we do it in a stupid way, leaving a classic missing wakeup race.
      So split maybe_do_interrupt() into interrupt_pending() and
      try_deliver_interrupt(), and check maybe_do_interrupt() and the
      "break_out" flag before calling schedule.
      Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
    • Rusty Russell's avatar
      lguest: fix lguest wake on guest clock tick, or fd activity · a6c372de
      Rusty Russell authored
      The Launcher could be inside the Guest on another CPU; wake_up_process
      will do nothing because it is "running".  kick_process will knock it
      back into our kernel in this case, otherwise we'll miss it until the
      next guest exit.
      Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
  10. 30 Mar, 2009 2 commits
  11. 23 Dec, 2008 1 commit
    • Yinghai Lu's avatar
      x86: fix lguest used_vectors breakage, -v2 · b77b881f
      Yinghai Lu authored
      Impact: fix lguest, clean up
      32-bit lguest used used_vectors to record vectors, but that model of
      allocating vectors changed and got broken, after we changed vector
      allocation to a per_cpu array.
      Try enable that for 64bit, and the array is used for all vectors that
      are not managed by vector_irq per_cpu array.
      Also kill system_vectors[], that is now a duplication of the
      used_vectors bitmap.
      [ merged in cpus4096 due to io_apic.c cpumask changes. ]
      [ -v2, fix build failure ]
      Signed-off-by: default avatarYinghai Lu <yinghai@kernel.org>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
  12. 28 Jul, 2008 1 commit
    • Rusty Russell's avatar
      lguest: Guest int3 fix · 0c12091d
      Rusty Russell authored
      Ron Minnich noticed that guest userspace gets a GPF when it tries to int3:
      we need to copy the privilege level from the guest-supplied IDT to the real
      IDT.  int3 is the only common case where guest userspace expects to invoke
      an interrupt, so that's the symptom of failing to do this.
      Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
  13. 27 Mar, 2008 1 commit
  14. 30 Jan, 2008 9 commits
  15. 24 Oct, 2007 1 commit
  16. 22 Oct, 2007 5 commits
  17. 30 Aug, 2007 1 commit
  18. 09 Aug, 2007 1 commit
    • Rusty Russell's avatar
      lguest: Fix Malicious Guest GDT Host Crash · 0d027c01
      Rusty Russell authored
      If a Guest makes hypercall which sets a GDT entry to not present, we
      currently set any segment registers using that GDT entry to 0.
      Unfortunately, this is not sufficient: there are other ways of
      altering GDT entries which will cause a fault.
      The correct solution to do what Linux does: let them set any GDT value
      they want and handle the #GP when popping causes a fault.  This has
      the added benefit of making our Switcher slightly more robust in the
      case of any other bugs which cause it to fault.
      We kill the Guest if it causes a fault in the Switcher: it's the
      Guest's responsibility to make sure it's not using segments when it
      changes them.
      Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
  19. 28 Jul, 2007 1 commit
    • Rusty Russell's avatar
      Provide timespec to guests rather than jiffies clock. · 6c8dca5d
      Rusty Russell authored
      A non-periodic clock_event_device and the "jiffies" clock don't mix well:
      tick_handle_periodic() can go into an infinite loop.
      Currently lguest guests use the jiffies clock when the TSC is
      unusable.  Instead, make the Host write the current time into the lguest
      page on every interrupt.  This doesn't cost much but is more precise
      and at least as accurate as the jiffies clock.  It also gets rid of
      the GET_WALLCLOCK hypercall.
      Also, delay setting sched_clock until our clock is set up, otherwise
      the early printk timestamps can go backwards (not harmful, just ugly).
      Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
  20. 26 Jul, 2007 3 commits
  21. 20 Jul, 2007 1 commit