xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Benjamin Sanda <ben.sanda@dornerworks.com>,
	xen-devel@lists.xenproject.org
Cc: Wei Liu <wei.liu2@citrix.com>,
	George Dunlap <george.dunlap@eu.citrix.com>,
	Tim Deegan <tim@xen.org>, Ian Jackson <ian.jackson@eu.citrix.com>,
	Julien Grall <julien.grall@arm.com>,
	Stefano Stabellini <stefano.stabellini@citrix.com>,
	Jan Beulich <jbeulich@suse.com>, Keir Fraser <keir@xen.org>
Subject: Re: [PATCH v3 1/5] xentrace: Common Support for get_pg_owner/put_pg_owner on ARM and x86
Date: Tue, 5 Apr 2016 00:05:06 +0100	[thread overview]
Message-ID: <5702F322.6090604@citrix.com> (raw)
In-Reply-To: <1459795727-3116-2-git-send-email-ben.sanda@dornerworks.com>

On 04/04/2016 19:48, Benjamin Sanda wrote:
> Moved get_pg_owner() and put_pg_owner() from the arch specific x86
> mm.c source files into the common page_alloc.c source. This was done
> as theses functions are now needed by both architectures to support
> xentrace on the ARM platform. Forward declarations were added to mm.h.
>
> One conditional compilation check was added in get_pg_owner() for the
> is_pvh_domain(curr) check which is only valid to perform on x86
> platforms.
>
> Signed-off-by: Benjamin Sanda <ben.sanda@dornerworks.com>
>
> ---
> Changed since v2:
>   * Combined patches 3-5 from v2 into one patch for v3. No code change.
> ---
>  xen/arch/x86/mm.c       | 48 ----------------------------------------------
>  xen/common/page_alloc.c | 51 +++++++++++++++++++++++++++++++++++++++++++++++++
>  xen/include/xen/mm.h    |  2 ++
>  3 files changed, 53 insertions(+), 48 deletions(-)
>
> diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
> index c997b53..0d695dd 100644
> --- a/xen/arch/x86/mm.c
> +++ b/xen/arch/x86/mm.c
> @@ -2998,54 +2998,6 @@ int new_guest_cr3(unsigned long mfn)
>      return rc;
>  }
>  
> -static struct domain *get_pg_owner(domid_t domid)
> -{
> -    struct domain *pg_owner = NULL, *curr = current->domain;
> -
> -    if ( likely(domid == DOMID_SELF) )
> -    {
> -        pg_owner = rcu_lock_current_domain();
> -        goto out;
> -    }
> -
> -    if ( unlikely(domid == curr->domain_id) )
> -    {
> -        MEM_LOG("Cannot specify itself as foreign domain");
> -        goto out;
> -    }
> -
> -    if ( !is_pvh_domain(curr) && unlikely(paging_mode_translate(curr)) )
> -    {
> -        MEM_LOG("Cannot mix foreign mappings with translated domains");
> -        goto out;
> -    }
> -
> -    switch ( domid )
> -    {
> -    case DOMID_IO:
> -        pg_owner = rcu_lock_domain(dom_io);
> -        break;
> -    case DOMID_XEN:
> -        pg_owner = rcu_lock_domain(dom_xen);
> -        break;
> -    default:
> -        if ( (pg_owner = rcu_lock_domain_by_id(domid)) == NULL )
> -        {
> -            MEM_LOG("Unknown domain '%u'", domid);
> -            break;
> -        }
> -        break;
> -    }
> -
> - out:
> -    return pg_owner;
> -}
> -
> -static void put_pg_owner(struct domain *pg_owner)
> -{
> -    rcu_unlock_domain(pg_owner);
> -}
> -
>  static inline int vcpumask_to_pcpumask(
>      struct domain *d, XEN_GUEST_HANDLE_PARAM(const_void) bmap, cpumask_t *pmask)
>  {
> diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c
> index 98e30e5..8fe9c03 100644
> --- a/xen/common/page_alloc.c
> +++ b/xen/common/page_alloc.c
> @@ -145,6 +145,7 @@
>  #ifdef CONFIG_X86
>  #include <asm/p2m.h>
>  #include <asm/setup.h> /* for highmem_start only */
> +#include <asm/paging.h>
>  #else
>  #define p2m_pod_offline_or_broken_hit(pg) 0
>  #define p2m_pod_offline_or_broken_replace(pg) BUG_ON(pg != NULL)
> @@ -1996,6 +1997,56 @@ static __init int register_heap_trigger(void)
>  }
>  __initcall(register_heap_trigger);
>  
> +struct domain *get_pg_owner(domid_t domid)
> +{
> +    struct domain *pg_owner = NULL, *curr = current->domain;
> +
> +    if ( likely(domid == DOMID_SELF) )
> +    {
> +        pg_owner = rcu_lock_current_domain();
> +        goto out;
> +    }
> +
> +    if ( unlikely(domid == curr->domain_id) )
> +    {
> +        gdprintk(XENLOG_WARNING,"Cannot specify itself as foreign domain");
> +        goto out;
> +    }
> +
> +#ifdef CONFIG_X86
> +    if ( !is_pvh_domain(curr) && unlikely(paging_mode_translate(curr)) )
> +    {
> +        gdprintk(XENLOG_WARNING,"Cannot mix foreign mappings with translated domains");

Space after comma.

> +        goto out;
> +    }
> +#endif
> +
> +    switch ( domid )
> +    {
> +    case DOMID_IO:
> +        pg_owner = rcu_lock_domain(dom_io);
> +        break;
> +    case DOMID_XEN:
> +        pg_owner = rcu_lock_domain(dom_xen);
> +        break;
> +    default:
> +        if ( (pg_owner = rcu_lock_domain_by_id(domid)) == NULL )
> +        {
> +            gdprintk(XENLOG_WARNING,"Unknown domain '%u'", domid);

While changing this code, please use d%d for the domain id, to be
consistent with the newer style.

With these two minor issues fixed, Reviewed-by: Andrew Cooper
<andrew.cooper3@citrix.com>

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

  reply	other threads:[~2016-04-04 23:05 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-04 18:48 [PATCH v3 0/5] xentrace/xenalyze Support on ARM Benjamin Sanda
2016-04-04 18:48 ` [PATCH v3 1/5] xentrace: Common Support for get_pg_owner/put_pg_owner on ARM and x86 Benjamin Sanda
2016-04-04 23:05   ` Andrew Cooper [this message]
2016-04-05  8:12   ` Jan Beulich
2016-04-14 19:59     ` Ben Sanda
2016-04-17  7:58       ` Jan Beulich
2016-04-04 18:48 ` [PATCH v3 2/5] xentrace: Memory/Page Mapping support for DOMID_XEN on ARM Benjamin Sanda
2016-04-08 10:42   ` Julien Grall
2016-04-08 15:49     ` Jan Beulich
2016-04-08 17:58       ` Andrew Cooper
2016-04-11  9:52         ` George Dunlap
2016-04-12 15:53           ` Julien Grall
2016-04-14 19:52             ` Ben Sanda
2016-04-20 12:48               ` Julien Grall
2016-04-22  9:42             ` Stefano Stabellini
2016-04-22 17:01               ` Julien Grall
2016-04-04 18:48 ` [PATCH v3 3/5] xentrace: Timestamp support for ARM platform Benjamin Sanda
2016-04-08 10:50   ` Julien Grall
2016-04-11 14:56   ` Konrad Rzeszutek Wilk
2016-04-04 18:48 ` [PATCH v3 4/5] xentrace: Trace Buffer Initialization on ARM Benjamin Sanda
2016-04-08 10:53   ` Julien Grall
2016-04-04 18:48 ` [PATCH v3 5/5] xenalyze: Build for Both ARM and x86 Platforms Benjamin Sanda
2016-04-05  8:09 ` [PATCH v3 0/5] xentrace/xenalyze Support on ARM Jan Beulich
2016-04-06 16:51   ` Ben Sanda
2016-04-06 16:59     ` Andrew Cooper
2016-04-06 17:03       ` Ben Sanda
2016-04-08 14:44   ` George Dunlap

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=5702F322.6090604@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=ben.sanda@dornerworks.com \
    --cc=george.dunlap@eu.citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=jbeulich@suse.com \
    --cc=julien.grall@arm.com \
    --cc=keir@xen.org \
    --cc=stefano.stabellini@citrix.com \
    --cc=tim@xen.org \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xenproject.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).