1. 27 3月, 2008 1 次提交
    • J
      xen: fix RMW when unmasking events · 04c44a08
      Jeremy Fitzhardinge 提交于
      xen_irq_enable_direct and xen_sysexit were using "andw $0x00ff,
      XEN_vcpu_info_pending(vcpu)" to unmask events and test for pending ones
      in one instuction.
      
      Unfortunately, the pending flag must be modified with a locked operation
      since it can be set by another CPU, and the unlocked form of this
      operation was causing the pending flag to get lost, allowing the processor
      to return to usermode with pending events and ultimately deadlock.
      
      The simple fix would be to make it a locked operation, but that's rather
      costly and unnecessary.  The fix here is to split the mask-clearing and
      pending-testing into two instructions; the interrupt window between
      them is of no concern because either way pending or new events will
      be processed.
      
      This should fix lingering bugs in using direct vcpu structure access too.
      
      [ Stable: needed in 2.6.24.x ]
      Signed-off-by: NJeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
      Cc: Stable <stable@kernel.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      04c44a08
  2. 11 10月, 2007 1 次提交
  3. 18 7月, 2007 2 次提交
    • J
      xen: use iret directly when possible · 9ec2b804
      Jeremy Fitzhardinge 提交于
      Most of the time we can simply use the iret instruction to exit the
      kernel, rather than having to use the iret hypercall - the only
      exception is if we're returning into vm86 mode, or from delivering an
      NMI (which we don't support yet).
      
      When running native, iret has the behaviour of testing for a pending
      interrupt atomically with re-enabling interrupts.  Unfortunately
      there's no way to do this with Xen, so there's a window in which we
      could get a recursive exception after enabling events but before
      actually returning to userspace.
      
      This causes a problem: if the nested interrupt causes one of the
      task's TIF_WORK_MASK flags to be set, they will not be checked again
      before returning to userspace.  This means that pending work may be
      left pending indefinitely, until the process enters and leaves the
      kernel again.  The net effect is that a pending signal or reschedule
      event could be delayed for an unbounded amount of time.
      
      To deal with this, the xen event upcall handler checks to see if the
      EIP is within the critical section of the iret code, after events
      are (potentially) enabled up to the iret itself.  If its within this
      range, it calls the iret critical section fixup, which adjusts the
      stack to deal with any unrestored registers, and then shifts the
      stack frame up to replace the previous invocation.
      Signed-off-by: NJeremy Fitzhardinge <jeremy@xensource.com>
      9ec2b804
    • J
      xen: Attempt to patch inline versions of common operations · 6487673b
      Jeremy Fitzhardinge 提交于
      This patchs adds the mechanism to allow us to patch inline versions of
      common operations.
      
      The implementations of the direct-access versions save_fl, restore_fl,
      irq_enable and irq_disable are now in assembler, and the same code is
      used for both out of line and inline uses.
      Signed-off-by: NJeremy Fitzhardinge <jeremy@xensource.com>
      Cc: Chris Wright <chrisw@sous-sol.org>
      Cc: Keir Fraser <keir@xensource.com>
      6487673b