09 Dec, 2020

2 commits

  • Commit 9e2369c06c8a18 ("xen: add helpers to allocate unpopulated
    memory") introduced usage of ZONE_DEVICE memory for foreign memory
    mappings.

    Unfortunately this collides with using page->lru for Xen backend
    private page caches.

    Fix that by using page->zone_device_data instead.

    Cc: # 5.9
    Fixes: 9e2369c06c8a18 ("xen: add helpers to allocate unpopulated memory")
    Signed-off-by: Juergen Gross
    Reviewed-by: Boris Ostrovsky
    Reviewed-by: Jason Andryuk
    Signed-off-by: Juergen Gross

    Juergen Gross
     
  • Instead of having similar helpers in multiple backend drivers use
    common helpers for caching pages allocated via gnttab_alloc_pages().

    Make use of those helpers in blkback and scsiback.

    Cc: # 5.9
    Signed-off-by: Juergen Gross
    Reviewed-by: Boris Ostrovsky
    Signed-off-by: Juergen Gross

    Juergen Gross
     

04 Sep, 2020

1 commit

  • To be used in order to create foreign mappings. This is based on the
    ZONE_DEVICE facility which is used by persistent memory devices in
    order to create struct pages and kernel virtual mappings for the IOMEM
    areas of such devices. Note that on kernels without support for
    ZONE_DEVICE Xen will fallback to use ballooned pages in order to
    create foreign mappings.

    The newly added helpers use the same parameters as the existing
    {alloc/free}_xenballooned_pages functions, which allows for in-place
    replacement of the callers. Once a memory region has been added to be
    used as scratch mapping space it will no longer be released, and pages
    returned are kept in a linked list. This allows to have a buffer of
    pages and prevents resorting to frequent additions and removals of
    regions.

    If enabled (because ZONE_DEVICE is supported) the usage of the new
    functionality untangles Xen balloon and RAM hotplug from the usage of
    unpopulated physical memory ranges to map foreign pages, which is the
    correct thing to do in order to avoid mappings of foreign pages depend
    on memory hotplug.

    Note the driver is currently not enabled on Arm platforms because it
    would interfere with the identity mapping required on some platforms.

    Signed-off-by: Roger Pau Monné
    Reviewed-by: Juergen Gross
    Link: https://lore.kernel.org/r/20200901083326.21264-4-roger.pau@citrix.com
    Signed-off-by: Juergen Gross

    Roger Pau Monne
     

10 Jun, 2020

1 commit

  • Patch series "mm: consolidate definitions of page table accessors", v2.

    The low level page table accessors (pXY_index(), pXY_offset()) are
    duplicated across all architectures and sometimes more than once. For
    instance, we have 31 definition of pgd_offset() for 25 supported
    architectures.

    Most of these definitions are actually identical and typically it boils
    down to, e.g.

    static inline unsigned long pmd_index(unsigned long address)
    {
    return (address >> PMD_SHIFT) & (PTRS_PER_PMD - 1);
    }

    static inline pmd_t *pmd_offset(pud_t *pud, unsigned long address)
    {
    return (pmd_t *)pud_page_vaddr(*pud) + pmd_index(address);
    }

    These definitions can be shared among 90% of the arches provided
    XYZ_SHIFT, PTRS_PER_XYZ and xyz_page_vaddr() are defined.

    For architectures that really need a custom version there is always
    possibility to override the generic version with the usual ifdefs magic.

    These patches introduce include/linux/pgtable.h that replaces
    include/asm-generic/pgtable.h and add the definitions of the page table
    accessors to the new header.

    This patch (of 12):

    The linux/mm.h header includes to allow inlining of the
    functions involving page table manipulations, e.g. pte_alloc() and
    pmd_alloc(). So, there is no point to explicitly include
    in the files that include .

    The include statements in such cases are remove with a simple loop:

    for f in $(git grep -l "include ") ; do
    sed -i -e '/include / d' $f
    done

    Signed-off-by: Mike Rapoport
    Signed-off-by: Andrew Morton
    Cc: Arnd Bergmann
    Cc: Borislav Petkov
    Cc: Brian Cain
    Cc: Catalin Marinas
    Cc: Chris Zankel
    Cc: "David S. Miller"
    Cc: Geert Uytterhoeven
    Cc: Greentime Hu
    Cc: Greg Ungerer
    Cc: Guan Xuetao
    Cc: Guo Ren
    Cc: Heiko Carstens
    Cc: Helge Deller
    Cc: Ingo Molnar
    Cc: Ley Foon Tan
    Cc: Mark Salter
    Cc: Matthew Wilcox
    Cc: Matt Turner
    Cc: Max Filippov
    Cc: Michael Ellerman
    Cc: Michal Simek
    Cc: Mike Rapoport
    Cc: Nick Hu
    Cc: Paul Walmsley
    Cc: Richard Weinberger
    Cc: Rich Felker
    Cc: Russell King
    Cc: Stafford Horne
    Cc: Thomas Bogendoerfer
    Cc: Thomas Gleixner
    Cc: Tony Luck
    Cc: Vincent Chen
    Cc: Vineet Gupta
    Cc: Will Deacon
    Cc: Yoshinori Sato
    Link: http://lkml.kernel.org/r/20200514170327.31389-1-rppt@kernel.org
    Link: http://lkml.kernel.org/r/20200514170327.31389-2-rppt@kernel.org
    Signed-off-by: Linus Torvalds

    Mike Rapoport
     

20 Dec, 2019

1 commit


10 Oct, 2019

1 commit


10 Nov, 2018

1 commit

  • Pull xen fixes from Juergen Gross:
    "Several fixes, mostly for rather recent regressions when running under
    Xen"

    * tag 'for-linus-4.20a-rc2-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip:
    xen: remove size limit of privcmd-buf mapping interface
    xen: fix xen_qlock_wait()
    x86/xen: fix pv boot
    xen-blkfront: fix kernel panic with negotiate_mq error path
    xen/grant-table: Fix incorrect gnttab_dma_free_pages() pr_debug message
    CONFIG_XEN_PV breaks xen_create_contiguous_region on ARM

    Linus Torvalds
     

06 Nov, 2018

1 commit

  • If a call to xenmem_reservation_increase() in gnttab_dma_free_pages()
    fails it triggers a message "Failed to decrease reservation..." which
    should be "Failed to increase reservation..."

    Fixes: 9bdc7304f536 ('xen/grant-table: Allow allocating buffers suitable for DMA')
    Reported-by: Ross Philipson
    Signed-off-by: Liam Merwick
    Reviewed-by: Mark Kanda
    Reviewed-by: Juergen Gross
    Signed-off-by: Juergen Gross

    Liam Merwick
     

31 Oct, 2018

1 commit

  • Move remaining definitions and declarations from include/linux/bootmem.h
    into include/linux/memblock.h and remove the redundant header.

    The includes were replaced with the semantic patch below and then
    semi-automated removal of duplicated '#include

    @@
    @@
    - #include
    + #include

    [sfr@canb.auug.org.au: dma-direct: fix up for the removal of linux/bootmem.h]
    Link: http://lkml.kernel.org/r/20181002185342.133d1680@canb.auug.org.au
    [sfr@canb.auug.org.au: powerpc: fix up for removal of linux/bootmem.h]
    Link: http://lkml.kernel.org/r/20181005161406.73ef8727@canb.auug.org.au
    [sfr@canb.auug.org.au: x86/kaslr, ACPI/NUMA: fix for linux/bootmem.h removal]
    Link: http://lkml.kernel.org/r/20181008190341.5e396491@canb.auug.org.au
    Link: http://lkml.kernel.org/r/1536927045-23536-30-git-send-email-rppt@linux.vnet.ibm.com
    Signed-off-by: Mike Rapoport
    Signed-off-by: Stephen Rothwell
    Acked-by: Michal Hocko
    Cc: Catalin Marinas
    Cc: Chris Zankel
    Cc: "David S. Miller"
    Cc: Geert Uytterhoeven
    Cc: Greentime Hu
    Cc: Greg Kroah-Hartman
    Cc: Guan Xuetao
    Cc: Ingo Molnar
    Cc: "James E.J. Bottomley"
    Cc: Jonas Bonn
    Cc: Jonathan Corbet
    Cc: Ley Foon Tan
    Cc: Mark Salter
    Cc: Martin Schwidefsky
    Cc: Matt Turner
    Cc: Michael Ellerman
    Cc: Michal Simek
    Cc: Palmer Dabbelt
    Cc: Paul Burton
    Cc: Richard Kuo
    Cc: Richard Weinberger
    Cc: Rich Felker
    Cc: Russell King
    Cc: Serge Semin
    Cc: Thomas Gleixner
    Cc: Tony Luck
    Cc: Vineet Gupta
    Cc: Yoshinori Sato
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Mike Rapoport
     

19 Sep, 2018

1 commit

  • When a driver domain (e.g. dom0) is running out of maptrack entries it
    can't map any more foreign domain pages. Instead of silently stalling
    the affected domUs issue a rate limited warning in this case in order
    to make it easier to detect that situation.

    Signed-off-by: Juergen Gross
    Reviewed-by: Boris Ostrovsky
    Signed-off-by: Boris Ostrovsky

    Juergen Gross
     

27 Jul, 2018

2 commits

  • Extend grant table module API to allow allocating buffers that can
    be used for DMA operations and mapping foreign grant references
    on top of those.
    The resulting buffer is similar to the one allocated by the balloon
    driver in that proper memory reservation is made by
    ({increase|decrease}_reservation and VA mappings are updated if
    needed).
    This is useful for sharing foreign buffers with HW drivers which
    cannot work with scattered buffers provided by the balloon driver,
    but require DMAable memory instead.

    Signed-off-by: Oleksandr Andrushchenko
    Reviewed-by: Boris Ostrovsky
    Signed-off-by: Boris Ostrovsky

    Oleksandr Andrushchenko
     
  • Make set/clear page private code shared and accessible to
    other kernel modules which can re-use these instead of open-coding.

    Signed-off-by: Oleksandr Andrushchenko
    Reviewed-by: Boris Ostrovsky
    Signed-off-by: Boris Ostrovsky

    Oleksandr Andrushchenko
     

23 Jun, 2018

1 commit

  • Pull xen fixes from Juergen Gross:
    "This contains the following fixes/cleanups:

    - the removal of a BUG_ON() which wasn't necessary and which could
    trigger now due to a recent change

    - a correction of a long standing bug happening very rarely in Xen
    dom0 when a hypercall buffer from user land was not accessible by
    the hypervisor for very short periods of time due to e.g. page
    migration or compaction

    - usage of EXPORT_SYMBOL_GPL() instead of EXPORT_SYMBOL() in a
    Xen-related driver (no breakage possible as using those symbols
    without others already exported via EXPORT-SYMBOL_GPL() wouldn't
    make any sense)

    - a simplification for Xen PVH or Xen ARM guests

    - some additional error handling for callers of xenbus_printf()"

    * tag 'for-linus-4.18-rc2-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip:
    xen: Remove unnecessary BUG_ON from __unbind_from_irq()
    xen: add new hypercall buffer mapping device
    xen/scsiback: add error handling for xenbus_printf
    scsi: xen-scsifront: add error handling for xenbus_printf
    xen/grant-table: Export gnttab_{alloc|free}_pages as GPL
    xen: add error handling for xenbus_printf
    xen: share start flags between PV and PVH

    Linus Torvalds
     

19 Jun, 2018

1 commit

  • Only gnttab_{alloc|free}_pages are exported as EXPORT_SYMBOL
    while all the rest are exported as EXPORT_SYMBOL_GPL, thus
    effectively making it not possible for non-GPL driver modules
    to use grant table module. Export gnttab_{alloc|free}_pages as
    EXPORT_SYMBOL_GPL so all the exports are aligned.

    Signed-off-by: Oleksandr Andrushchenko
    Reviewed-by: Juergen Gross
    Signed-off-by: Juergen Gross

    Oleksandr Andrushchenko
     

13 Jun, 2018

1 commit

  • The kmalloc() function has a 2-factor argument form, kmalloc_array(). This
    patch replaces cases of:

    kmalloc(a * b, gfp)

    with:
    kmalloc_array(a * b, gfp)

    as well as handling cases of:

    kmalloc(a * b * c, gfp)

    with:

    kmalloc(array3_size(a, b, c), gfp)

    as it's slightly less ugly than:

    kmalloc_array(array_size(a, b), c, gfp)

    This does, however, attempt to ignore constant size factors like:

    kmalloc(4 * 1024, gfp)

    though any constants defined via macros get caught up in the conversion.

    Any factors with a sizeof() of "unsigned char", "char", and "u8" were
    dropped, since they're redundant.

    The tools/ directory was manually excluded, since it has its own
    implementation of kmalloc().

    The Coccinelle script used for this was:

    // Fix redundant parens around sizeof().
    @@
    type TYPE;
    expression THING, E;
    @@

    (
    kmalloc(
    - (sizeof(TYPE)) * E
    + sizeof(TYPE) * E
    , ...)
    |
    kmalloc(
    - (sizeof(THING)) * E
    + sizeof(THING) * E
    , ...)
    )

    // Drop single-byte sizes and redundant parens.
    @@
    expression COUNT;
    typedef u8;
    typedef __u8;
    @@

    (
    kmalloc(
    - sizeof(u8) * (COUNT)
    + COUNT
    , ...)
    |
    kmalloc(
    - sizeof(__u8) * (COUNT)
    + COUNT
    , ...)
    |
    kmalloc(
    - sizeof(char) * (COUNT)
    + COUNT
    , ...)
    |
    kmalloc(
    - sizeof(unsigned char) * (COUNT)
    + COUNT
    , ...)
    |
    kmalloc(
    - sizeof(u8) * COUNT
    + COUNT
    , ...)
    |
    kmalloc(
    - sizeof(__u8) * COUNT
    + COUNT
    , ...)
    |
    kmalloc(
    - sizeof(char) * COUNT
    + COUNT
    , ...)
    |
    kmalloc(
    - sizeof(unsigned char) * COUNT
    + COUNT
    , ...)
    )

    // 2-factor product with sizeof(type/expression) and identifier or constant.
    @@
    type TYPE;
    expression THING;
    identifier COUNT_ID;
    constant COUNT_CONST;
    @@

    (
    - kmalloc
    + kmalloc_array
    (
    - sizeof(TYPE) * (COUNT_ID)
    + COUNT_ID, sizeof(TYPE)
    , ...)
    |
    - kmalloc
    + kmalloc_array
    (
    - sizeof(TYPE) * COUNT_ID
    + COUNT_ID, sizeof(TYPE)
    , ...)
    |
    - kmalloc
    + kmalloc_array
    (
    - sizeof(TYPE) * (COUNT_CONST)
    + COUNT_CONST, sizeof(TYPE)
    , ...)
    |
    - kmalloc
    + kmalloc_array
    (
    - sizeof(TYPE) * COUNT_CONST
    + COUNT_CONST, sizeof(TYPE)
    , ...)
    |
    - kmalloc
    + kmalloc_array
    (
    - sizeof(THING) * (COUNT_ID)
    + COUNT_ID, sizeof(THING)
    , ...)
    |
    - kmalloc
    + kmalloc_array
    (
    - sizeof(THING) * COUNT_ID
    + COUNT_ID, sizeof(THING)
    , ...)
    |
    - kmalloc
    + kmalloc_array
    (
    - sizeof(THING) * (COUNT_CONST)
    + COUNT_CONST, sizeof(THING)
    , ...)
    |
    - kmalloc
    + kmalloc_array
    (
    - sizeof(THING) * COUNT_CONST
    + COUNT_CONST, sizeof(THING)
    , ...)
    )

    // 2-factor product, only identifiers.
    @@
    identifier SIZE, COUNT;
    @@

    - kmalloc
    + kmalloc_array
    (
    - SIZE * COUNT
    + COUNT, SIZE
    , ...)

    // 3-factor product with 1 sizeof(type) or sizeof(expression), with
    // redundant parens removed.
    @@
    expression THING;
    identifier STRIDE, COUNT;
    type TYPE;
    @@

    (
    kmalloc(
    - sizeof(TYPE) * (COUNT) * (STRIDE)
    + array3_size(COUNT, STRIDE, sizeof(TYPE))
    , ...)
    |
    kmalloc(
    - sizeof(TYPE) * (COUNT) * STRIDE
    + array3_size(COUNT, STRIDE, sizeof(TYPE))
    , ...)
    |
    kmalloc(
    - sizeof(TYPE) * COUNT * (STRIDE)
    + array3_size(COUNT, STRIDE, sizeof(TYPE))
    , ...)
    |
    kmalloc(
    - sizeof(TYPE) * COUNT * STRIDE
    + array3_size(COUNT, STRIDE, sizeof(TYPE))
    , ...)
    |
    kmalloc(
    - sizeof(THING) * (COUNT) * (STRIDE)
    + array3_size(COUNT, STRIDE, sizeof(THING))
    , ...)
    |
    kmalloc(
    - sizeof(THING) * (COUNT) * STRIDE
    + array3_size(COUNT, STRIDE, sizeof(THING))
    , ...)
    |
    kmalloc(
    - sizeof(THING) * COUNT * (STRIDE)
    + array3_size(COUNT, STRIDE, sizeof(THING))
    , ...)
    |
    kmalloc(
    - sizeof(THING) * COUNT * STRIDE
    + array3_size(COUNT, STRIDE, sizeof(THING))
    , ...)
    )

    // 3-factor product with 2 sizeof(variable), with redundant parens removed.
    @@
    expression THING1, THING2;
    identifier COUNT;
    type TYPE1, TYPE2;
    @@

    (
    kmalloc(
    - sizeof(TYPE1) * sizeof(TYPE2) * COUNT
    + array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2))
    , ...)
    |
    kmalloc(
    - sizeof(TYPE1) * sizeof(THING2) * (COUNT)
    + array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2))
    , ...)
    |
    kmalloc(
    - sizeof(THING1) * sizeof(THING2) * COUNT
    + array3_size(COUNT, sizeof(THING1), sizeof(THING2))
    , ...)
    |
    kmalloc(
    - sizeof(THING1) * sizeof(THING2) * (COUNT)
    + array3_size(COUNT, sizeof(THING1), sizeof(THING2))
    , ...)
    |
    kmalloc(
    - sizeof(TYPE1) * sizeof(THING2) * COUNT
    + array3_size(COUNT, sizeof(TYPE1), sizeof(THING2))
    , ...)
    |
    kmalloc(
    - sizeof(TYPE1) * sizeof(THING2) * (COUNT)
    + array3_size(COUNT, sizeof(TYPE1), sizeof(THING2))
    , ...)
    )

    // 3-factor product, only identifiers, with redundant parens removed.
    @@
    identifier STRIDE, SIZE, COUNT;
    @@

    (
    kmalloc(
    - (COUNT) * STRIDE * SIZE
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    kmalloc(
    - COUNT * (STRIDE) * SIZE
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    kmalloc(
    - COUNT * STRIDE * (SIZE)
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    kmalloc(
    - (COUNT) * (STRIDE) * SIZE
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    kmalloc(
    - COUNT * (STRIDE) * (SIZE)
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    kmalloc(
    - (COUNT) * STRIDE * (SIZE)
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    kmalloc(
    - (COUNT) * (STRIDE) * (SIZE)
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    kmalloc(
    - COUNT * STRIDE * SIZE
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    )

    // Any remaining multi-factor products, first at least 3-factor products,
    // when they're not all constants...
    @@
    expression E1, E2, E3;
    constant C1, C2, C3;
    @@

    (
    kmalloc(C1 * C2 * C3, ...)
    |
    kmalloc(
    - (E1) * E2 * E3
    + array3_size(E1, E2, E3)
    , ...)
    |
    kmalloc(
    - (E1) * (E2) * E3
    + array3_size(E1, E2, E3)
    , ...)
    |
    kmalloc(
    - (E1) * (E2) * (E3)
    + array3_size(E1, E2, E3)
    , ...)
    |
    kmalloc(
    - E1 * E2 * E3
    + array3_size(E1, E2, E3)
    , ...)
    )

    // And then all remaining 2 factors products when they're not all constants,
    // keeping sizeof() as the second factor argument.
    @@
    expression THING, E1, E2;
    type TYPE;
    constant C1, C2, C3;
    @@

    (
    kmalloc(sizeof(THING) * C2, ...)
    |
    kmalloc(sizeof(TYPE) * C2, ...)
    |
    kmalloc(C1 * C2 * C3, ...)
    |
    kmalloc(C1 * C2, ...)
    |
    - kmalloc
    + kmalloc_array
    (
    - sizeof(TYPE) * (E2)
    + E2, sizeof(TYPE)
    , ...)
    |
    - kmalloc
    + kmalloc_array
    (
    - sizeof(TYPE) * E2
    + E2, sizeof(TYPE)
    , ...)
    |
    - kmalloc
    + kmalloc_array
    (
    - sizeof(THING) * (E2)
    + E2, sizeof(THING)
    , ...)
    |
    - kmalloc
    + kmalloc_array
    (
    - sizeof(THING) * E2
    + E2, sizeof(THING)
    , ...)
    |
    - kmalloc
    + kmalloc_array
    (
    - (E1) * E2
    + E1, E2
    , ...)
    |
    - kmalloc
    + kmalloc_array
    (
    - (E1) * (E2)
    + E1, E2
    , ...)
    |
    - kmalloc
    + kmalloc_array
    (
    - E1 * E2
    + E1, E2
    , ...)
    )

    Signed-off-by: Kees Cook

    Kees Cook
     

06 Feb, 2018

1 commit

  • The page given to gnttab_end_foreign_access() to free could be a
    compound page so use put_page() instead of free_page() since it can
    handle both compound and single pages correctly.

    This bug was discovered when migrating a Xen VM with several VIFs and
    CONFIG_DEBUG_VM enabled. It hits a BUG usually after fewer than 10
    iterations. All netfront devices disconnect from the backend during a
    suspend/resume and this will call gnttab_end_foreign_access() if a
    netfront queue has an outstanding skb. The mismatch between calling
    get_page() and free_page() on a compound page causes a reference
    counting error which is detected when DEBUG_VM is enabled.

    Signed-off-by: Ross Lagerwall
    Reviewed-by: Boris Ostrovsky
    Signed-off-by: Juergen Gross

    Ross Lagerwall
     

22 Nov, 2017

1 commit

  • This changes all DEFINE_TIMER() callbacks to use a struct timer_list
    pointer instead of unsigned long. Since the data argument has already been
    removed, none of these callbacks are using their argument currently, so
    this renames the argument to "unused".

    Done using the following semantic patch:

    @match_define_timer@
    declarer name DEFINE_TIMER;
    identifier _timer, _callback;
    @@

    DEFINE_TIMER(_timer, _callback);

    @change_callback depends on match_define_timer@
    identifier match_define_timer._callback;
    type _origtype;
    identifier _origarg;
    @@

    void
    -_callback(_origtype _origarg)
    +_callback(struct timer_list *unused)
    { ... }

    Signed-off-by: Kees Cook

    Kees Cook
     

17 Nov, 2017

1 commit

  • Pull xen updates from Juergen Gross:
    "Xen features and fixes for v4.15-rc1

    Apart from several small fixes it contains the following features:

    - a series by Joao Martins to add vdso support of the pv clock
    interface

    - a series by Juergen Gross to add support for Xen pv guests to be
    able to run on 5 level paging hosts

    - a series by Stefano Stabellini adding the Xen pvcalls frontend
    driver using a paravirtualized socket interface"

    * tag 'for-linus-4.15-rc1-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip: (34 commits)
    xen/pvcalls: fix potential endless loop in pvcalls-front.c
    xen/pvcalls: Add MODULE_LICENSE()
    MAINTAINERS: xen, kvm: track pvclock-abi.h changes
    x86/xen/time: setup vcpu 0 time info page
    x86/xen/time: set pvclock flags on xen_time_init()
    x86/pvclock: add setter for pvclock_pvti_cpu0_va
    ptp_kvm: probe for kvm guest availability
    xen/privcmd: remove unused variable pageidx
    xen: select grant interface version
    xen: update arch/x86/include/asm/xen/cpuid.h
    xen: add grant interface version dependent constants to gnttab_ops
    xen: limit grant v2 interface to the v1 functionality
    xen: re-introduce support for grant v2 interface
    xen: support priv-mapping in an HVM tools domain
    xen/pvcalls: remove redundant check for irq >= 0
    xen/pvcalls: fix unsigned less than zero error check
    xen/time: Return -ENODEV from xen_get_wallclock()
    xen/pvcalls-front: mark expected switch fall-through
    xen: xenbus_probe_frontend: mark expected switch fall-throughs
    xen/time: do not decrease steal time after live migration on xen
    ...

    Linus Torvalds
     

07 Nov, 2017

4 commits

  • Grant v2 will be needed in cases where a frame number in the grant
    table can exceed 32 bits. For PV guests this is a host feature, while
    for HVM guests this is a guest feature.

    So select grant v2 in case frame numbers can be larger than 32 bits
    and grant v1 else.

    For testing purposes add a way to specify the grant interface version
    via a boot parameter.

    Signed-off-by: Juergen Gross
    Reviewed-by: Boris Ostrovsky
    Signed-off-by: Boris Ostrovsky

    Juergen Gross
     
  • Instead of having multiple variables with constants like
    grant_table_version or grefs_per_grant_frame add those to struct
    gnttab_ops and access them just via the gnttab_interface pointer.

    Signed-off-by: Juergen Gross
    Reviewed-by: Boris Ostrovsky
    Signed-off-by: Boris Ostrovsky

    Juergen Gross
     
  • As there is currently no user for sub-page grants or transient grants
    remove that functionality. This at once makes it possible to switch
    from grant v2 to grant v1 without restrictions, as there is no loss of
    functionality other than the limited frame number width related to
    the switch.

    Signed-off-by: Juergen Gross
    Reviewed-by: Boris Ostrovsky
    Signed-off-by: Boris Ostrovsky

    Juergen Gross
     
  • The grant v2 support was removed from the kernel with
    commit 438b33c7145ca8a5131a30c36d8f59bce119a19a ("xen/grant-table:
    remove support for V2 tables") as the higher memory footprint of v2
    grants resulted in less grants being possible for a kernel compared
    to the v1 grant interface.

    As machines with more than 16TB of memory are expected to be more
    common in the near future support of grant v2 is mandatory in order
    to be able to run a Xen pv domain at any memory location.

    So re-add grant v2 support basically by reverting above commit.

    Signed-off-by: Juergen Gross
    Reviewed-by: Boris Ostrovsky
    Signed-off-by: Boris Ostrovsky

    Juergen Gross
     

05 Oct, 2017

1 commit

  • Drop the arguments from the macro and adjust all callers with the
    following script:

    perl -pi -e 's/DEFINE_TIMER\((.*), 0, 0\);/DEFINE_TIMER($1);/g;' \
    $(git grep DEFINE_TIMER | cut -d: -f1 | sort -u | grep -v timer.h)

    Signed-off-by: Kees Cook
    Acked-by: Geert Uytterhoeven # for m68k parts
    Acked-by: Guenter Roeck # for watchdog parts
    Acked-by: David S. Miller # for networking parts
    Acked-by: Greg Kroah-Hartman
    Acked-by: Kalle Valo # for wireless parts
    Acked-by: Arnd Bergmann
    Cc: linux-mips@linux-mips.org
    Cc: Petr Mladek
    Cc: Benjamin Herrenschmidt
    Cc: Lai Jiangshan
    Cc: Sebastian Reichel
    Cc: Kalle Valo
    Cc: Paul Mackerras
    Cc: Pavel Machek
    Cc: linux1394-devel@lists.sourceforge.net
    Cc: Chris Metcalf
    Cc: linux-s390@vger.kernel.org
    Cc: linux-wireless@vger.kernel.org
    Cc: "James E.J. Bottomley"
    Cc: Wim Van Sebroeck
    Cc: Michael Ellerman
    Cc: Ursula Braun
    Cc: Viresh Kumar
    Cc: Harish Patil
    Cc: Stephen Boyd
    Cc: Michael Reed
    Cc: Manish Chopra
    Cc: Len Brown
    Cc: Arnd Bergmann
    Cc: linux-pm@vger.kernel.org
    Cc: Heiko Carstens
    Cc: Tejun Heo
    Cc: Julian Wiedmann
    Cc: John Stultz
    Cc: Mark Gross
    Cc: linux-watchdog@vger.kernel.org
    Cc: linux-scsi@vger.kernel.org
    Cc: "Martin K. Petersen"
    Cc: Greg Kroah-Hartman
    Cc: "Rafael J. Wysocki"
    Cc: Oleg Nesterov
    Cc: Ralf Baechle
    Cc: Stefan Richter
    Cc: Guenter Roeck
    Cc: netdev@vger.kernel.org
    Cc: Martin Schwidefsky
    Cc: Andrew Morton
    Cc: linuxppc-dev@lists.ozlabs.org
    Cc: Sudip Mukherjee
    Link: https://lkml.kernel.org/r/1507159627-127660-11-git-send-email-keescook@chromium.org
    Signed-off-by: Thomas Gleixner

    Kees Cook
     

23 Jul, 2017

1 commit

  • log a message when we enter this situation:
    1) we already allocated the max number of available grants from hypervisor
    and
    2) we still need more (but the request fails because of 1)).

    Sometimes the lack of grants causes IO hangs in xen_blkfront devices.
    Adding this log would help debuging.

    Signed-off-by: Wengang Wang
    Reviewed-by: Konrad Rzeszutek Wilk
    Reviewed-by: Junxiao Bi
    Reviewed-by: Juergen Gross
    Signed-off-by: Juergen Gross

    Wengang Wang
     

07 Feb, 2017

1 commit


21 Mar, 2016

1 commit

  • Code that uses no modular facilities whatsoever should not be
    sourcing module.h at all, since that header drags in a bunch
    of other headers with it.

    Similarly, code that is not explicitly using modular facilities
    like module_init() but only is declaring module_param setup
    variables should be using moduleparam.h and not the larger
    module.h file for that.

    In making this change, we also uncover an implicit use of BUG()
    in inline fcns within arch/arm/include/asm/xen/hypercall.h so
    we explicitly source for that file now.

    Signed-off-by: Paul Gortmaker
    Reviewed-by: Stefano Stabellini
    Signed-off-by: David Vrabel

    Paul Gortmaker
     

21 Dec, 2015

1 commit


23 Oct, 2015

4 commits

  • With the 64KB page granularity support on ARM64, a Linux page may be
    split accross multiple grant.

    Currently we have the helper gnttab_foreach_grant_in_grant to break a
    Linux page based on an offset and a len, but it doesn't fit when we only
    have a number of grants in hand.

    Introduce a new helper which take an array of Linux page and a number of
    grant and will figure out the address of each grant.

    Signed-off-by: Julien Grall
    Signed-off-by: David Vrabel

    Julien Grall
     
  • The Xen interface is using 4KB page granularity. This means that each
    grant is 4KB.

    The current implementation allocates a Linux page per grant. On Linux
    using 64KB page granularity, only the first 4KB of the page will be
    used.

    We could decrease the memory wasted by sharing the page with multiple
    grant. It will require some care with the {Set,Clear}ForeignPage macro.

    Note that no changes has been made in the x86 code because both Linux
    and Xen will only use 4KB page granularity.

    Signed-off-by: Julien Grall
    Reviewed-by: David Vrabel
    Reviewed-by: Stefano Stabellini
    Signed-off-by: David Vrabel

    Julien Grall
     
  • Currently, a grant is always based on the Xen page granularity (i.e
    4KB). When Linux is using a different page granularity, a single page
    will be split between multiple grants.

    The new helpers will be in charge of splitting the Linux page into grants
    and call a function given by the caller on each grant.

    Also provide an helper to count the number of grants within a given
    contiguous region.

    Note that the x86/include/asm/xen/page.h is now including
    xen/interface/grant_table.h rather than xen/grant_table.h. It's
    necessary because xen/grant_table.h depends on asm/xen/page.h and will
    break the compilation. Furthermore, only definition in
    interface/grant_table.h is required.

    Signed-off-by: Julien Grall
    Reviewed-by: David Vrabel
    Reviewed-by: Stefano Stabellini
    Signed-off-by: David Vrabel

    Julien Grall
     
  • All users of alloc_xenballoon_pages() wanted low memory pages, so
    remove the option for high memory.

    Signed-off-by: David Vrabel
    Reviewed-by: Daniel Kiper

    David Vrabel
     

17 Jun, 2015

1 commit

  • SPP was used by the grant table v2 code which has been removed in
    commit 438b33c7145ca8a5131a30c36d8f59bce119a19a "xen/grant-table:
    remove support for V2 tables".

    Signed-off-by: Julien Grall
    Reviewed-by: David Vrabel
    Cc: Konrad Rzeszutek Wilk
    Cc: Boris Ostrovsky
    Signed-off-by: David Vrabel

    Julien Grall
     

27 Apr, 2015

1 commit


28 Jan, 2015

4 commits

  • Introduce gnttab_unmap_refs_async() that can be used to safely unmap
    pages that may be in use (ref count > 1). If the pages are in use the
    unmap is deferred and retried later. This polling is not very clever
    but it should be good enough if the cases where the delay is necessary
    are rare.

    The initial delay is 5 ms and is increased linearly on each subsequent
    retry (to reduce load if the page is in use for a long time).

    This is needed to allow block backends using grant mapping to safely
    use network storage (block or filesystem based such as iSCSI or NFS).

    The network storage driver may complete a block request whilst there
    is a queued network packet retry (because the ack from the remote end
    races with deciding to queue the retry). The pages for the retried
    packet would be grant unmapped and the network driver (or hardware)
    would access the unmapped page.

    Signed-off-by: Jennifer Herbert
    Acked-by: Stefano Stabellini
    Signed-off-by: David Vrabel

    Jennifer Herbert
     
  • Use the "foreign" page flag to mark pages that have a grant map. Use
    page->private to store information of the grant (the granting domain
    and the grant reference).

    Signed-off-by: Jennifer Herbert
    Reviewed-by: Stefano Stabellini
    Signed-off-by: David Vrabel

    Jennifer Herbert
     
  • Add gnttab_alloc_pages() and gnttab_free_pages() to allocate/free pages
    suitable to for granted maps.

    Signed-off-by: David Vrabel
    Reviewed-by: Stefano Stabellini

    David Vrabel
     
  • When unmapping grants, instead of converting the kernel map ops to
    unmap ops on the fly, pre-populate the set of unmap ops.

    This allows the grant unmap for the kernel mappings to be trivially
    batched in the future.

    Signed-off-by: David Vrabel
    Reviewed-by: Stefano Stabellini

    David Vrabel
     

23 Sep, 2014

1 commit


15 Jul, 2014

2 commits

  • Since 11c7ff17c9b6dbf3a4e4f36be30ad531a6cf0ec9 (xen/grant-table: Force
    to use v1 of grants.) the code for V2 grant tables is not used.

    Signed-off-by: David Vrabel
    Signed-off-by: Konrad Rzeszutek Wilk

    David Vrabel
     
  • arch_gnttab_map_frames() and arch_gnttab_unmap_frames() are called in
    atomic context but were calling alloc_vm_area() which might sleep.

    Also, if a driver attempts to allocate a grant ref from an interrupt
    and the table needs expanding, then the CPU may already by in lazy MMU
    mode and apply_to_page_range() will BUG when it tries to re-enable
    lazy MMU mode.

    These two functions are only used in PV guests.

    Introduce arch_gnttab_init() to allocates the virtual address space in
    advance.

    Avoid the use of apply_to_page_range() by using saving and using the
    array of PTE addresses from the alloc_vm_area() call.

    N.B. 'alloc_vm_area' pre-allocates the pagetable so there is no need
    to worry about having to do a PGD/PUD/PMD walk (like apply_to_page_range
    does) and we can instead do set_pte.

    Signed-off-by: David Vrabel
    Signed-off-by: Konrad Rzeszutek Wilk
    ----
    [v2: Add comment about alloc_vm_area]
    [v3: Fix compile error found by 0-day bot]

    David Vrabel