xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Julien Grall <julien.grall@linaro.org>
To: Tamas K Lengyel <tamas.lengyel@zentific.com>
Cc: Ian Campbell <ian.campbell@citrix.com>, Tim Deegan <tim@xen.org>,
	Ian Jackson <ian.jackson@eu.citrix.com>,
	"xen-devel@lists.xen.org" <xen-devel@lists.xen.org>,
	Stefano Stabellini <stefano.stabellini@citrix.com>,
	Andres Lagar-Cavilla <andres@lagarcavilla.org>,
	Jan Beulich <jbeulich@suse.com>,
	Daniel De Graaf <dgdegra@tycho.nsa.gov>,
	Tamas K Lengyel <tklengyel@sec.in.tum.de>
Subject: Re: [PATCH v3 10/15] xen/arm: Data abort exception (R/W) mem_events.
Date: Wed, 03 Sep 2014 13:20:09 -0700	[thread overview]
Message-ID: <540777F9.8020006@linaro.org> (raw)
In-Reply-To: <CAErYnsjmdrKff-RB13fCK12uN6Puj0ArACos0qsqX7dTSSf6Tw@mail.gmail.com>


Hello Tamas,

On 02/09/14 02:06, Tamas K Lengyel wrote:
> Honestly, I tried to wrap my head around apply_p2m_changes and it is
> already quite complex. While I see I could apply the type/access
> permissions with it over a range, I'm not entirely sure how I would make
> it force-shatter all large pages. It was just easier (for now) to do it
> manually.

To shatter large pages, you can give a look to the REMOVE case in 
apply_one_level. I would even create an helper to shatter a page

apply_one_level doesn't look very complex. Almost everything is in a 
case. I would prefer that you extend the function rather than creating a 
new function.

