1. 13 Mar, 2017 1 commit
  2. 02 Mar, 2017 1 commit
    • Ingo Molnar's avatar
      sched/headers: Prepare for new header dependencies before moving code to <linux/sched/mm.h> · 6e84f315
      Ingo Molnar authored
      We are going to split <linux/sched/mm.h> out of <linux/sched.h>, which
      will have to be picked up from other headers and a couple of .c files.
      
      Create a trivial placeholder <linux/sched/mm.h> file that just
      maps to <linux/sched.h> to make this patch obviously correct and
      bisectable.
      
      The APIs that are going to be moved first are:
      
         mm_alloc()
         __mmdrop()
         mmdrop()
         mmdrop_async_fn()
         mmdrop_async()
         mmget_not_zero()
         mmput()
         mmput_async()
         get_task_mm()
         mm_access()
         mm_release()
      
      Include the new header in the files that are going to need it.
      Acked-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: linux-kernel@vger.kernel.org
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      6e84f315
  3. 28 Nov, 2016 1 commit
  4. 06 Jul, 2016 1 commit
  5. 24 May, 2016 1 commit
    • David Vrabel's avatar
      xen/gntdev: reduce copy batch size to 16 · 36ae220a
      David Vrabel authored
      IOCTL_GNTDEV_GRANT_COPY batches copy operations to reduce the number
      of hypercalls.  The stack is used to avoid a memory allocation in a
      hot path. However, a batch size of 24 requires more than 1024 bytes of
      stack which in some configurations causes a compiler warning.
      
          xen/gntdev.c: In function ‘gntdev_ioctl_grant_copy’:
          xen/gntdev.c:949:1: warning: the frame size of 1248 bytes is
          larger than 1024 bytes [-Wframe-larger-than=]
      
      This is a harmless warning as there is still plenty of stack spare,
      but people keep trying to "fix" it.  Reduce the batch size to 16 to
      reduce stack usage to less than 1024 bytes.  This should have minimal
      impact on performance.
      Signed-off-by: default avatarDavid Vrabel <david.vrabel@citrix.com>
      36ae220a
  6. 07 Jan, 2016 1 commit
    • David Vrabel's avatar
      xen/gntdev: add ioctl for grant copy · a4cdb556
      David Vrabel authored
      Add IOCTL_GNTDEV_GRANT_COPY to allow applications to copy between user
      space buffers and grant references.
      
      This interface is similar to the GNTTABOP_copy hypercall ABI except
      the local buffers are provided using a virtual address (instead of a
      GFN and offset).  To avoid userspace from having to page align its
      buffers the driver will use two or more ops if required.
      
      If the ioctl returns 0, the application must check the status of each
      segment with the segments status field.  If the ioctl returns a -ve
      error code (EINVAL or EFAULT), the status of individual ops is
      undefined.
      Signed-off-by: default avatarDavid Vrabel <david.vrabel@citrix.com>
      Reviewed-by: default avatarBoris Ostrovsky <boris.ostrovsky@oracle.com>
      a4cdb556
  7. 21 Dec, 2015 1 commit
  8. 26 Nov, 2015 1 commit
  9. 10 Sep, 2015 1 commit
  10. 30 Jun, 2015 1 commit
  11. 17 Jun, 2015 1 commit
  12. 27 Apr, 2015 1 commit
  13. 28 Jan, 2015 6 commits
  14. 03 Feb, 2014 1 commit
  15. 31 Jan, 2014 1 commit
    • Zoltan Kiss's avatar
      xen/grant-table: Avoid m2p_override during mapping · 08ece5bb
      Zoltan Kiss authored
      The grant mapping API does m2p_override unnecessarily: only gntdev needs it,
      for blkback and future netback patches it just cause a lock contention, as
      those pages never go to userspace. Therefore this series does the following:
      - the original functions were renamed to __gnttab_[un]map_refs, with a new
        parameter m2p_override
      - based on m2p_override either they follow the original behaviour, or just set
        the private flag and call set_phys_to_machine
      - gnttab_[un]map_refs are now a wrapper to call __gnttab_[un]map_refs with
        m2p_override false
      - a new function gnttab_[un]map_refs_userspace provides the old behaviour
      
      It also removes a stray space from page.h and change ret to 0 if
      XENFEAT_auto_translated_physmap, as that is the only possible return value
      there.
      
      v2:
      - move the storing of the old mfn in page->index to gnttab_map_refs
      - move the function header update to a separate patch
      
      v3:
      - a new approach to retain old behaviour where it needed
      - squash the patches into one
      
      v4:
      - move out the common bits from m2p* functions, and pass pfn/mfn as parameter
      - clear page->private before doing anything with the page, so m2p_find_override
        won't race with this
      
      v5:
      - change return value handling in __gnttab_[un]map_refs
      - remove a stray space in page.h
      - add detail why ret = 0 now at some places
      
      v6:
      - don't pass pfn to m2p* functions, just get it locally
      Signed-off-by: default avatarZoltan Kiss <zoltan.kiss@citrix.com>
      Suggested-by: default avatarDavid Vrabel <david.vrabel@citrix.com>
      Acked-by: default avatarDavid Vrabel <david.vrabel@citrix.com>
      Acked-by: default avatarStefano Stabellini <stefano.stabellini@eu.citrix.com>
      Signed-off-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      08ece5bb
  16. 06 Jan, 2014 1 commit
    • Konrad Rzeszutek Wilk's avatar
      xen/pvh: Piggyback on PVHVM for grant driver (v4) · 6926f6d6
      Konrad Rzeszutek Wilk authored
      In PVH the shared grant frame is the PFN and not MFN,
      hence its mapped via the same code path as HVM.
      
      The allocation of the grant frame is done differently - we
      do not use the early platform-pci driver and have an
      ioremap area - instead we use balloon memory and stitch
      all of the non-contingous pages in a virtualized area.
      
      That means when we call the hypervisor to replace the GMFN
      with a XENMAPSPACE_grant_table type, we need to lookup the
      old PFN for every iteration instead of assuming a flat
      contingous PFN allocation.
      
      Lastly, we only use v1 for grants. This is because PVHVM
      is not able to use v2 due to no XENMEM_add_to_physmap
      calls on the error status page (see commit
      69e8f430
       xen/granttable: Disable grant v2 for HVM domains.)
      
      Until that is implemented this workaround has to
      be in place.
      
      Also per suggestions by Stefano utilize the PVHVM paths
      as they share common functionality.
      
      v2 of this patch moves most of the PVH code out in the
      arch/x86/xen/grant-table driver and touches only minimally
      the generic driver.
      
      v3, v4: fixes us some of the code due to earlier patches.
      Signed-off-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      Acked-by: default avatarStefano Stabellini <stefano.stabellini@eu.citrix.com>
      6926f6d6
  17. 20 Aug, 2013 1 commit
  18. 28 Jun, 2013 1 commit
    • Joe Perches's avatar
      xen: Convert printks to pr_<level> · 283c0972
      Joe Perches authored
      Convert printks to pr_<level> (excludes printk(KERN_DEBUG...)
      to be more consistent throughout the xen subsystem.
      
      Add pr_fmt with KBUILD_MODNAME or "xen:" KBUILD_MODNAME
      Coalesce formats and add missing word spaces
      Add missing newlines
      Align arguments and reflow to 80 columns
      Remove DRV_NAME from formats as pr_fmt adds the same content
      
      This does change some of the prefixes of these messages
      but it also does make them more consistent.
      Signed-off-by: default avatarJoe Perches <joe@perches.com>
      Signed-off-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      283c0972
  19. 15 Jan, 2013 3 commits
  20. 30 Oct, 2012 1 commit
  21. 09 Oct, 2012 1 commit
    • Konstantin Khlebnikov's avatar
      mm: kill vma flag VM_RESERVED and mm->reserved_vm counter · 314e51b9
      Konstantin Khlebnikov authored
      A long time ago, in v2.4, VM_RESERVED kept swapout process off VMA,
      currently it lost original meaning but still has some effects:
      
       | effect                 | alternative flags
      -+------------------------+---------------------------------------------
      1| account as reserved_vm | VM_IO
      2| skip in core dump      | VM_IO, VM_DONTDUMP
      3| do not merge or expand | VM_IO, VM_DONTEXPAND, VM_HUGETLB, VM_PFNMAP
      4| do not mlock           | VM_IO, VM_DONTEXPAND, VM_HUGETLB, VM_PFNMAP
      
      This patch removes reserved_vm counter from mm_struct.  Seems like nobody
      cares about it, it does not exported into userspace directly, it only
      reduces total_vm showed in proc.
      
      Thus VM_RESERVED can be replaced with VM_IO or pair VM_DONTEXPAND | VM_DONTDUMP.
      
      remap_pfn_range() and io_remap_pfn_range() set VM_IO|VM_DONTEXPAND|VM_DONTDUMP.
      remap_vmalloc_range() set VM_DONTEXPAND | VM_DONTDUMP.
      
      [akpm@linux-foundation.org: drivers/vfio/pci/vfio_pci.c fixup]
      Signed-off-by: default avatarKonstantin Khlebnikov <khlebnikov@openvz.org>
      Cc: Alexander Viro <viro@zeniv.linux.org.uk>
      Cc: Carsten Otte <cotte@de.ibm.com>
      Cc: Chris Metcalf <cmetcalf@tilera.com>
      Cc: Cyrill Gorcunov <gorcunov@openvz.org>
      Cc: Eric Paris <eparis@redhat.com>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Hugh Dickins <hughd@google.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: James Morris <james.l.morris@oracle.com>
      Cc: Jason Baron <jbaron@redhat.com>
      Cc: Kentaro Takeda <takedakn@nttdata.co.jp>
      Cc: Matt Helsley <matthltc@us.ibm.com>
      Cc: Nick Piggin <npiggin@kernel.dk>
      Cc: Oleg Nesterov <oleg@redhat.com>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Robert Richter <robert.richter@amd.com>
      Cc: Suresh Siddha <suresh.b.siddha@intel.com>
      Cc: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
      Cc: Venkatesh Pallipadi <venki@google.com>
      Acked-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      314e51b9
  22. 12 Sep, 2012 1 commit
    • Stefano Stabellini's avatar
      xen/m2p: do not reuse kmap_op->dev_bus_addr · 2fc136ee
      Stefano Stabellini authored
      If the caller passes a valid kmap_op to m2p_add_override, we use
      kmap_op->dev_bus_addr to store the original mfn, but dev_bus_addr is
      part of the interface with Xen and if we are batching the hypercalls it
      might not have been written by the hypervisor yet. That means that later
      on Xen will write to it and we'll think that the original mfn is
      actually what Xen has written to it.
      
      Rather than "stealing" struct members from kmap_op, keep using
      page->index to store the original mfn and add another parameter to
      m2p_remove_override to get the corresponding kmap_op instead.
      It is now responsibility of the caller to keep track of which kmap_op
      corresponds to a particular page in the m2p_override (gntdev, the only
      user of this interface that passes a valid kmap_op, is already doing that).
      
      CC: stable@kernel.org
      Reported-and-Tested-By: default avatarSander Eikelenboom <linux@eikelenboom.it>
      Signed-off-by: default avatarStefano Stabellini <stefano.stabellini@eu.citrix.com>
      Signed-off-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      2fc136ee
  23. 21 Aug, 2012 1 commit
  24. 17 Apr, 2012 1 commit
  25. 20 Dec, 2011 1 commit
  26. 21 Nov, 2011 1 commit
  27. 16 Nov, 2011 1 commit
  28. 14 Oct, 2011 1 commit
    • Daniel De Graaf's avatar
      xen/gntdev: Fix sleep-inside-spinlock · 1f1503ba
      Daniel De Graaf authored
      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: default avatarDario Faggioli <dario.faggioli@citrix.com>
      Signed-off-by: default avatarDaniel De Graaf <dgdegra@tycho.nsa.gov>
      Signed-off-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      1f1503ba
  29. 29 Sep, 2011 2 commits
    • Stefano Stabellini's avatar
      xen: modify kernel mappings corresponding to granted pages · 0930bba6
      Stefano Stabellini authored
      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: default avatarStefano Stabellini <stefano.stabellini@eu.citrix.com>
      [v1: Removed GRANT_FRAME_BIT usage]
      Signed-off-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      0930bba6
    • Stefano Stabellini's avatar
      xen: add an "highmem" parameter to alloc_xenballooned_pages · 693394b8
      Stefano Stabellini authored
      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: default avatarStefano Stabellini <stefano.stabellini@eu.citrix.com>
      Signed-off-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      693394b8
  30. 26 Jul, 2011 1 commit
  31. 24 Mar, 2011 2 commits