From: "Roger Pau Monné" <roger.pau@citrix.com>
To: Roman Shaposhnik <roman@zededa.com>
Cc: "jgross@suse.com" <jgross@suse.com>,
Andrew Cooper <andrew.cooper3@citrix.com>,
Paul Durrant <Paul.Durrant@citrix.com>,
"jbeulich@suse.com" <jbeulich@suse.com>,
"xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>,
"boris.ostrovsky@oracle.com" <boris.ostrovsky@oracle.com>
Subject: Re: [Xen-devel] [BUG] After upgrade to Xen 4.12.0 iommu=no-igfx
Date: Tue, 30 Jul 2019 11:21:22 +0200 [thread overview]
Message-ID: <20190730092122.dbpfzu7jsznpyksd@Air-de-Roger> (raw)
In-Reply-To: <20190726093545.zwmbt27c24skd3iz@Air-de-Roger>
Ping?
It would be very helpful for us in order to get this sorted out if you
could answer the questions below and try the new debug patch :).
On Fri, Jul 26, 2019 at 11:35:45AM +0200, Roger Pau Monné wrote:
> On Thu, Jul 25, 2019 at 05:47:19PM -0700, Roman Shaposhnik wrote:
> > Hi Roger!
> >
> > With your patch (and build as a debug build) Xen crashes on boot
> > (which I guess was the point of your BUG_ON statement).
>
> Yes, that's very weird, seems like entries are not added to the iommu
> page tables but I have no idea why, AFAICT this works fine on my
> system.
>
> Do you have any patches on top of RELEASE-4.12.0?
>
> I have another patch with more verbose output, could you give it a
> try? It's maybe going to be more chatty than the previous one.
>
> I'm sorry to keep you testing stuff, but since I cannot reproduce this
> locally I have to rely on you to provide the debug output.
>
> Thanks, Roger.
> ---8<---
> diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c
> index b9bbb8f485..75f8359a99 100644
> --- a/xen/arch/x86/mm/p2m.c
> +++ b/xen/arch/x86/mm/p2m.c
> @@ -1331,7 +1331,7 @@ int set_identity_p2m_entry(struct domain *d, unsigned long gfn_l,
>
> if ( !paging_mode_translate(p2m->domain) )
> {
> - if ( !need_iommu_pt_sync(d) )
> + if ( !has_iommu_pt(d) )
> return 0;
> return iommu_legacy_map(d, _dfn(gfn_l), _mfn(gfn_l), PAGE_ORDER_4K,
> IOMMUF_readable | IOMMUF_writable);
> @@ -1422,7 +1422,7 @@ int clear_identity_p2m_entry(struct domain *d, unsigned long gfn_l)
>
> if ( !paging_mode_translate(d) )
> {
> - if ( !need_iommu_pt_sync(d) )
> + if ( !has_iommu_pt(d) )
> return 0;
> return iommu_legacy_unmap(d, _dfn(gfn_l), PAGE_ORDER_4K);
> }
> diff --git a/xen/drivers/passthrough/iommu.c b/xen/drivers/passthrough/iommu.c
> index 117b869b0c..214c5d515f 100644
> --- a/xen/drivers/passthrough/iommu.c
> +++ b/xen/drivers/passthrough/iommu.c
> @@ -291,8 +291,18 @@ int iommu_map(struct domain *d, dfn_t dfn, mfn_t mfn,
> unsigned long i;
> int rc = 0;
>
> +if (dfn_x(dfn) >= 0x8d800 && dfn_x(dfn) < 0x90000 )
> +{
> + printk("<RMRR> iommu_map %#lx\n", dfn_x(dfn));
> + process_pending_softirqs();
> +}
> +
> if ( !iommu_enabled || !hd->platform_ops )
> +{
> + printk("iommu_enabled: %d platform_ops %p\n",
> + iommu_enabled, hd->platform_ops);
> return 0;
> +}
>
> ASSERT(IS_ALIGNED(dfn_x(dfn), (1ul << page_order)));
> ASSERT(IS_ALIGNED(mfn_x(mfn), (1ul << page_order)));
> diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
> index 50a0e25224..8c3fcb50ae 100644
> --- a/xen/drivers/passthrough/vtd/iommu.c
> +++ b/xen/drivers/passthrough/vtd/iommu.c
> @@ -2009,12 +2009,33 @@ static int rmrr_identity_mapping(struct domain *d, bool_t map,
> if ( !map )
> return -ENOENT;
>
> +printk("<RMRR> mapping %#lx - %#lx\n", base_pfn, end_pfn);
> while ( base_pfn < end_pfn )
> {
> int err = set_identity_p2m_entry(d, base_pfn, p2m_access_rw, flag);
> + mfn_t mfn;
> + unsigned int f;
>
> if ( err )
> return err;
> +
> +err = intel_iommu_lookup_page(d, _dfn(base_pfn), &mfn, &f);
> +if ( err )
> +{
> + printk("intel_iommu_lookup_page err: %d\n", err);
> + BUG();
> +}
> +if ( base_pfn != mfn_x(mfn) )
> +{
> + printk("base_pfn: %#lx mfn: %#lx\n", base_pfn, mfn_x(mfn));
> + BUG();
> +}
> +if ( f != (IOMMUF_readable | IOMMUF_writable) )
> +{
> + printk("flags: %#x\n", f);
> + BUG();
> +}
> +
> base_pfn++;
> }
>
> @@ -2263,6 +2284,7 @@ static void __hwdom_init setup_hwdom_rmrr(struct domain *d)
> u16 bdf;
> int ret, i;
>
> +printk("<RMRR> setting up regions\n");
> pcidevs_lock();
> for_each_rmrr_device ( rmrr, bdf, i )
> {
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xenproject.org
> https://lists.xenproject.org/mailman/listinfo/xen-devel
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
next prev parent reply other threads:[~2019-07-30 9:21 UTC|newest]
Thread overview: 65+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-19 19:31 [Xen-devel] [BUG] After upgrade to Xen 4.12.0 iommu=no-igfx Roman Shaposhnik
2019-07-19 20:02 ` Roman Shaposhnik
2019-07-22 8:20 ` Paul Durrant
2019-07-22 11:48 ` Roger Pau Monné
2019-07-22 11:54 ` Paul Durrant
2019-07-22 13:48 ` Roger Pau Monné
2019-07-22 14:03 ` Paul Durrant
2019-07-22 14:39 ` Roger Pau Monné
2019-07-22 15:02 ` Paul Durrant
2019-07-22 15:21 ` Roger Pau Monné
2019-07-22 23:36 ` Roman Shaposhnik
2019-07-22 23:47 ` Andrew Cooper
2019-07-23 17:32 ` Roman Shaposhnik
2019-07-23 17:35 ` Andrew Cooper
2019-07-23 17:48 ` Roman Shaposhnik
2019-07-23 17:50 ` Andrew Cooper
2019-07-23 17:58 ` Roman Shaposhnik
2019-07-23 18:12 ` Andrew Cooper
2019-07-23 18:25 ` Roman Shaposhnik
2019-07-26 7:58 ` Jan Beulich
2019-07-30 17:56 ` Roman Shaposhnik
2019-07-31 8:34 ` Jan Beulich
2019-07-31 8:58 ` Andrew Cooper
2019-07-31 9:30 ` Jan Beulich
2019-07-31 19:37 ` Roman Shaposhnik
2019-07-24 12:00 ` Jan Beulich
2019-07-24 12:04 ` Jan Beulich
2019-07-24 11:23 ` Andrew Cooper
2019-07-24 11:40 ` Andrew Cooper
2019-07-24 14:11 ` Roger Pau Monné
2019-07-26 0:47 ` Roman Shaposhnik
2019-07-26 9:35 ` Roger Pau Monné
2019-07-30 9:21 ` Roger Pau Monné [this message]
2019-07-30 17:55 ` Roman Shaposhnik
2019-07-31 8:31 ` Jan Beulich
2019-07-31 8:36 ` Roger Pau Monné
2019-07-31 8:43 ` Roger Pau Monné
2019-07-31 19:35 ` Roman Shaposhnik
2019-07-31 19:46 ` Andrew Cooper
2019-07-31 21:03 ` Roman Shaposhnik
2019-08-01 8:15 ` Roger Pau Monné
2019-08-01 18:25 ` Roman Shaposhnik
2019-08-02 8:05 ` Roger Pau Monné
2019-08-06 16:17 ` Roger Pau Monné
2019-08-06 21:48 ` Roman Shaposhnik
2019-08-07 7:08 ` Jan Beulich
2019-08-07 9:57 ` Roger Pau Monné
2019-08-07 10:03 ` Jan Beulich
2019-08-07 7:35 ` Roger Pau Monné
2019-08-07 8:31 ` Jan Beulich
2019-08-07 10:17 ` Roger Pau Monné
2019-08-12 8:57 ` Roger Pau Monné
2019-08-13 19:24 ` Roman Shaposhnik
2019-08-14 8:06 ` Roger Pau Monné
2019-08-19 5:00 ` Roman Shaposhnik
2019-08-19 8:16 ` Roger Pau Monné
2019-08-20 2:03 ` Roman Shaposhnik
2019-08-01 7:35 ` Jan Beulich
2019-07-31 19:30 ` Roman Shaposhnik
2019-08-01 8:45 ` Roger Pau Monné
2019-08-01 18:19 ` Roman Shaposhnik
2019-07-20 16:39 ` Andrew Cooper
2019-07-22 8:03 ` Paul Durrant
2019-07-24 17:42 ` Rich Persaud
2019-07-26 1:13 ` Roman Shaposhnik
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=20190730092122.dbpfzu7jsznpyksd@Air-de-Roger \
--to=roger.pau@citrix.com \
--cc=Paul.Durrant@citrix.com \
--cc=andrew.cooper3@citrix.com \
--cc=boris.ostrovsky@oracle.com \
--cc=jbeulich@suse.com \
--cc=jgross@suse.com \
--cc=roman@zededa.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).