xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH v4 8/9] xen/arm: Implement hypercall for dirty page tracing
@ 2013-10-08  6:29 Jaeyong Yoo
  2013-10-08  8:46 ` Ian Campbell
  0 siblings, 1 reply; 18+ messages in thread
From: Jaeyong Yoo @ 2013-10-08  6:29 UTC (permalink / raw)
  To: Julien Grall; +Cc: xen-devel@lists.xen.org

>------- Original Message -------
>Sender : Julien Grall<julien.grall@citrix.com>
>Date : 2013-10-07 22:02 (GMT+09:00)
>Title : Re: [Xen-devel] [PATCH v4 8/9] xen/arm: Implement hypercall for dirty page tracing
>
>On 10/04/2013 05:44 AM, Jaeyong Yoo wrote:
>> Add hypercall (shadow op: enable/disable and clean/peek dirted page bitmap).
>> It consists of two parts: dirty page detecting and saving.
>> For detecting, we setup the guest p2m's leaf PTE read-only and whenever
>> the guest tries to write something, permission fault happens and traps into xen.
>> The permission-faulted GPA should be saved for the toolstack (when it wants to see
>> which pages are dirted). For this purpose, we temporarily save the GPAs into linked
>> list by using 'add_mapped_vaddr' function and when toolstack wants
>> (log_dirty_op function) the GPAs are copied into bitmap and the linnked list is flushed.
>> 
>> Additionally, for supporting parallel migration of domUs, vlpt area should be context
>> switched.
>> 
>> Signed-off-by: Jaeyong Yoo 
>> ---
>
>[..]
>
>> diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c
>> index 4c0fc32..3b78ed2 100644
>> --- 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) )
>>      {
>> @@ -1327,22 +1329,23 @@ static void do_trap_data_abort_guest(struct cpu_user_regs *regs,
>>      info.gva = READ_SYSREG64(FAR_EL2);
>>  #endif
>>  
>> -    if (dabt.s1ptw)
>> +    if ( dabt.s1ptw && !page_fault )
>
>I think checking !page_fault is nearly everywhere is error-prone when
>this function will be modified.
>
>Can you do something like this?
>
>if ( page_fault )
>  // Your code to handle page fault
>else
>{
>  // handle_mmio
>}
>
>It will avoid && !page_fault.

That looks better.

>>          goto bad_data_abort;
>>  
>>      rc = gva_to_ipa(info.gva, &info.gpa);
>> -    if ( rc == -EFAULT )
>> +    if ( rc == -EFAULT && !page_fault )
>>          goto bad_data_abort;
>>  
>>      /* XXX: Decode the instruction if ISS is not valid */
>> -    if ( !dabt.valid )
>> +    if ( !dabt.valid && !page_fault )
>>          goto bad_data_abort;
>>  
>>      /*
>>       * Erratum 766422: Thumb store translation fault to Hypervisor may
>>       * not have correct HSR Rt value.
>>       */
>> -    if ( cpu_has_erratum_766422() && (regs->cpsr & PSR_THUMB) && dabt.write )
>> +    if ( cpu_has_erratum_766422() && (regs->cpsr & PSR_THUMB) && dabt.write
>> +            && !page_fault)
>>      {
>>          rc = decode_instruction(regs, &info.dabt);
>>          if ( rc )
>> @@ -1358,6 +1361,16 @@ static void do_trap_data_abort_guest(struct cpu_user_regs *regs,
>>          return;
>>      }
>>  
>> +    /* handle permission fault on write */
>> +    if ( page_fault )
>> +    {
>> +        if ( current->domain->arch.dirty.mode == 0 )
>> +           goto bad_data_abort;
>> +
>> +        handle_page_fault(current->domain, info.gpa);
>
>You must call advance_pc(regs, hsr) here.

I got it.

>
>> +        return;
>> +    }
>> +
>>  bad_data_abort:
>
>-- 
>Julien Grall

^ permalink raw reply	[flat|nested] 18+ messages in thread
* Re: [PATCH v4 8/9] xen/arm: Implement hypercall for dirty page tracing
@ 2013-10-20  4:22 Jaeyong Yoo
  0 siblings, 0 replies; 18+ messages in thread
From: Jaeyong Yoo @ 2013-10-20  4:22 UTC (permalink / raw)
  To: Ian Campbell; +Cc: 'Stefano Stabellini', xen-devel@lists.xen.org

> > > I meant the pte frobbing immediately before the call the add_mapped_vaddr
> > > quoted above.
> > > 
> > 
> > I don't think it is necessary because at the moment the dirty bitmap
> > is constructed based on the VAs in the linked list. If the PTE frobbing
> > happens
> > immediately before add_mapped_vaddr, the corresponding dirty-page would be 
> > checked at the next round get-dirty-gitmap. 
>
> OK, thanks. Can we get a code comment on the ordering constraints her
please.

Sure, of course.

Jaeyong.

^ permalink raw reply	[flat|nested] 18+ messages in thread
* [PATCH v4 0/9] xen/arm: live migration support in arndale board
@ 2013-10-04  4:43 Jaeyong Yoo
  2013-10-04  4:44 ` [PATCH v4 8/9] xen/arm: Implement hypercall for dirty page tracing Jaeyong Yoo
  0 siblings, 1 reply; 18+ messages in thread
