21 Dec, 2011

2 commits

  • Add support for mappings without GNTMAP_contains_pte. This was not
    supported because the unmap operation assumed that this flag was being
    used; adding a parameter to the unmap operation to allow the PTE
    clearing to be disabled is sufficient to make unmap capable of
    supporting either mapping type.

    Signed-off-by: Daniel De Graaf
    [v1: Fix cleanpatch warnings]
    Signed-off-by: Konrad Rzeszutek Wilk

    Daniel De Graaf
     
  • * commit 'v3.2-rc3': (412 commits)
    Linux 3.2-rc3
    virtio-pci: make reset operation safer
    virtio-mmio: Correct the name of the guest features selector
    virtio: add HAS_IOMEM dependency to MMIO platform bus driver
    eCryptfs: Extend array bounds for all filename chars
    eCryptfs: Flush file in vma close
    eCryptfs: Prevent file create race condition
    regulator: TPS65910: Fix VDD1/2 voltage selector count
    i2c: Make i2cdev_notifier_call static
    i2c: Delete ANY_I2C_BUS
    i2c: Fix device name for 10-bit slave address
    i2c-algo-bit: Generate correct i2c address sequence for 10-bit target
    drm: integer overflow in drm_mode_dirtyfb_ioctl()
    Revert "of/irq: of_irq_find_parent: check for parent equal to child"
    drivers/gpu/vga/vgaarb.c: add missing kfree
    drm/radeon/kms/atom: unify i2c gpio table handling
    drm/radeon/kms: fix up gpio i2c mask bits for r4xx for real
    ttm: Don't return the bo reserved on error path
    mount_subtree() pointless use-after-free
    iio: fix a leak due to improper use of anon_inode_getfd()
    ...

    Konrad Rzeszutek Wilk
     

22 Nov, 2011

1 commit


17 Nov, 2011

1 commit


07 Nov, 2011

1 commit

  • * 'stable/cleanups-3.2' of git://git.kernel.org/pub/scm/linux/kernel/git/konrad/xen:
    xen: use static initializers in xen-balloon.c
    Xen: fix braces and tabs coding style issue in xenbus_probe.c
    Xen: fix braces coding style issue in xenbus_probe.h
    Xen: fix whitespaces,tabs coding style issue in drivers/xen/pci.c
    Xen: fix braces coding style issue in gntdev.c and grant-table.c
    Xen: fix whitespaces,tabs coding style issue in drivers/xen/events.c
    Xen: fix whitespaces,tabs coding style issue in drivers/xen/balloon.c

    Fix up trivial whitespace-conflicts in
    drivers/xen/{balloon.c,pci.c,xenbus/xenbus_probe.c}

    Linus Torvalds
     

14 Oct, 2011

1 commit

  • 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: [] gntdev_ioctl+0x2bd/0x4d5
    Pid: 3256, comm: qemu-dm Tainted: G W 3.1.0-rc8+ #5
    Call Trace:
    [] __might_sleep+0x131/0x135
    [] mutex_lock_nested+0x25/0x45
    [] free_xenballooned_pages+0x20/0xb1
    [] gntdev_put_map+0xa8/0xdb
    [] ? _raw_spin_lock+0x71/0x7a
    [] ? gntdev_ioctl+0x2bd/0x4d5
    [] gntdev_ioctl+0x31f/0x4d5
    [] ? check_events+0x12/0x20
    [] do_vfs_ioctl+0x488/0x4d7
    [] ? xen_restore_fl_direct_reloc+0x4/0x4
    [] ? lock_release+0x21c/0x229
    [] ? rcu_read_unlock+0x21/0x32
    [] sys_ioctl+0x47/0x6a
    [] 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: Dario Faggioli
    Signed-off-by: Daniel De Graaf
    Signed-off-by: Konrad Rzeszutek Wilk

    Daniel De Graaf
     

29 Sep, 2011

