xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Julien Grall <julien.grall@arm.com>
To: Zhongze Liu <blackskygg@gmail.com>,
	Stefano Stabellini <sstabellini@kernel.org>
Cc: Wei Liu <wei.liu2@citrix.com>,
	Andrew Cooper <andrew.cooper3@citrix.com>,
	Ian Jackson <ian.jackson@eu.citrix.com>,
	xen-devel@lists.xen.org, Jan Beulich <jbeulich@suse.com>,
	xen-devel@lists.xenproject.org
Subject: Re: [RFC] DOMCTL_memattrs_op : a new DOMCTL to play with stage-2 page attributes
Date: Mon, 3 Jul 2017 12:16:07 +0100	[thread overview]
Message-ID: <61b4b75a-23db-adf5-2b96-1d5f70d19cb3@arm.com> (raw)
In-Reply-To: <CAHrd_jpheqH6qNaxYRVop+6ysa=FqrDkrTFym3H3Dp4MZ0qs4g@mail.gmail.com>

Hi,

On 01/07/17 10:16, Zhongze Liu wrote:
>> On the ARM side, we are missing BUFFERABLE and WRITEALLOC. I don't know
>> how they map to these tags, which comes from the x86 world. Maybe we
>> should just add them separately as ARM only, like:
>>
>>   /* bufferable, ARM only */
>>   #define XEN_DOMCTL_MEMATTRS_BUFFERABLE 0x08U
>>   /* write alloc, ARM only */
>>   #define XEN_DOMCTL_MEMATTRS_CACHE_WA   0x09U
>>
>> Theoretically, we could say XEN_DOMCTL_MEMATTRS_UC means "BUFFERABLE" on
>> ARM and XEN_DOMCTL_MEMATTRS_SUC means "UNCACHED", because that's
>> actually what they correspond to I think. However using x86 names for
>> ARM caching attributes is very confusing and error prone. So I would
>> prefer introducing separate tags for ARM and x86. However, reusing
>> XEN_DOMCTL_MEMATTRS_UC, XEN_DOMCTL_MEMATTRS_CACHE_WT and
>> XEN_DOMCTL_MEMATTRS_CACHE_WB as Zhongze did in this proposal would be OK
>> for me.

When I read bufferable it is unclear if you speak about normal memory or 
device. I am looking at renaming the memory attribute with prefixing 
them with the type memory.

For instance BUFFERABLE would be renamed to NORMAL_NC...

>>
>> Julien, what do you think?

I will only speak about ARM as my knowledge is very limited on x86.

For ARM, the resulting memory attribute is a combination of stage-1 and 
stage-2 (see Table D4-43 in ARM DDI 0487B.a). It adds further 
restriction to the memory attributes defined by the Guest in its 
page-tables.

This means that even the memory attribute used in stage-2 is normal 
cacheable, a guest is free to make it non-cacheable via stage-1 page 
table. This is not really clear in the description of the DOMCTL what is 
the real purpose. Is it restricting possibility of the guest?

Now, looking at the description, this domctl will be called after we 
mapped the RAM in the guest memory. So you will switch from write-back 
cacheable to another memory attribute. I think this will require cache 
maintainance to remove potential stall cache line.

Furthermore, you don't have any restriction on when this domctl will be 
called. It would be possible to call it when the guest is running or 
called on a range with memory attribute already changed. This will 
require some thoughts on how to do the cache maintenance.

Finally, Xen ARM64 will always have the whole RAM memory mapped in Xen 
with write-allocate memory attribute. This may result a memory attribute 
mismatch if the region is accessed by Xen (see B2.8).

This may take sometimes to get the implementation of the DOMCTL right. 
So I would rather focus to be able to share page between guest and an 
future-proof toolstack interface.

If you still have time at the end of the GSOC, you can look at using 
different memory attributes

Cheers,

-- 
Julien Grall

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

  parent reply	other threads:[~2017-07-03 11:16 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-30 20:15 [RFC] DOMCTL_memattrs_op : a new DOMCTL to play with stage-2 page attributes Zhongze Liu
2017-06-30 21:48 ` Stefano Stabellini
2017-07-01  8:29   ` Zhongze Liu
2017-07-01  9:16   ` Zhongze Liu
2017-07-01  9:22     ` Zhongze Liu
2017-07-03 11:16     ` Julien Grall [this message]
2017-07-03 15:28       ` Zhongze Liu
2017-07-03 17:40         ` Stefano Stabellini
2017-07-03 14:25 ` Jan Beulich
2017-07-03 15:47   ` Zhongze Liu
2017-07-03 17:58     ` Stefano Stabellini
2017-07-04  7:47       ` Jan Beulich
2017-07-05 18:35         ` Stefano Stabellini
2017-07-05 20:39           ` Julien Grall
2017-07-06  8:36             ` Jan Beulich
2017-07-06 17:42               ` Stefano Stabellini
2017-07-06 18:07                 ` Julien Grall
2017-07-07  7:27                   ` Jan Beulich
2017-07-07  8:56                     ` George Dunlap
2017-07-07  9:39                       ` Jan Beulich
2017-07-06  8:23           ` Jan Beulich

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=61b4b75a-23db-adf5-2b96-1d5f70d19cb3@arm.com \
    --to=julien.grall@arm.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=blackskygg@gmail.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=jbeulich@suse.com \
    --cc=sstabellini@kernel.org \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.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 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).