xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Wei Liu <wei.liu2@citrix.com>
To: Ian Campbell <Ian.Campbell@citrix.com>
Cc: "Tim (Xen.org)" <tim@xen.org>,
	wei.liu2@citrix.com, David Vrabel <david.vrabel@citrix.com>,
	Jan Beulich <JBeulich@suse.com>,
	"xen-devel@lists.xen.org" <xen-devel@lists.xen.org>
Subject: Re: [PATCH 15/16] Infrastructure for manipulating 3-level event channel pages
Date: Mon, 4 Feb 2013 11:37:49 +0000	[thread overview]
Message-ID: <1359977869.7477.26.camel@zion.uk.xensource.com> (raw)
In-Reply-To: <1359976820.5281.66.camel@zakaz.uk.xensource.com>

On Mon, 2013-02-04 at 11:20 +0000, Ian Campbell wrote:
> On Mon, 2013-02-04 at 09:23 +0000, Jan Beulich wrote:
> > >>> On 31.01.13 at 15:43, Wei Liu <wei.liu2@citrix.com> wrote:
> > > +static long __map_l3_arrays(struct domain *d, xen_pfn_t *pending,
> > > +                            xen_pfn_t *mask, int nr_pages)
> > > +{
> > > +    int rc;
> > > +    void *mapping;
> > > +    struct page_info *pginfo;
> > > +    unsigned long gfn;
> > > +    int pending_count = 0, mask_count = 0;
> > > +
> > > +#define __MAP(src, dst, cnt)                                    \
> > > +    for ( (cnt) = 0; (cnt) < nr_pages; (cnt)++ )                \
> > > +    {                                                           \
> > > +        rc = -EINVAL;                                           \
> > > +        gfn = (src)[(cnt)];                                     \
> > > +        pginfo = get_page_from_gfn(d, gfn, NULL, P2M_ALLOC);    \
> > > +        if ( !pginfo )                                          \
> > > +            goto err;                                           \
> > > +        if ( !get_page_type(pginfo, PGT_writable_page) )        \
> > > +        {                                                       \
> > > +            put_page(pginfo);                                   \
> > > +            goto err;                                           \
> > > +        }                                                       \
> > > +        mapping = __map_domain_page_global(pginfo);             \
> > > +        if ( !mapping )                                         \
> > > +        {                                                       \
> > > +            put_page_and_type(pginfo);                          \
> > > +            rc = -ENOMEM;                                       \
> > > +            goto err;                                           \
> > > +        }                                                       \
> > > +        (dst)[(cnt)] = mapping;                                 \
> > > +    }
> > > +
> > > +    __MAP(pending, d->evtchn_pending, pending_count)
> > > +    __MAP(mask, d->evtchn_mask, mask_count)
> > > +#undef __MAP
> > > +
> > > +    rc = 0;
> > > +
> > > + err:
> > > +    return rc;
> > > +}
> > 
> > So this alone already is up to 16 pages per guest, and hence a
> > theoretical maximum of 512k pages, i.e. 2G mapped space.
> 
> That's given a theoretical 32k guests? Ouch. It also ignores the need
> for other global mappings.
> 
> on the flip side only a minority of domains are likely to be using the
> extended scheme, and I expect even those which are would not be using
> all 16 pages, so maybe we can fault them in on demand as we bind/unbind
> evtchns.
> 

This is doable. However I'm afraid checking for mapping validity in hot
path could bring in performance penalty.

> Where does 16 come from? How many pages to we end up with at each level
> in the new scheme?
> 

For 64 bit guest, 8 pages each for evtchn_pending / evtchn_mask. And
there are also other global mappings for per-vcpu L2 selectors - there
is no API for a vcpu to manipulate other vcpu's mapping. So the worst
case would be there could be lots of global mappings if a domain has
hundreds of cpus utilizes 3-level event channel.

