All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Jan Beulich" <JBeulich@suse.com>
To: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: xen-devel <xen-devel@lists.xenproject.org>,
	Wei Liu <wei.liu2@citrix.com>,
	Roger Pau Monne <roger.pau@citrix.com>
Subject: Re: [PATCH for-4.12 1/8] dom0/pvh: align allocation and mapping order to start address
Date: Tue, 05 Feb 2019 04:37:07 -0700	[thread overview]
Message-ID: <5C5975630200007800213EA2@prv1-mh.provo.novell.com> (raw)
In-Reply-To: <b4701681-bf77-57d4-d6df-404be74ac28d@citrix.com>

>>> On 05.02.19 at 11:54, <andrew.cooper3@citrix.com> wrote:
> On 05/02/2019 07:42, Jan Beulich wrote:
>>>>> On 04.02.19 at 18:11, <roger.pau@citrix.com> wrote:
>>> On Mon, Feb 04, 2019 at 09:41:34AM -0700, Jan Beulich wrote:
>>>>>>> On 30.01.19 at 11:36, <roger.pau@citrix.com> wrote:
>>>>> Due to the recent changes in the iommu mapping logic, the start
>>>>> addresses provided need to be aligned to the order intended to be
>>>>> mapped.
>>>> Irrespective of your reply to Wei's similar request (where you've
>>>> provided links to mails showing crashes) I'd like you to explain
>>>> this better. This is in particular because I don't really see what
>>>> "recent changes in the iommu mapping logic" you talk about.
>>> Commit 725bf00a87f ("iommu / p2m: add a page_order parameter to
>>> iommu_map/unmap_page()...") added the following two asserts to
>>> iommu_map:
>>>
>>> ASSERT(IS_ALIGNED(dfn_x(dfn), (1ul << page_order)));
>>> ASSERT(IS_ALIGNED(mfn_x(mfn), (1ul << page_order)));
>>>
>>> Previously iommu_map would add unaligned entries without complaining,
>>> but now in debug builds the assert will trigger.
>> Right, but the assertions were added to ensure expected behavior,
>> not to change anything.
> 
> No - this isn't reasonable.
> 
> Those assertions were added "because noone should be violating them".
> 
> As it turns out, that expectation was false.  There are real codepaths
> which do trip this assert, which functioned correctly before.
> 
> The two options are to either to bugfix the assertion failures by
> removing the assertions, or do some code improvement to update callers
> to be consistent with the new, different, expectation.
> 
> Roger was correct to being with.  The IOMMU code has recently shifted
> expectations, in a way which currently malfunctions only in debug builds.

I'm sorry, but no, I can't agree with such a position: Be it P2M or
IOMMU, requesting larger order mappings with frame numbers not
suitably aligned for the requested order is a mistake. It is the very
nature of "order" passed to both allocation and mapping functions
that returned blocks or memory or produced mappings adhere to
the requested order in terms of both size and alignment. (Was it
you or someone else who recently asked whether an allocation
with order > 0 would produce an order-aligned chunk of memory?)
For anything else it should indeed be a count rather than an order
to be passed in.

It's a second mistake for any code to have accepted such inputs.

Jan



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

  reply	other threads:[~2019-02-05 11:37 UTC|newest]

Thread overview: 62+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-30 10:36 [PATCH for-4.12 0/8] pvh/dom0/shadow/amd fixes Roger Pau Monne
2019-01-30 10:36 ` [PATCH for-4.12 1/8] dom0/pvh: align allocation and mapping order to start address Roger Pau Monne
2019-01-30 12:37   ` Wei Liu
2019-01-30 13:58     ` Roger Pau Monné
2019-01-31 17:22       ` Wei Liu
2019-02-04 16:41   ` Jan Beulich
2019-02-04 17:11     ` Roger Pau Monné
2019-02-05  7:42       ` Jan Beulich
2019-02-05 10:26         ` Roger Pau Monné
2019-02-05 11:38           ` Jan Beulich
2019-02-05 10:54         ` Andrew Cooper
2019-02-05 11:37           ` Jan Beulich [this message]
2019-01-30 10:36 ` [PATCH for-4.12 2/8] amd/ntp: remove assert that prevents creating 2M MMIO entries Roger Pau Monne
2019-02-04 16:48   ` Andrew Cooper
2019-02-04 16:56   ` Jan Beulich
2019-02-04 17:18     ` Roger Pau Monné
2019-02-05  7:45       ` Jan Beulich
2019-02-05 10:40         ` Roger Pau Monné
2019-02-05 12:44           ` Jan Beulich
2019-02-05 13:38             ` Roger Pau Monné
2019-02-05 14:55               ` Jan Beulich
2019-02-07 17:21               ` George Dunlap
2019-02-08 17:49                 ` Roger Pau Monné
2019-02-11  9:47                   ` Jan Beulich
2019-02-11 12:03                     ` Roger Pau Monné
     [not found]                       ` <7BBE0D330200008C0063616D@prv1-mh.provo.novell.com>
2019-02-11 12:11                         ` Jan Beulich
2019-01-30 10:36 ` [PATCH for-4.12 3/8] iommu/pvh: add reserved regions below 1MB to the iommu page tables Roger Pau Monne
2019-02-05 10:47   ` Jan Beulich
2019-02-05 11:15     ` Roger Pau Monné
2019-02-05 12:49       ` Jan Beulich
2019-02-05 14:01         ` Roger Pau Monné
2019-02-05 15:18           ` Jan Beulich
2019-02-05 15:45             ` Roger Pau Monné
2019-01-30 10:36 ` [PATCH for-4.12 4/8] x86/shadow: alloc enough pages so initialization doesn't fail Roger Pau Monne
2019-02-05 11:21   ` Jan Beulich
2019-02-05 11:47     ` Roger Pau Monné
2019-02-05 12:55       ` Jan Beulich
2019-02-05 13:52         ` Roger Pau Monné
2019-02-05 15:15           ` Jan Beulich
2019-02-05 15:53             ` Roger Pau Monné
2019-02-05 17:32               ` Jan Beulich
2019-02-06  9:10                 ` Roger Pau Monné
2019-02-06 11:02                   ` Jan Beulich
2019-01-30 10:36 ` [PATCH for-4.12 5/8] pvh/dom0: warn when dom0_mem is not set to a fixed value Roger Pau Monne
2019-02-06 13:54   ` Jan Beulich
2019-02-07 15:39     ` Roger Pau Monné
2019-02-07 16:47       ` Jan Beulich
2019-02-07 17:09   ` George Dunlap
2019-02-07 17:48     ` Roger Pau Monné
2019-02-08 11:11       ` George Dunlap
2019-01-30 10:36 ` [PATCH 6/8] x86/mm: split p2m ioreq server pages special handling into helper Roger Pau Monne
2019-01-31 14:59   ` Paul Durrant
2019-01-31 16:58     ` Roger Pau Monné
2019-01-30 10:36 ` [PATCH 7/8] x86/mm: handle foreign mappings in p2m_entry_modify Roger Pau Monne
2019-02-06 16:59   ` Jan Beulich
2019-02-07 16:53     ` Roger Pau Monné
2019-02-07 16:59       ` Jan Beulich
2019-02-07 17:49   ` George Dunlap
2019-02-07 17:57     ` Roger Pau Monné
2019-02-07 18:05       ` George Dunlap
2019-02-08  9:37         ` Roger Pau Monné
2019-01-30 10:36 ` [PATCH 8/8] npt/shadow: allow getting foreign page table entries Roger Pau Monne

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=5C5975630200007800213EA2@prv1-mh.provo.novell.com \
    --to=jbeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=roger.pau@citrix.com \
    --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.