[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH v3.1 11/15] xen/mm: introduce a function to map large chunks of MMIO



On Sat, Oct 29, 2016 at 10:59:57AM +0200, Roger Pau Monne wrote:
> Current {un}map_mmio_regions implementation has a maximum number of loops to
> perform before giving up and returning to the caller. This is an issue when
> mapping large MMIO regions when building the hardware domain. In order to
> solve it, introduce a wrapper around {un}map_mmio_regions that takes care of
> calling process_pending_softirqs between consecutive {un}map_mmio_regions
> calls.
> 
> Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
> ---
> Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
> Cc: George Dunlap <George.Dunlap@xxxxxxxxxxxxx>
> Cc: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
> Cc: Jan Beulich <jbeulich@xxxxxxxx>
> Cc: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
> Cc: Stefano Stabellini <sstabellini@xxxxxxxxxx>
> Cc: Tim Deegan <tim@xxxxxxx>
> Cc: Wei Liu <wei.liu2@xxxxxxxxxx>
> ---
> Changes since v2:
>  - Pull the code into a separate patch.
>  - Use an unbounded for loop with break conditions.
> ---
>  xen/common/memory.c          | 26 ++++++++++++++++++++++++++
>  xen/include/xen/p2m-common.h |  7 +++++++
>  2 files changed, 33 insertions(+)
> 
> diff --git a/xen/common/memory.c b/xen/common/memory.c
> index 21797ca..66c0484 100644
> --- a/xen/common/memory.c
> +++ b/xen/common/memory.c
> @@ -1418,6 +1418,32 @@ int prepare_ring_for_helper(
>      return 0;
>  }
>  
> +int modify_identity_mmio(struct domain *d, unsigned long pfn,
> +                         unsigned long nr_pages, bool map)
> +{
> +    int rc;
> +
> +    for ( ; ; )
> +    {
> +        rc = (map ? map_mmio_regions : unmap_mmio_regions)
> +             (d, _gfn(pfn), nr_pages, _mfn(pfn));
> +        if ( rc == 0 )
> +            break;
> +        if ( rc < 0 )
> +        {
> +            printk(XENLOG_WARNING
> +                   "Failed to identity %smap [%#lx,%#lx) for d%d: %d\n",
> +                   map ? "" : "un", pfn, pfn + nr_pages, d->domain_id, rc);

If we fail should we call this again but with the unmap operation?

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.