1. 29 9月, 2011 3 次提交
    • D
      xen: allow balloon driver to use more than one memory region · 8b5d44a5
      David Vrabel 提交于
      Allow the xen balloon driver to populate its list of extra pages from
      more than one region of memory.  This will allow platforms to provide
      (for example) a region of low memory and a region of high memory.
      
      The maximum possible number of extra regions is 128 (== E820MAX) which
      is quite large so xen_extra_mem is placed in __initdata.  This is safe
      as both xen_memory_setup() and balloon_init() are in __init.
      
      The balloon regions themselves are not altered (i.e., there is still
      only the one region).
      Signed-off-by: NDavid Vrabel <david.vrabel@citrix.com>
      Signed-off-by: NKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      8b5d44a5
    • D
      xen/balloon: simplify test for the end of usable RAM · b1cbf9b1
      David Vrabel 提交于
      When initializing the balloon only max_pfn needs to be checked
      (max_pfn will always be <= e820_end_of_ram_pfn()) and improve the
      confusing comment.
      Signed-off-by: NDavid Vrabel <david.vrabel@citrix.com>
      Signed-off-by: NKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      b1cbf9b1
    • D
      xen/balloon: account for pages released during memory setup · aa24411b
      David Vrabel 提交于
      In xen_memory_setup() pages that occur in gaps in the memory map are
      released back to Xen.  This reduces the domain's current page count in
      the hypervisor.  The Xen balloon driver does not correctly decrease
      its initial current_pages count to reflect this.  If 'delta' pages are
      released and the target is adjusted the resulting reservation is
      always 'delta' less than the requested target.
      
      This affects dom0 if the initial allocation of pages overlaps the PCI
      memory region but won't affect most domU guests that have been setup
      with pseudo-physical memory maps that don't have gaps.
      
      Fix this by accouting for the released pages when starting the balloon
      driver.
      
      If the domain's targets are managed by xapi, the domain may eventually
      run out of memory and die because xapi currently gets its target
      calculations wrong and whenever it is restarted it always reduces the
      target by 'delta'.
      Signed-off-by: NDavid Vrabel <david.vrabel@citrix.com>
      Signed-off-by: NKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      aa24411b
  2. 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
  3. 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
  4. 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
  5. 04 8月, 2011 4 次提交
  6. 27 7月, 2011 3 次提交
  7. 26 7月, 2011 1 次提交
    • D
      xen/balloon: memory hotplug support for Xen balloon driver · 080e2be7
      Daniel Kiper 提交于
      Memory hotplug support for Xen balloon driver.  It should be mentioned
      that hotplugged memory is not onlined automatically.  It should be onlined
      by user through standard sysfs interface.
      
      Memory could be hotplugged in following steps:
      
        1) dom0: xl mem-max <domU> <maxmem>
           where <maxmem> is >= requested memory size,
      
        2) dom0: xl mem-set <domU> <memory>
           where <memory> is requested memory size; alternatively memory
           could be added by writing proper value to
           /sys/devices/system/xen_memory/xen_memory0/target or
           /sys/devices/system/xen_memory/xen_memory0/target_kb on dumU,
      
        3) domU: for i in /sys/devices/system/memory/memory*/state; do \
                   [ "`cat "$i"`" = offline ] && echo online > "$i"; done
      
      Memory could be onlined automatically on domU by adding following line to
      udev rules:
      
        SUBSYSTEM=="memory", ACTION=="add", RUN+="/bin/sh -c '[ -f /sys$devpath/state ] && echo online > /sys$devpath/state'"
      
      In that case step 3 should be omitted.
      Signed-off-by: NDaniel Kiper <dkiper@net-space.pl>
      Acked-by: NKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      Cc: Ian Campbell <ian.campbell@citrix.com>
      Cc: Jeremy Fitzhardinge <jeremy@goop.org>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      080e2be7
  8. 20 7月, 2011 13 次提交
    • K
      xen/pciback: Have 'passthrough' option instead of XEN_PCIDEV_BACKEND_PASS and... · 2ebdc426
      Konrad Rzeszutek Wilk 提交于
      xen/pciback: Have 'passthrough' option instead of XEN_PCIDEV_BACKEND_PASS and XEN_PCIDEV_BACKEND_VPCI
      
      .. compile options. This way the user can decide during runtime whether they
      want the default 'vpci' (virtual pci passthrough) or where the PCI devices
      are passed in without any BDF renumbering. The option 'passthrough' allows
      the user to toggle the it from 0 (vpci) to 1 (passthrough).
      Signed-off-by: NKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      2ebdc426
    • K
      xen/pciback: Remove the DEBUG option. · 77899970
      Konrad Rzeszutek Wilk 提交于
      The latter is easily fixed - by the developer compiling the
      module with -DDEBUG. And during runtime - the loglvl provides
      quite a lot of useful data.
      Signed-off-by: NKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      77899970
    • K
      xen/pciback: Drop two backends, squash and cleanup some code. · a92336a1
      Konrad Rzeszutek Wilk 提交于
       - Remove the slot and controller controller backend as they
         are not used.
       - Document the find pciback_[read|write]_config_[byte|word|dword]
         to make it easier to find.
       - Collapse the code from conf_space_capability_msi into pciback_ops.c
       - Collapse conf_space_capability_[pm|vpd].c in conf_space_capability.c
         [and remove the conf_space_capability.h file]
       - Rename all visible functions from pciback to xen_pcibk.
       - Rename all the printk/pr_info, etc that use the "pciback" to say
         "xen-pciback".
       - Convert functions that are not referenced outside the code to be
         static to save on name space.
       - Do the same thing for structures that are internal to the driver.
       - Run checkpatch.pl after the renames and fixup its warnings and
         fix any compile errors caused by the variable rename
       - Cleanup any structs that checkpath.pl commented about or just
         look odd.
      Signed-off-by: NKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      a92336a1
    • K
      xen/pciback: Print out the MSI/MSI-X (PIRQ) values · c288b67b
      Konrad Rzeszutek Wilk 提交于
      If the verbose_request is set (and loglevel high enough), print out
      the MSI/MSI-X values that are sent to the guest. This should aid in
      debugging issues.
      Signed-off-by: NKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      c288b67b
    • K
      xen/pciback: Don't setup an fake IRQ handler for SR-IOV devices. · e17ab35f
      Konrad Rzeszutek Wilk 提交于
      If we try to setup an fake IRQ handler for legacy interrupts
      for devices that only have MSI-X (most if not all SR-IOV cards),
      we will fail with this:
      
      pciback[0000:01:10.0]: failed to install fake IRQ handler for IRQ 0! (rc:-38)
      
      Since those cards don't have anything in dev->irq.
      Signed-off-by: NKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      e17ab35f
    • I
      xen: rename pciback module to xen-pciback. · a0b2fa8e
      Ian Campbell 提交于
      pciback is rather generic for a modular distro style kernel.
      Signed-off-by: NIan Campbell <ian.campbell@citrix.com>
      Cc: Jeremy Fitzhardinge <jeremy@goop.org>
      Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      Signed-off-by: NJeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
      a0b2fa8e
    • K
      xen/pciback: Fine-grain the spinlocks and fix BUG: scheduling while atomic cases. · 494ef20d
      Konrad Rzeszutek Wilk 提交于
      We were using coarse spinlocks that could end up with a deadlock.
      This patch fixes that and makes the spinlocks much more fine-grained.
      
      We also drop be->watchding state spinlocks as they are already
      guarded by the xenwatch_thread against multiple customers. Without
      that we would trigger the BUG: scheduling while atomic.
      Signed-off-by: NKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      494ef20d
    • K
      xen/pciback: Allocate IRQ handler for device that is shared with guest. · 0513fe9e
      Konrad Rzeszutek Wilk 提交于
      If the device that is to be shared with a guest is a level device and
      the IRQ is shared with the initial domain we need to take actions.
      Mainly we install a dummy IRQ handler that will ACK on the interrupt
      line so as to not have the initial domain disable the interrupt line.
      
      This dummy IRQ handler is not enabled when the device MSI/MSI-X lines
      are set, nor for edge interrupts. And also not for level interrupts
      that are not shared amongst devices. Lastly, if the user passes
      to the guest all of the PCI devices on the shared line the we won't
      install the dummy handler either.
      
      There is also SysFS instrumentation to check its state and turn
      IRQ ACKing on/off if necessary.
      Signed-off-by: NKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      0513fe9e
    • K
      xen/pciback: Disable MSI/MSI-X when reseting a device · a2be65fd
      Konrad Rzeszutek Wilk 提交于
      In cases where the guest is abruptly killed and has not disabled
      MSI/MSI-X interrupts we want to do it for it.
      
      Otherwise when the guest is started up and enables MSI, we would
      get a WARN() that the device already had been enabled.
      Signed-off-by: NKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      a2be65fd
    • Z
      xen/pciback: guest SR-IOV support for PV guest · fd5b221b
      Zhao, Yu 提交于
      These changes are for PV guest to use Virtual Function. Because the VF's
      vendor, device registers in cfg space are 0xffff, which are invalid and
      ignored by PCI device scan. Values in 'struct pci_dev' are fixed up by
      SR-IOV code, and using these values will present correct VID and DID to
      PV guest kernel.
      
      And command registers in the cfg space are read only 0, which means we
      have to emulate MMIO enable bit (VF only uses MMIO  resource) so PV
      kernel can work properly.
      Acked-by: NJan Beulich <jbeulich@novell.com>
      Signed-off-by: NKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      fd5b221b
    • K
      xen/pciback: Register the owner (domain) of the PCI device. · 6221a9b2
      Konrad Rzeszutek Wilk 提交于
      When the front-end and back-end start negotiating we register
      the domain that will use the PCI device. Furthermore during shutdown
      of guest or unbinding of the PCI device (and unloading of module)
      from pciback we unregister the domain owner.
      Signed-off-by: NKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      Signed-off-by: NJeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
      6221a9b2
    • K
      xen/pciback: Cleanup the driver based on checkpatch warnings and errors. · 8bfd4e02
      Konrad Rzeszutek Wilk 提交于
      Checkpatch found some extra warnings and errors. This mega
      patch fixes them all in one big swoop. We also spruce
      up the pcistub_ids to use DEFINE_PCI_DEVICE_TABLE macro
      (suggested by Jan Beulich).
      Signed-off-by: NKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      8bfd4e02
    • K
      xen/pciback: xen pci backend driver. · 30edc14b
      Konrad Rzeszutek Wilk 提交于
      This is the host side counterpart to the frontend driver in
      drivers/pci/xen-pcifront.c. The PV protocol is also implemented by
      frontend drivers in other OSes too, such as the BSDs.
      
      The PV protocol is rather simple. There is page shared with the guest,
      which has the 'struct xen_pci_sharedinfo' embossed in it. The backend
      has a thread that is kicked every-time the structure is changed and
      based on the operation field it performs specific tasks:
      
       XEN_PCI_OP_conf_[read|write]:
         Read/Write 0xCF8/0xCFC filtered data. (conf_space*.c)
         Based on which field is probed, we either enable/disable the PCI
         device, change power state, read VPD, etc. The major goal of this
         call is to provide a Physical IRQ (PIRQ) to the guest.
      
         The PIRQ is Xen hypervisor global IRQ value irrespective of the IRQ
         is tied in to the IO-APIC, or is a vector. For GSI type
         interrupts, the PIRQ==GSI holds. For MSI/MSI-X the
         PIRQ value != Linux IRQ number (thought PIRQ==vector).
      
         Please note, that with Xen, all interrupts (except those level shared ones)
         are injected directly to the guest - there is no host interaction.
      
       XEN_PCI_OP_[enable|disable]_msi[|x] (pciback_ops.c)
         Enables/disables the MSI/MSI-X capability of the device. These operations
         setup the MSI/MSI-X vectors for the guest and pass them to the frontend.
      
         When the device is activated, the interrupts are directly injected in the
         guest without involving the host.
      
       XEN_PCI_OP_aer_[detected|resume|mmio|slotreset]: In case of failure,
        perform the appropriate AER commands on the guest. Right now that is
        a cop-out - we just kill the guest.
      
      Besides implementing those commands, it can also
      
       - hide a PCI device from the host. When booting up, the user can specify
         xen-pciback.hide=(1:0:0)(BDF..) so that host does not try to use the
         device.
      
      The driver was lifted from linux-2.6.18.hg tree and fixed up
      so that it could compile under v3.0. Per suggestion from Jesse Barnes
      moved the driver to drivers/xen/xen-pciback.
      Signed-off-by: NKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      Signed-off-by: NJeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
      30edc14b
  9. 12 7月, 2011 2 次提交
  10. 09 7月, 2011 1 次提交
    • D
      xen: tmem: self-ballooning and frontswap-selfshrinking · a50777c7
      Dan Magenheimer 提交于
      This patch introduces two in-kernel drivers for Xen transcendent memory
      ("tmem") functionality that complement cleancache and frontswap.  Both
      use control theory to dynamically adjust and optimize memory utilization.
      Selfballooning controls the in-kernel Xen balloon driver, targeting a goal
      value (vm_committed_as), thus pushing less frequently used clean
      page cache pages (through the cleancache code) into Xen tmem where
      Xen can balance needs across all VMs residing on the physical machine.
      Frontswap-selfshrinking controls the number of pages in frontswap,
      driving it towards zero (effectively doing a partial swapoff) when
      in-kernel memory pressure subsides, freeing up RAM for other VMs.
      
      More detail is provided in the header comment of xen-selfballooning.c.
      Signed-off-by: NDan Magenheimer <dan.magenheimer@oracle.com>
      
      [v8: konrad.wilk@oracle.com: set default enablement depending on frontswap]
      [v7: konrad.wilk@oracle.com: fix capitalization and punctuation in comments]
      [v6: fix frontswap-selfshrinking initialization]
      [v6: konrad.wilk@oracle.com: fix init pr_infos; add comments about swap]
      [v5: konrad.wilk@oracle.com: add NULL to attr list; move inits up to decls]
      [v4: dkiper@net-space.pl: use strict_strtoul plus a few syntactic nits]
      [v3: konrad.wilk@oracle.com: fix potential divides-by-zero]
      [v3: konrad.wilk@oracle.com: add many more comments, fix nits]
      [v2: rebased to linux-3.0-rc1]
      [v2: Ian.Campbell@citrix.com: reorganize as new file (xen-selfballoon.c)]
      [v2: dkiper@net-space.pl: proper access to vm_committed_as]
      [v2: dkiper@net-space.pl: accounting fixes]
      Cc: Jan Beulich <JBeulich@novell.com>
      Cc: Jeremy Fitzhardinge <jeremy@goop.org>
      Cc: <xen-devel@lists.xensource.com>
      a50777c7
  11. 01 7月, 2011 2 次提交
  12. 18 6月, 2011 1 次提交
  13. 16 6月, 2011 1 次提交
  14. 07 6月, 2011 1 次提交
    • F
      swiotlb: Export swioltb_nr_tbl and utilize it as appropiate. · 5f98ecdb
      FUJITA Tomonori 提交于
      By default the io_tlb_nslabs is set to zero, and gets set to
      whatever value is passed in via swiotlb_init_with_tbl function.
      The default value passed in is 64MB. However, if the user provides
      the 'swiotlb=<nslabs>' the default value is ignored and
      the value provided by the user is used... Except when the SWIOTLB
      is used under Xen - there the default value of 64MB is used and
      the Xen-SWIOTLB has no mechanism to get the 'io_tlb_nslabs' filled
      out by setup_io_tlb_npages functions. This patch provides a function
      for the Xen-SWIOTLB to call to see if the io_tlb_nslabs is set
      and if so use that value.
      Signed-off-by: NFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
      Signed-off-by: NKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      5f98ecdb
  15. 31 5月, 2011 1 次提交
  16. 27 5月, 2011 1 次提交
    • D
      xen: cleancache shim to Xen Transcendent Memory · 5bc20fc5
      Dan Magenheimer 提交于
      This patch provides a shim between the kernel-internal cleancache
      API (see Documentation/mm/cleancache.txt) and the Xen Transcendent
      Memory ABI (see http://oss.oracle.com/projects/tmem).
      
      Xen tmem provides "hypervisor RAM" as an ephemeral page-oriented
      pseudo-RAM store for cleancache pages, shared cleancache pages,
      and frontswap pages.  Tmem provides enterprise-quality concurrency,
      full save/restore and live migration support, compression
      and deduplication.
      
      A presentation showing up to 8% faster performance and up to 52%
      reduction in sectors read on a kernel compile workload, despite
      aggressive in-kernel page reclamation ("self-ballooning") can be
      found at:
      
      http://oss.oracle.com/projects/tmem/dist/documentation/presentations/TranscendentMemoryXenSummit2010.pdfSigned-off-by: NDan Magenheimer <dan.magenheimer@oracle.com>
      Reviewed-by: NJeremy Fitzhardinge <jeremy@goop.org>
      Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      Cc: Matthew Wilcox <matthew@wil.cx>
      Cc: Nick Piggin <npiggin@kernel.dk>
      Cc: Mel Gorman <mel@csn.ul.ie>
      Cc: Rik Van Riel <riel@redhat.com>
      Cc: Jan Beulich <JBeulich@novell.com>
      Cc: Chris Mason <chris.mason@oracle.com>
      Cc: Andreas Dilger <adilger@sun.com>
      Cc: Ted Ts'o <tytso@mit.edu>
      Cc: Mark Fasheh <mfasheh@suse.com>
      Cc: Joel Becker <joel.becker@oracle.com>
      Cc: Nitin Gupta <ngupta@vflare.org>
      5bc20fc5
  17. 19 5月, 2011 2 次提交
    • D
      drivers/xen/sys-hypervisor: Cleanup code/data sections definitions · 887cb456
      Daniel Kiper 提交于
      Cleanup code/data sections definitions
      accordingly to include/linux/init.h.
      Signed-off-by: NDaniel Kiper <dkiper@net-space.pl>
      Signed-off-by: NKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      887cb456
    • K
      xen/p2m/m2p/gnttab: Support GNTMAP_host_map in the M2P override. · d5431d52
      Konrad Rzeszutek Wilk 提交于
      We only supported the M2P (and P2M) override only for the
      GNTMAP_contains_pte type mappings. Meaning that we grants
      operations would "contain the machine address of the PTE to update"
      If the flag is unset, then the grant operation is
      "contains a host virtual address". The latter case means that
      the Hypervisor takes care of updating our page table
      (specifically the PTE entry) with the guest's MFN. As such we should
      not try to do anything with the PTE. Previous to this patch
      we would try to clear the PTE which resulted in Xen hypervisor
      being upset with us:
      
      (XEN) mm.c:1066:d0 Attempt to implicitly unmap a granted PTE c0100000ccc59067
      (XEN) domain_crash called from mm.c:1067
      (XEN) Domain 0 (vcpu#0) crashed on cpu#3:
      (XEN) ----[ Xen-4.0-110228  x86_64  debug=y  Not tainted ]----
      
      and crashing us.
      
      This patch allows us to inhibit the PTE clearing in the PV guest
      if the GNTMAP_contains_pte is not set.
      
      On the m2p_remove_override path we provide the same parameter.
      
      Sadly in the grant-table driver we do not have a mechanism to
      tell m2p_remove_override whether to clear the PTE or not. Since
      the grant-table driver is used by user-space, we can safely assume
      that it operates only on PTE's. Hence the implementation for
      it to work on !GNTMAP_contains_pte returns -EOPNOTSUPP. In the future
      we can implement the support for this. It will require some extra
      accounting structure to keep track of the page[i], and the flag.
      
      [v1: Added documentation details, made it return -EOPNOTSUPP instead
       of trying to do a half-way implementation]
      Signed-off-by: NKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      d5431d52
  18. 13 5月, 2011 1 次提交