All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Jan Beulich" <JBeulich@suse.com>
To: Paul Durrant <paul.durrant@citrix.com>
Cc: Kevin Tian <kevin.tian@intel.com>,
	Stefano Stabellini <sstabellini@kernel.org>,
	Wei Liu <wei.liu2@citrix.com>,
	Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>,
	Andrew Cooper <andrew.cooper3@citrix.com>,
	Tim Deegan <tim@xen.org>,
	george.dunlap@citrix.com,
	Sander Eikelenboom <linux@eikelenboom.it>,
	Julien Grall <julien.grall@arm.com>,
	Jun Nakajima <jun.nakajima@intel.com>,
	xen-devel <xen-devel@lists.xenproject.org>,
	IanJackson <Ian.Jackson@citrix.com>,
	Chao Gao <chao.gao@intel.com>,
	Roger Pau Monne <roger.pau@citrix.com>
Subject: Re: [PATCH] iommu: specify page_count rather than page_order to iommu_map/unmap()...
Date: Tue, 22 Jan 2019 03:46:48 -0700	[thread overview]
Message-ID: <5C46F4980200007800210113@prv1-mh.provo.novell.com> (raw)
In-Reply-To: <a2497e649cfb499aa6f719fe474b5975@AMSPEX02CL03.citrite.net>

>>> On 21.01.19 at 14:22, <Paul.Durrant@citrix.com> wrote:
>>  -----Original Message-----
>> From: Jan Beulich [mailto:JBeulich@suse.com]
>> Sent: 21 January 2019 12:05
>> To: Paul Durrant <Paul.Durrant@citrix.com>
>> Cc: Julien Grall <julien.grall@arm.com>; Andrew Cooper
>> <Andrew.Cooper3@citrix.com>; George Dunlap <George.Dunlap@citrix.com>; Ian
>> Jackson <Ian.Jackson@citrix.com>; Roger Pau Monne <roger.pau@citrix.com>;
>> Wei Liu <wei.liu2@citrix.com>; Sander Eikelenboom <linux@eikelenboom.it>;
>> Chao Gao <chao.gao@intel.com>; Jun Nakajima <jun.nakajima@intel.com>;
>> Kevin Tian <kevin.tian@intel.com>; Stefano Stabellini
>> <sstabellini@kernel.org>; xen-devel <xen-devel@lists.xenproject.org>;
>> Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>; Tim (Xen.org)
>> <tim@xen.org>
>> Subject: RE: [PATCH] iommu: specify page_count rather than page_order to
>> iommu_map/unmap()...
>> 
>> >>> On 21.01.19 at 12:56, <Paul.Durrant@citrix.com> wrote:
>> >>  -----Original Message-----
>> >> From: Jan Beulich [mailto:JBeulich@suse.com]
>> >> Sent: 21 January 2019 11:28
>> >> To: Paul Durrant <Paul.Durrant@citrix.com>
>> >> Cc: Julien Grall <julien.grall@arm.com>; Andrew Cooper
>> >> <Andrew.Cooper3@citrix.com>; Roger Pau Monne <roger.pau@citrix.com>;
>> Wei
>> >> Liu <wei.liu2@citrix.com>; Sander Eikelenboom <linux@eikelenboom.it>;
>> >> George Dunlap <George.Dunlap@citrix.com>; Ian Jackson
>> >> <Ian.Jackson@citrix.com>; Chao Gao <chao.gao@intel.com>; Jun Nakajima
>> >> <jun.nakajima@intel.com>; Kevin Tian <kevin.tian@intel.com>; Stefano
>> >> Stabellini <sstabellini@kernel.org>; xen-devel <xen-
>> >> devel@lists.xenproject.org>; Konrad Rzeszutek Wilk
>> >> <konrad.wilk@oracle.com>; Tim (Xen.org) <tim@xen.org>
>> >> Subject: Re: [PATCH] iommu: specify page_count rather than page_order
>> to
>> >> iommu_map/unmap()...
>> >>
>> >> >>> On 18.01.19 at 17:03, <paul.durrant@citrix.com> wrote:
>> >> > ...and remove alignment assertions.
>> >> >
>> >> > Testing shows that certain callers of iommu_legacy_map/unmap()
>> specify
>> >> > order > 0 ranges that are not order aligned thus causing one of the
>> >> > IS_ALIGNED() assertions to fire.
>> >>
>> >> As said before - without a much better explanation of why the current
>> >> order-based model is unsuitable (so far I've been provided only vague
>> >> pointers into "somewhere in PVH Dom0 boot code" iirc) to understand
>> >> why it's undesirable to simply make those call sites obey to the
>> current
>> >> requirements, I'm not happy to see us go this route.
>> >
>> > I thought...
>> >
>> > "Using a count actually makes more sense because the valid
>> > set of mapping orders is specific to the IOMMU implementation and to it
>> > should be up to the implementation specific code to translate a mapping
>> > count into an optimal set of mapping orders (when the code is finally
>> > modified to support orders > 0)."
>> >
>> > ...was reasonably clear. Is that not a reasonable justification? What
>> else
>> > could I say?
>> 
>> Well, I was hoping to be pointed at the (apparently multiple) call sites
>> where making them match the current function pattern is more involved
>> and/or less desirable than changing the functions here.
> 
> AFAICT, one of them is memory.c:populate_physmap() where the extent order 
> comes from the memop_args and the memory comes from alloc_domheap_pages(), 
> which I don't believe aligns memory on the specified order.

