From: Julien Grall <julien.grall@arm.com>
To: Benjamin Sanda <ben.sanda@dornerworks.com>,
xen-devel@lists.xenproject.org
Cc: Keir Fraser <keir@xen.org>,
Ian Jackson <ian.jackson@eu.citrix.com>,
Dario Faggioli <dario.faggioli@citrix.com>,
Tim Deegan <tim@xen.org>,
George Dunlap <george.dunlap@citrix.com>,
Jan Beulich <jbeulich@suse.com>,
Andrew Cooper <andrew.cooper3@citrix.com>,
Paul Sujkov <psujkov@gmail.com>
Subject: Re: [PATCH 4/6] xentrace: ARM platform DOMID_XEN mapping support
Date: Thu, 17 Mar 2016 15:53:45 +0000 [thread overview]
Message-ID: <56EAD309.6010807@arm.com> (raw)
In-Reply-To: <1458161499-15313-5-git-send-email-ben.sanda@dornerworks.com>
Hello Benjamin,
Thank you for the patch.
On 16/03/16 20:51, Benjamin Sanda wrote:
> From: bensanda <ben.sanda@dornerworks.com>
>
> Modified xenmem_add_to_physmap_one() to provide support for xentrace on the ARM platform. Checks for DOMID_XEN added via new function, get_pg_owner, ported from x86 code base. This provides correct calls to rcu_lock_domain() when DOMID_XEN is requested. DOMID_XEN checks also adde to skip page to MFN translation (xentrace sends a MFN dirrectly and so does not need to be translated).
A line in the commit message should not be longer than 72 characters.
>
> Signed-off-by: Benjamin Sanda <ben.sanda@dornerworks.com>
> ---
> xen/arch/arm/mm.c | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++++--
> 1 file changed, 54 insertions(+), 2 deletions(-)
>
> diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c
> index 81f9e2e..b1d834f 100644
> --- a/xen/arch/arm/mm.c
> +++ b/xen/arch/arm/mm.c
> @@ -41,6 +41,7 @@
> #include <xen/pfn.h>
>
> struct domain *dom_xen, *dom_io, *dom_cow;
> +static struct domain *get_pg_owner(domid_t domid);
I would rather avoid to forward declare a function if there is no strict
dependency on other functions. Instead, I would add the function before
the caller.
>
> /* Static start-of-day pagetables that we use before the allocators
> * are up. These are used by all CPUs during bringup before switching
> @@ -1099,7 +1100,8 @@ int xenmem_add_to_physmap_one(
> {
> struct domain *od;
> p2m_type_t p2mt;
> - od = rcu_lock_domain_by_any_id(foreign_domid);
> + od = get_pg_owner(foreign_domid);
> +
> if ( od == NULL )
> return -ESRCH;
>
> @@ -1132,7 +1134,17 @@ int xenmem_add_to_physmap_one(
> return -EINVAL;
> }
>
> - mfn = page_to_mfn(page);
> + /* If DOMID_XEN then no page to MFN translation is
> + needed as we already have the MFN directly */
> + if(DOMID_XEN !=od->domain_id)
> + {
> + mfn = page_to_mfn(page);
> + }
> + else
> + {
> + mfn = idx;
> + }
> +
Please avoid to spread the DOMID_ID specific case everywhere. The cost
to calculate the MFN of a page is very limited.
> t = p2m_map_foreign;
>
> rcu_unlock_domain(od);
> @@ -1312,6 +1324,46 @@ void clear_and_clean_page(struct page_info *page)
> unmap_domain_page(p);
> }
>
> +/* Ported from x86 architecture: checks for special domain requests for
> +DOMID_XEN or DOMID_IO which must be handled differently then guest domain
> +requests */
> +static struct domain *get_pg_owner(domid_t domid)
This function is very similar to the x86 one. I think it would benefit
to implement get_pg_owner in the common code and add arch specific
helper when it's necessary.
Also, please introduce the helper put_pg_owner to stay consistent.
> +{
> + 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) )
> + {
> + goto out;
> + }
> +
> + /* check for special domain cases of DOMID_IO or DOMID_XEN which
> + must use rcu_lock_domain() and dom_xen/dom_io as the domid_t */
> + 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 )
> + {
> + break;
> + }
> + break;
> + }
> +
> + out:
> + return pg_owner;
> +}
> +
> /*
> * Local variables:
> * mode: C
>
Regards,
--
Julien Grall
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
next prev parent reply other threads:[~2016-03-17 15:53 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-16 20:51 [PATCH 0/6] xentrace/xenalyze support on ARM Benjamin Sanda
2016-03-16 20:51 ` [PATCH 1/6] Flask: Support for ARM xentrace Benjamin Sanda
2016-03-17 14:56 ` Julien Grall
2016-03-17 15:03 ` Julien Grall
2016-03-25 19:27 ` Konrad Rzeszutek Wilk
2016-03-28 15:52 ` Ben Sanda
2016-03-16 20:51 ` [PATCH 2/6] xenalyze: Support for ARM platform Benjamin Sanda
2016-03-16 20:59 ` Andrew Cooper
2016-03-17 10:39 ` George Dunlap
2016-03-16 20:51 ` [PATCH 3/6] xentrace: P2M lookup suport " Benjamin Sanda
2016-03-17 16:21 ` Julien Grall
2016-03-28 18:55 ` Ben Sanda
2016-03-30 18:38 ` Julien Grall
2016-03-16 20:51 ` [PATCH 4/6] xentrace: ARM platform DOMID_XEN mapping support Benjamin Sanda
2016-03-17 15:53 ` Julien Grall [this message]
2016-03-16 20:51 ` [PATCH 5/6] xentrace: Trace buffer support for ARM platform Benjamin Sanda
2016-03-16 20:51 ` [PATCH 6/6] xentrace: ARM platform timestamp support Benjamin Sanda
2016-03-25 19:31 ` Konrad Rzeszutek Wilk
2016-03-31 16:38 ` Stefano Stabellini
2016-03-31 16:44 ` Ben Sanda
2016-04-01 13:05 ` Stefano Stabellini
2016-03-17 15:00 ` [PATCH 0/6] xentrace/xenalyze support on ARM Julien Grall
2016-03-17 16:50 ` Ben Sanda
2016-03-17 17:01 ` Julien Grall
2016-03-17 17:04 ` Ben Sanda
2016-03-18 17:12 ` Wei Liu
2016-03-17 17:23 ` 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=56EAD309.6010807@arm.com \
--to=julien.grall@arm.com \
--cc=andrew.cooper3@citrix.com \
--cc=ben.sanda@dornerworks.com \
--cc=dario.faggioli@citrix.com \
--cc=george.dunlap@citrix.com \
--cc=ian.jackson@eu.citrix.com \
--cc=jbeulich@suse.com \
--cc=keir@xen.org \
--cc=psujkov@gmail.com \
--cc=tim@xen.org \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.