All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Jan Beulich" <JBeulich@suse.com>
To: "Andrew Cooper" <andrew.cooper3@citrix.com>,
	"Roger Pau Monné" <roger.pau@citrix.com>
Cc: Stefano Stabellini <sstabellini@kernel.org>,
	Wei Liu <wei.liu2@citrix.com>,
	George Dunlap <george.dunlap@eu.citrix.com>,
	TimDeegan <tim@xen.org>, Xen-devel <xen-devel@lists.xen.org>,
	Julien Grall <julien.grall@arm.com>
Subject: Re: [PATCH 7/7] xen/mm: Clean up share_xen_page_with_guest() API
Date: Fri, 16 Mar 2018 01:43:59 -0600	[thread overview]
Message-ID: <5AAB83CF02000078001B2960@prv-mh.provo.novell.com> (raw)
In-Reply-To: <6043e871-3cf7-f126-d504-f925fa505470@citrix.com>

>>> On 15.03.18 at 21:25, <andrew.cooper3@citrix.com> wrote:
> On 13/03/18 14:39, Jan Beulich wrote:
>>>>> On 13.03.18 at 13:28, <roger.pau@citrix.com> wrote:
>>> On Fri, Mar 09, 2018 at 01:18:42PM +0000, Andrew Cooper wrote:
>>>> --- a/xen/arch/arm/mm.c
>>>> +++ b/xen/arch/arm/mm.c
>>>> @@ -1187,8 +1187,8 @@ unsigned long domain_get_maximum_gpfn(struct domain 
> *d)
>>>>      return gfn_x(d->arch.p2m.max_mapped_gfn);
>>>>  }
>>>>  
>>>> -void share_xen_page_with_guest(struct page_info *page,
>>>> -                          struct domain *d, int readonly)
>>>> +void share_xen_page_with_guest(struct page_info *page, struct domain *d,
>>>> +                               enum XENSHARE_flags flags)
>>> Naming this _flags feels wrong to me, I would assume flags to be
>>> something which can be used as (SHARE_r | SHARE_w) (ie: stacked) and
>>> so on. I would maybe name this XENSHARE_options rather than flags.
>>>
>>> TBH I would be OK with renaming the parameter to "bool ro/readonly"
>>> and let the callers use true and false directly. It seems like
>>> over-engineering to use an enum for this, or maybe you have further
>>> changes in mind that are going to expand the set of options?
>> On one hand I agree that an enum like this is somewhat strange
>> to have, and a boolean would seem like a better fit. Otoh using
>> plain true/false at the call sites would make it pretty unclear
>> whether "true" means r/o or r/w. So another option might be
>> to have multiple inline wrappers around the actual worker, like
>> share_xen_page_with_guest_ro().
> 
> Splitting into (SHARE_r | SHARE_w( doesn't make sense because the
> underlying implementation take a boolean idea of whether to use PGT_none
> or PGT_writable_page.
> 
> We've already got share_xen_page_with_privileged_guests() as a wrapper
> around share_xen_page_with_guest().  Therefore, we'd end up with a total
> of 4 extra wrappers if we wanted _rw and _ro suffixes, which seems over
> the top to me.
> 
> I agree its not completely great like this, but it is the least bad
> option I managed to come up with.

Well, without wanting put under question the ack I've already
given, the question of course is whether the code is much
better after the change than it was before. If there's no really
good shape to put this in, leaving things as they are is certainly
also an option.

Jan


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

  reply	other threads:[~2018-03-16  7:43 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-09 13:18 [PATCH 0/7] xen: More assorted improvements to domain creation Andrew Cooper
2018-03-09 13:18 ` [PATCH 1/7] xen/domain: Drop DOMCRF_dummy Andrew Cooper
2018-03-09 14:12   ` Wei Liu
2018-03-09 16:46     ` Jan Beulich
2018-03-11 20:01   ` Julien Grall
2018-03-09 13:18 ` [PATCH 2/7] xen/domain: Drop all DOMCRF_* constants Andrew Cooper
2018-03-09 14:12   ` Wei Liu
2018-03-09 14:14     ` Andrew Cooper
2018-03-09 14:16       ` Wei Liu
2018-03-09 16:48         ` Jan Beulich
2018-03-11 20:02   ` Julien Grall
2018-03-09 13:18 ` [PATCH 3/7] RFC arm/domain: Reject invalid combinations of domain creation flags Andrew Cooper
2018-03-11 19:59   ` Julien Grall
2018-03-12 16:32     ` Wei Liu
2018-03-13 14:42       ` Julien Grall
2018-03-15 20:02         ` Andrew Cooper
2018-03-09 13:18 ` [PATCH 4/7] x86/domain: Remove unused parameters from {hvm, pv}_domain_initialise() Andrew Cooper
2018-03-09 14:13   ` Wei Liu
2018-03-09 16:49     ` Jan Beulich
2018-03-13 12:05   ` Roger Pau Monné
2018-03-15 20:09     ` Andrew Cooper
2018-03-16 10:58       ` Jan Beulich
2018-03-09 13:18 ` [PATCH 5/7] x86/domain: Optimise the order of actions in arch_domain_create() Andrew Cooper
2018-03-09 14:43   ` Wei Liu
2018-03-09 16:54   ` Jan Beulich
2018-03-15 20:15     ` Andrew Cooper
2018-03-16  7:40       ` Jan Beulich
2018-03-13 12:18   ` Roger Pau Monné
2018-03-09 13:18 ` [PATCH 6/7] xen/domain: Pass the full domctl_createdomain struct to create_domain() Andrew Cooper
2018-03-09 14:50   ` Wei Liu
2018-03-09 17:00   ` Jan Beulich
2018-03-09 17:06     ` Andrew Cooper
2018-03-12 12:57       ` Jan Beulich
2018-03-11 20:08   ` Julien Grall
2018-03-09 13:18 ` [PATCH 7/7] xen/mm: Clean up share_xen_page_with_guest() API Andrew Cooper
2018-03-09 14:53   ` Wei Liu
2018-03-11 20:29   ` Julien Grall
2018-03-13 12:28   ` Roger Pau Monné
2018-03-13 14:39     ` Jan Beulich
2018-03-15 20:25       ` Andrew Cooper
2018-03-16  7:43         ` Jan Beulich [this message]
2018-03-16  8:58           ` Andrew Cooper

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=5AAB83CF02000078001B2960@prv-mh.provo.novell.com \
    --to=jbeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=george.dunlap@eu.citrix.com \
    --cc=julien.grall@arm.com \
    --cc=roger.pau@citrix.com \
    --cc=sstabellini@kernel.org \
    --cc=tim@xen.org \
    --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.