* Re: [Qemu-devel] [PATCH 12/18] Insert event_tap_mmio() to cpu_physical_memory_rw() in exec.c.
@ 2011-04-26 14:24 "大村 圭"
2011-04-26 14:51 ` Jan Kiszka
0 siblings, 1 reply; 12+ messages in thread
From: "大村 圭" @ 2011-04-26 14:24 UTC (permalink / raw)
To: "Jan Kiszka", "OHMURA Kei"
Cc: kwolf, aliguori, dlaor, ananth, kvm, mst, mtosatti, qemu-devel,
"Yoshiaki Tamura", vatsa, blauwirbel, quintela,
tamura.yoshiaki, avi, pbonzini, psuriset, stefanha
2011/4/25 Jan Kiszka <jan.kiszka@web.de>:
> On 2011-04-25 13:00, OHMURA Kei wrote:
>> From: Yoshiaki Tamura <tamura.yoshiaki@lab.ntt.co.jp>
>>
>> Record mmio write event to replay it upon failover.
>>
>> Signed-off-by: Yoshiaki Tamura <tamura.yoshiaki@lab.ntt.co.jp>
>> Signed-off-by: OHMURA Kei <ohmura.kei@lab.ntt.co.jp>
>> ---
>> exec.c | 4 ++++
>> 1 files changed, 4 insertions(+), 0 deletions(-)
>>
>> diff --git a/exec.c b/exec.c
>> index c3dc68a..3c3cece 100644
>> --- a/exec.c
>> +++ b/exec.c
>> @@ -33,6 +33,7 @@
>> #include "osdep.h"
>> #include "kvm.h"
>> #include "qemu-timer.h"
>> +#include "event-tap.h"
>> #if defined(CONFIG_USER_ONLY)
>> #include <qemu.h>
>> #include <signal.h>
>> @@ -3736,6 +3737,9 @@ void cpu_physical_memory_rw(target_phys_addr_t addr, uint8_t *buf,
>> io_index = (pd >> IO_MEM_SHIFT) & (IO_MEM_NB_ENTRIES - 1);
>> if (p)
>> addr1 = (addr & ~TARGET_PAGE_MASK) + p->region_offset;
>> +
>> + event_tap_mmio(addr, buf, len);
>> +
>
> You know that this is incomplete? A few devices are calling st*_phys
> directly, specifically virtio.
>
> What kind of mmio should be traced here, device or CPU originated? Or both?
>
> Jan
>
>
To let Kemari replay outputs upon failover, tracing CPU originated
mmio (specifically write requests) should be enough.
IIUC, we can reproduce device originated mmio as a result of cpu
originated mmio.
Thanks,
Kei
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [Qemu-devel] [PATCH 12/18] Insert event_tap_mmio() to cpu_physical_memory_rw() in exec.c.
2011-04-26 14:24 [Qemu-devel] [PATCH 12/18] Insert event_tap_mmio() to cpu_physical_memory_rw() in exec.c "大村 圭"
@ 2011-04-26 14:51 ` Jan Kiszka
2011-04-27 5:51 ` Takuya Yoshikawa
2011-04-27 14:19 ` Yoshiaki Tamura
0 siblings, 2 replies; 12+ messages in thread
From: Jan Kiszka @ 2011-04-26 14:51 UTC (permalink / raw)
To: 大村 圭
Cc: kwolf, aliguori, dlaor, ananth, kvm, mst, mtosatti, qemu-devel,
Yoshiaki Tamura, vatsa, blauwirbel, quintela, tamura.yoshiaki,
avi, pbonzini, psuriset, stefanha
On 2011-04-26 16:24, "大村 圭" wrote:
>
> 2011/4/25 Jan Kiszka <jan.kiszka@web.de>:
>> On 2011-04-25 13:00, OHMURA Kei wrote:
>>> From: Yoshiaki Tamura <tamura.yoshiaki@lab.ntt.co.jp>
>>>
>>> Record mmio write event to replay it upon failover.
>>>
>>> Signed-off-by: Yoshiaki Tamura <tamura.yoshiaki@lab.ntt.co.jp>
>>> Signed-off-by: OHMURA Kei <ohmura.kei@lab.ntt.co.jp>
>>> ---
>>> exec.c | 4 ++++
>>> 1 files changed, 4 insertions(+), 0 deletions(-)
>>>
>>> diff --git a/exec.c b/exec.c
>>> index c3dc68a..3c3cece 100644
>>> --- a/exec.c
>>> +++ b/exec.c
>>> @@ -33,6 +33,7 @@
>>> #include "osdep.h"
>>> #include "kvm.h"
>>> #include "qemu-timer.h"
>>> +#include "event-tap.h"
>>> #if defined(CONFIG_USER_ONLY)
>>> #include <qemu.h>
>>> #include <signal.h>
>>> @@ -3736,6 +3737,9 @@ void cpu_physical_memory_rw(target_phys_addr_t addr, uint8_t *buf,
>>> io_index = (pd >> IO_MEM_SHIFT) & (IO_MEM_NB_ENTRIES - 1);
>>> if (p)
>>> addr1 = (addr & ~TARGET_PAGE_MASK) + p->region_offset;
>>> +
>>> + event_tap_mmio(addr, buf, len);
>>> +
>>
>> You know that this is incomplete? A few devices are calling st*_phys
>> directly, specifically virtio.
>>
>> What kind of mmio should be traced here, device or CPU originated? Or both?
>>
>> Jan
>>
>>
>
> To let Kemari replay outputs upon failover, tracing CPU originated
> mmio (specifically write requests) should be enough.
> IIUC, we can reproduce device originated mmio as a result of cpu
> originated mmio.
>
OK, I see.
But this tap will only work for KVM. I think you either have to catch
the other paths that TCG could take as well or maybe better move the
hook into kvm-all - then it's absolutely clear that this is no generic
feature.
Jan
--
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [Qemu-devel] [PATCH 12/18] Insert event_tap_mmio() to cpu_physical_memory_rw() in exec.c.
2011-04-26 14:51 ` Jan Kiszka
@ 2011-04-27 5:51 ` Takuya Yoshikawa
2011-04-27 14:19 ` Yoshiaki Tamura
2011-04-27 14:19 ` Yoshiaki Tamura
1 sibling, 1 reply; 12+ messages in thread
From: Takuya Yoshikawa @ 2011-04-27 5:51 UTC (permalink / raw)
To: Jan Kiszka
Cc: kwolf, 大村 圭, dlaor, ananth, kvm, mst,
mtosatti, aliguori, Yoshiaki Tamura, qemu-devel, blauwirbel,
quintela, tamura.yoshiaki, avi, vatsa, pbonzini, psuriset,
stefanha
> >> What kind of mmio should be traced here, device or CPU originated? Or both?
> >>
> >> Jan
> >>
> >>
> >
> > To let Kemari replay outputs upon failover, tracing CPU originated
> > mmio (specifically write requests) should be enough.
> > IIUC, we can reproduce device originated mmio as a result of cpu
> > originated mmio.
> >
Sorry, but I don't understand why it is safe yet.
The problem is not if the mmio's are to be replayed but if replaying
them will produce the same result, is it?
In other words, is it really idempotent?
Takuya
>
> OK, I see.
>
> But this tap will only work for KVM. I think you either have to catch
> the other paths that TCG could take as well or maybe better move the
> hook into kvm-all - then it's absolutely clear that this is no generic
> feature.
>
> Jan
>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [Qemu-devel] [PATCH 12/18] Insert event_tap_mmio() to cpu_physical_memory_rw() in exec.c.
2011-04-27 5:51 ` Takuya Yoshikawa
@ 2011-04-27 14:19 ` Yoshiaki Tamura
0 siblings, 0 replies; 12+ messages in thread
From: Yoshiaki Tamura @ 2011-04-27 14:19 UTC (permalink / raw)
To: Takuya Yoshikawa
Cc: kwolf@redhat.com, 大村 圭, dlaor@redhat.com,
ananth@in.ibm.com, kvm@vger.kernel.org, mst@redhat.com,
Jan Kiszka, mtosatti@redhat.com, qemu-devel@nongnu.org,
Yoshiaki Tamura, aliguori@us.ibm.com, blauwirbel@gmail.com,
quintela@redhat.com, avi@redhat.com, vatsa@linux.vnet.ibm.com,
pbonzini@redhat.com, psuriset@linux.vnet.ibm.com,
stefanha@linux.vnet.ibm.com
On Apr 27, 2011, at 2:51 PM, Takuya Yoshikawa <yoshikawa.takuya@oss.ntt.co.jp> wrote:
>
>>>> What kind of mmio should be traced here, device or CPU originated? Or both?
>>>>
>>>> Jan
>>>>
>>>>
>>>
>>> To let Kemari replay outputs upon failover, tracing CPU originated
>>> mmio (specifically write requests) should be enough.
>>> IIUC, we can reproduce device originated mmio as a result of cpu
>>> originated mmio.
>>>
>
> Sorry, but I don't understand why it is safe yet.
>
> The problem is not if the mmio's are to be replayed but if replaying
> them will produce the same result, is it?
No. That's the functionality of event-tap queuing.
The mmio tap is for recording which CPU originated mmio resulted in I/O monitored at event-tap queuing.
We expect the replayed result to be same as the primary, but we don't have to guarantee while it's queued.
Thanks,
Yoshi
>
> In other words, is it really idempotent?
>
> Takuya
>
>>
>> OK, I see.
>>
>> But this tap will only work for KVM. I think you either have to catch
>> the other paths that TCG could take as well or maybe better move the
>> hook into kvm-all - then it's absolutely clear that this is no generic
>> feature.
>>
>> Jan
>>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [Qemu-devel] [PATCH 12/18] Insert event_tap_mmio() to cpu_physical_memory_rw() in exec.c.
2011-04-26 14:51 ` Jan Kiszka
2011-04-27 5:51 ` Takuya Yoshikawa
@ 2011-04-27 14:19 ` Yoshiaki Tamura
2011-04-27 15:00 ` Jan Kiszka
1 sibling, 1 reply; 12+ messages in thread
From: Yoshiaki Tamura @ 2011-04-27 14:19 UTC (permalink / raw)
To: Jan Kiszka
Cc: kwolf@redhat.com, 大村 圭, dlaor@redhat.com,
ananth@in.ibm.com, kvm@vger.kernel.org, mst@redhat.com,
mtosatti@redhat.com, aliguori@us.ibm.com, Yoshiaki Tamura,
qemu-devel@nongnu.org, blauwirbel@gmail.com, quintela@redhat.com,
avi@redhat.com, vatsa@linux.vnet.ibm.com, pbonzini@redhat.com,
psuriset@linux.vnet.ibm.com, stefanha@linux.vnet.ibm.com
On Apr 26, 2011, at 11:51 PM, Jan Kiszka <jan.kiszka@siemens.com> wrote:
> On 2011-04-26 16:24, "大村 圭" wrote:
>>
>> 2011/4/25 Jan Kiszka <jan.kiszka@web.de>:
>>> On 2011-04-25 13:00, OHMURA Kei wrote:
>>>> From: Yoshiaki Tamura <tamura.yoshiaki@lab.ntt.co.jp>
>>>>
>>>> Record mmio write event to replay it upon failover.
>>>>
>>>> Signed-off-by: Yoshiaki Tamura <tamura.yoshiaki@lab.ntt.co.jp>
>>>> Signed-off-by: OHMURA Kei <ohmura.kei@lab.ntt.co.jp>
>>>> ---
>>>> exec.c | 4 ++++
>>>> 1 files changed, 4 insertions(+), 0 deletions(-)
>>>>
>>>> diff --git a/exec.c b/exec.c
>>>> index c3dc68a..3c3cece 100644
>>>> --- a/exec.c
>>>> +++ b/exec.c
>>>> @@ -33,6 +33,7 @@
>>>> #include "osdep.h"
>>>> #include "kvm.h"
>>>> #include "qemu-timer.h"
>>>> +#include "event-tap.h"
>>>> #if defined(CONFIG_USER_ONLY)
>>>> #include <qemu.h>
>>>> #include <signal.h>
>>>> @@ -3736,6 +3737,9 @@ void cpu_physical_memory_rw(target_phys_addr_t addr, uint8_t *buf,
>>>> io_index = (pd >> IO_MEM_SHIFT) & (IO_MEM_NB_ENTRIES - 1);
>>>> if (p)
>>>> addr1 = (addr & ~TARGET_PAGE_MASK) + p->region_offset;
>>>> +
>>>> + event_tap_mmio(addr, buf, len);
>>>> +
>>>
>>> You know that this is incomplete? A few devices are calling st*_phys
>>> directly, specifically virtio.
>>>
>>> What kind of mmio should be traced here, device or CPU originated? Or both?
>>>
>>> Jan
>>>
>>>
>>
>> To let Kemari replay outputs upon failover, tracing CPU originated
>> mmio (specifically write requests) should be enough.
>> IIUC, we can reproduce device originated mmio as a result of cpu
>> originated mmio.
>>
>
> OK, I see.
>
> But this tap will only work for KVM. I think you either have to catch
> the other paths that TCG could take as well or maybe better move the
> hook into kvm-all - then it's absolutely clear that this is no generic
> feature.
Hi Jan,
Indeed Kemari is for KVM, so moving to kvm-all.c seems to be reasonable. However, I would like to have this feature general rather than locking up only in KVM.
Could you describe the difference between KVM and TCG in processing mmio, so that we can see the issue?
Yoshi
>
> Jan
>
> --
> Siemens AG, Corporate Technology, CT T DE IT 1
> Corporate Competence Center Embedded Linux
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [Qemu-devel] [PATCH 12/18] Insert event_tap_mmio() to cpu_physical_memory_rw() in exec.c.
2011-04-27 14:19 ` Yoshiaki Tamura
@ 2011-04-27 15:00 ` Jan Kiszka
0 siblings, 0 replies; 12+ messages in thread
From: Jan Kiszka @ 2011-04-27 15:00 UTC (permalink / raw)
To: Yoshiaki Tamura
Cc: kwolf@redhat.com, 大村 圭, dlaor@redhat.com,
ananth@in.ibm.com, kvm@vger.kernel.org, mst@redhat.com,
mtosatti@redhat.com, aliguori@us.ibm.com, Yoshiaki Tamura,
qemu-devel@nongnu.org, blauwirbel@gmail.com, quintela@redhat.com,
avi@redhat.com, vatsa@linux.vnet.ibm.com, pbonzini@redhat.com,
psuriset@linux.vnet.ibm.com, stefanha@linux.vnet.ibm.com
On 2011-04-27 16:19, Yoshiaki Tamura wrote:
> Hi Jan,
>
> Indeed Kemari is for KVM, so moving to kvm-all.c seems to be reasonable. However, I would like to have this feature general rather than locking up only in KVM.
>
> Could you describe the difference between KVM and TCG in processing mmio, so that we can see the issue?
Additional entry points are ld/st*_phys helpers in exec.c and the magic
that softmmu_template.h is generating.
Jan
--
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Qemu-devel] [PATCH 00/18] Kemari for KVM v0.2.14
@ 2011-04-25 11:00 OHMURA Kei
2011-04-25 11:00 ` [Qemu-devel] [PATCH 12/18] Insert event_tap_mmio() to cpu_physical_memory_rw() in exec.c OHMURA Kei
0 siblings, 1 reply; 12+ messages in thread
From: OHMURA Kei @ 2011-04-25 11:00 UTC (permalink / raw)
To: qemu-devel, kvm
Cc: kwolf, aliguori, mtosatti, ohmura.kei, ananth, mst, dlaor, vatsa,
blauwirbel, quintela, tamura.yoshiaki, avi, pbonzini, psuriset,
stefanha
Hi,
This patch series is a revised version of Kemari for KVM. The current
code is based on qemu.git ec444452b8753a372de30b22d9b4765a799db612.
The changes from v0.2.13 -> v0.2.14 are:
- rebased to latest.
- correct patch[07], [09] author.
The changes from v0.2.12 -> v0.2.13 are:
- replaced qemu_get_timer() with qemu_get_timer_ns()
- check check s->file before calling qemu_ft_trans_cancel()
- avoid virtio-net assert upon calling event_tap_unregister()
The changes from v0.2.11 -> v0.2.12 are:
- fix vm_state_notify() to use QLIST_FOREACH_SAFE (Juan)
- introduce qemu_loadvm_state_no_header() and refactored
qemu_loadvm_state() to call it after checking headers (Juan)
The changes from v0.2.10 -> v0.2.11 are:
- rebased to 0.14
- upon unregistering event-tap, set event_tap_state after event_tap_flush
- modify commit log of 02/18 that it won't make existing migration
bi-directional.
The changes from v0.2.9 -> v0.2.10 are:
- change migrate format to kemari:<protocol>:<host>:<port> (Paolo)
The changes from v0.2.8 -> v0.2.9 are:
- abstract common code between qemu_savevm_{state,trans}_* (Paolo)
- change incoming format to kemari:<protocol>:<host>:<port> (Paolo)
The changes from v0.2.7 -> v0.2.8 are:
- fixed calling wrong cb in event-tap
- add missing qemu_aio_release in event-tap
The changes from v0.2.6 -> v0.2.7 are:
- add AIOCB, AIOPool and cancel functions (Kevin)
- insert event-tap for bdrv_flush (Kevin)
- add error handing when calling bdrv functions (Kevin)
- fix usage of qemu_aio_flush and bdrv_flush (Kevin)
- use bs in AIOCB on the primary (Kevin)
- reorder event-tap functions to gather with block/net (Kevin)
- fix checking bs->device_name (Kevin)
The changes from v0.2.5 -> v0.2.6 are:
- use qemu_{put,get}_be32() to save/load niov in event-tap
The changes from v0.2.4 -> v0.2.5 are:
- fixed braces and trailing spaces by using Blue's checkpatch.pl (Blue)
- event-tap: don't try to send blk_req if it's a bdrv_aio_flush event
The changes from v0.2.3 -> v0.2.4 are:
- call vm_start() before event_tap_flush_one() to avoid failure in
virtio-net assertion
- add vm_change_state_handler to turn off ft_mode
- use qemu_iovec functions in event-tap
- remove duplicated code in migration
- remove unnecessary new line for error_report in ft_trans_file
The changes from v0.2.2 -> v0.2.3 are:
- queue async net requests without copying (MST)
-- if not async, contents of the packets are sent to the secondary
- better description for option -k (MST)
- fix memory transfer failure
- fix ft transaction initiation failure
The changes from v0.2.1 -> v0.2.2 are:
- decrement last_avaid_idx with inuse before saving (MST)
- remove qemu_aio_flush() and bdrv_flush_all() in migrate_ft_trans_commit()
The changes from v0.2 -> v0.2.1 are:
- Move event-tap to net/block layer and use stubs (Blue, Paul, MST, Kevin)
- Tap bdrv_aio_flush (Marcelo)
- Remove multiwrite interface in event-tap (Stefan)
- Fix event-tap to use pio/mmio to replay both net/block (Stefan)
- Improve error handling in event-tap (Stefan)
- Fix leak in event-tap (Stefan)
- Revise virtio last_avail_idx manipulation (MST)
- Clean up migration.c hook (Marcelo)
- Make deleting change state handler robust (Isaku, Anthony)
The changes from v0.1.1 -> v0.2 are:
- Introduce a queue in event-tap to make VM sync live.
- Change transaction receiver to a state machine for async receiving.
- Replace net/block layer functions with event-tap proxy functions.
- Remove dirty bitmap optimization for now.
- convert DPRINTF() in ft_trans_file to trace functions.
- convert fprintf() in ft_trans_file to error_report().
- improved error handling in ft_trans_file.
- add a tmp pointer to qemu_del_vm_change_state_handler.
The changes from v0.1 -> v0.1.1 are:
- events are tapped in net/block layer instead of device emulation layer.
- Introduce a new option for -incoming to accept FT transaction.
- Removed writev() support to QEMUFile and FdMigrationState for now.
I would post this work in a different series.
- Modified virtio-blk save/load handler to send inuse variable to
correctly replay.
- Removed configure --enable-ft-mode.
- Removed unnecessary check for qemu_realloc().
The first 6 patches modify several functions of qemu to prepare
introducing Kemari specific components.
The next 6 patches are the components of Kemari. They introduce
event-tap and the FT transaction protocol file based on buffered file.
The design document of FT transaction protocol can be found at,
http://wiki.qemu.org/images/b/b1/Kemari_sender_receiver_0.5a.pdf
Then the following 2 patches modifies net/block layer functions with
event-tap functions. Please note that if Kemari is off, event-tap
will just passthrough, and there is most no intrusion to exisiting
functions including normal live migration.
Finally, the migration layer are modified to support Kemari in the
last 4 patches. Again, there shouldn't be any affection if a user
doesn't specify Kemari specific options. The transaction is now async
on both sender and receiver side. The sender side respects the
max_downtime to decide when to switch from async to sync mode.
The repository contains all patches I'm sending with this message.
For those who want to try, please pull the following repository. It
also includes dirty bitmap optimization which aren't ready for posting
yet. To remove the dirty bitmap optimization, please look at HEAD~5
of the tree.
git://kemari.git.sourceforge.net/gitroot/kemari/kemari next
Thanks,
Kei
OHMURA Kei (2):
Introduce fault tolerant VM transaction QEMUFile and ft_mode.
Introduce event-tap.
Yoshiaki Tamura (16):
Make QEMUFile buf expandable, and introduce qemu_realloc_buffer() and
qemu_clear_buffer().
Introduce read() to FdMigrationState.
Introduce qemu_loadvm_state_no_header() and make qemu_loadvm_state()
a wrapper.
qemu-char: export socket_set_nodelay().
vl.c: add deleted flag for deleting the handler.
virtio: decrement last_avail_idx with inuse before saving.
savevm: introduce util functions to control ft_trans_file from savevm
layer.
Call init handler of event-tap at main() in vl.c.
ioport: insert event_tap_ioport() to ioport_write().
Insert event_tap_mmio() to cpu_physical_memory_rw() in exec.c.
net: insert event-tap to qemu_send_packet() and
qemu_sendv_packet_async().
block: insert event-tap to bdrv_aio_writev(), bdrv_aio_flush() and
bdrv_flush().
savevm: introduce qemu_savevm_trans_{begin,commit}.
migration: introduce migrate_ft_trans_{put,get}_ready(), and modify
migrate_fd_put_ready() when ft_mode is on.
migration-tcp: modify tcp_accept_incoming_migration() to handle
ft_mode, and add a hack not to close fd when ft_mode is enabled.
Introduce "kemari:" to enable FT migration mode (Kemari).
Makefile.objs | 1 +
Makefile.target | 1 +
block.c | 15 +
event-tap.c | 940 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
event-tap.h | 44 +++
exec.c | 4 +
ft_trans_file.c | 624 ++++++++++++++++++++++++++++++++++++
ft_trans_file.h | 72 +++++
hmp-commands.hx | 4 +-
hw/hw.h | 7 +
hw/virtio.c | 10 +-
ioport.c | 2 +
migration-tcp.c | 83 +++++-
migration.c | 294 +++++++++++++++++-
migration.h | 3 +
net.c | 9 +
qemu-char.c | 2 +-
qemu-tool.c | 28 ++
qemu_socket.h | 1 +
qmp-commands.hx | 4 +-
savevm.c | 372 +++++++++++++++++-----
sysemu.h | 2 +
trace-events | 25 ++
vl.c | 18 +-
24 files changed, 2477 insertions(+), 88 deletions(-)
create mode 100644 event-tap.c
create mode 100644 event-tap.h
create mode 100644 ft_trans_file.c
create mode 100644 ft_trans_file.h
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Qemu-devel] [PATCH 12/18] Insert event_tap_mmio() to cpu_physical_memory_rw() in exec.c.
2011-04-25 11:00 [Qemu-devel] [PATCH 00/18] Kemari for KVM v0.2.14 OHMURA Kei
@ 2011-04-25 11:00 ` OHMURA Kei
2011-04-25 11:46 ` Jan Kiszka
0 siblings, 1 reply; 12+ messages in thread
From: OHMURA Kei @ 2011-04-25 11:00 UTC (permalink / raw)
To: qemu-devel, kvm
Cc: kwolf, aliguori, mtosatti, ohmura.kei, ananth, mst, dlaor, vatsa,
Yoshiaki Tamura, blauwirbel, quintela, tamura.yoshiaki, avi,
pbonzini, psuriset, stefanha
From: Yoshiaki Tamura <tamura.yoshiaki@lab.ntt.co.jp>
Record mmio write event to replay it upon failover.
Signed-off-by: Yoshiaki Tamura <tamura.yoshiaki@lab.ntt.co.jp>
Signed-off-by: OHMURA Kei <ohmura.kei@lab.ntt.co.jp>
---
exec.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/exec.c b/exec.c
index c3dc68a..3c3cece 100644
--- a/exec.c
+++ b/exec.c
@@ -33,6 +33,7 @@
#include "osdep.h"
#include "kvm.h"
#include "qemu-timer.h"
+#include "event-tap.h"
#if defined(CONFIG_USER_ONLY)
#include <qemu.h>
#include <signal.h>
@@ -3736,6 +3737,9 @@ void cpu_physical_memory_rw(target_phys_addr_t addr, uint8_t *buf,
io_index = (pd >> IO_MEM_SHIFT) & (IO_MEM_NB_ENTRIES - 1);
if (p)
addr1 = (addr & ~TARGET_PAGE_MASK) + p->region_offset;
+
+ event_tap_mmio(addr, buf, len);
+
/* XXX: could force cpu_single_env to NULL to avoid
potential bugs */
if (l >= 4 && ((addr1 & 3) == 0)) {
--
1.7.0.2
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [Qemu-devel] [PATCH 12/18] Insert event_tap_mmio() to cpu_physical_memory_rw() in exec.c.
2011-04-25 11:00 ` [Qemu-devel] [PATCH 12/18] Insert event_tap_mmio() to cpu_physical_memory_rw() in exec.c OHMURA Kei
@ 2011-04-25 11:46 ` Jan Kiszka
0 siblings, 0 replies; 12+ messages in thread
From: Jan Kiszka @ 2011-04-25 11:46 UTC (permalink / raw)
To: OHMURA Kei
Cc: kwolf, aliguori, dlaor, ananth, kvm, mst, mtosatti, qemu-devel,
Yoshiaki Tamura, vatsa, blauwirbel, quintela, tamura.yoshiaki,
avi, pbonzini, psuriset, stefanha
[-- Attachment #1: Type: text/plain, Size: 1197 bytes --]
On 2011-04-25 13:00, OHMURA Kei wrote:
> From: Yoshiaki Tamura <tamura.yoshiaki@lab.ntt.co.jp>
>
> Record mmio write event to replay it upon failover.
>
> Signed-off-by: Yoshiaki Tamura <tamura.yoshiaki@lab.ntt.co.jp>
> Signed-off-by: OHMURA Kei <ohmura.kei@lab.ntt.co.jp>
> ---
> exec.c | 4 ++++
> 1 files changed, 4 insertions(+), 0 deletions(-)
>
> diff --git a/exec.c b/exec.c
> index c3dc68a..3c3cece 100644
> --- a/exec.c
> +++ b/exec.c
> @@ -33,6 +33,7 @@
> #include "osdep.h"
> #include "kvm.h"
> #include "qemu-timer.h"
> +#include "event-tap.h"
> #if defined(CONFIG_USER_ONLY)
> #include <qemu.h>
> #include <signal.h>
> @@ -3736,6 +3737,9 @@ void cpu_physical_memory_rw(target_phys_addr_t addr, uint8_t *buf,
> io_index = (pd >> IO_MEM_SHIFT) & (IO_MEM_NB_ENTRIES - 1);
> if (p)
> addr1 = (addr & ~TARGET_PAGE_MASK) + p->region_offset;
> +
> + event_tap_mmio(addr, buf, len);
> +
You know that this is incomplete? A few devices are calling st*_phys
directly, specifically virtio.
What kind of mmio should be traced here, device or CPU originated? Or both?
Jan
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 259 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Qemu-devel] [PATCH 00/18] [PATCH 00/18] Kemari for KVM v0.2.13
@ 2011-03-23 4:10 Yoshiaki Tamura
2011-03-23 4:10 ` [Qemu-devel] [PATCH 12/18] Insert event_tap_mmio() to cpu_physical_memory_rw() in exec.c Yoshiaki Tamura
0 siblings, 1 reply; 12+ messages in thread
From: Yoshiaki Tamura @ 2011-03-23 4:10 UTC (permalink / raw)
To: kvm, qemu-devel
Cc: kwolf, aliguori, mtosatti, ohmura.kei, ananth, mst, dlaor, vatsa,
Yoshiaki Tamura, blauwirbel, quintela, avi, pbonzini, psuriset,
stefanha
Hi,
This patch series is a revised version of Kemari for KVM, which
applied comments for the previous post. The current code is based on
qemu.git 4ac8e585c85079f6fd2b2b6da3cb845e3e19459c.
The changes from v0.2.12 -> v0.2.13 are:
- replaced qemu_get_timer() with qemu_get_timer_ns()
- check check s->file before calling qemu_ft_trans_cancel()
- avoid virtio-net assert upon calling event_tap_unregister()
The changes from v0.2.11 -> v0.2.12 are:
- fix vm_state_notify() to use QLIST_FOREACH_SAFE (Juan)
- introduce qemu_loadvm_state_no_header() and refactored
qemu_loadvm_state() to call it after checking headers (Juan)
The changes from v0.2.10 -> v0.2.11 are:
- rebased to 0.14
- upon unregistering event-tap, set event_tap_state after event_tap_flush
- modify commit log of 02/18 that it won't make existing migration
bi-directional.
The changes from v0.2.9 -> v0.2.10 are:
- change migrate format to kemari:<protocol>:<host>:<port> (Paolo)
The changes from v0.2.8 -> v0.2.9 are:
- abstract common code between qemu_savevm_{state,trans}_* (Paolo)
- change incoming format to kemari:<protocol>:<host>:<port> (Paolo)
The changes from v0.2.7 -> v0.2.8 are:
- fixed calling wrong cb in event-tap
- add missing qemu_aio_release in event-tap
The changes from v0.2.6 -> v0.2.7 are:
- add AIOCB, AIOPool and cancel functions (Kevin)
- insert event-tap for bdrv_flush (Kevin)
- add error handing when calling bdrv functions (Kevin)
- fix usage of qemu_aio_flush and bdrv_flush (Kevin)
- use bs in AIOCB on the primary (Kevin)
- reorder event-tap functions to gather with block/net (Kevin)
- fix checking bs->device_name (Kevin)
The changes from v0.2.5 -> v0.2.6 are:
- use qemu_{put,get}_be32() to save/load niov in event-tap
The changes from v0.2.4 -> v0.2.5 are:
- fixed braces and trailing spaces by using Blue's checkpatch.pl (Blue)
- event-tap: don't try to send blk_req if it's a bdrv_aio_flush event
The changes from v0.2.3 -> v0.2.4 are:
- call vm_start() before event_tap_flush_one() to avoid failure in
virtio-net assertion
- add vm_change_state_handler to turn off ft_mode
- use qemu_iovec functions in event-tap
- remove duplicated code in migration
- remove unnecessary new line for error_report in ft_trans_file
The changes from v0.2.2 -> v0.2.3 are:
- queue async net requests without copying (MST)
-- if not async, contents of the packets are sent to the secondary
- better description for option -k (MST)
- fix memory transfer failure
- fix ft transaction initiation failure
The changes from v0.2.1 -> v0.2.2 are:
- decrement last_avaid_idx with inuse before saving (MST)
- remove qemu_aio_flush() and bdrv_flush_all() in migrate_ft_trans_commit()
The changes from v0.2 -> v0.2.1 are:
- Move event-tap to net/block layer and use stubs (Blue, Paul, MST, Kevin)
- Tap bdrv_aio_flush (Marcelo)
- Remove multiwrite interface in event-tap (Stefan)
- Fix event-tap to use pio/mmio to replay both net/block (Stefan)
- Improve error handling in event-tap (Stefan)
- Fix leak in event-tap (Stefan)
- Revise virtio last_avail_idx manipulation (MST)
- Clean up migration.c hook (Marcelo)
- Make deleting change state handler robust (Isaku, Anthony)
The changes from v0.1.1 -> v0.2 are:
- Introduce a queue in event-tap to make VM sync live.
- Change transaction receiver to a state machine for async receiving.
- Replace net/block layer functions with event-tap proxy functions.
- Remove dirty bitmap optimization for now.
- convert DPRINTF() in ft_trans_file to trace functions.
- convert fprintf() in ft_trans_file to error_report().
- improved error handling in ft_trans_file.
- add a tmp pointer to qemu_del_vm_change_state_handler.
The changes from v0.1 -> v0.1.1 are:
- events are tapped in net/block layer instead of device emulation layer.
- Introduce a new option for -incoming to accept FT transaction.
- Removed writev() support to QEMUFile and FdMigrationState for now.
I would post this work in a different series.
- Modified virtio-blk save/load handler to send inuse variable to
correctly replay.
- Removed configure --enable-ft-mode.
- Removed unnecessary check for qemu_realloc().
The first 6 patches modify several functions of qemu to prepare
introducing Kemari specific components.
The next 6 patches are the components of Kemari. They introduce
event-tap and the FT transaction protocol file based on buffered file.
The design document of FT transaction protocol can be found at,
http://wiki.qemu.org/images/b/b1/Kemari_sender_receiver_0.5a.pdf
Then the following 2 patches modifies net/block layer functions with
event-tap functions. Please note that if Kemari is off, event-tap
will just passthrough, and there is most no intrusion to exisiting
functions including normal live migration.
Finally, the migration layer are modified to support Kemari in the
last 4 patches. Again, there shouldn't be any affection if a user
doesn't specify Kemari specific options. The transaction is now async
on both sender and receiver side. The sender side respects the
max_downtime to decide when to switch from async to sync mode.
The repository contains all patches I'm sending with this message.
For those who want to try, please pull the following repository. It
also includes dirty bitmap optimization which aren't ready for posting
yet. To remove the dirty bitmap optimization, please look at HEAD~5
of the tree.
git://kemari.git.sourceforge.net/gitroot/kemari/kemari next
Thanks,
Yoshi
Yoshiaki Tamura (18):
Make QEMUFile buf expandable, and introduce qemu_realloc_buffer() and
qemu_clear_buffer().
Introduce read() to FdMigrationState.
Introduce qemu_loadvm_state_no_header() and make qemu_loadvm_state()
a wrapper.
qemu-char: export socket_set_nodelay().
vl.c: add deleted flag for deleting the handler.
virtio: decrement last_avail_idx with inuse before saving.
Introduce fault tolerant VM transaction QEMUFile and ft_mode.
savevm: introduce util functions to control ft_trans_file from savevm
layer.
Introduce event-tap.
Call init handler of event-tap at main() in vl.c.
ioport: insert event_tap_ioport() to ioport_write().
Insert event_tap_mmio() to cpu_physical_memory_rw() in exec.c.
net: insert event-tap to qemu_send_packet() and
qemu_sendv_packet_async().
block: insert event-tap to bdrv_aio_writev(), bdrv_aio_flush() and
bdrv_flush().
savevm: introduce qemu_savevm_trans_{begin,commit}.
migration: introduce migrate_ft_trans_{put,get}_ready(), and modify
migrate_fd_put_ready() when ft_mode is on.
migration-tcp: modify tcp_accept_incoming_migration() to handle
ft_mode, and add a hack not to close fd when ft_mode is enabled.
Introduce "kemari:" to enable FT migration mode (Kemari).
Makefile.objs | 1 +
Makefile.target | 1 +
block.c | 15 +
event-tap.c | 940 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
event-tap.h | 44 +++
exec.c | 4 +
ft_trans_file.c | 624 ++++++++++++++++++++++++++++++++++++
ft_trans_file.h | 72 +++++
hmp-commands.hx | 4 +-
hw/hw.h | 7 +
hw/virtio.c | 10 +-
ioport.c | 2 +
migration-tcp.c | 82 +++++-
migration.c | 294 +++++++++++++++++-
migration.h | 3 +
net.c | 9 +
qemu-char.c | 2 +-
qemu-tool.c | 27 ++
qemu_socket.h | 1 +
qmp-commands.hx | 4 +-
savevm.c | 372 +++++++++++++++++-----
sysemu.h | 2 +
trace-events | 25 ++
vl.c | 18 +-
24 files changed, 2475 insertions(+), 88 deletions(-)
create mode 100644 event-tap.c
create mode 100644 event-tap.h
create mode 100644 ft_trans_file.c
create mode 100644 ft_trans_file.h
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Qemu-devel] [PATCH 12/18] Insert event_tap_mmio() to cpu_physical_memory_rw() in exec.c.
2011-03-23 4:10 [Qemu-devel] [PATCH 00/18] [PATCH 00/18] Kemari for KVM v0.2.13 Yoshiaki Tamura
@ 2011-03-23 4:10 ` Yoshiaki Tamura
0 siblings, 0 replies; 12+ messages in thread
From: Yoshiaki Tamura @ 2011-03-23 4:10 UTC (permalink / raw)
To: kvm, qemu-devel
Cc: kwolf, aliguori, mtosatti, ohmura.kei, ananth, mst, dlaor, vatsa,
Yoshiaki Tamura, blauwirbel, quintela, avi, pbonzini, psuriset,
stefanha
Record mmio write event to replay it upon failover.
Signed-off-by: Yoshiaki Tamura <tamura.yoshiaki@lab.ntt.co.jp>
---
exec.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/exec.c b/exec.c
index 964ce31..be71464 100644
--- a/exec.c
+++ b/exec.c
@@ -33,6 +33,7 @@
#include "osdep.h"
#include "kvm.h"
#include "qemu-timer.h"
+#include "event-tap.h"
#if defined(CONFIG_USER_ONLY)
#include <qemu.h>
#include <signal.h>
@@ -3733,6 +3734,9 @@ void cpu_physical_memory_rw(target_phys_addr_t addr, uint8_t *buf,
io_index = (pd >> IO_MEM_SHIFT) & (IO_MEM_NB_ENTRIES - 1);
if (p)
addr1 = (addr & ~TARGET_PAGE_MASK) + p->region_offset;
+
+ event_tap_mmio(addr, buf, len);
+
/* XXX: could force cpu_single_env to NULL to avoid
potential bugs */
if (l >= 4 && ((addr1 & 3) == 0)) {
--
1.7.1.2
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [Qemu-devel] [PATCH 00/18] Kemari for KVM v0.2.12
@ 2011-02-24 7:28 Yoshiaki Tamura
2011-02-24 7:28 ` [Qemu-devel] [PATCH 12/18] Insert event_tap_mmio() to cpu_physical_memory_rw() in exec.c Yoshiaki Tamura
0 siblings, 1 reply; 12+ messages in thread
From: Yoshiaki Tamura @ 2011-02-24 7:28 UTC (permalink / raw)
To: kvm, qemu-devel
Cc: kwolf, aliguori, mtosatti, ohmura.kei, ananth, mst, dlaor, vatsa,
Yoshiaki Tamura, blauwirbel, quintela, avi, pbonzini, psuriset,
stefanha
Hi,
This patch series is a revised version of Kemari for KVM, which
applied comments for the previous post. The current code is based on
qemu.git 9a31334f419c1d773cf4b4bfbbdace96fbf8a4f4.
The changes from v0.2.11 -> v0.2.12 are:
- fix vm_state_notify() to use QLIST_FOREACH_SAFE (Juan)
- introduce qemu_loadvm_state_no_header() and refactored
qemu_loadvm_state() to call it after checking headers (Juan)
The changes from v0.2.10 -> v0.2.11 are:
- rebased to 0.14
- upon unregistering event-tap, set event_tap_state after event_tap_flush
- modify commit log of 02/18 that it won't make existing migration
bi-directional.
The changes from v0.2.9 -> v0.2.10 are:
- change migrate format to kemari:<protocol>:<host>:<port> (Paolo)
The changes from v0.2.8 -> v0.2.9 are:
- abstract common code between qemu_savevm_{state,trans}_* (Paolo)
- change incoming format to kemari:<protocol>:<host>:<port> (Paolo)
The changes from v0.2.7 -> v0.2.8 are:
- fixed calling wrong cb in event-tap
- add missing qemu_aio_release in event-tap
The changes from v0.2.6 -> v0.2.7 are:
- add AIOCB, AIOPool and cancel functions (Kevin)
- insert event-tap for bdrv_flush (Kevin)
- add error handing when calling bdrv functions (Kevin)
- fix usage of qemu_aio_flush and bdrv_flush (Kevin)
- use bs in AIOCB on the primary (Kevin)
- reorder event-tap functions to gather with block/net (Kevin)
- fix checking bs->device_name (Kevin)
The changes from v0.2.5 -> v0.2.6 are:
- use qemu_{put,get}_be32() to save/load niov in event-tap
The changes from v0.2.4 -> v0.2.5 are:
- fixed braces and trailing spaces by using Blue's checkpatch.pl (Blue)
- event-tap: don't try to send blk_req if it's a bdrv_aio_flush event
The changes from v0.2.3 -> v0.2.4 are:
- call vm_start() before event_tap_flush_one() to avoid failure in
virtio-net assertion
- add vm_change_state_handler to turn off ft_mode
- use qemu_iovec functions in event-tap
- remove duplicated code in migration
- remove unnecessary new line for error_report in ft_trans_file
The changes from v0.2.2 -> v0.2.3 are:
- queue async net requests without copying (MST)
-- if not async, contents of the packets are sent to the secondary
- better description for option -k (MST)
- fix memory transfer failure
- fix ft transaction initiation failure
The changes from v0.2.1 -> v0.2.2 are:
- decrement last_avaid_idx with inuse before saving (MST)
- remove qemu_aio_flush() and bdrv_flush_all() in migrate_ft_trans_commit()
The changes from v0.2 -> v0.2.1 are:
- Move event-tap to net/block layer and use stubs (Blue, Paul, MST, Kevin)
- Tap bdrv_aio_flush (Marcelo)
- Remove multiwrite interface in event-tap (Stefan)
- Fix event-tap to use pio/mmio to replay both net/block (Stefan)
- Improve error handling in event-tap (Stefan)
- Fix leak in event-tap (Stefan)
- Revise virtio last_avail_idx manipulation (MST)
- Clean up migration.c hook (Marcelo)
- Make deleting change state handler robust (Isaku, Anthony)
The changes from v0.1.1 -> v0.2 are:
- Introduce a queue in event-tap to make VM sync live.
- Change transaction receiver to a state machine for async receiving.
- Replace net/block layer functions with event-tap proxy functions.
- Remove dirty bitmap optimization for now.
- convert DPRINTF() in ft_trans_file to trace functions.
- convert fprintf() in ft_trans_file to error_report().
- improved error handling in ft_trans_file.
- add a tmp pointer to qemu_del_vm_change_state_handler.
The changes from v0.1 -> v0.1.1 are:
- events are tapped in net/block layer instead of device emulation layer.
- Introduce a new option for -incoming to accept FT transaction.
- Removed writev() support to QEMUFile and FdMigrationState for now.
I would post this work in a different series.
- Modified virtio-blk save/load handler to send inuse variable to
correctly replay.
- Removed configure --enable-ft-mode.
- Removed unnecessary check for qemu_realloc().
The first 6 patches modify several functions of qemu to prepare
introducing Kemari specific components.
The next 6 patches are the components of Kemari. They introduce
event-tap and the FT transaction protocol file based on buffered file.
The design document of FT transaction protocol can be found at,
http://wiki.qemu.org/images/b/b1/Kemari_sender_receiver_0.5a.pdf
Then the following 2 patches modifies net/block layer functions with
event-tap functions. Please note that if Kemari is off, event-tap
will just passthrough, and there is most no intrusion to exisiting
functions including normal live migration.
Finally, the migration layer are modified to support Kemari in the
last 4 patches. Again, there shouldn't be any affection if a user
doesn't specify Kemari specific options. The transaction is now async
on both sender and receiver side. The sender side respects the
max_downtime to decide when to switch from async to sync mode.
The repository contains all patches I'm sending with this message.
For those who want to try, please pull the following repository. It
also includes dirty bitmap optimization which aren't ready for posting
yet. To remove the dirty bitmap optimization, please look at HEAD~4
of the tree.
git://kemari.git.sourceforge.net/gitroot/kemari/kemari next
Thanks,
Yoshi
Yoshiaki Tamura (18):
Make QEMUFile buf expandable, and introduce qemu_realloc_buffer() and
qemu_clear_buffer().
Introduce read() to FdMigrationState.
Introduce qemu_loadvm_state_no_header() and make qemu_loadvm_state()
a wrapper.
qemu-char: export socket_set_nodelay().
vl.c: add deleted flag for deleting the handler.
virtio: decrement last_avail_idx with inuse before saving.
Introduce fault tolerant VM transaction QEMUFile and ft_mode.
savevm: introduce util functions to control ft_trans_file from savevm
layer.
Introduce event-tap.
Call init handler of event-tap at main() in vl.c.
ioport: insert event_tap_ioport() to ioport_write().
Insert event_tap_mmio() to cpu_physical_memory_rw() in exec.c.
net: insert event-tap to qemu_send_packet() and
qemu_sendv_packet_async().
block: insert event-tap to bdrv_aio_writev(), bdrv_aio_flush() and
bdrv_flush().
savevm: introduce qemu_savevm_trans_{begin,commit}.
migration: introduce migrate_ft_trans_{put,get}_ready(), and modify
migrate_fd_put_ready() when ft_mode is on.
migration-tcp: modify tcp_accept_incoming_migration() to handle
ft_mode, and add a hack not to close fd when ft_mode is enabled.
Introduce "kemari:" to enable FT migration mode (Kemari).
Makefile.objs | 1 +
Makefile.target | 1 +
block.c | 15 +
event-tap.c | 940 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
event-tap.h | 44 +++
exec.c | 4 +
ft_trans_file.c | 624 ++++++++++++++++++++++++++++++++++++
ft_trans_file.h | 72 +++++
hmp-commands.hx | 4 +-
hw/hw.h | 7 +
hw/virtio.c | 10 +-
ioport.c | 2 +
migration-tcp.c | 82 +++++-
migration.c | 289 +++++++++++++++++-
migration.h | 3 +
net.c | 9 +
qemu-char.c | 2 +-
qemu-tool.c | 28 ++
qemu_socket.h | 1 +
qmp-commands.hx | 4 +-
savevm.c | 372 +++++++++++++++++-----
sysemu.h | 2 +
trace-events | 25 ++
vl.c | 18 +-
24 files changed, 2471 insertions(+), 88 deletions(-)
create mode 100644 event-tap.c
create mode 100644 event-tap.h
create mode 100644 ft_trans_file.c
create mode 100644 ft_trans_file.h
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Qemu-devel] [PATCH 12/18] Insert event_tap_mmio() to cpu_physical_memory_rw() in exec.c.
2011-02-24 7:28 [Qemu-devel] [PATCH 00/18] Kemari for KVM v0.2.12 Yoshiaki Tamura
@ 2011-02-24 7:28 ` Yoshiaki Tamura
0 siblings, 0 replies; 12+ messages in thread
From: Yoshiaki Tamura @ 2011-02-24 7:28 UTC (permalink / raw)
To: kvm, qemu-devel
Cc: kwolf, aliguori, mtosatti, ohmura.kei, ananth, mst, dlaor, vatsa,
Yoshiaki Tamura, blauwirbel, quintela, avi, pbonzini, psuriset,
stefanha
Record mmio write event to replay it upon failover.
Signed-off-by: Yoshiaki Tamura <tamura.yoshiaki@lab.ntt.co.jp>
---
exec.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/exec.c b/exec.c
index d611100..e192eec 100644
--- a/exec.c
+++ b/exec.c
@@ -33,6 +33,7 @@
#include "osdep.h"
#include "kvm.h"
#include "qemu-timer.h"
+#include "event-tap.h"
#if defined(CONFIG_USER_ONLY)
#include <qemu.h>
#include <signal.h>
@@ -3662,6 +3663,9 @@ void cpu_physical_memory_rw(target_phys_addr_t addr, uint8_t *buf,
io_index = (pd >> IO_MEM_SHIFT) & (IO_MEM_NB_ENTRIES - 1);
if (p)
addr1 = (addr & ~TARGET_PAGE_MASK) + p->region_offset;
+
+ event_tap_mmio(addr, buf, len);
+
/* XXX: could force cpu_single_env to NULL to avoid
potential bugs */
if (l >= 4 && ((addr1 & 3) == 0)) {
--
1.7.1.2
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [Qemu-devel] [PATCH 00/18] Kemari for KVM v0.2.11
@ 2011-02-23 13:48 Yoshiaki Tamura
2011-02-23 13:48 ` [Qemu-devel] [PATCH 12/18] Insert event_tap_mmio() to cpu_physical_memory_rw() in exec.c Yoshiaki Tamura
0 siblings, 1 reply; 12+ messages in thread
From: Yoshiaki Tamura @ 2011-02-23 13:48 UTC (permalink / raw)
To: kvm, qemu-devel
Cc: kwolf, aliguori, mtosatti, ananth, mst, dlaor, vatsa,
Yoshiaki Tamura, blauwirbel, ohmura.kei, avi, pbonzini, psuriset,
stefanha
Hi,
This patch series is a revised version of Kemari for KVM, which
applied comments for the previous post. The current code is based on
qemu.git 9a31334f419c1d773cf4b4bfbbdace96fbf8a4f4.
The changes from v0.2.10 -> v0.2.11 are:
- rebased to 0.14
- upon unregistering event-tap, set event_tap_state after event_tap_flush
- modify commit log of 02/18 that it won't make existing migration
bi-directional.
The changes from v0.2.9 -> v0.2.10 are:
- change migrate format to kemari:<protocol>:<host>:<port> (Paolo)
The changes from v0.2.8 -> v0.2.9 are:
- abstract common code between qemu_savevm_{state,trans}_* (Paolo)
- change incoming format to kemari:<protocol>:<host>:<port> (Paolo)
The changes from v0.2.7 -> v0.2.8 are:
- fixed calling wrong cb in event-tap
- add missing qemu_aio_release in event-tap
The changes from v0.2.6 -> v0.2.7 are:
- add AIOCB, AIOPool and cancel functions (Kevin)
- insert event-tap for bdrv_flush (Kevin)
- add error handing when calling bdrv functions (Kevin)
- fix usage of qemu_aio_flush and bdrv_flush (Kevin)
- use bs in AIOCB on the primary (Kevin)
- reorder event-tap functions to gather with block/net (Kevin)
- fix checking bs->device_name (Kevin)
The changes from v0.2.5 -> v0.2.6 are:
- use qemu_{put,get}_be32() to save/load niov in event-tap
The changes from v0.2.4 -> v0.2.5 are:
- fixed braces and trailing spaces by using Blue's checkpatch.pl (Blue)
- event-tap: don't try to send blk_req if it's a bdrv_aio_flush event
The changes from v0.2.3 -> v0.2.4 are:
- call vm_start() before event_tap_flush_one() to avoid failure in
virtio-net assertion
- add vm_change_state_handler to turn off ft_mode
- use qemu_iovec functions in event-tap
- remove duplicated code in migration
- remove unnecessary new line for error_report in ft_trans_file
The changes from v0.2.2 -> v0.2.3 are:
- queue async net requests without copying (MST)
-- if not async, contents of the packets are sent to the secondary
- better description for option -k (MST)
- fix memory transfer failure
- fix ft transaction initiation failure
The changes from v0.2.1 -> v0.2.2 are:
- decrement last_avaid_idx with inuse before saving (MST)
- remove qemu_aio_flush() and bdrv_flush_all() in migrate_ft_trans_commit()
The changes from v0.2 -> v0.2.1 are:
- Move event-tap to net/block layer and use stubs (Blue, Paul, MST, Kevin)
- Tap bdrv_aio_flush (Marcelo)
- Remove multiwrite interface in event-tap (Stefan)
- Fix event-tap to use pio/mmio to replay both net/block (Stefan)
- Improve error handling in event-tap (Stefan)
- Fix leak in event-tap (Stefan)
- Revise virtio last_avail_idx manipulation (MST)
- Clean up migration.c hook (Marcelo)
- Make deleting change state handler robust (Isaku, Anthony)
The changes from v0.1.1 -> v0.2 are:
- Introduce a queue in event-tap to make VM sync live.
- Change transaction receiver to a state machine for async receiving.
- Replace net/block layer functions with event-tap proxy functions.
- Remove dirty bitmap optimization for now.
- convert DPRINTF() in ft_trans_file to trace functions.
- convert fprintf() in ft_trans_file to error_report().
- improved error handling in ft_trans_file.
- add a tmp pointer to qemu_del_vm_change_state_handler.
The changes from v0.1 -> v0.1.1 are:
- events are tapped in net/block layer instead of device emulation layer.
- Introduce a new option for -incoming to accept FT transaction.
- Removed writev() support to QEMUFile and FdMigrationState for now.
I would post this work in a different series.
- Modified virtio-blk save/load handler to send inuse variable to
correctly replay.
- Removed configure --enable-ft-mode.
- Removed unnecessary check for qemu_realloc().
The first 6 patches modify several functions of qemu to prepare
introducing Kemari specific components.
The next 6 patches are the components of Kemari. They introduce
event-tap and the FT transaction protocol file based on buffered file.
The design document of FT transaction protocol can be found at,
http://wiki.qemu.org/images/b/b1/Kemari_sender_receiver_0.5a.pdf
Then the following 2 patches modifies net/block layer functions with
event-tap functions. Please note that if Kemari is off, event-tap
will just passthrough, and there is most no intrusion to exisiting
functions including normal live migration.
Finally, the migration layer are modified to support Kemari in the
last 4 patches. Again, there shouldn't be any affection if a user
doesn't specify Kemari specific options. The transaction is now async
on both sender and receiver side. The sender side respects the
max_downtime to decide when to switch from async to sync mode.
The repository contains all patches I'm sending with this message.
For those who want to try, please pull the following repository. It
also includes dirty bitmap optimization which aren't ready for posting
yet. To remove the dirty bitmap optimization, please look at HEAD~4
of the tree.
git://kemari.git.sourceforge.net/gitroot/kemari/kemari next
Thanks,
Yoshi
Yoshiaki Tamura (18):
Make QEMUFile buf expandable, and introduce qemu_realloc_buffer() and
qemu_clear_buffer().
Introduce read() to FdMigrationState.
Introduce skip_header parameter to qemu_loadvm_state().
qemu-char: export socket_set_nodelay().
vl.c: add deleted flag for deleting the handler.
virtio: decrement last_avail_idx with inuse before saving.
Introduce fault tolerant VM transaction QEMUFile and ft_mode.
savevm: introduce util functions to control ft_trans_file from savevm
layer.
Introduce event-tap.
Call init handler of event-tap at main() in vl.c.
ioport: insert event_tap_ioport() to ioport_write().
Insert event_tap_mmio() to cpu_physical_memory_rw() in exec.c.
net: insert event-tap to qemu_send_packet() and
qemu_sendv_packet_async().
block: insert event-tap to bdrv_aio_writev(), bdrv_aio_flush() and
bdrv_flush().
savevm: introduce qemu_savevm_trans_{begin,commit}.
migration: introduce migrate_ft_trans_{put,get}_ready(), and modify
migrate_fd_put_ready() when ft_mode is on.
migration-tcp: modify tcp_accept_incoming_migration() to handle
ft_mode, and add a hack not to close fd when ft_mode is enabled.
Introduce "kemari:" to enable FT migration mode (Kemari).
Makefile.objs | 1 +
Makefile.target | 1 +
block.c | 15 +
event-tap.c | 940 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
event-tap.h | 44 +++
exec.c | 4 +
ft_trans_file.c | 624 ++++++++++++++++++++++++++++++++++++
ft_trans_file.h | 72 +++++
hmp-commands.hx | 4 +-
hw/hw.h | 7 +
hw/virtio.c | 10 +-
ioport.c | 2 +
migration-tcp.c | 82 +++++-
migration.c | 291 +++++++++++++++++-
migration.h | 3 +
net.c | 9 +
qemu-char.c | 2 +-
qemu-tool.c | 28 ++
qemu_socket.h | 1 +
qmp-commands.hx | 4 +-
savevm.c | 350 +++++++++++++++++----
sysemu.h | 4 +-
trace-events | 25 ++
vl.c | 16 +-
24 files changed, 2457 insertions(+), 82 deletions(-)
create mode 100644 event-tap.c
create mode 100644 event-tap.h
create mode 100644 ft_trans_file.c
create mode 100644 ft_trans_file.h
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Qemu-devel] [PATCH 12/18] Insert event_tap_mmio() to cpu_physical_memory_rw() in exec.c.
2011-02-23 13:48 [Qemu-devel] [PATCH 00/18] Kemari for KVM v0.2.11 Yoshiaki Tamura
@ 2011-02-23 13:48 ` Yoshiaki Tamura
0 siblings, 0 replies; 12+ messages in thread
From: Yoshiaki Tamura @ 2011-02-23 13:48 UTC (permalink / raw)
To: kvm, qemu-devel
Cc: kwolf, aliguori, mtosatti, ananth, mst, dlaor, vatsa,
Yoshiaki Tamura, blauwirbel, ohmura.kei, avi, pbonzini, psuriset,
stefanha
Record mmio write event to replay it upon failover.
Signed-off-by: Yoshiaki Tamura <tamura.yoshiaki@lab.ntt.co.jp>
---
exec.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/exec.c b/exec.c
index d611100..e192eec 100644
--- a/exec.c
+++ b/exec.c
@@ -33,6 +33,7 @@
#include "osdep.h"
#include "kvm.h"
#include "qemu-timer.h"
+#include "event-tap.h"
#if defined(CONFIG_USER_ONLY)
#include <qemu.h>
#include <signal.h>
@@ -3662,6 +3663,9 @@ void cpu_physical_memory_rw(target_phys_addr_t addr, uint8_t *buf,
io_index = (pd >> IO_MEM_SHIFT) & (IO_MEM_NB_ENTRIES - 1);
if (p)
addr1 = (addr & ~TARGET_PAGE_MASK) + p->region_offset;
+
+ event_tap_mmio(addr, buf, len);
+
/* XXX: could force cpu_single_env to NULL to avoid
potential bugs */
if (l >= 4 && ((addr1 & 3) == 0)) {
--
1.7.1.2
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [Qemu-devel] [PATCH 00/18] Kemari for KVM v0.2.10
@ 2011-02-10 9:30 Yoshiaki Tamura
2011-02-10 9:30 ` [Qemu-devel] [PATCH 12/18] Insert event_tap_mmio() to cpu_physical_memory_rw() in exec.c Yoshiaki Tamura
0 siblings, 1 reply; 12+ messages in thread
From: Yoshiaki Tamura @ 2011-02-10 9:30 UTC (permalink / raw)
To: kvm, qemu-devel
Cc: kwolf, aliguori, mtosatti, ananth, mst, dlaor, vatsa,
Yoshiaki Tamura, blauwirbel, ohmura.kei, avi, pbonzini, psuriset,
stefanha
Hi,
This patch series is a revised version of Kemari for KVM, which
applied comments for the previous post. The current code is based on
qemu.git f26e5a54f0554798a2e6f7a074b809b13635d007.
The changes from v0.2.9 -> v0.2.10 are:
- change migrate format to kemari:<protocol>:<host>:<port> (Paolo)
The changes from v0.2.8 -> v0.2.9 are:
- abstract common code between qemu_savevm_{state,trans}_* (Paolo)
- change incoming format to kemari:<protocol>:<host>:<port> (Paolo)
The changes from v0.2.7 -> v0.2.8 are:
- fixed calling wrong cb in event-tap
- add missing qemu_aio_release in event-tap
The changes from v0.2.6 -> v0.2.7 are:
- add AIOCB, AIOPool and cancel functions (Kevin)
- insert event-tap for bdrv_flush (Kevin)
- add error handing when calling bdrv functions (Kevin)
- fix usage of qemu_aio_flush and bdrv_flush (Kevin)
- use bs in AIOCB on the primary (Kevin)
- reorder event-tap functions to gather with block/net (Kevin)
- fix checking bs->device_name (Kevin)
The changes from v0.2.5 -> v0.2.6 are:
- use qemu_{put,get}_be32() to save/load niov in event-tap
The changes from v0.2.4 -> v0.2.5 are:
- fixed braces and trailing spaces by using Blue's checkpatch.pl (Blue)
- event-tap: don't try to send blk_req if it's a bdrv_aio_flush event
The changes from v0.2.3 -> v0.2.4 are:
- call vm_start() before event_tap_flush_one() to avoid failure in
virtio-net assertion
- add vm_change_state_handler to turn off ft_mode
- use qemu_iovec functions in event-tap
- remove duplicated code in migration
- remove unnecessary new line for error_report in ft_trans_file
The changes from v0.2.2 -> v0.2.3 are:
- queue async net requests without copying (MST)
-- if not async, contents of the packets are sent to the secondary
- better description for option -k (MST)
- fix memory transfer failure
- fix ft transaction initiation failure
The changes from v0.2.1 -> v0.2.2 are:
- decrement last_avaid_idx with inuse before saving (MST)
- remove qemu_aio_flush() and bdrv_flush_all() in migrate_ft_trans_commit()
The changes from v0.2 -> v0.2.1 are:
- Move event-tap to net/block layer and use stubs (Blue, Paul, MST, Kevin)
- Tap bdrv_aio_flush (Marcelo)
- Remove multiwrite interface in event-tap (Stefan)
- Fix event-tap to use pio/mmio to replay both net/block (Stefan)
- Improve error handling in event-tap (Stefan)
- Fix leak in event-tap (Stefan)
- Revise virtio last_avail_idx manipulation (MST)
- Clean up migration.c hook (Marcelo)
- Make deleting change state handler robust (Isaku, Anthony)
The changes from v0.1.1 -> v0.2 are:
- Introduce a queue in event-tap to make VM sync live.
- Change transaction receiver to a state machine for async receiving.
- Replace net/block layer functions with event-tap proxy functions.
- Remove dirty bitmap optimization for now.
- convert DPRINTF() in ft_trans_file to trace functions.
- convert fprintf() in ft_trans_file to error_report().
- improved error handling in ft_trans_file.
- add a tmp pointer to qemu_del_vm_change_state_handler.
The changes from v0.1 -> v0.1.1 are:
- events are tapped in net/block layer instead of device emulation layer.
- Introduce a new option for -incoming to accept FT transaction.
- Removed writev() support to QEMUFile and FdMigrationState for now.
I would post this work in a different series.
- Modified virtio-blk save/load handler to send inuse variable to
correctly replay.
- Removed configure --enable-ft-mode.
- Removed unnecessary check for qemu_realloc().
The first 6 patches modify several functions of qemu to prepare
introducing Kemari specific components.
The next 6 patches are the components of Kemari. They introduce
event-tap and the FT transaction protocol file based on buffered file.
The design document of FT transaction protocol can be found at,
http://wiki.qemu.org/images/b/b1/Kemari_sender_receiver_0.5a.pdf
Then the following 2 patches modifies net/block layer functions with
event-tap functions. Please note that if Kemari is off, event-tap
will just passthrough, and there is most no intrusion to exisiting
functions including normal live migration.
Finally, the migration layer are modified to support Kemari in the
last 4 patches. Again, there shouldn't be any affection if a user
doesn't specify Kemari specific options. The transaction is now async
on both sender and receiver side. The sender side respects the
max_downtime to decide when to switch from async to sync mode.
The repository contains all patches I'm sending with this message.
For those who want to try, please pull the following repository. It
also includes dirty bitmap optimization which aren't ready for posting
yet. To remove the dirty bitmap optimization, please look at HEAD~4
of the tree.
git://kemari.git.sourceforge.net/gitroot/kemari/kemari next
Thanks,
Yoshi
Yoshiaki Tamura (18):
Make QEMUFile buf expandable, and introduce qemu_realloc_buffer() and
qemu_clear_buffer().
Introduce read() to FdMigrationState.
Introduce skip_header parameter to qemu_loadvm_state().
qemu-char: export socket_set_nodelay().
vl.c: add deleted flag for deleting the handler.
virtio: decrement last_avail_idx with inuse before saving.
Introduce fault tolerant VM transaction QEMUFile and ft_mode.
savevm: introduce util functions to control ft_trans_file from savevm
layer.
Introduce event-tap.
Call init handler of event-tap at main() in vl.c.
ioport: insert event_tap_ioport() to ioport_write().
Insert event_tap_mmio() to cpu_physical_memory_rw() in exec.c.
net: insert event-tap to qemu_send_packet() and
qemu_sendv_packet_async().
block: insert event-tap to bdrv_aio_writev(), bdrv_aio_flush() and
bdrv_flush().
savevm: introduce qemu_savevm_trans_{begin,commit}.
migration: introduce migrate_ft_trans_{put,get}_ready(), and modify
migrate_fd_put_ready() when ft_mode is on.
migration-tcp: modify tcp_accept_incoming_migration() to handle
ft_mode, and add a hack not to close fd when ft_mode is enabled.
Introduce "kemari:" to enable FT migration mode (Kemari).
Makefile.objs | 1 +
Makefile.target | 1 +
block.c | 15 +
event-tap.c | 939 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
event-tap.h | 44 +++
exec.c | 4 +
ft_trans_file.c | 624 ++++++++++++++++++++++++++++++++++++
ft_trans_file.h | 72 +++++
hmp-commands.hx | 4 +-
hw/hw.h | 7 +
hw/virtio.c | 10 +-
ioport.c | 2 +
migration-tcp.c | 82 +++++-
migration.c | 291 +++++++++++++++++-
migration.h | 3 +
net.c | 9 +
qemu-char.c | 2 +-
qemu-tool.c | 28 ++
qemu_socket.h | 1 +
qmp-commands.hx | 4 +-
savevm.c | 350 +++++++++++++++++----
sysemu.h | 4 +-
trace-events | 25 ++
vl.c | 16 +-
24 files changed, 2456 insertions(+), 82 deletions(-)
create mode 100644 event-tap.c
create mode 100644 event-tap.h
create mode 100644 ft_trans_file.c
create mode 100644 ft_trans_file.h
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Qemu-devel] [PATCH 12/18] Insert event_tap_mmio() to cpu_physical_memory_rw() in exec.c.
2011-02-10 9:30 [Qemu-devel] [PATCH 00/18] Kemari for KVM v0.2.10 Yoshiaki Tamura
@ 2011-02-10 9:30 ` Yoshiaki Tamura
0 siblings, 0 replies; 12+ messages in thread
From: Yoshiaki Tamura @ 2011-02-10 9:30 UTC (permalink / raw)
To: kvm, qemu-devel
Cc: kwolf, aliguori, mtosatti, ananth, mst, dlaor, vatsa,
Yoshiaki Tamura, blauwirbel, ohmura.kei, avi, pbonzini, psuriset,
stefanha
Record mmio write event to replay it upon failover.
Signed-off-by: Yoshiaki Tamura <tamura.yoshiaki@lab.ntt.co.jp>
---
exec.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/exec.c b/exec.c
index e950df2..c81fd09 100644
--- a/exec.c
+++ b/exec.c
@@ -33,6 +33,7 @@
#include "osdep.h"
#include "kvm.h"
#include "qemu-timer.h"
+#include "event-tap.h"
#if defined(CONFIG_USER_ONLY)
#include <qemu.h>
#include <signal.h>
@@ -3632,6 +3633,9 @@ void cpu_physical_memory_rw(target_phys_addr_t addr, uint8_t *buf,
io_index = (pd >> IO_MEM_SHIFT) & (IO_MEM_NB_ENTRIES - 1);
if (p)
addr1 = (addr & ~TARGET_PAGE_MASK) + p->region_offset;
+
+ event_tap_mmio(addr, buf, len);
+
/* XXX: could force cpu_single_env to NULL to avoid
potential bugs */
if (l >= 4 && ((addr1 & 3) == 0)) {
--
1.7.1.2
^ permalink raw reply related [flat|nested] 12+ messages in thread
end of thread, other threads:[~2011-04-27 15:00 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-26 14:24 [Qemu-devel] [PATCH 12/18] Insert event_tap_mmio() to cpu_physical_memory_rw() in exec.c "大村 圭"
2011-04-26 14:51 ` Jan Kiszka
2011-04-27 5:51 ` Takuya Yoshikawa
2011-04-27 14:19 ` Yoshiaki Tamura
2011-04-27 14:19 ` Yoshiaki Tamura
2011-04-27 15:00 ` Jan Kiszka
-- strict thread matches above, loose matches on Subject: below --
2011-04-25 11:00 [Qemu-devel] [PATCH 00/18] Kemari for KVM v0.2.14 OHMURA Kei
2011-04-25 11:00 ` [Qemu-devel] [PATCH 12/18] Insert event_tap_mmio() to cpu_physical_memory_rw() in exec.c OHMURA Kei
2011-04-25 11:46 ` Jan Kiszka
2011-03-23 4:10 [Qemu-devel] [PATCH 00/18] [PATCH 00/18] Kemari for KVM v0.2.13 Yoshiaki Tamura
2011-03-23 4:10 ` [Qemu-devel] [PATCH 12/18] Insert event_tap_mmio() to cpu_physical_memory_rw() in exec.c Yoshiaki Tamura
2011-02-24 7:28 [Qemu-devel] [PATCH 00/18] Kemari for KVM v0.2.12 Yoshiaki Tamura
2011-02-24 7:28 ` [Qemu-devel] [PATCH 12/18] Insert event_tap_mmio() to cpu_physical_memory_rw() in exec.c Yoshiaki Tamura
2011-02-23 13:48 [Qemu-devel] [PATCH 00/18] Kemari for KVM v0.2.11 Yoshiaki Tamura
2011-02-23 13:48 ` [Qemu-devel] [PATCH 12/18] Insert event_tap_mmio() to cpu_physical_memory_rw() in exec.c Yoshiaki Tamura
2011-02-10 9:30 [Qemu-devel] [PATCH 00/18] Kemari for KVM v0.2.10 Yoshiaki Tamura
2011-02-10 9:30 ` [Qemu-devel] [PATCH 12/18] Insert event_tap_mmio() to cpu_physical_memory_rw() in exec.c Yoshiaki Tamura
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).