From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Roger Pau Monne <roger.pau@citrix.com>, xen-devel@lists.xenproject.org
Cc: Tim Deegan <tim@xen.org>, Jan Beulich <jbeulich@suse.com>
Subject: Re: [PATCH RFC 1/2] xen/pvh: take the p2m lock when doing logdirty ops from HVM domains
Date: Wed, 15 Oct 2014 12:31:44 +0100 [thread overview]
Message-ID: <543E5B20.1030505@citrix.com> (raw)
In-Reply-To: <1413370425-15015-2-git-send-email-roger.pau@citrix.com>
On 15/10/14 11:53, Roger Pau Monne wrote:
> Due to locking order, the p2m lock must be taken before the paging lock, or
> else the following panic occurs when trying to use logdirty ops from a PVH
> Dom0:
>
> (XEN) mm locking order violation: 292 > 222
> (XEN) Xen BUG at mm-locks.h:140
> (XEN) ----[ Xen-4.5-unstable x86_64 debug=y Not tainted ]----
> (XEN) CPU: 1
> (XEN) RIP: e008:[<ffff82d0801e9ea5>] get_page_from_gfn_p2m+0xb0/0x286
> (XEN) RFLAGS: 0000000000010282 CONTEXT: hypervisor
> (XEN) rax: 0000000000000000 rbx: ffff83019a1f7884 rcx: 0000000000000000
> (XEN) rdx: ffff83019a1f0000 rsi: 000000000000000a rdi: ffff82d0802926c0
> (XEN) rbp: ffff83019a1f77f8 rsp: ffff83019a1f7798 r8: ffff83019e830000
> (XEN) r9: 0000000000000003 r10: 00000000000000de r11: 0000000000000003
> (XEN) r12: ffff83019a1f77c4 r13: ffff83019a138820 r14: ffff83019a1f7974
> (XEN) r15: 0000000000057431 cr0: 0000000080050033 cr4: 00000000000026f0
> (XEN) cr3: 000000019ea86000 cr2: 000000080205d000
> (XEN) ds: 0000 es: 0000 fs: 0000 gs: 0000 ss: 0000 cs: e008
> [...]
> (XEN) Xen call trace:
> (XEN) [<ffff82d0801e9ea5>] get_page_from_gfn_p2m+0xb0/0x286
> (XEN) [<ffff82d0802223e9>] hap_p2m_ga_to_gfn_4_levels+0x59/0x2b7
> (XEN) [<ffff82d080222663>] hap_gva_to_gfn_4_levels+0x1c/0x29
> (XEN) [<ffff82d0801edf67>] paging_gva_to_gfn+0xb8/0xce
> (XEN) [<ffff82d0801b9bc0>] clear_user_hvm+0xd7/0x324
> (XEN) [<ffff82d0801e8776>] paging_log_dirty_op+0x358/0x552
> (XEN) [<ffff82d0801e8d47>] paging_domctl+0x140/0x177
> (XEN) [<ffff82d08015ccca>] arch_do_domctl+0x212/0x269e
> (XEN) [<ffff82d08010487c>] do_domctl+0x195d/0x1cd1
> (XEN) [<ffff82d0801bafba>] hvm_do_hypercall+0x1b8/0x31c
> (XEN) [<ffff82d0801e0d3f>] vmx_vmexit_handler+0xf91/0x1a5f
> (XEN) [<ffff82d0801e7a51>] vmx_asm_vmexit_handler+0x41/0xc0
> (XEN)
> (XEN)
> (XEN) ****************************************
> (XEN) Panic on CPU 1:
> (XEN) Xen BUG at mm-locks.h:140
> (XEN) ****************************************
> (XEN)
> (XEN) Reboot in five seconds...
>
> Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
> Cc: Tim Deegan <tim@xen.org>
> Cc: Jan Beulich <jbeulich@suse.com>
Hmm. I suspect there might be more of these issues scattered around
with the other DOMCTL/SYSCTL hypercalls, none of which have ever been
used from an HVM guest before.
> ---
> xen/arch/x86/mm/paging.c | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/xen/arch/x86/mm/paging.c b/xen/arch/x86/mm/paging.c
> index 6b788f7..5af6309 100644
> --- a/xen/arch/x86/mm/paging.c
> +++ b/xen/arch/x86/mm/paging.c
> @@ -412,6 +412,8 @@ static int paging_log_dirty_op(struct domain *d,
>
> if ( !resuming )
> domain_pause(d);
> + if (has_hvm_container_vcpu(current))
> + p2m_lock(p2m_get_hostp2m(current->domain));
It appears as if there is some indentation issue here.
Also, can you pull current into a struct vcpu *curr on the stack?
~Andrew
> paging_lock(d);
>
> if ( !d->arch.paging.preempt.dom )
> @@ -421,6 +423,8 @@ static int paging_log_dirty_op(struct domain *d,
> d->arch.paging.preempt.op != sc->op )
> {
> paging_unlock(d);
> + if (has_hvm_container_vcpu(current))
> + p2m_unlock(p2m_get_hostp2m(current->domain));
> ASSERT(!resuming);
> domain_unpause(d);
> return -EBUSY;
> @@ -533,6 +537,8 @@ static int paging_log_dirty_op(struct domain *d,
> }
>
> paging_unlock(d);
> + if (has_hvm_container_vcpu(current))
> + p2m_unlock(p2m_get_hostp2m(current->domain));
>
> if ( rv )
> {
> @@ -555,6 +561,8 @@ static int paging_log_dirty_op(struct domain *d,
> out:
> d->arch.paging.preempt.dom = NULL;
> paging_unlock(d);
> + if (has_hvm_container_vcpu(current))
> + p2m_unlock(p2m_get_hostp2m(current->domain));
> domain_unpause(d);
>
> if ( l1 )
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
next prev parent reply other threads:[~2014-10-15 11:31 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-15 10:53 [PATCH RFC 0/2] xen/pvh: enable migration on PVH Dom0 Roger Pau Monne
2014-10-15 10:53 ` [PATCH RFC 1/2] xen/pvh: take the p2m lock when doing logdirty ops from HVM domains Roger Pau Monne
2014-10-15 11:31 ` Andrew Cooper [this message]
2014-10-15 11:52 ` Roger Pau Monné
2014-10-15 11:55 ` Andrew Cooper
2014-10-15 11:58 ` Roger Pau Monné
2014-10-16 8:21 ` Jan Beulich
2014-10-16 9:20 ` Tim Deegan
2014-10-16 10:03 ` Roger Pau Monné
2014-11-13 15:46 ` Tim Deegan
2014-11-13 16:17 ` Jan Beulich
2014-10-16 14:15 ` Jan Beulich
2014-10-16 15:05 ` Tim Deegan
2014-10-15 10:53 ` [PATCH RFC 2/2] xen/pvh: enable mmu_update hypercall Roger Pau Monne
2014-10-16 7:53 ` Tim Deegan
2014-10-16 8:45 ` Jan Beulich
2014-10-16 11:30 ` Roger Pau Monné
2014-10-16 13:28 ` 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=543E5B20.1030505@citrix.com \
--to=andrew.cooper3@citrix.com \
--cc=jbeulich@suse.com \
--cc=roger.pau@citrix.com \
--cc=tim@xen.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.