All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Jan Beulich" <JBeulich@suse.com>
To: Roger Pau Monne <roger.pau@citrix.com>
Cc: Juergen Gross <jgross@suse.com>, Wei Liu <wei.liu2@citrix.com>,
	George Dunlap <George.Dunlap@eu.citrix.com>,
	Andrew Cooper <andrew.cooper3@citrix.com>,
	george.dunlap@citrix.com,
	xen-devel <xen-devel@lists.xenproject.org>
Subject: Re: [PATCH for-4.12 2/8] amd/ntp: remove assert that prevents creating 2M MMIO entries
Date: Tue, 05 Feb 2019 00:45:56 -0700	[thread overview]
Message-ID: <5C593F340200007800213D19@prv1-mh.provo.novell.com> (raw)
In-Reply-To: <20190204171847.q3cymyuclraa77lm@mac>

>>> On 04.02.19 at 18:18, <roger.pau@citrix.com> wrote:
> On Mon, Feb 04, 2019 at 09:56:22AM -0700, Jan Beulich wrote:
>> >>> On 30.01.19 at 11:36, <roger.pau@citrix.com> wrote:
>> > The assert was originally added to make sure that higher order
>> > regions (> PAGE_ORDER_4K) could not be used to bypass the
>> > mmio_ro_ranges check performed by p2m_type_to_flags.
>> > 
>> > This however is already checked in set_mmio_p2m_entry, which makes
>> > sure that higher order mappings don't overlap with mmio_ro_ranges,
>> > thus allowing the creation of high order MMIO mappings safely.
>> 
>> Well, the assertions were added to make sure no other code
>> path appears that violates this requirement. Arguably e.g.
>> set_identity_p2m_entry() could gain an order parameter and
>> then try to establish larger p2m_mmio_direct entries.
>> 
>> Don't get me wrong, I don't object to the removal of the
>> assertions, but the description makes it sound as if they were
>> entirely redundant. Even better would be though if they
>> could be extended to keep triggering in "bad" cases.
> 
> I could add something like:
> 
> ASSERT(!rangeset_overlaps_range(mmio_ro_ranges, mfn_x(mfn),
>                                 mfn_x(mfn) + PFN_DOWN(MB(2))));
> 
> I think this should be safe and would trigger in case of misuse.

Looks okay, if slightly extended (or made conditional) to exclude
the addition of MB(2) to MFN_INVALID to wrap and potentially
hit a r/o range in the low 1Mb.

>> > --- a/xen/arch/x86/mm/p2m-pt.c
>> > +++ b/xen/arch/x86/mm/p2m-pt.c
>> > @@ -668,7 +668,6 @@ p2m_pt_set_entry(struct p2m_domain *p2m, gfn_t gfn_, mfn_t mfn,
>> >          }
>> >  
>> >          ASSERT(p2m_flags_to_type(flags) != p2m_ioreq_server);
>> > -        ASSERT(!mfn_valid(mfn) || p2mt != p2m_mmio_direct);
>> >          l2e_content = mfn_valid(mfn) || p2m_allows_invalid_mfn(p2mt)
>> >              ? p2m_l2e_from_pfn(mfn_x(mfn),
>> >                                 p2m_type_to_flags(p2m, p2mt, mfn, 1))
>> 
>> There's a similar check in the 1G mapping logic several lines up. Why
>> does that not also need removing?
> 
> So far mmio_order doesn't allow creation of 1G entries for mmio
> regions, that's why I haven't removed that assert. I can however
> replace it with the assert suggested above properly adjusted for 1G
> pages.

Yes, this or explicitly say in the description why you leave alone the
other one.

Jan



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

  reply	other threads:[~2019-02-05  7:46 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
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 [this message]
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=5C593F340200007800213D19@prv1-mh.provo.novell.com \
    --to=jbeulich@suse.com \
    --cc=George.Dunlap@eu.citrix.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=george.dunlap@citrix.com \
    --cc=jgross@suse.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.