From: Eugene Fedotov <e.fedotov@samsung.com>
To: xen-devel@lists.xen.org
Subject: Re: [PATCH v4 8/9] xen/arm: Implement hypercall for dirty page tracing
Date: Tue, 08 Oct 2013 19:36:42 +0400 [thread overview]
Message-ID: <5254268A.4010403@samsung.com> (raw)
In-Reply-To: <007301cec40b$4a9fbcf0$dfdf36d0$%yoo@samsung.com>
If we move necessary checking into handle_page_fault routine, so the
resulting patch for traps.c will look more simple:
--- a/xen/arch/arm/traps.c
+++ b/xen/arch/arm/traps.c
@@ -1313,6 +1313,8 @@ static void do_trap_data_abort_guest(struct
cpu_user_regs *regs,
const char *msg;
int rc, level = -1;
mmio_info_t info;
+ int page_fault = ( (dabt.dfsc & FSC_MASK) ==
+ (FSC_FLT_PERM | FSC_3D_LEVEL) && dabt.write );
if ( !check_conditional_instr(regs, hsr) )
{
@@ -1334,6 +1336,13 @@ static void do_trap_data_abort_guest(struct
cpu_user_regs *regs,
if ( rc == -EFAULT )
goto bad_data_abort;
+ /* domU page fault handling for guest live migration */
+ /* dabt.valid can be 0 here */
+ if ( page_fault && handle_page_fault(current->domain, info.gpa) )
+ {
+ /* Do not modify pc after page fault to repeat memory operation */
+ return;
+ }
/* XXX: Decode the instruction if ISS is not valid */
if ( !dabt.valid )
goto bad_data_abort;
Will it be acceptable, or you think "else" statement looks more better?
Where handle_page_fault returns zero if dirty page tracing is not
enabled for domain (dirty.mode==0) or address is not valid for domain
(having memory map we check it), so MMIO and faults from dom0 are not
handled by handle_page_fault.
The handle_page_fault routine (see [PATCH v4 7/9] xen/arm: Implement
virtual-linear page table for guest p2m mapping in live migration) will be:
int handle_page_fault(struct domain *d, paddr_t addr)
{
lpae_t *vlp2m_pte = 0;
vaddr_t start, end;
if (!d->arch.dirty.mode) return 0;
/* Ensure that addr is inside guest's RAM */
get_gma_start_end(d, &start, &end);
if ( addr < start || addr > end ) return 0;
vlp2m_pte = get_vlpt_3lvl_pte(addr);
if ( vlp2m_pte->p2m.valid && vlp2m_pte->p2m.write == 0 )
{
lpae_t pte = *vlp2m_pte;
pte.p2m.write = 1;
write_pte(vlp2m_pte, pte);
flush_tlb_local();
/* in order to remove mappings in cleanup stage */
add_mapped_vaddr(d, addr);
}
return 1;
}
Best,
Evgeny.
next prev parent reply other threads:[~2013-10-08 15:36 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-08 6:29 [PATCH v4 8/9] xen/arm: Implement hypercall for dirty page tracing Jaeyong Yoo
2013-10-08 8:46 ` Ian Campbell
2013-10-08 9:46 ` Jaeyong Yoo
2013-10-08 15:36 ` Eugene Fedotov [this message]
2013-10-10 14:13 ` Julien Grall
2013-10-16 13:44 ` Ian Campbell
-- strict thread matches above, loose matches on Subject: below --
2013-10-20 4:22 Jaeyong Yoo
2013-10-04 4:43 [PATCH v4 0/9] xen/arm: live migration support in arndale board Jaeyong Yoo
2013-10-04 4:44 ` [PATCH v4 8/9] xen/arm: Implement hypercall for dirty page tracing Jaeyong Yoo
2013-10-07 13:02 ` Julien Grall
2013-10-07 15:51 ` Eugene Fedotov
2013-10-10 14:10 ` Julien Grall
2013-10-16 13:44 ` Ian Campbell
2013-10-17 10:12 ` Jaeyong Yoo
2013-10-17 10:30 ` Ian Campbell
2013-10-17 11:05 ` Jaeyong Yoo
2013-10-17 11:47 ` Ian Campbell
2013-10-18 4:17 ` Jaeyong Yoo
2013-10-18 9:11 ` Ian Campbell
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=5254268A.4010403@samsung.com \
--to=e.fedotov@samsung.com \
--cc=xen-devel@lists.xen.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.