> Some levels of the trie are per-VCPU, did you account for that already
> in the 2GB?
> 
> >  The
> > global page mapping area, however, is only 1Gb in size on x86-64
> > (didn't check ARM at all)...
> 
> There isn't currently a global page mapping area on 32-bit ARM (I
> suppose we have avoided them somehow...) but obviously 2G would be a
> problem in a 4GB address space.
> 
> On ARM we currently have 2G for domheap mappings which I suppose we
> would split if we needed a global page map
> 
> These need to be global so we can deliver evtchns to VCPUs which aren't
> running, right? I suppose mapping on demand (other than for a running
> VCPU) would be prohibitively expensive.
> 

Those are the leaf mappings which are supposed to be global.

> Could we make this space per-VCPU (or per-domain) by saying that a
> domain maps its own evtchn pages plus the required pages from other
> domains with which an evtchn is bound? Might be tricky to arrange
> though, especially with the per-VCPU pages and affinity changes?
> 

Really tricky... Also potential performance penalty.



Wei.

  parent reply	other threads:[~2013-02-04 11:37 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-31 14:42 [PATCH 00/16] Implement 3-level event channel in Xen Wei Liu
2013-01-31 14:42 ` [PATCH 01/16] Remove trailing whitespaces in sched.h Wei Liu
2013-01-31 14:42 ` [PATCH 02/16] Remove trailing whitespaces in event.h Wei Liu
2013-01-31 14:42 ` [PATCH 03/16] Remove trailing whitespaces in xen.h Wei Liu
2013-01-31 14:42 ` [PATCH 04/16] Move event channel macros / struct definition to proper place Wei Liu
2013-02-04  9:00   ` Jan Beulich
2013-02-04 10:25     ` Wei Liu
2013-01-31 14:42 ` [PATCH 05/16] Add evtchn_level in struct domain Wei Liu
2013-01-31 14:42 ` [PATCH 06/16] Dynamically allocate d->evtchn Wei Liu
2013-01-31 14:42 ` [PATCH 07/16] Bump EVTCHNS_PER_BUCKET to 512 Wei Liu
2013-01-31 14:42 ` [PATCH 08/16] Add evtchn_is_{pending, masked} and evtchn_clear_pending Wei Liu
2013-01-31 14:42 ` [PATCH 09/16] Introduce some macros for event channels Wei Liu
2013-01-31 14:42 ` [PATCH 10/16] Update Xen public header Wei Liu
2013-01-31 14:42 ` [PATCH 11/16] Define N-level event channel registration interface Wei Liu
2013-01-31 14:43 ` [PATCH 12/16] Add control structures for 3-level event channel Wei Liu
2013-01-31 14:43 ` [PATCH 13/16] Make NR_EVTCHN_BUCKETS 3-level ready Wei Liu
2013-01-31 14:43 ` [PATCH 14/16] Genneralized event channel operations Wei Liu
2013-01-31 14:43 ` [PATCH 15/16] Infrastructure for manipulating 3-level event channel pages Wei Liu
2013-02-04  9:23   ` Jan Beulich
2013-02-04 11:20     ` Ian Campbell
2013-02-04 11:29       ` Jan Beulich
2013-02-04 13:45         ` Wei Liu
2013-02-04 13:47           ` Ian Campbell
2013-02-04 13:51             ` Wei Liu
2013-02-04 13:54               ` Ian Campbell
2013-02-04 13:59                 ` Wei Liu
2013-02-04 14:22                   ` Ian Campbell
2013-02-04 14:24                     ` Wei Liu
2013-02-04 14:06           ` Jan Beulich
2013-02-04 14:36             ` Wei Liu
2013-02-04 11:37       ` Wei Liu [this message]
2013-01-31 14:43 ` [PATCH 16/16] Implement 3-level event channel routines Wei Liu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1359977869.7477.26.camel@zion.uk.xensource.com \
    --to=wei.liu2@citrix.com \
    --cc=Ian.Campbell@citrix.com \
    --cc=JBeulich@suse.com \
    --cc=david.vrabel@citrix.com \
    --cc=tim@xen.org \
    --cc=xen-devel@lists.xen.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).