All of lore.kernel.org
 help / color / mirror / Atom feed
From: George Dunlap <george.dunlap@citrix.com>
To: Jan Beulich <JBeulich@suse.com>, aisaila@bitdefender.com
Cc: George Dunlap <George.Dunlap@eu.citrix.com>,
	Andrew Cooper <andrew.cooper3@citrix.com>,
	tamas@tklengyel.com, Razvan Cojocaru <rcojocaru@bitdefender.com>,
	xen-devel@lists.xen.org
Subject: Re: [PATCH v4] x86/mm: Add mem access rights to NPT
Date: Wed, 25 Jul 2018 10:25:24 +0100	[thread overview]
Message-ID: <9ad5e355-8d22-c67c-b803-46dc935fe47b@citrix.com> (raw)
In-Reply-To: <5B57154C02000078001D72F6@prv1-mh.provo.novell.com>

On 07/24/2018 01:02 PM, Jan Beulich wrote:
>>>> On 24.07.18 at 13:26, <george.dunlap@citrix.com> wrote:
>> On 07/24/2018 09:55 AM, Jan Beulich wrote:
>>>>>> On 23.07.18 at 15:48, <aisaila@bitdefender.com> wrote:
>>>> --- a/xen/arch/x86/mm/mem_access.c
>>>> +++ b/xen/arch/x86/mm/mem_access.c
>>>> @@ -221,12 +221,12 @@ bool p2m_mem_access_check(paddr_t gpa, unsigned long 
>> gla,
>>>>          {
>>>>              req->u.mem_access.flags |= MEM_ACCESS_GLA_VALID;
>>>>              req->u.mem_access.gla = gla;
>>>> -
>>>> -            if ( npfec.kind == npfec_kind_with_gla )
>>>> -                req->u.mem_access.flags |= MEM_ACCESS_FAULT_WITH_GLA;
>>>> -            else if ( npfec.kind == npfec_kind_in_gpt )
>>>> -                req->u.mem_access.flags |= MEM_ACCESS_FAULT_IN_GPT;
>>>>          }
>>>> +
>>>> +        if ( npfec.kind == npfec_kind_with_gla )
>>>> +            req->u.mem_access.flags |= MEM_ACCESS_FAULT_WITH_GLA;
>>>> +        else if ( npfec.kind == npfec_kind_in_gpt )
>>>> +            req->u.mem_access.flags |= MEM_ACCESS_FAULT_IN_GPT;
>>>
>>> Without explanation in the commit message and without comment
>>> this change is a no-go imo: I consider it at least questionable to
>>> have npfec_kind_with_gla without .gla_valid set to true. Perhaps
>>> it's just a naming issue, but that would then still require half a
>>> sentence to explain.
>>
>> The naming here is confusing, but it seems to be based on the AMD manual
>> naming convention (IIRC from my skim through the manual last week).
>> "With gla" in this context means, "The nested fault happend while trying
>> to translate the final guest linear address of the access", as opposed
>> to "The nested fault happend while trying to translate one of the page
>> tables, before the guest linear address for the virtual address could be
>> calculated."  It's a perfectly valid setting on AMD box, in spite of the
>> fact that AMD doesn't report the virt -> gla translation.
>>
>> I'd be in favor of renaming the variable, but that shouldn't be
>> Alexandru's job.
>>
>> What about adding a comment like this:
>>
>> "Naming is confusing here; 'with_gla' simply means the fault happened as
>> the result of a translating the final gla, as opposed to translating one
>> of the pagetables."
> 
> Yes, that would clarify thnigs enough, I think.
> 
>>>> +        {
>>>> +            xfree(d->arch.monitor.msr_bitmap);
>>>> +            return -ENOMEM;
>>>> +        }
>>>> +        radix_tree_init(p2m->mem_access_settings);
>>>> +    }
>>>
>>> What's the SVM connection here? Please don't forget that p2m-pt.c
>>> also serves the shadow case. Perhaps struct p2m_domain should
>>> contain a boolean indicator whether this auxiliary data structure is
>>> needed?
>>
>> It's basically just "hap_enabled()" isn't it?
> 
> Only if we can't make it there when EPT is active.

It can make it here when VMX is active and shadow is enabled, but it
shouldn't be able to get here when EPT is active.  We could add an
ASSERT() to that effect; it should be safe in production, as the only
side effect should be that we do a small pointless allocation.

 -George

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

  reply	other threads:[~2018-07-25  9:25 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-23 13:48 [PATCH v4] x86/mm: Add mem access rights to NPT Alexandru Isaila
2018-07-24  8:55 ` Jan Beulich
2018-07-24  9:28   ` Razvan Cojocaru
2018-07-24  9:33     ` Jan Beulich
2018-07-24 11:26   ` George Dunlap
2018-07-24 12:02     ` Jan Beulich
2018-07-25  9:25       ` George Dunlap [this message]
2018-07-25 10:37         ` Jan Beulich
2018-08-09 12:14           ` Isaila Alexandru
2018-09-26  8:17           ` Isaila Alexandru
2018-09-26 13:13             ` George Dunlap
2018-07-25  8:29   ` Isaila Alexandru
2018-07-25  9:14     ` Jan Beulich
2018-07-25  9:28       ` Isaila Alexandru
2018-09-26 16:02 ` George Dunlap
2018-09-26 16:02   ` 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=9ad5e355-8d22-c67c-b803-46dc935fe47b@citrix.com \
    --to=george.dunlap@citrix.com \
    --cc=George.Dunlap@eu.citrix.com \
    --cc=JBeulich@suse.com \
    --cc=aisaila@bitdefender.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=rcojocaru@bitdefender.com \
    --cc=tamas@tklengyel.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.