2 commits

  • If we want to use granted pages for AIO, changing the mappings of a user
    vma and the corresponding p2m is not enough, we also need to update the
    kernel mappings accordingly.
    Currently this is only needed for pages that are created for user usages
    through /dev/xen/gntdev. As in, pages that have been in use by the
    kernel and use the P2M will not need this special mapping.
    However there are no guarantees that in the future the kernel won't
    start accessing pages through the 1:1 even for internal usage.

    In order to avoid the complexity of dealing with highmem, we allocated
    the pages lowmem.
    We issue a HYPERVISOR_grant_table_op right away in
    m2p_add_override and we remove the mappings using another
    HYPERVISOR_grant_table_op in m2p_remove_override.
    Considering that m2p_add_override and m2p_remove_override are called
    once per page we use multicalls and hypercall batching.

    Use the kmap_op pointer directly as argument to do the mapping as it is
    guaranteed to be present up until the unmapping is done.
    Before issuing any unmapping multicalls, we need to make sure that the
    mapping has already being done, because we need the kmap->handle to be
    set correctly.

    Signed-off-by: Stefano Stabellini
    [v1: Removed GRANT_FRAME_BIT usage]
    Signed-off-by: Konrad Rzeszutek Wilk

    Stefano Stabellini
     
  • Add an highmem parameter to alloc_xenballooned_pages, to allow callers to
    request lowmem or highmem pages.

    Fix the code style of free_xenballooned_pages' prototype.

    Signed-off-by: Stefano Stabellini
    Signed-off-by: Konrad Rzeszutek Wilk

    Stefano Stabellini
     

27 Jul, 2011

1 commit


20 May, 2011

1 commit

  • …rnel.org/pub/scm/linux/kernel/git/konrad/xen

    * 'stable/backend.base.v3' of git://git.kernel.org/pub/scm/linux/kernel/git/konrad/xen:
    xen/pci: Fix compiler error when CONFIG_XEN_PRIVILEGED_GUEST is not set.
    xen/p2m: Add EXPORT_SYMBOL_GPL to the M2P override functions.
    xen/p2m/m2p/gnttab: Support GNTMAP_host_map in the M2P override.
    xen/irq: The Xen hypervisor cleans up the PIRQs if the other domain forgot.
    xen/irq: Export 'xen_pirq_from_irq' function.
    xen/irq: Add support to check if IRQ line is shared with other domains.
    xen/irq: Check if the PCI device is owned by a domain different than DOMID_SELF.
    xen/pci: Add xen_[find|register|unregister]_device_domain_owner functions.

    * 'stable/gntalloc.v7' of git://git.kernel.org/pub/scm/linux/kernel/git/konrad/xen:
    xen/gntdev,gntalloc: Remove unneeded VM flags

    Linus Torvalds
     

24 Mar, 2011

2 commits


16 Mar, 2011

1 commit

  • Grant mappings cause the PFNMFN mapping to be lost on the pages used
    for the mapping. Instead of leaking memory, use pages that have already
    been ballooned out and so have no valid mapping. This removes the need
    for the bad-page leak workaround as pages are repopulated by the balloon
    driver.

    Acked-by: Ian Campbell
    Signed-off-by: Daniel De Graaf
    Signed-off-by: Konrad Rzeszutek Wilk

    Daniel De Graaf
     

10 Mar, 2011