Of course it does (in MFN space). What I notice is that the gpfn passed
in is not validated to be suitably aligned for the specified order. With
guest_physmap_add_entry() processing each 4k page separately this
doesn't currently have any bad effects, but I think it's a bug
nevertheless. After all the comment in struct xen_memory_reservation's
declaration says "size/alignment of each". The issue with fixing flaws
like this is that there's always the risk of causing regressions with
existing guests.

> Regardless of the 
> alignment though, the fact that order comes from a hypercall argument and may 
> not match any of the orders supported by the IOMMU implementation makes me 
> think that using a page count is better.

Splitting up guest requests is orthogonal to whether a count or an
order is more suitable as a parameter.

Jan


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

  reply	other threads:[~2019-01-22 10:46 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-18 16:03 [PATCH] iommu: specify page_count rather than page_order to iommu_map/unmap() Paul Durrant
2019-01-18 16:06 ` Julien Grall
2019-01-18 16:09   ` Paul Durrant
2019-01-18 17:40 ` Andrew Cooper
2019-01-21  9:19   ` Paul Durrant
2019-01-21 11:27 ` Jan Beulich
2019-01-21 11:56   ` Paul Durrant
2019-01-21 12:04     ` Jan Beulich
2019-01-21 13:22       ` Paul Durrant
2019-01-22 10:46         ` Jan Beulich [this message]
2019-01-22 16:36           ` Paul Durrant
2019-01-22 18:23           ` Andrew Cooper
2019-01-23 10:42             ` Jan Beulich
2019-01-22 17:02   ` Roger Pau Monné
2019-01-23 10:47     ` Jan Beulich

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=5C46F4980200007800210113@prv1-mh.provo.novell.com \
    --to=jbeulich@suse.com \
    --cc=Ian.Jackson@citrix.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=chao.gao@intel.com \
    --cc=george.dunlap@citrix.com \
    --cc=julien.grall@arm.com \
    --cc=jun.nakajima@intel.com \
    --cc=kevin.tian@intel.com \
    --cc=konrad.wilk@oracle.com \
    --cc=linux@eikelenboom.it \
    --cc=paul.durrant@citrix.com \
    --cc=roger.pau@citrix.com \
    --cc=sstabellini@kernel.org \
    --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.