>
>
>         +    {
>         +
>         +        bool_t pte_update = p2m_set_entry(d, pfn_to_paddr(pfn), a);
>         +
>         +        if ( !pte_update )
>         +            break;
>
>
>     Shouldn't you continue here? The other pages in the batch may
>     require updates.
>
>
> This is the same approach as in x86.

Hmmm ... no. x86 will break if an error has occured (i.e rc != 0) and 
return the rc later.

Here, you p2m_set_entry will return a boolean (I don't really understand 
why because you are mixing bool and int for rc withing this function).

If p2m_set_entry returns false, you will break in p2m_set_mem_access and 
return 0 (rc has been initialized to 0 earlier). Therefore the userspace 
application will think everything has been correctly updated but it's wrong!

> Right, I missed page additions with default_access. With so few software
> programmable bits available in the PTE, we have no other choice but to
> store the permission settings separately. I just need to make sure that
> the radix tree is updated when a pte is added/removed.

I'm not sure to fully understand your plan. Do you intend to add every 
page in the radix tree? If so, I'm a bit worry about the size of the 
radix tree. Xen will waste memory when xen access is not used (IHMO, the 
feature is only used in few cases).

>         +        return -ESRCH;
>         +
>         +    index = radix_tree_ptr_to_int(i);
>         +
>         +    if ( (unsigned) index >= ARRAY_SIZE(memaccess) )
>         +        return -ERANGE;
>
>
>     You are casting to unsigned all usage of index within this function.
>     Why not directly define index as an "unsigned int"?
>
>
> The radix tree returns an int but I guess could do that.

Which is fine because, IIRC, the compiler will implicitly cast the value 
in unsigned.

Regards,

-- 
Julien Grall

  reply	other threads:[~2014-09-03 20:20 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-01 14:21 [PATCH v3 00/15] Mem_event and mem_access for ARM Tamas K Lengyel
2014-09-01 14:21 ` [PATCH v3 01/15] xen: Relocate mem_access and mem_event into common Tamas K Lengyel
2014-09-01 15:06   ` Jan Beulich
2014-09-01 15:15     ` Tamas K Lengyel
2014-09-01 14:21 ` [PATCH v3 02/15] xen: Relocate struct npfec definition " Tamas K Lengyel
2014-09-01 15:44   ` Jan Beulich
2014-09-01 14:21 ` [PATCH v3 03/15] xen: Relocate mem_event_op domctl and access_op memop " Tamas K Lengyel
2014-09-01 15:46   ` Jan Beulich
2014-09-01 16:25     ` Tamas K Lengyel
2014-09-02  6:30       ` Jan Beulich
2014-09-02  7:43         ` Tamas K Lengyel
2014-09-01 18:11   ` Julien Grall
2014-09-01 20:51     ` Tamas K Lengyel
2014-09-02  6:53       ` Jan Beulich
2014-09-02  7:41         ` Tamas K Lengyel
2014-09-01 14:21 ` [PATCH v3 04/15] xen/mem_event: Clean out superfluous white-spaces Tamas K Lengyel
2014-09-01 14:21 ` [PATCH v3 05/15] xen/mem_event: Relax error condition on debug builds Tamas K Lengyel
2014-09-01 15:47   ` Jan Beulich
2014-09-01 14:22 ` [PATCH v3 06/15] xen/mem_event: Abstract architecture specific sanity checks Tamas K Lengyel
2014-09-01 14:22 ` [PATCH v3 07/15] xen/mem_access: Abstract architecture specific sanity check Tamas K Lengyel
2014-09-01 15:50   ` Jan Beulich
2014-09-01 14:22 ` [PATCH v3 08/15] xen/arm: p2m type definitions and changes Tamas K Lengyel
2014-09-01 14:22 ` [PATCH v3 09/15] xen/arm: Add set access required domctl Tamas K Lengyel
2014-09-01 19:10   ` Julien Grall
2014-09-02  7:48     ` Tamas K Lengyel
2014-09-02  8:17       ` Jan Beulich
2014-09-02  9:23         ` Tamas K Lengyel
2014-09-01 14:22 ` [PATCH v3 10/15] xen/arm: Data abort exception (R/W) mem_events Tamas K Lengyel
2014-09-01 21:07   ` Julien Grall
2014-09-02  9:06     ` Tamas K Lengyel
2014-09-03 20:20       ` Julien Grall [this message]
2014-09-03 21:56         ` Tamas K Lengyel
2014-09-08 20:41           ` Julien Grall
2014-09-09  9:20             ` Ian Campbell
2014-09-09 13:08               ` Tamas K Lengyel
2014-09-01 14:22 ` [PATCH v3 11/15] xen/arm: Instruction prefetch abort (X) mem_event handling Tamas K Lengyel
2014-09-01 14:22 ` [PATCH v3 12/15] xen/arm: Shatter large pages when using mem_acces Tamas K Lengyel
2014-09-01 14:22 ` [PATCH v3 13/15] xen/arm: Enable the compilation of mem_access and mem_event on ARM Tamas K Lengyel
2014-09-03 14:38   ` Daniel De Graaf
2014-09-01 14:22 ` [PATCH v3 14/15] tools/libxc: Allocate magic page for mem access " Tamas K Lengyel
2014-09-01 14:22 ` [PATCH v3 15/15] tools/tests: Enable xen-access " Tamas K Lengyel
2014-09-01 21:26   ` Julien Grall
2014-09-02  8:49     ` Tamas K Lengyel
2014-09-02 12:15     ` Tamas K Lengyel
2014-09-03 20:27       ` Julien Grall
2014-09-03 22:06         ` Tamas K Lengyel
2014-09-01 19:56 ` [PATCH v3 00/15] Mem_event and mem_access for ARM Julien Grall
2014-09-02  9:47   ` Tamas K Lengyel

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=540777F9.8020006@linaro.org \
    --to=julien.grall@linaro.org \
    --cc=andres@lagarcavilla.org \
    --cc=dgdegra@tycho.nsa.gov \
    --cc=ian.campbell@citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=jbeulich@suse.com \
    --cc=stefano.stabellini@citrix.com \
    --cc=tamas.lengyel@zentific.com \
    --cc=tim@xen.org \
    --cc=tklengyel@sec.in.tum.de \
    --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).