2 commits

  • The only time when granted pages need to be treated specially is when
    using Xen's PTE modification for grant mappings owned by another domain
    (that is, only gntdev on PV guests). Otherwise, the area does not
    require VM_DONTCOPY and VM_PFNMAP, since it can be accessed just like
    any other page of RAM.

    Since the vm_operations_struct close operations decrement reference
    counts, a corresponding open function that increments them is required
    now that it is possible to have multiple references to a single area.

    We are careful in the gntdev to check if we can remove those flags. The
    reason that we need to be careful in gntdev on PV guests is because we are
    not changing the PFN/MFN mapping on PV; instead, we change the application's
    page tables to point to the other domain's memory. This means that the vma
    cannot be copied without using another grant mapping hypercall; it also
    requires special handling on unmap, which is the reason for gntdev's
    dependency on the MMU notifier.

    For gntalloc, this is not a concern - the pages are owned by the domain
    using the gntalloc device, and can be mapped and unmapped in the same manner
    as any other page of memory.

    Acked-by: Ian Campbell
    Signed-off-by: Daniel De Graaf
    Signed-off-by: Konrad Rzeszutek Wilk
    [v2: Added in git commit "We are.." from email correspondence]

    Daniel De Graaf
     
  • addr is actually a virtual address so use an unsigned long. Fixes:

    CC drivers/xen/gntdev.o
    drivers/xen/gntdev.c: In function 'map_grant_pages':
    drivers/xen/gntdev.c:268: warning: cast from pointer to integer of different size

    Reduce the scope of the variable at the same time.

    Signed-off-by: Ian Campbell
    Signed-off-by: Konrad Rzeszutek Wilk

    Ian Campbell
     

23 Feb, 2011

2 commits


15 Feb, 2011

11 commits


12 Jan, 2011

6 commits

  • Use gnttab_map_refs and gnttab_unmap_refs to map and unmap the grant
    ref, so that we can have a corresponding struct page.

    Signed-off-by: Stefano Stabellini
    Signed-off-by: Jeremy Fitzhardinge
    Signed-off-by: Konrad Rzeszutek Wilk

    Stefano Stabellini
     
  • apply_to_page_range will acquire PTE lock while priv->lock is held,
    and mn_invl_range_start tries to acquire priv->lock with PTE already
    held. Fix by not holding priv->lock during the entire map operation.
    This is safe because map->vma is set nonzero while the lock is held,
    which will cause subsequent maps to fail and will cause the unmap
    ioctl (and other users of gntdev_del_map) to return -EBUSY until the
    area is unmapped. It is similarly impossible for gntdev_vma_close to
    be called while the vma is still being created.

    Signed-off-by: Daniel De Graaf
    Signed-off-by: Konrad Rzeszutek Wilk

    Daniel De Graaf
     
  • It's the struct page of the L1 pte page. But we can get its mfn
    by simply doing an arbitrary_virt_to_machine() on it anyway (which is
    the safe conservative choice; since we no longer allow HIGHPTE pages,
    we would never expect to be operating on a mapped pte page).

    Signed-off-by: Jeremy Fitzhardinge
    Signed-off-by: Konrad Rzeszutek Wilk

    Jeremy Fitzhardinge
     
  • This flag controls the meaning of gnttab_map_grant_ref.host_addr and
    specifies that the field contains a reference to the pte entry to be
    used to perform the mapping. Therefore move the use of this flag to
    the point at which we actually use a reference to the pte instead of
    something else, splitting up the usage of the flag in this way is
    confusing and potentially error prone.

    The other flags are all properties of the mapping itself as opposed to
    properties of the hypercall arguments and therefore it make sense to
    continue to pass them round in map->flags.

    Signed-off-by: Ian Campbell
    Cc: Stefano Stabellini
    Cc: Derek G. Murray
    Cc: Gerd Hoffmann
    Signed-off-by: Jeremy Fitzhardinge
    Signed-off-by: Konrad Rzeszutek Wilk

    Ian Campbell
     
  • These pages are from other domains, so don't have any local PFN.
    VM_PFNMAP is the closest concept Linux has to this.

    Signed-off-by: Jeremy Fitzhardinge
    Signed-off-by: Konrad Rzeszutek Wilk

    Jeremy Fitzhardinge
     
  • The gntdev driver allows usermode to map granted pages from other
    domains. This is typically used to implement a Xen backend driver
    in user mode.

    Signed-off-by: Gerd Hoffmann
    Signed-off-by: Stefano Stabellini
    Signed-off-by: Jeremy Fitzhardinge
    Signed-off-by: Konrad Rzeszutek Wilk

    Gerd Hoffmann