From: Zhongze Liu <blackskygg@gmail.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: Tim Deegan <tim@xen.org>,
Stefano Stabellini <sstabellini@kernel.org>,
Wei Liu <wei.liu2@citrix.com>,
George Dunlap <George.Dunlap@eu.citrix.com>,
Andrew Cooper <andrew.cooper3@citrix.com>,
Ian Jackson <ian.jackson@eu.citrix.com>,
xen-devel@lists.xen.org, zhongzeliu <zhongzeliu@hustunique.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 23:47:21 +0800 [thread overview]
Message-ID: <CAHrd_jrOXhP7+BToxFh8FDCyVQkueUGY5d8YJXCmyXGJOJ4phg@mail.gmail.com> (raw)
In-Reply-To: <595A70080200007800168003@prv-mh.provo.novell.com>
Hi Jan,
2017-07-03 22:25 GMT+08:00 Jan Beulich <JBeulich@suse.com>:
>>>> On 30.06.17 at 22:15, <blackskygg@gmail.com> wrote:
>> /*
>> * Set access permissions, cacheability and shareability (ARM only) of a
>> * continuos range of normal memory (RAM) in the stage-2 page table.
>> */
>> /* XEN_DOMCTL_memattrs_op */
>>
>> /* set chacheability and shareability */
>> #define XEN_DOMCTL_MEMATTRS_OP_SET_CACHEATTRS 1
>> /* set access permissions */
>> #define XEN_DOMCTL_MEMATTRS_OP_SET_PERMISSIONS 2
>> /* get chacheability and shareability */
>> #define XEN_DOMCTL_MEMATTRS_OP_GET_CACHEATTRS 1
>> /* get access permissions */
>> #define XEN_DOMCTL_MEMATTRS_OP_GET_PERMISSIONS 2
>>
>> /* flags for XEN_DOMCTL_MEMATTRS_OP_SET_CACHEATTRS */
>> /* chacheability flags, the values happen to be the same with those in
>> * x86 PAT. (See [4])
>> */
>> /* uncacheable */
>> #define XEN_DOMCTL_MEMATTRS_UC 0x00U
>> /* write combine, x86 only */
>> #define XEN_DOMCTL_MEMATTRS_CACHE_WC 0x01U
>> /* write through */
>> #define XEN_DOMCTL_MEMATTRS_CACHE_WT 0x04U
>> /* write protect, x86 only */
>> #define XEN_DOMCTL_MEMATTRS_CACHE_WP 0x05U
>> /* write back */
>> #define XEN_DOMCTL_MEMATTRS_CACHE_WB 0x06U
>> /* strong uncacheable, x86 only*/
>> #define XEN_DOMCTL_MEMATTRS_SUC 0x07U
>
> I think if we really want to go this route, this part should mean
> removal of DOMCTL_pin_mem_cacheattr then. However, ...
>
>> /* shareability flags (See [5]), arm only, the value is taken from
>> * asm-arm/page.h, but live in the second 8-bit.
>> */
>> #define XEN_DOMCTL_MEMATTRS_SHAREABILITY_SHIFT 8
>> #define XEN_DOMCTL_MEMATTRS_SH_NON_SHAREABLE (LPAE_SH_NON_SHAREABLE<<8)
>> #define XEN_DOMCTL_MEMATTRS_SH_UNPREDICTALE (LPAE_SH_UNPREDICTALE<<8)
>> #define XEN_DOMCTL_MEMATTRS_SH_OUTER (LPAE_SH_OUTER<<8)
>> #define XEN_DOMCTL_MEMATTRS_SH_INNER (LPAE_SH_INNER<<8)
>>
>> /* flags for XEN_DOMCTL_MEMATTRS_OP_SET_PERMISSIONS */
>> #define XEN_DOMCTL_MEMATTRS_ACCESS_N 0x00U
>> #define XEN_DOMCTL_MEMATTRS_ACCESS_R (0x01U<<0)
>> #define XEN_DOMCTL_MEMATTRS_ACCESS_W (0x01U<<1)
>> #define XEN_DOMCTL_MEMATTRS_ACCESS_X (0x01U<<2)
>> #define XEN_DOMCTL_MEMATTRS_ACCESS_RW \
>> (XEN_DOMCTL_MEMATTRS_ACCESS_R|XEN_DOMCTL_MEMATTRS_ACCESS_W)
>> #define XEN_DOMCTL_MEMATTRS_ACCESS_RX \
>> (XEN_DOMCTL_MEMATTRS_ACCESS_R|XEN_DOMCTL_MEMATTRS_ACCESS_X)
>> #define XEN_DOMCTL_MEMATTRS_ACCESS_WX \
>> (XEN_DOMCTL_MEMATTRS_ACCESS_W|XEN_DOMCTL_MEMATTRS_ACCESS_X)
>> #define XEN_DOMCTL_MEMATTRS_ACCESS_RWX \
>> (XEN_DOMCTL_MEMATTRS_ACCESS_RW|XEN_DOMCTL_MEMATTRS_ACCESS_X)
>
> ... with this basically duplicating
> XENMEM_access_op_{set,get}_access I now wonder whether
> we don't already have all you need (apart from an ARM variant of
> DOMCTL_pin_mem_cacheattr).
In fact, there isn't much description on the usage of this
interface, so I turned to the implementation in
xen/common/mem_access.c, where I see this
interface invoking p2m_set_mem_acess, which further invokes
set_mem_acess and finally
p2m->set_entry(), so I guess this might be the right interface to use.
To confirm the guess, I turned to Stabellini for help, and he told me
that XENMEM_access_op
is "for getting very detail info on what the guest is accessing", and
might not be suitable
for this scenario, so I just gave up using it, and that's why I have this RFC.
I'll re-confirm this with Stabellini.
>
> This being an RFC, I'll skip pointing out various cosmetic issues with
> your proposal.
>
> Jan
>
Thank you.
Cheers,
Zhongze Liu
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
next prev parent reply other threads:[~2017-07-03 15:47 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
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 [this message]
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=CAHrd_jrOXhP7+BToxFh8FDCyVQkueUGY5d8YJXCmyXGJOJ4phg@mail.gmail.com \
--to=blackskygg@gmail.com \
--cc=George.Dunlap@eu.citrix.com \
--cc=JBeulich@suse.com \
--cc=andrew.cooper3@citrix.com \
--cc=ian.jackson@eu.citrix.com \
--cc=sstabellini@kernel.org \
--cc=tim@xen.org \
--cc=wei.liu2@citrix.com \
--cc=xen-devel@lists.xen.org \
--cc=xen-devel@lists.xenproject.org \
--cc=zhongzeliu@hustunique.com \
/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).