From: Jaeyong Yoo @ 2013-10-04  4:43 UTC (permalink / raw)
  To: xen-devel; +Cc: Jaeyong Yoo

Hello xen-devel,
here goes the v4 patch series. The major changes in this version is the following:

  1) VLPT is improved. In version 3, we manually construct the xen's page table
     to establish VLPT, but in this version, by simply copying the guest p2m's
     entry into xen's page table, we can accomplish the same with smaller LOC
     and faster dirty-page detection.

  2) Enable SMP-domu live migration.

  3) Stability improved. For single-core domU live migration, we can migrate 512
     times in a row (512 is the maximum number of domain ID, as far as I know).
     For SMP-core domU live migration, we can migrate 50 ~ 300 times in a row,
     (minimum 50), and after that dom0 or domU crashes. We are trying to figure
     out the reason of faults. I hope I could get some feedbacks from community
     members about this.

And, here goes the brief description of each patch.

Patch 1 implements hvm save/restore.

Patch 2 implements vcpu save/restore by adding more required registers for live migration.

Patch 3 implements 'set_memory_map' hyerpcall for telling hypervisor about the DomU's memory map. This memory map is used for dirty-page tracing (Patch 4, 7, 8, and 9)

Patch 4 implements 'get_maximum_gpfn'

Patch 5 implements 'modify_returncode' for switching the return value of suspend hypercall from domU.

Patch 6 is an obvious fix of a clear_guest_offset macro.

Patch 7 implements base functions for VLPT.

Patch 8 implements dirty-page tracing by using VLPT.

Patch 9 implements the toolstack part for live migration of ARM.


Best,
Jaeyong


Alexey Sokolov, Elena Pyatunina, Evgeny Fedotov, and Nikolay Martyanov (1):
  xen/arm: Implement toolstack for xl restore/save and migrate

Alexey Sokolov (1):
  xen/arm: Implement modify_returncode

Evgeny Fedotov (2):
  xen/arm: Implement set_memory_map hypercall
  xen/arm: Implement get_maximum_gpfn hypercall for arm

Jaeyong Yoo and Evgeny Fedotov (1):
  xen/arm: Implement hvm save and restore

Jaeyong Yoo and Alexey Sokolov (1):
  xen/arm: Add more registers for saving and restoring vcpu  registers

Jaeyong Yoo and Elena Pyatunina (1)
  xen/arm: Implement hypercall for dirty page tracing 

Jaeyong Yoo (2):
  xen/arm: Implement virtual-linear page table for guest      p2m
    mapping in live migration
  xen/arm: Fixing clear_guest_offset macro

 config/arm32.mk                          |   1 +
 tools/include/xen-foreign/reference.size |   2 +-
 tools/libxc/Makefile                     |   5 +
 tools/libxc/xc_arm_migrate.c             | 805 +++++++++++++++++++++++++++++++
 tools/libxc/xc_dom_arm.c                 |  12 +-
 tools/libxc/xc_domain.c                  |  44 ++
 tools/libxc/xc_resume.c                  |  25 +
 tools/libxc/xenctrl.h                    |  23 +
 tools/misc/Makefile                      |   4 +
 xen/arch/arm/Makefile                    |   1 +
 xen/arch/arm/domain.c                    |  52 ++
 xen/arch/arm/domctl.c                    | 136 +++++-
 xen/arch/arm/hvm.c                       | 228 +++++++++
 xen/arch/arm/mm.c                        | 190 +++++++-
 xen/arch/arm/p2m.c                       | 300 ++++++++++++
 xen/arch/arm/save.c                      |  66 +++
 xen/arch/arm/traps.c                     |  21 +-
 xen/common/Makefile                      |   2 +
 xen/include/asm-arm/config.h             |   6 +
 xen/include/asm-arm/domain.h             |  14 +
 xen/include/asm-arm/guest_access.h       |   5 +-
 xen/include/asm-arm/hvm/support.h        |  29 ++
 xen/include/asm-arm/mm.h                 |  29 ++
 xen/include/asm-arm/p2m.h                |   4 +
 xen/include/asm-arm/processor.h          |   2 +
 xen/include/public/arch-arm.h            |  35 ++
 xen/include/public/arch-arm/hvm/save.h   |  66 +++
 xen/include/public/memory.h              |  15 +-
 xen/include/xsm/dummy.h                  |   5 +
 xen/include/xsm/xsm.h                    |   5 +
 30 files changed, 2119 insertions(+), 13 deletions(-)
 create mode 100644 tools/libxc/xc_arm_migrate.c
 create mode 100644 xen/arch/arm/save.c
 create mode 100644 xen/include/asm-arm/hvm/support.h

-- 
1.8.1.2

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2013-10-20  4:22 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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

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).