1. 01 11月, 2011 1 次提交
  2. 20 10月, 2011 6 次提交
  3. 17 10月, 2011 1 次提交
  4. 15 10月, 2011 1 次提交
    • D
      xen: Fix selfballooning and ensure it doesn't go too far · 38a1ed4f
      Dan Magenheimer 提交于
      The balloon driver's "current_pages" is very different from
      totalram_pages.  Self-ballooning needs to be driven by
      the latter.  Also, Committed_AS doesn't account for pages
      used by the kernel so:
      1) Add totalreserve_pages to Committed_AS for the normal target.
      2) Enforce a floor for when there are little or no user-space threads
         using memory (e.g. single-user mode) to avoid OOMs.  The floor
         function includes a "min_usable_mb" tuneable in case we discover
         later that the floor function is still too aggressive in some
         workloads, though likely it will not be needed.
      
      Changes since version 4:
      - change floor calculation so that it is not as aggressive; this version
        uses a piecewise linear function similar to minimum_target in the 2.6.18
        balloon driver, but modified to add to totalreserve_pages instead of
        subtract from max_pfn, the 2.6.18 version causes OOMs on recent kernels
        because the kernel has expanded over time
      - change safety_margin to min_usable_mb and comment on its use
      - since committed_as does NOT include kernel space (and other reserved
        pages), totalreserve_pages is now added to committed_as.  The result is
        less aggressive self-ballooning, but theoretically more appropriate.
      Changes since version 3:
      - missing include causes compile problem when CONFIG_FRONTSWAP is disabled
      - add comments after includes
      Changes since version 2:
      - missing include causes compile problem only on 32-bit
      Changes since version 1:
      - tuneable safety margin added
      
      [v5: avi.miller@oracle.com: still too aggressive, seeing some OOMs]
      [v4: konrad.wilk@oracle.com: fix compile when CONFIG_FRONTSWAP is disabled]
      [v3: guru.anbalagane@oracle.com: fix 32-bit compile]
      [v2: konrad.wilk@oracle.com: make safety margin tuneable]
      Signed-off-by: NDan Magenheimer <dan.magenheimer@oracle.com>
      [v1: Altered description and added an extra include]
      Signed-off-by: NKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      38a1ed4f
  5. 14 10月, 2011 3 次提交
    • D
      xen/gntdev: Fix sleep-inside-spinlock · 1f1503ba
      Daniel De Graaf 提交于
      BUG: sleeping function called from invalid context at /local/scratch/dariof/linux/kernel/mutex.c:271
      in_atomic(): 1, irqs_disabled(): 0, pid: 3256, name: qemu-dm
      1 lock held by qemu-dm/3256:
       #0:  (&(&priv->lock)->rlock){......}, at: [<ffffffff813223da>] gntdev_ioctl+0x2bd/0x4d5
      Pid: 3256, comm: qemu-dm Tainted: G        W   3.1.0-rc8+ #5
      Call Trace:
       [<ffffffff81054594>] __might_sleep+0x131/0x135
       [<ffffffff816bd64f>] mutex_lock_nested+0x25/0x45
       [<ffffffff8131c7c8>] free_xenballooned_pages+0x20/0xb1
       [<ffffffff8132194d>] gntdev_put_map+0xa8/0xdb
       [<ffffffff816be546>] ? _raw_spin_lock+0x71/0x7a
       [<ffffffff813223da>] ? gntdev_ioctl+0x2bd/0x4d5
       [<ffffffff8132243c>] gntdev_ioctl+0x31f/0x4d5
       [<ffffffff81007d62>] ? check_events+0x12/0x20
       [<ffffffff811433bc>] do_vfs_ioctl+0x488/0x4d7
       [<ffffffff81007d4f>] ? xen_restore_fl_direct_reloc+0x4/0x4
       [<ffffffff8109168b>] ? lock_release+0x21c/0x229
       [<ffffffff81135cdd>] ? rcu_read_unlock+0x21/0x32
       [<ffffffff81143452>] sys_ioctl+0x47/0x6a
       [<ffffffff816bfd82>] system_call_fastpath+0x16/0x1b
      
      gntdev_put_map tries to acquire a mutex when freeing pages back to the
      xenballoon pool, so it cannot be called with a spinlock held. In
      gntdev_release, the spinlock is not needed as we are freeing the
      structure later; in the ioctl, only the list manipulation needs to be
      under the lock.
      Reported-and-Tested-By: NDario Faggioli <dario.faggioli@citrix.com>
      Signed-off-by: NDaniel De Graaf <dgdegra@tycho.nsa.gov>
      Signed-off-by: NKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      1f1503ba
    • D
      xenbus: don't rely on xen_initial_domain to detect local xenstore · e4184aaf
      Daniel De Graaf 提交于
      The xenstore daemon does not have to run in the xen initial domain;
      however, Linux currently uses xen_initial_domain to test if a loopback
      event channel should be used instead of the event channel provided in
      Xen's start_info structure. Instead, if the event channel passed in the
      start_info structure is not valid, assume that this domain will run
      xenstored locally and set up the event channel.
      Signed-off-by: NDaniel De Graaf <dgdegra@tycho.nsa.gov>
      Reviewed-by: NIan Campbell <Ian.Campbell@citrix.com>
      Signed-off-by: NKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      e4184aaf
    • D
      xenbus: Fix loopback event channel assuming domain 0 · 77447991
      Daniel De Graaf 提交于
      The xenbus event channel established in xenbus_init is intended to be a
      loopback channel, but the remote domain was hardcoded to 0; this will
      cause the channel to be unusable when xenstore is not being run in
      domain 0.
      Signed-off-by: NDaniel De Graaf <dgdegra@tycho.nsa.gov>
      Reviewed-by: NIan Campbell <Ian.Campbell@citrix.com>
      Signed-off-by: NKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      77447991
  6. 29 9月, 2011 7 次提交
  7. 27 9月, 2011 2 次提交
  8. 23 9月, 2011 2 次提交
    • O
      xen/pv-on-hvm kexec: add xs_reset_watches to shutdown watches from old kernel · ddacf5ef
      Olaf Hering 提交于
      Add new xs_reset_watches function to shutdown watches from old kernel after
      kexec boot.  The old kernel does not unregister all watches in the
      shutdown path.  They are still active, the double registration can not
      be detected by the new kernel.  When the watches fire, unexpected events
      will arrive and the xenwatch thread will crash (jumps to NULL).  An
      orderly reboot of a hvm guest will destroy the entire guest with all its
      resources (including the watches) before it is rebuilt from scratch, so
      the missing unregister is not an issue in that case.
      
      With this change the xenstored is instructed to wipe all active watches
      for the guest.  However, a patch for xenstored is required so that it
      accepts the XS_RESET_WATCHES request from a client (see changeset
      23839:42a45baf037d in xen-unstable.hg). Without the patch for xenstored
      the registration of watches will fail and some features of a PVonHVM
      guest are not available. The guest is still able to boot, but repeated
      kexec boots will fail.
      
      [v5: use xs_single instead of passing a dummy string to xs_talkv]
      [v4: ignore -EEXIST in xs_reset_watches]
      [v3: use XS_RESET_WATCHES instead of XS_INTRODUCE]
      [v2: move all code which deals with XS_INTRODUCE into xs_introduce()
          (based on feedback from Ian Campbell); remove casts from kvec assignment]
      Signed-off-by: NOlaf Hering <olaf@aepfle.de>
      [v1: Redid the git description a bit]
      Signed-off-by: NKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      ddacf5ef
    • J
      xen/pci: support multi-segment systems · 55e901fc
      Jan Beulich 提交于
      Now that the hypercall interface changes are in -unstable, make the
      kernel side code not ignore the segment (aka domain) number anymore
      (which results in pretty odd behavior on such systems). Rather, if
      only the old interfaces are available, don't call them for devices on
      non-zero segments at all.
      Signed-off-by: NJan Beulich <jbeulich@suse.com>
      [v1: Edited git description]
      Signed-off-by: NKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      55e901fc
  9. 22 9月, 2011 5 次提交
    • K
      xen/pciback: use mutex rather than spinlock in vpci backend · 74d33ded
      Konrad Rzeszutek Wilk 提交于
      Similar to the "xen/pciback: use mutex rather than spinlock in passthrough backend"
      this patch converts the vpci backend to use a mutex instead of
      a spinlock. Note that the code taking the lock won't ever get called
      from non-sleepable context
      Signed-off-by: NKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      74d33ded
    • K
      xen/pciback: Use mutexes when working with Xenbus state transitions. · b1766b62
      Konrad Rzeszutek Wilk 提交于
      The caller that orchestrates the state changes is xenwatch_thread
      and it takes a mutex. In our processing of Xenbus states we can take
      the luxery of going to sleep on a mutex, so lets do that and
      also fix this bug:
      
      BUG: sleeping function called from invalid context at /linux/kernel/mutex.c:271
      in_atomic(): 1, irqs_disabled(): 0, pid: 32, name: xenwatch
      2 locks held by xenwatch/32:
       #0:  (xenwatch_mutex){......}, at: [<ffffffff813856ab>] xenwatch_thread+0x4b/0x180
       #1:  (&(&pdev->dev_lock)->rlock){......}, at: [<ffffffff8138f05b>] xen_pcibk_disconnect+0x1b/0x80
      Pid: 32, comm: xenwatch Not tainted 3.1.0-rc6-00015-g3ce340d #2
      Call Trace:
       [<ffffffff810892b2>] __might_sleep+0x102/0x130
       [<ffffffff8163b90f>] mutex_lock_nested+0x2f/0x50
       [<ffffffff81382c1c>] unbind_from_irq+0x2c/0x1b0
       [<ffffffff8110da66>] ? free_irq+0x56/0xb0
       [<ffffffff81382dbc>] unbind_from_irqhandler+0x1c/0x30
       [<ffffffff8138f06b>] xen_pcibk_disconnect+0x2b/0x80
       [<ffffffff81390348>] xen_pcibk_frontend_changed+0xe8/0x140
       [<ffffffff81387ac2>] xenbus_otherend_changed+0xd2/0x150
       [<ffffffff810895c1>] ? get_parent_ip+0x11/0x50
       [<ffffffff81387de0>] frontend_changed+0x10/0x20
       [<ffffffff81385712>] xenwatch_thread+0xb2/0x180
      Signed-off-by: NKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      b1766b62
    • J
      xen/pciback: miscellaneous adjustments · 402c5e15
      Jan Beulich 提交于
      This is a minor bugfix and a set of small cleanups; as it is not clear
      whether this needs splitting into pieces (and if so, at what
      granularity), it is a single combined patch.
      - add a missing return statement to an error path in
        kill_domain_by_device()
      - use pci_is_enabled() rather than raw atomic_read()
      - remove a bogus attempt to zero-terminate an already zero-terminated
        string
      - #define DRV_NAME once uniformly in the shared local header
      - make DRIVER_ATTR() variables static
      - eliminate a pointless use of list_for_each_entry_safe()
      - add MODULE_ALIAS()
      - a little bit of constification
      - adjust a few messages
      - remove stray semicolons from inline function definitions
      Signed-off-by: NJan Beulich <jbeulich@suse.com>
      [v1: Dropped the resource_size fix, altered the description]
      [v2: Fixed cleanpatch.pl comments]
      Signed-off-by: NKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      402c5e15
    • J
      xen/pciback: use mutex rather than spinlock in passthrough backend · 04df3552
      Jan Beulich 提交于
      To accommodate the call to the callback function from
      __xen_pcibk_publish_pci_roots(), which so far dropped and the re-
      acquired the lock without checking that the list didn't actually
      change, convert the code to use a mutex instead (observing that the
      code taking the lock won't ever get called from non-sleepable
      context).
      
      As a result, drop the bogus use of list_for_each_entry_safe() and
      remove the inappropriate dropping of the lock.
      Signed-off-by: NJan Beulich <jbeulich@suse.com>
      Signed-off-by: NKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      04df3552
    • T
      xen/pciback: use resource_size() · 5fa99911
      Thomas Meyer 提交于
       Use resource_size function on resource object
       instead of explicit computation.
      
       The semantic patch that makes this output is available
       in scripts/coccinelle/api/resource_size.cocci.
      
       More information about semantic patching is available at
       http://coccinelle.lip6.fr/Signed-off-by: NThomas Meyer <thomas@m3y3r.de>
      Signed-off-by: NKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      5fa99911
  10. 15 9月, 2011 1 次提交
    • K
      xen/irq: Alter the locking to use a mutex instead of a spinlock. · 77365948
      Konrad Rzeszutek Wilk 提交于
      When we allocate/change the IRQ informations, we do not
      need to use spinlocks. We can use a mutex (which is
      what the generic IRQ code does for allocations/changes).
      Fixes a slew of:
      
      BUG: sleeping function called from invalid context at /linux/kernel/mutex.c:271
      in_atomic(): 1, irqs_disabled(): 0, pid: 3216, name: xenstored
      2 locks held by xenstored/3216:
       #0:  (&u->bind_mutex){......}, at: [<ffffffffa02e0920>] evtchn_ioctl+0x30/0x3a0 [xen_evtchn]
       #1:  (irq_mapping_update_lock){......}, at: [<ffffffff8138b274>] bind_evtchn_to_irq+0x24/0x90
      Pid: 3216, comm: xenstored Not tainted 3.1.0-rc6-00021-g437a3d1 #2
      Call Trace:
       [<ffffffff81088d10>] __might_sleep+0x100/0x130
       [<ffffffff81645c2f>] mutex_lock_nested+0x2f/0x50
       [<ffffffff81627529>] __irq_alloc_descs+0x49/0x200
       [<ffffffffa02e0920>] ? evtchn_ioctl+0x30/0x3a0 [xen_evtchn]
       [<ffffffff8138b214>] xen_allocate_irq_dynamic+0x34/0x70
       [<ffffffff8138b2ad>] bind_evtchn_to_irq+0x5d/0x90
       [<ffffffffa02e03c0>] ? evtchn_bind_to_user+0x60/0x60 [xen_evtchn]
       [<ffffffff8138c282>] bind_evtchn_to_irqhandler+0x32/0x80
       [<ffffffffa02e03a9>] evtchn_bind_to_user+0x49/0x60 [xen_evtchn]
       [<ffffffffa02e0a34>] evtchn_ioctl+0x144/0x3a0 [xen_evtchn]
       [<ffffffff811b4070>] ? vfsmount_lock_local_unlock+0x50/0x80
       [<ffffffff811a6a1a>] do_vfs_ioctl+0x9a/0x5e0
       [<ffffffff811b476f>] ? mntput+0x1f/0x30
       [<ffffffff81196259>] ? fput+0x199/0x240
       [<ffffffff811a7001>] sys_ioctl+0xa1/0xb0
       [<ffffffff8164ea82>] system_call_fastpath+0x16/0x1b
      Reported-by: NJim Burns <jim_burn@bellsouth.net>
      Acked-by: NIan Campbell <ian.campbell@citrix.com>
      Signed-off-by: NKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      77365948
  11. 01 9月, 2011 3 次提交
    • O
      xen/pv-on-hvm kexec+kdump: reset PV devices in kexec or crash kernel · 116df6f0
      Olaf Hering 提交于
      After triggering a crash dump in a HVM guest, the PV backend drivers
      will remain in Connected state. When the kdump kernel starts the PV
      drivers will skip such devices. As a result, no root device is found and
      the vmcore cant be saved.
      
      A similar situation happens after a kexec boot, here the devices will be
      in the Closed state.
      
      With this change all frontend devices with state XenbusStateConnected or
      XenbusStateClosed will be reset by changing the state file to Closing ->
      Closed -> Initializing.  This will trigger a disconnect in the backend
      drivers. Now the frontend drivers will find the backend drivers in state
      Initwait and can connect.
      Signed-off-by: NOlaf Hering <olaf@aepfle.de>
      [v2:
        - add timeout when waiting for backend state change
        (based on feedback from Ian Campell)
        - extent printk message to include backend string
        - add comment to fall-through case in xenbus_reset_frontend]
      Signed-off-by: NKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      116df6f0
    • O
      xen/pv-on-hvm kexec: rebind virqs to existing eventchannel ports · 62cc5fc7
      Olaf Hering 提交于
      During a kexec boot some virqs such as timer and debugirq were already
      registered by the old kernel.  The hypervisor will return -EEXISTS from
      the new EVTCHNOP_bind_virq request and the BUG in bind_virq_to_irq()
      triggers.  Catch the -EEXISTS error and loop through all possible ports to find
      what port belongs to the virq/cpu combo.
      Signed-off-by: NOlaf Hering <olaf@aepfle.de>
      [v2:
        - use NR_EVENT_CHANNELS instead of private MAX_EVTCHNS]
      Signed-off-by: NKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      62cc5fc7
    • O
      xen/pv-on-hvm kexec: prevent crash in xenwatch_thread() when stale watch events arrive · c4c303c7
      Olaf Hering 提交于
      During repeated kexec boots xenwatch_thread() can crash because
      xenbus_watch->callback is cleared by xenbus_watch_path() if a node/token
      combo for a new watch happens to match an already registered watch from
      an old kernel.  In this case xs_watch returns -EEXISTS, then
      register_xenbus_watch() does not remove the to-be-registered watch from
      the list of active watches but returns the -EEXISTS to the caller
      anyway.
      
      Because the watch is still active in xenstored it will cause an event
      which will arrive in the new kernel. process_msg() will find the
      encapsulated struct xenbus_watch in its list of registered watches and
      puts the "empty" watch handle in the queue for xenwatch_thread().
      xenwatch_thread() then calls ->callback which was cleared earlier by
      xenbus_watch_path().
      
      To prevent that crash in a guest running on an old xen toolstack remove
      the special -EEXIST handling.
      
      v2:
       - remove the EEXIST handing in register_xenbus_watch() instead of
         checking for ->callback in process_msg()
      Signed-off-by: NKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      Signed-off-by: NOlaf Hering <olaf@aepfle.de>
      c4c303c7
  12. 27 8月, 2011 5 次提交
  13. 16 8月, 2011 1 次提交
    • R
      xen: self-balloon needs module.h · 4fec0e0b
      Randy Dunlap 提交于
      Fix build errors (found when CONFIG_SYSFS is not enabled):
      
        drivers/xen/xen-selfballoon.c:446: warning: data definition has no type or storage class
        drivers/xen/xen-selfballoon.c:446: warning: type defaults to 'int' in declaration of 'EXPORT_SYMBOL'
        drivers/xen/xen-selfballoon.c:446: warning: parameter names (without types) in function declaration
        drivers/xen/xen-selfballoon.c:485: error: expected declaration specifiers or '...' before string constant
        drivers/xen/xen-selfballoon.c:485: warning: data definition has no type or storage class
        drivers/xen/xen-selfballoon.c:485: warning: type defaults to 'int' in declaration of 'MODULE_LICENSE'
        drivers/xen/xen-selfballoon.c:485: warning: function declaration isn't a prototype
      Signed-off-by: NRandy Dunlap <rdunlap@xenotime.net>
      Acked-by: NKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      4fec0e0b
  14. 11 8月, 2011 1 次提交
    • R
      xen: xen-selfballoon.c needs more header files · 30eefc95
      Randy Dunlap 提交于
      Fix build errors (found when CONFIG_SYSFS is not enabled):
      
      drivers/xen/xen-selfballoon.c:446: warning: data definition has no type or storage class
      drivers/xen/xen-selfballoon.c:446: warning: type defaults to 'int' in declaration of 'EXPORT_SYMBOL'
      drivers/xen/xen-selfballoon.c:446: warning: parameter names (without types) in function declaration
      drivers/xen/xen-selfballoon.c:485: error: expected declaration specifiers or '...' before string constant
      drivers/xen/xen-selfballoon.c:485: warning: data definition has no type or storage class
      drivers/xen/xen-selfballoon.c:485: warning: type defaults to 'int' in declaration of 'MODULE_LICENSE'
      drivers/xen/xen-selfballoon.c:485: warning: function declaration isn't a prototype
      Signed-off-by: NRandy Dunlap <rdunlap@xenotime.net>
      Signed-off-by: NKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      30eefc95
  15. 04 8月, 2011 1 次提交