From: George Dunlap <george.dunlap@eu.citrix.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: Tim Deegan <tim@xen.org>, Ravi Sahita <ravi.sahita@intel.com>,
Wei Liu <wei.liu2@citrix.com>,
Andrew Cooper <andrew.cooper3@citrix.com>,
Ian Jackson <ian.jackson@eu.citrix.com>,
Ed White <edmund.h.white@intel.com>,
xen-devel@lists.xen.org, tlengyel@novetta.com,
Daniel De Graaf <dgdegra@tycho.nsa.gov>
Subject: Re: [PATCH v4 08/15] x86/altp2m: add control of suppress_ve.
Date: Fri, 10 Jul 2015 12:56:29 +0100 [thread overview]
Message-ID: <559FB2ED.8070803@eu.citrix.com> (raw)
In-Reply-To: <559FCD52020000780008F775@mail.emea.novell.com>
On 07/10/2015 12:49 PM, Jan Beulich wrote:
>>>> On 10.07.15 at 13:11, <george.dunlap@eu.citrix.com> wrote:
>> On 07/10/2015 10:39 AM, Jan Beulich wrote:
>>>>>> On 10.07.15 at 02:52, <edmund.h.white@intel.com> wrote:
>>>> @@ -1528,16 +1528,17 @@ bool_t p2m_mem_access_check(paddr_t gpa, unsigned long gla,
>>>> vm_event_request_t *req;
>>>> int rc;
>>>> unsigned long eip = guest_cpu_user_regs()->eip;
>>>> + bool_t sve;
>>>>
>>>> /* First, handle rx2rw conversion automatically.
>>>> * These calls to p2m->set_entry() must succeed: we have the gfn
>>>> * locked and just did a successful get_entry(). */
>>>> gfn_lock(p2m, gfn, 0);
>>>> - mfn = p2m->get_entry(p2m, gfn, &p2mt, &p2ma, 0, NULL);
>>>> + mfn = p2m->get_entry(p2m, gfn, &p2mt, &p2ma, 0, NULL, &sve);
>>>>
>>>> if ( npfec.write_access && p2ma == p2m_access_rx2rw )
>>>> {
>>>> - rc = p2m->set_entry(p2m, gfn, mfn, PAGE_ORDER_4K, p2mt, p2m_access_rw);
>>>> + rc = p2m->set_entry(p2m, gfn, mfn, PAGE_ORDER_4K, p2mt, p2m_access_rw, sve);
>>>> ASSERT(rc == 0);
>>>> gfn_unlock(p2m, gfn, 0);
>>>> return 1;
>>>> @@ -1546,7 +1547,7 @@ bool_t p2m_mem_access_check(paddr_t gpa, unsigned long gla,
>>>> {
>>>> ASSERT(npfec.write_access || npfec.read_access || npfec.insn_fetch);
>>>> rc = p2m->set_entry(p2m, gfn, mfn, PAGE_ORDER_4K,
>>>> - p2mt, p2m_access_rwx);
>>>> + p2mt, p2m_access_rwx, -1);
>>>
>>> So why -1 here ...
>>>
>>>> @@ -1566,14 +1567,14 @@ bool_t p2m_mem_access_check(paddr_t gpa, unsigned long gla,
>>>> else
>>>> {
>>>> gfn_lock(p2m, gfn, 0);
>>>> - mfn = p2m->get_entry(p2m, gfn, &p2mt, &p2ma, 0, NULL);
>>>> + mfn = p2m->get_entry(p2m, gfn, &p2mt, &p2ma, 0, NULL, &sve);
>>>> if ( p2ma != p2m_access_n2rwx )
>>>> {
>>>> /* A listener is not required, so clear the access
>>>> * restrictions. This set must succeed: we have the
>>>> * gfn locked and just did a successful get_entry(). */
>>>> rc = p2m->set_entry(p2m, gfn, mfn, PAGE_ORDER_4K,
>>>> - p2mt, p2m_access_rwx);
>>>> + p2mt, p2m_access_rwx, sve);
>>>
>>> ... but sve here, when -1 means "retain current setting" anyway?
>>> (Same question applies elsewhere.)
>>
>> This is my code. I considered whether to use -1 here, but since we're
>> reading and retaining gfn, mfn, and p2mt, it seemed more consistent
>> stylistically to just read and re-write it along with the others.
>>
>> In any case I don't have strong opinions.
>
> I'd suggest the other mechanism so one can easily see which places
> actually want to change the flag (or set it to a specific value). But in
> the end it's your call which way to go.
That does make sense. In fact, if there were "leave the default"
options for the other values (mfn, p2mt, &c) it would be clearer that
only the page order and the access rights were being changed here.
Anyway that's a minor issue at this point. Ed / Ravi, feel free to
change it according to Jan's suggestion, or leave it as it is for now.
-George
next prev parent reply other threads:[~2015-07-10 11:56 UTC|newest]
Thread overview: 51+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-10 0:52 [PATCH v4 00/15] Alternate p2m: support multiple copies of host p2m Ed White
2015-07-10 0:52 ` [PATCH v4 01/15] common/domain: Helpers to pause a domain while in context Ed White
2015-07-10 0:52 ` [PATCH v4 02/15] VMX: VMFUNC and #VE definitions and detection Ed White
2015-07-10 0:52 ` [PATCH v4 03/15] VMX: implement suppress #VE Ed White
2015-07-10 9:09 ` Jan Beulich
2015-07-10 19:22 ` Sahita, Ravi
2015-07-10 0:52 ` [PATCH v4 04/15] x86/HVM: Hardware alternate p2m support detection Ed White
2015-07-10 0:52 ` [PATCH v4 05/15] x86/altp2m: basic data structures and support routines Ed White
2015-07-10 9:13 ` Jan Beulich
2015-07-10 0:52 ` [PATCH v4 06/15] VMX/altp2m: add code to support EPTP switching and #VE Ed White
2015-07-10 16:48 ` George Dunlap
2015-07-10 0:52 ` [PATCH v4 07/15] VMX: add VMFUNC leaf 0 (EPTP switching) to emulator Ed White
2015-07-10 9:30 ` Jan Beulich
2015-07-11 20:01 ` Sahita, Ravi
2015-07-11 21:25 ` Sahita, Ravi
2015-07-13 7:18 ` Jan Beulich
2015-07-13 7:13 ` Jan Beulich
2015-07-10 0:52 ` [PATCH v4 08/15] x86/altp2m: add control of suppress_ve Ed White
2015-07-10 9:39 ` Jan Beulich
2015-07-10 11:11 ` George Dunlap
2015-07-10 11:49 ` Jan Beulich
2015-07-10 11:56 ` George Dunlap [this message]
2015-07-10 17:02 ` George Dunlap
2015-07-11 21:29 ` Sahita, Ravi
2015-07-10 0:52 ` [PATCH v4 09/15] x86/altp2m: alternate p2m memory events Ed White
2015-07-10 1:01 ` Lengyel, Tamas
2015-07-10 0:52 ` [PATCH v4 10/15] x86/altp2m: add remaining support routines Ed White
2015-07-10 9:41 ` Jan Beulich
2015-07-10 17:15 ` George Dunlap
2015-07-11 20:20 ` Sahita, Ravi
2015-07-10 0:52 ` [PATCH v4 11/15] x86/altp2m: define and implement alternate p2m HVMOP types Ed White
2015-07-10 10:01 ` Jan Beulich
2015-07-10 22:03 ` Sahita, Ravi
2015-07-13 7:25 ` Jan Beulich
2015-07-13 23:39 ` Sahita, Ravi
2015-07-14 8:58 ` Jan Beulich
2015-07-10 0:52 ` [PATCH v4 12/15] x86/altp2m: Add altp2mhvm HVM domain parameter Ed White
2015-07-10 8:53 ` Wei Liu
2015-07-10 17:32 ` George Dunlap
2015-07-10 22:12 ` Sahita, Ravi
2015-07-14 11:50 ` George Dunlap
2015-07-10 0:52 ` [PATCH v4 13/15] x86/altp2m: XSM hooks for altp2m HVM ops Ed White
2015-07-10 0:52 ` [PATCH v4 14/15] tools/libxc: add support to altp2m hvmops Ed White
2015-07-10 8:46 ` Ian Campbell
2015-07-10 0:52 ` [PATCH v4 15/15] tools/xen-access: altp2m testcases Ed White
2015-07-10 1:35 ` Lengyel, Tamas
2015-07-11 6:06 ` Razvan Cojocaru
2015-07-10 8:50 ` Ian Campbell
2015-07-10 8:55 ` Wei Liu
2015-07-10 9:12 ` Wei Liu
2015-07-10 9:20 ` Ian Campbell
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=559FB2ED.8070803@eu.citrix.com \
--to=george.dunlap@eu.citrix.com \
--cc=JBeulich@suse.com \
--cc=andrew.cooper3@citrix.com \
--cc=dgdegra@tycho.nsa.gov \
--cc=edmund.h.white@intel.com \
--cc=ian.jackson@eu.citrix.com \
--cc=ravi.sahita@intel.com \
--cc=tim@xen.org \
--cc=tlengyel@novetta.com \
--cc=wei.liu2@citrix.com \
--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 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.