From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Manuel Bouyer <bouyer@antioche.eu.org>, <xen-devel@lists.xenproject.org>
Subject: Re: IOCTL_PRIVCMD_MMAPBATCH on Xen 4.13.0
Date: Fri, 15 May 2020 22:00:07 +0100 [thread overview]
Message-ID: <d623cd12-4024-82ba-7388-21f606e1a0bd@citrix.com> (raw)
In-Reply-To: <20200515202912.GA11714@antioche.eu.org>
On 15/05/2020 21:29, Manuel Bouyer wrote:
> Hello,
> NetBSD works as dom0 up to Xen 4.11. I'm trying to get it working
> on 4.13.0. I added the support for gntdev operations, but I'm stuck with
> privcmd IOCTL_PRIVCMD_MMAPBATCH. It seems to work fine for PV and PVH domUs,
> but with HVM domUs, MMU_NORMAL_PT_UPDATE returns -22 (EINVAL) and
> qemu-dm dumps core (as expected; the page is not mapped).
> Of course this works fine in 4.11
>
> In the Xen kernel, I tracked it down to arch/x86/mm.c near line 2229,
> in mod_l1_entry():
> /* Translate foreign guest address. */
> if ( cmd != MMU_PT_UPDATE_NO_TRANSLATE &&
> paging_mode_translate(pg_dom) )
> {
> p2m_type_t p2mt;
> p2m_query_t q = l1e_get_flags(nl1e) & _PAGE_RW ?
> P2M_ALLOC | P2M_UNSHARE : P2M_ALLOC;
>
> page = get_page_from_gfn(pg_dom, l1e_get_pfn(nl1e), &p2mt, q);
>
> if ( p2m_is_paged(p2mt) )
> {
> if ( page )
> put_page(page);
> p2m_mem_paging_populate(pg_dom, l1e_get_pfn(nl1e));
> return -ENOENT;
> }
>
> if ( p2mt == p2m_ram_paging_in && !page )
> return -ENOENT;
>
> /* Did our attempt to unshare fail? */
> if ( (q & P2M_UNSHARE) && p2m_is_shared(p2mt) )
> {
> /* We could not have obtained a page ref. */
> ASSERT(!page);
> /* And mem_sharing_notify has already been called. */
> return -ENOMEM;
> }
>
> if ( !page ) {
> gdprintk(XENLOG_WARNING, "translate but no page\n");
> return -EINVAL;
> }
> nl1e = l1e_from_page(page, l1e_get_flags(nl1e));
> }
>
> the gdprintk() I added in the ( !page) case fires, so this is the
> cause of the EINVAL.
> Is it expected for a HVM domU ? If so, how should the dom0 code be
> changed to get it working ? I failed to see where our code is different
> from linux ...
What is qemu doing at the time? Is it by any chance trying to map the
IOREQ server frame?
~Andrew
next prev parent reply other threads:[~2020-05-15 21:00 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-15 20:29 IOCTL_PRIVCMD_MMAPBATCH on Xen 4.13.0 Manuel Bouyer
2020-05-15 21:00 ` Andrew Cooper [this message]
2020-05-15 21:06 ` Manuel Bouyer
2020-05-15 21:38 ` Andrew Cooper
2020-05-15 21:53 ` Manuel Bouyer
2020-05-16 16:18 ` Andrew Cooper
2020-05-17 9:30 ` Manuel Bouyer
2020-05-17 17:32 ` Manuel Bouyer
2020-05-17 17:56 ` Manuel Bouyer
2020-05-18 7:36 ` Paul Durrant
2020-05-18 17:31 ` Manuel Bouyer
2020-05-19 7:34 ` Jan Beulich
2020-05-19 8:46 ` Manuel Bouyer
2020-05-19 8:51 ` Jan Beulich
2020-05-19 9:54 ` Roger Pau Monné
2020-05-19 10:28 ` Manuel Bouyer
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=d623cd12-4024-82ba-7388-21f606e1a0bd@citrix.com \
--to=andrew.cooper3@citrix.com \
--cc=bouyer@antioche.eu.org \
--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.