qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [POC] colo-proxy in qemu
@ 2015-07-20  6:42 Li Zhijian
  2015-07-20 10:32 ` Stefan Hajnoczi
                   ` (2 more replies)
  0 siblings, 3 replies; 57+ messages in thread
From: Li Zhijian @ 2015-07-20  6:42 UTC (permalink / raw)
  To: qemu-devel, stefanha, jasowang
  Cc: zhanghailiang, jan.kiszka, peter.huangpeng, dgilbert,
	Gonglei (Arei), Yang Hongyang

Hi, all

We are planning to implement colo-proxy in qemu to cache and compare packets.
This module is one of the important component of COLO project and now it is
still in early stage, so any comments and feedback are warmly welcomed,
thanks in advance.

## Background
COLO FT/HA (COarse-grain LOck-stepping Virtual Machines for Non-stop Service)
project is a high availability solution. Both Primary VM (PVM) and Secondary VM
(SVM) run in parallel. They receive the same request from client, and generate
responses in parallel too. If the response packets from PVM and SVM are
identical, they are released immediately. Otherwise, a VM checkpoint (on demand)
is conducted.
Paper:
http://www.socc2013.org/home/program/a3-dong.pdf?attredirects=0
COLO on Xen:
http://wiki.xen.org/wiki/COLO_-_Coarse_Grain_Lock_Stepping
COLO on Qemu/KVM:
http://wiki.qemu.org/Features/COLO

By the needs of capturing response packets from PVM and SVM and finding out
whether they are identical, we introduce a new module to qemu networking called
colo-proxy.

This document describes the design of the colo-proxy module

## Glossary
   PVM - Primary VM, which provides services to clients.
   SVM - Secondary VM, a hot standby and replication of PVM.
   PN - Primary Node, the host which PVM runs on
   SN - Secondary Node, the host which SVM runs on

## Workflow ##
The following image show the qemu networking packet datapath between
guest's NIC and qemu's backend in colo-proxy.

+---+                                        +---+
|PN |                                        |SN |
+---+--------------------------+             +------------------------------+
|               +-------+      |             |   +-------+                  |
+--------+      |chkpoint<--------[socket]------->chkpoint         +--------+
|PVM     |      +---^---+      |             |   +---+---+         |SVM     |
|        |  +proxy--v--------+ |             |       |             |        |
|        |  |                | |             |       |             |        |
| +---+  |  | +TCP/IP stack+ | |             | +-----v-------proxy | +---+  |
+-|NIC|--+  | |            | | |             | |                 | +-|NIC|--+
| +^-++     | | +--------+ | | |             | | +TCP/IP stack-+ |   +^--+  |
|  | +------> | | compare| | <-[socket]-forward- | +--------+  | |    |     |
|  |        | | +---+----+ | | |             | | | |seq&ack |  | <----+     |
|  |        | +-----|------+ | |             | | | |adjust  |  | |          |
|  |        |       |        | |             | | | +--------+  | |          |
|  +-----------<+>-----copy&forward-[socket]---> +-------------+ |          |
|           +---|---|--------+ |             | +------------^----+          |
|               |   |          |             |              |               |
|               |   |          |             |              x               |
|            +--+---v----+     |             |            +-v---------+     |
| QEMU       |  backend  |     |             | QEMU       |  backend  |     |
+------------+  (tap)    +-----+             +------------+  (tap)    +-----+
              +-----------+                                +-----------+

## Our Idea ##

### Net filter
In current QEMU, a packet is transported between networking backend(tap) and
qemu network adapter(NIC) directly. Backend and adapter is linked by
NetClientState->peer in qemu as following
        +----------------------------------------+
        v                                        |
+NetClientState+   +------->+NetClientState+    |
|info->type=TAP|   |        |info->type=NIC|    |
+--------------+   |        +--------------+    |
|   *peer      +---+        |   *peer      +----+
+--------------+            +--------------+
|name="tap0"   |            |name="e1000"  |
+--------------+            +--------------+
| ...          |            | ...          |
+--------------+            +--------------+

