All of lore.kernel.org
 help / color / mirror / Atom feed
From: George Dunlap <george.dunlap@citrix.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: Kevin Tian <kevin.tian@intel.com>, Wei Liu <wei.liu2@citrix.com>,
	Ian Campbell <ian.campbell@citrix.com>,
	Stefano Stabellini <stefano.stabellini@eu.citrix.com>,
	George Dunlap <George.Dunlap@eu.citrix.com>,
	Andrew Cooper <andrew.cooper3@citrix.com>,
	Ian Jackson <Ian.Jackson@eu.citrix.com>, TimDeegan <tim@xen.org>,
	Jun Nakajima <jun.nakajima@intel.com>,
	xen-devel <xen-devel@lists.xenproject.org>,
	Keir Fraser <keir@xen.org>
Subject: Re: [PATCH v7] x86/p2m: use large pages for MMIO mappings
Date: Tue, 9 Feb 2016 12:17:08 +0000	[thread overview]
Message-ID: <56B9D8C4.2070706@citrix.com> (raw)
In-Reply-To: <56B9E01502000078000CFFDE@prv-mh.provo.novell.com>

On 09/02/16 11:48, Jan Beulich wrote:
>>>> On 09.02.16 at 11:56, <george.dunlap@citrix.com> wrote:
>> On 09/02/16 08:42, Jan Beulich wrote:
>>>>>> On 08.02.16 at 19:04, <george.dunlap@citrix.com> wrote:
>>>> First -- and this isn't a blocker, but just a question (and sorry if
>>>> it's been answered before) -- why have the "0 means I did it all, <nr
>>>> means I did it partially"?  Why not just return the number of entries
>>>> actually handled?
>>>
>>> Because I view zero as the conventional "success" indicator. No
>>> other deeper reason.
>>
>> For certain classes of functionality, yes.  But for other classes --
>> where the caller will request N but the OS / hypervisor / whatever may
>> do some other number fewer than N, then the convention is to always pass
>> the number of items completed.  read() and write() system calls are like
>> this, as are most of the XENMEM operations (e.g.,
>> XENMEM_increase_resevration).
>>
>> Since this domctl looks a lot like some of those XENMEM operations,
>> wouldn't it make more sense to follow that convention, and return the
>> number of extents actually allocated?
> 
> Well, if comparing with the XENMEM ones, perhaps. But if comparing
> with other domctls, perhaps rather not? I've really been undecided
> here from the very beginning, since I had considered that alternative
> right away.

Well from a brief survey of things that can partially succeed
(getmemlist, gethvmcontext, {get,set}_vcpu_msrs), it seems that most of
them:

1. Use the return value *only* for success or failure; they either
return 0 or -errno, even if they only partially succeed
2. Return the actual number of things accomplished in the struct itself.

You seem to be introducing a new model, where you use the return value
sort of for all three.  (Are there any other hypercalls that behave this
way?)

I don't think sometimes returning the number of things you did and
sometimes returning zero makes any sense.  My suggestion would be either
make "nr_mfns" bidirectional (as similar fields are in the other
domctls) and return 0 on either full or partial success, or just return
the number of mfns actually mapped either on full or partial success.

>> Under those conditions, it looks to me like the following will happen:
>> 1. map_mmio_regions() will call set_mmio_p2m_entry() with order 9
>> 2. set_mmio_p2m_entry() will return 9 (requesting using order 8)
>> 3. map_mmio_regions() will call set_mmio_p2m_entry() with order 8
>> 4. set_mmio_p2m_entry() will call set_typed_p2m_entry() with order 8
>> 5. set_typed_p2m_entry() will read the current p2m entry of >= 9 and
>> continue (since 8 <= 9)
>> 6. set_typed_p2m_entry() will call p2m_set_entry() with an order of 8
>> 7. ept_set_entry() will return -EINVAL, since order % EPT_TABLE_ORDER != 0.
>>
>> Am I missing something?
> 
> Between step 6 and step 7 there is actually p2m_set_entry()
> breaking up the request into chunks or orders the hardware
> supports.

Oh, right -- sorry, I assumed that p2m_set_entry() was just an alias for
the underlying *set_entry() function.  I see now there's a loop handling
arbitrary orders.  Thanks. :-)

 -George

  reply	other threads:[~2016-02-09 12:17 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-02 15:15 [PATCH v7] x86/p2m: use large pages for MMIO mappings Jan Beulich
2016-02-02 15:27 ` Andrew Cooper
2016-02-02 15:41   ` Jan Beulich
2016-02-08 18:04 ` George Dunlap
2016-02-09  8:42   ` Jan Beulich
2016-02-09 10:56     ` George Dunlap
2016-02-09 11:48       ` Jan Beulich
2016-02-09 12:17         ` George Dunlap [this message]
2016-02-09 12:35           ` Jan Beulich
2016-02-10 10:06             ` Ian Campbell
2016-02-10 10:19               ` 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=56B9D8C4.2070706@citrix.com \
    --to=george.dunlap@citrix.com \
    --cc=George.Dunlap@eu.citrix.com \
    --cc=Ian.Jackson@eu.citrix.com \
    --cc=JBeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=ian.campbell@citrix.com \
    --cc=jun.nakajima@intel.com \
    --cc=keir@xen.org \
    --cc=kevin.tian@intel.com \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=tim@xen.org \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xenproject.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.