xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Zhongze Liu <blackskygg@gmail.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: Stefano Stabellini <sstabellini@kernel.org>,
	George Dunlap <george.dunlap@eu.citrix.com>,
	Andrew Cooper <andrew.cooper3@citrix.com>,
	xen-devel@lists.xen.org, Julien Grall <julien.grall@arm.com>,
	Daniel De Graaf <dgdegra@tycho.nsa.gov>
Subject: Re: [PATCH 4/6] xsm: flask: change the interface and default policy for xsm_map_gmfn_foregin
Date: Thu, 24 Aug 2017 19:33:30 +0800	[thread overview]
Message-ID: <CAHrd_jpkEhD6LUm-7s03F9foPYC9L6R4hwvBo9KKkSbM9tjuHA@mail.gmail.com> (raw)
In-Reply-To: <599E90320200007800172F60@prv-mh.provo.novell.com>

Hi Jan,

2017-08-24 14:37 GMT+08:00 Jan Beulich <JBeulich@suse.com>:
>>>> On 24.08.17 at 02:51, <blackskygg@gmail.com> wrote:
>> 2017-08-23 17:55 GMT+08:00 Jan Beulich <JBeulich@suse.com>:
>>>>>> On 22.08.17 at 20:08, <blackskygg@gmail.com> wrote:
>>>> --- a/xen/include/xsm/dummy.h
>>>> +++ b/xen/include/xsm/dummy.h
>>>> @@ -525,10 +525,12 @@ static XSM_INLINE int xsm_remove_from_physmap(XSM_DEFAULT_ARG struct domain *d1,
>>>>      return xsm_default_action(action, d1, d2);
>>>>  }
>>>>
>>>> -static XSM_INLINE int xsm_map_gmfn_foreign(XSM_DEFAULT_ARG struct domain *d, struct domain *t)
>>>> +static XSM_INLINE int xsm_map_gmfn_foreign(XSM_DEFAULT_ARG struct domain *cd,
>>>> +                                           struct domain *d, struct domain *t)
>>>>  {
>>>>      XSM_ASSERT_ACTION(XSM_TARGET);
>>>> -    return xsm_default_action(action, d, t);
>>>> +    return xsm_default_action(action, cd, d) ||
>>>> +        xsm_default_action(action, cd, t);
>>>>  }
>>>
>>> ... you use "or" here and ...
>>
>> This might be confusing. But think of returning 0 as "allowed", the
>> only condition where this
>> statement returns a 0 is when both calls return 0 -- so it's actually
>> an "and". (Think of de-morgan's law.)
>>
>> But as Stefano has pointed out, I should preserve the error code.
>
> Ah, right - the code as written suggests boolean return values,
> which gives it the wrong look. You really mean ?: instead of ||.
> Why do you, btw, pass in current->domain (as cd) instead of
> obtaining it here (just like various other hooks do)?

This was my original plan, but I'm not very sure about this, so I turn
to Julien for help, and...
Here is part of the irc log from a discussion with Julien on
#xendevel, where Julien said:

   blackskygg: I think you want to pass the current domain in
parameter, i.e having 3 domains argument.
   because your solution only works when XSM is not enabled (this is
the dummy callback)
   when XSM is enabled, the policy would be specificed by the administrator
   he needs to be able to know which domain was doing the configuration.

Cheers,

Zhongze Liu
>
> Jan
>

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

  reply	other threads:[~2017-08-24 11:33 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-22 18:08 [PATCH 0/6] Allow setting up shared memory areas between VMs from xl config files Zhongze Liu
2017-08-22 18:08 ` [PATCH 1/6] libxc: add xc_domain_remove_from_physmap to wrap XENMEM_remove_from_physmap Zhongze Liu
2017-08-23 16:14   ` Wei Liu
2017-08-22 18:08 ` [PATCH 2/6] libxl: introduce a new structure to represent static shared memory regions Zhongze Liu
2017-08-22 20:05   ` Stefano Stabellini
2017-08-23  2:05     ` Zhongze Liu
2017-08-22 18:08 ` [PATCH 3/6] libxl:xl: add parsing code to parse "libxl_static_sshm" from xl config files Zhongze Liu
2017-08-22 20:36   ` Stefano Stabellini
2017-08-23 10:58     ` Julien Grall
2017-08-22 18:08 ` [PATCH 4/6] xsm: flask: change the interface and default policy for xsm_map_gmfn_foregin Zhongze Liu
2017-08-22 19:58   ` Stefano Stabellini
2017-08-23  2:18     ` Zhongze Liu
2017-08-23 15:56       ` Daniel De Graaf
2017-08-23  9:55   ` Jan Beulich
2017-08-23 17:16     ` Stefano Stabellini
2017-08-24  6:32       ` Jan Beulich
2017-08-24  0:51     ` Zhongze Liu
2017-08-24  6:37       ` Jan Beulich
2017-08-24 11:33         ` Zhongze Liu [this message]
2017-08-24 12:39           ` Jan Beulich
2017-08-24 14:30             ` Daniel De Graaf
2017-08-22 18:08 ` [PATCH 5/6] libxl: support mapping static shared memory areas during domain creation Zhongze Liu
2017-08-22 21:42   ` Stefano Stabellini
2017-08-23  2:37     ` Zhongze Liu
2017-08-25 11:05   ` Wei Liu
2017-08-25 12:02     ` Zhongze Liu
2017-08-25 12:09       ` Wei Liu
2017-08-22 18:08 ` [PATCH 6/6] libxl: support unmapping static shared memory areas during domain destruction Zhongze Liu
2017-08-22 21:31   ` Stefano Stabellini
2017-08-23  2:43     ` Zhongze Liu
2017-08-25 11:05   ` Wei Liu

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_jpkEhD6LUm-7s03F9foPYC9L6R4hwvBo9KKkSbM9tjuHA@mail.gmail.com \
    --to=blackskygg@gmail.com \
    --cc=JBeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=dgdegra@tycho.nsa.gov \
    --cc=george.dunlap@eu.citrix.com \
    --cc=julien.grall@arm.com \
    --cc=sstabellini@kernel.org \
    --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).