In COLO QEMU, we insert a net filter named colo-proxy between backend and
adapter like below:
typedef struct COLOState {
     NetClientState nc;
     NetClientState *peer;
} COLOState;
    +------->+NetClientState+            +NetClientState+<--------+
    |        |info->type=TAP|            |info->type=NIC|         |
    |        +--------------+            +--------------+         |
+-----------+   *peer      |            |   *peer      +------------+
|  |        +--------------+            +--------------+         |  |
|  |        |name="tap0"   |            |name="e1000"  |         |  |
|  |        +--------------+            +--------------+         |  |
|  |        | ...          |            | ...          |         |  |
|  |        +--------------+            +--------------+         |  |
|  |                                                             |  |
|  |   +-COLOState------------+       +-COLOState------------+   |  |
+--------->+NetClientState+<- - +   +---->+NetClientState+<---------+
    |   |   |info->type=COLO   | |   | |   |info->type=COLO   |   |
    |   |   +--------------+   | |   | |   +--------------+   |   |
    +-------+   *peer      |   | |   | |   |   *peer      +-------+
        |   +--------------+   | |   | |   +--------------+   |
        |   |name="colo1"  |   | |   | |   |name="colo2"  |   |
        |   +--------------+   | |   | |   +--------------+   |
        |                      | |   | |                      |
        |   +--------------+---------+ |   +--------------+   |
        |   |   *peer      |   | |     |   |   *peer      |   |
        |   +--------------+   | +---------+--------------+   |
        +----------------------+       +----------------------+

After we insert colo-proxy filter, all packets will pass by this filter
and more important thing is that we can analysis packet by ourselves.

### QEMU space TCP/IP stack(re-use SLIRP) ###
We need a QEMU space TCP/IP stack to help us to analysis packet. After looking
into QEMU, we found that SLIRP
http://wiki.qemu.org/Documentation/Networking#User_Networking_.28SLIRP.29
is a good choice for us. SLIRP proivdes a full TCP/IP stack within QEMU, it can
help use to handle the packet written to/read from backend(tap) device which is
just like a link layer(L2) packet.

### packet enqueue and compare ###
Together with QEMU space TCP/IP stack, we enqueue all packets sent by PVM and
SVM on Primary QEMU, and then compare the packet payload for each connection.

### Net filter Usage ###
On both Primary/Secondary host, invoke QEMU with the following parameters to insert
a net filter(colo-proxy):
   "-netdev tap,id=hn0 -device e1000,netdev=hn0 \
    -netdev colo,id=colo,backend=hn0"

^ permalink raw reply	[flat|nested] 57+ messages in thread
* [Qemu-devel] [PATCH] MAINTAINERS: Add Samuel Thibault as slirp maintainer
@ 2015-08-06 11:10 Samuel Thibault
  2015-08-10 10:18 ` Stefan Hajnoczi
  2016-03-07 12:14 ` Jan Kiszka
  0 siblings, 2 replies; 57+ messages in thread
From: Samuel Thibault @ 2015-08-06 11:10 UTC (permalink / raw)
  To: qemu-devel

Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>

---
Jan Kiszka, le Wed 29 Jul 2015 09:36:15 +0200, a écrit :
> On 2015-07-29 00:12, Samuel Thibault wrote:
> > Hello,
> > 
> > Jan Kiszka, le Mon 27 Jul 2015 15:33:27 +0200, a écrit :
> >> Of course, I'm fine with handing this over to someone who'd like to
> >> pick up. Do we have volunteers?
> >>
> >> Samuel, would you like to do this? As a subsystem maintainer, you are
> >> already familiar with QEMU processes.
> > 
> > I can help with maintenance, yes.
> 
> "Help with" will easily mean "be the one and only". ;)

Right, I understand that :) That's still preferable to have two contact
people.

diff --git a/MAINTAINERS b/MAINTAINERS
index 978b717..b506df5 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1018,6 +1018,7 @@ F: scripts/qmp/
 T: git git://repo.or.cz/qemu/armbru.git qapi-next
 
 SLIRP
+M: Samuel Thibault <samuel.thibault@ens-lyon.org>
 M: Jan Kiszka <jan.kiszka@siemens.com>
 S: Maintained
 F: slirp/

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

end of thread, other threads:[~2016-03-07 12:14 UTC | newest]

Thread overview: 57+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-20  6:42 [Qemu-devel] [POC] colo-proxy in qemu Li Zhijian
2015-07-20 10:32 ` Stefan Hajnoczi
2015-07-20 11:55   ` zhanghailiang
2015-07-20 13:12     ` Vasiliy Tolstov
2015-07-20 15:01       ` Stefan Hajnoczi
2015-07-21  1:59         ` zhanghailiang
2015-07-28 22:13           ` Samuel Thibault
2015-07-21  6:13         ` Jan Kiszka
2015-07-21  9:49           ` Stefan Hajnoczi
2015-07-27 10:13             ` Stefan Hajnoczi
2015-07-27 11:24               ` zhanghailiang
2015-07-27 11:31                 ` Samuel Thibault
2015-07-27 13:33               ` Jan Kiszka
2015-07-28 22:12                 ` Samuel Thibault
2015-07-29  7:36                   ` Jan Kiszka
2015-07-29  9:33                     ` [Qemu-devel] [PATCH] MAINTAINERS: Add Samuel Thibault as slirp maintainer Samuel Thibault
2015-08-06 10:10                       ` Stefan Hajnoczi
2015-08-06 12:29                         ` Fam Zheng
2015-08-07 10:19                           ` Stefan Hajnoczi
2015-08-07 10:34                             ` Fam Zheng
2015-07-20 12:02   ` [Qemu-devel] [POC] colo-proxy in qemu Li Zhijian
2015-07-24  2:04   ` Dong, Eddie
2015-07-24  2:12     ` Jason Wang
2015-07-24  8:04       ` Yang Hongyang
2015-07-27  3:24         ` Jason Wang
2015-07-27  3:54           ` Yang Hongyang
2015-07-27  4:49             ` Jason Wang
2015-07-27  5:51               ` Yang Hongyang
2015-07-27  7:37                 ` Jason Wang
2015-07-27  7:49                   ` Yang Hongyang
2015-07-27  8:06                     ` Jason Wang
2015-07-27  8:22                       ` Yang Hongyang
2015-07-27  7:53                 ` Jason Wang
2015-07-27  8:17                   ` Yang Hongyang
2015-07-27 18:33                   ` Dr. David Alan Gilbert
2015-07-27 10:40         ` Dr. David Alan Gilbert
2015-07-27 13:39           ` Yang Hongyang
2015-07-24  2:05 ` Dong, Eddie
2015-07-30  4:23 ` Jason Wang
2015-07-30  7:16   ` Gonglei
2015-07-30  7:47     ` Dong, Eddie
2015-07-30  8:03       ` Dr. David Alan Gilbert
2015-07-30  8:15         ` Jason Wang
2015-07-30 11:56           ` Dr. David Alan Gilbert
2015-07-30 12:10             ` Gonglei
2015-07-30 12:30               ` Dr. David Alan Gilbert
2015-07-30 12:42                 ` zhanghailiang
2015-07-30 13:59                   ` Dr. David Alan Gilbert
2015-07-30 15:17                     ` Yang Hongyang
2015-07-30 17:53                       ` Dr. David Alan Gilbert
2015-07-31  1:08                         ` Yang Hongyang
2015-07-31  1:28                           ` zhanghailiang
2015-07-31  1:31                             ` Yang Hongyang
2015-07-31  1:26                         ` zhanghailiang
  -- strict thread matches above, loose matches on Subject: below --
2015-08-06 11:10 [Qemu-devel] [PATCH] MAINTAINERS: Add Samuel Thibault as slirp maintainer Samuel Thibault
2015-08-10 10:18 ` Stefan Hajnoczi
2016-03-07 12:14 ` Jan Kiszka

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