Re: [PATCH v4 00/12] virtio: s4 support

2011-12-06 Thread Amit Shah
On (Wed) 07 Dec 2011 [17:54:29], Rusty Russell wrote: > On Wed, 7 Dec 2011 01:18:38 +0530, Amit Shah wrote: > > Hi, > > > > These patches add support for S4 to virtio (pci) and all drivers. > > Dumb meta-question: why do we want to hibernate virtual machines? Not a dumb question at all :) But

Re: [PATCH v4 00/12] virtio: s4 support

2011-12-06 Thread Rusty Russell
On Wed, 7 Dec 2011 01:18:38 +0530, Amit Shah wrote: > Hi, > > These patches add support for S4 to virtio (pci) and all drivers. Dumb meta-question: why do we want to hibernate virtual machines? I figure there's a reason, but it seems a bit weird :) Thanks, Rusty. _

Re: [PATCH v4 12/12] virtio: balloon: Add freeze, restore handlers to support S4

2011-12-06 Thread Amit Shah
On (Wed) 07 Dec 2011 [01:18:50], Amit Shah wrote: [snip] > Now to not race with a host issuing ballooning requests while we are in > the process of freezing, we just exit from the vballoon kthread when the > processes are asked to freeze. Upon thaw and restore, we re-start the > thread. Actuall

Re: [PATCH v4 01/12] virtio: pci: switch to new PM API

2011-12-06 Thread Amit Shah
Hi Rafael, On (Tue) 06 Dec 2011 [23:12:36], Rafael J. Wysocki wrote: > Hi, > > On Tuesday, December 06, 2011, Amit Shah wrote: > > The older PM API doesn't have a way to get notifications on hibernate > > events. Switch to the newer one that gives us those notifications. > > > > Signed-off-by:

Re: [net-next RFC PATCH 5/5] virtio-net: flow director support

2011-12-06 Thread Jason Wang
On 12/06/2011 09:15 PM, Stefan Hajnoczi wrote: On Tue, Dec 6, 2011 at 10:21 AM, Jason Wang wrote: On 12/06/2011 05:18 PM, Stefan Hajnoczi wrote: On Tue, Dec 6, 2011 at 6:33 AM, Jason Wangwrote: On 12/05/2011 06:55 PM, Stefan Hajnoczi wrote: On Mon, Dec 5, 2011 at 8:59 AM, Jason Wang wr

Re: [net-next RFC PATCH 5/5] virtio-net: flow director support

2011-12-06 Thread Sridhar Samudrala
On 12/6/2011 8:14 AM, Michael S. Tsirkin wrote: On Tue, Dec 06, 2011 at 07:42:54AM -0800, Sridhar Samudrala wrote: On 12/6/2011 5:15 AM, Stefan Hajnoczi wrote: On Tue, Dec 6, 2011 at 10:21 AM, Jason Wang wrote: On 12/06/2011 05:18 PM, Stefan Hajnoczi wrote: On Tue, Dec 6, 2011 at 6:33 AM, J

Re: [PATCH v4 01/12] virtio: pci: switch to new PM API

2011-12-06 Thread Rafael J. Wysocki
Hi, On Tuesday, December 06, 2011, Amit Shah wrote: > The older PM API doesn't have a way to get notifications on hibernate > events. Switch to the newer one that gives us those notifications. > > Signed-off-by: Amit Shah > --- > drivers/virtio/virtio_pci.c | 16 > 1 files c

[PATCH v4 12/12] virtio: balloon: Add freeze, restore handlers to support S4

2011-12-06 Thread Amit Shah
Handling balloon hibernate / restore is tricky. If the balloon was inflated before going into the hibernation state, upon resume, the host will not have any memory of that. Any pages that were passed on to the host earlier would most likely be invalid, and the host will have to re-balloon to the

[PATCH v4 11/12] virtio: balloon: Move out vq initialization into separate function

2011-12-06 Thread Amit Shah
The probe and PM restore functions will share this code. Signed-off-by: Amit Shah --- drivers/virtio/virtio_balloon.c | 48 -- 1 files changed, 30 insertions(+), 18 deletions(-) diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_balloon.c

[PATCH v4 10/12] virtio: balloon: ensure thread exists before stopping it

2011-12-06 Thread Amit Shah
The vballoon thread could have exited earlier and not re-started. Ensure we don't try to stop a non-existent thread. This can happen if the balloon driver goes into S4 state and the thread exits (this code lands in the next patch). If, however, on restore, the vqs fail to initialise, the vballoon

[PATCH v4 09/12] virtio: net: Add freeze, restore handlers to support S4

2011-12-06 Thread Amit Shah
Remove all the vqs, disable napi and detach from the netdev on hibernation. Re-create vqs after restoring from a hibernated image, re-enable napi and re-attach the netdev. This keeps networking working across hibernation. Signed-off-by: Amit Shah --- drivers/net/virtio_net.c | 36 +++

[PATCH v4 08/12] virtio: net: Move out vq and vq buf removal into separate function

2011-12-06 Thread Amit Shah
The remove and PM freeze functions will share this code. Signed-off-by: Amit Shah --- drivers/net/virtio_net.c | 19 --- 1 files changed, 12 insertions(+), 7 deletions(-) diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index 6baa563..697a0fc 100644 --- a/drive

[PATCH v4 07/12] virtio: net: Move out vq initialization into separate function

2011-12-06 Thread Amit Shah
The probe and PM restore functions will share this code. Signed-off-by: Amit Shah --- drivers/net/virtio_net.c | 47 +++-- 1 files changed, 28 insertions(+), 19 deletions(-) diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index 6ee8410.

[PATCH v4 06/12] virtio: blk: Add freeze, restore handlers to support S4

2011-12-06 Thread Amit Shah
Delete the vq and flush any pending requests from the block queue on the freeze callback to prepare for hibernation. Re-create the vq in the restore callback to resume normal function. Signed-off-by: Amit Shah --- drivers/block/virtio_blk.c | 38 ++ 1 files

[PATCH v4 05/12] virtio: blk: Move out vq initialization to separate function

2011-12-06 Thread Amit Shah
The probe and PM restore functions will share this code. Signed-off-by: Amit Shah --- drivers/block/virtio_blk.c | 19 ++- 1 files changed, 14 insertions(+), 5 deletions(-) diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c index 4d0b70a..467f218 100644 --- a

[PATCH v4 04/12] virtio: console: Add freeze and restore handlers to support S4

2011-12-06 Thread Amit Shah
Remove all vqs and associated buffers in the freeze callback which prepares us to go into hibernation state. On restore, re-create all the vqs and populate the input vqs with buffers to get to the pre-hibernate state. Note: Any outstanding unconsumed buffers are discarded; which means there's a p

[PATCH v4 03/12] virtio: console: Move out vq and vq buf removal into separate functions

2011-12-06 Thread Amit Shah
This common code will be shared with the PM freeze function. Signed-off-by: Amit Shah --- drivers/char/virtio_console.c | 68 - 1 files changed, 40 insertions(+), 28 deletions(-) diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c

[PATCH v4 02/12] virtio: pci: add PM notification handlers for restore, freeze, thaw, poweroff

2011-12-06 Thread Amit Shah
Handle thaw, restore and freeze notifications from the PM core. Expose these to individual virtio drivers that can quiesce and resume vq operations. For drivers not implementing the thaw() method, use the restore method instead. These functions also save device-specific data so that the device c

[PATCH v4 01/12] virtio: pci: switch to new PM API

2011-12-06 Thread Amit Shah
The older PM API doesn't have a way to get notifications on hibernate events. Switch to the newer one that gives us those notifications. Signed-off-by: Amit Shah --- drivers/virtio/virtio_pci.c | 16 1 files changed, 12 insertions(+), 4 deletions(-) diff --git a/drivers/virt

[PATCH v4 00/12] virtio: s4 support

2011-12-06 Thread Amit Shah
Hi, These patches add support for S4 to virtio (pci) and all drivers. For each driver, all vqs are removed before hibernation, and then re-created after restore. Some driver-specific uninit and init work is also done in the freeze and restore functions. All the drivers in testing work fine: *

Re: [net-next RFC PATCH 5/5] virtio-net: flow director support

2011-12-06 Thread Ben Hutchings
On Tue, 2011-12-06 at 15:25 +0800, Jason Wang wrote: > On 12/06/2011 04:42 AM, Ben Hutchings wrote: [...] > > This is not a proper implementation of ndo_rx_flow_steer. If you steer > > a flow by changing the RSS table this can easily cause packet reordering > > in other flows. The filtering shoul

Re: [net-next RFC PATCH 2/5] tuntap: simple flow director support

2011-12-06 Thread Ben Hutchings
On Tue, 2011-12-06 at 15:21 +0800, Jason Wang wrote: > On 12/06/2011 04:09 AM, Ben Hutchings wrote: > > On Mon, 2011-12-05 at 16:58 +0800, Jason Wang wrote: > >> This patch adds a simple flow director to tun/tap device. It is just a > >> page that contains the hash to queue mapping which could be c

Re: [PATCH v3 2/3] hvc_init(): Enforce one-time initialization.

2011-12-06 Thread Miche Baker-Harvey
Amit, Ah, indeed. I am not using MSI-X, so virtio_pci::vp_try_to_find_vqs() calls vp_request_intx() and sets up an interrupt callback. From there, when an interrupt occurs, the stack looks something like this: virtio_pci::vp_interrupt() virtio_pci::vp_vring_interrupt() virtio_ring::vring_

Re: [Xen-devel] [PATCH RFC V3 2/4] kvm hypervisor : Add a hypercall to KVM hypervisor to support pv-ticketlocks

2011-12-06 Thread Konrad Rzeszutek Wilk
On Sun, Dec 04, 2011 at 11:36:58PM +0530, Raghavendra K T wrote: > On 12/02/2011 01:20 AM, Raghavendra K T wrote: > >>Have you tested it on AMD machines? There are some differences in the > >>hypercall infrastructure there. > > > >Yes. 'll test on AMD machine and update on that. > > > > I tested t

Re: [net-next RFC PATCH 5/5] virtio-net: flow director support

2011-12-06 Thread Michael S. Tsirkin
On Tue, Dec 06, 2011 at 07:42:54AM -0800, Sridhar Samudrala wrote: > On 12/6/2011 5:15 AM, Stefan Hajnoczi wrote: > >On Tue, Dec 6, 2011 at 10:21 AM, Jason Wang wrote: > >>On 12/06/2011 05:18 PM, Stefan Hajnoczi wrote: > >>>On Tue, Dec 6, 2011 at 6:33 AM, Jason Wangwrote: > On 12/05/2011 0

Re: [net-next RFC PATCH 5/5] virtio-net: flow director support

2011-12-06 Thread Sridhar Samudrala
On 12/6/2011 5:15 AM, Stefan Hajnoczi wrote: On Tue, Dec 6, 2011 at 10:21 AM, Jason Wang wrote: On 12/06/2011 05:18 PM, Stefan Hajnoczi wrote: On Tue, Dec 6, 2011 at 6:33 AM, Jason Wangwrote: On 12/05/2011 06:55 PM, Stefan Hajnoczi wrote: On Mon, Dec 5, 2011 at 8:59 AM, Jason Wang wrot

Re: [net-next RFC PATCH 5/5] virtio-net: flow director support

2011-12-06 Thread Stefan Hajnoczi
On Tue, Dec 6, 2011 at 10:21 AM, Jason Wang wrote: > On 12/06/2011 05:18 PM, Stefan Hajnoczi wrote: >> >> On Tue, Dec 6, 2011 at 6:33 AM, Jason Wang  wrote: >>> >>> On 12/05/2011 06:55 PM, Stefan Hajnoczi wrote: On Mon, Dec 5, 2011 at 8:59 AM, Jason Wang  wrote: >> The vcpus are jus

Re: [PATCH] virtio-ring: Use threshold for switching to indirect descriptors

2011-12-06 Thread Rusty Russell
On Tue, 06 Dec 2011 11:58:21 +0200, Avi Kivity wrote: > On 12/06/2011 07:07 AM, Rusty Russell wrote: > > Yes, but the hypervisor/trusted party would simply have to do the copy; > > the rings themselves would be shared A would say "copy this to/from B's > > ring entry N" and you know that A can't h

Re: [net-next RFC PATCH 5/5] virtio-net: flow director support

2011-12-06 Thread Jason Wang
On 12/06/2011 05:18 PM, Stefan Hajnoczi wrote: On Tue, Dec 6, 2011 at 6:33 AM, Jason Wang wrote: On 12/05/2011 06:55 PM, Stefan Hajnoczi wrote: On Mon, Dec 5, 2011 at 8:59 AM, Jason Wangwrote: +static int virtnet_set_fd(struct net_device *dev, u32 pfn) +{ + struct virtnet_info *vi =

Re: [PATCH] virtio-ring: Use threshold for switching to indirect descriptors

2011-12-06 Thread Avi Kivity
On 12/06/2011 07:07 AM, Rusty Russell wrote: > On Mon, 05 Dec 2011 11:52:54 +0200, Avi Kivity wrote: > > On 12/05/2011 02:10 AM, Rusty Russell wrote: > > > On Sun, 04 Dec 2011 17:16:59 +0200, Avi Kivity wrote: > > > > On 12/04/2011 05:11 PM, Michael S. Tsirkin wrote: > > > > > > There's also the

Re: [net-next RFC PATCH 5/5] virtio-net: flow director support

2011-12-06 Thread Stefan Hajnoczi
On Tue, Dec 6, 2011 at 6:33 AM, Jason Wang wrote: > On 12/05/2011 06:55 PM, Stefan Hajnoczi wrote: >> >> On Mon, Dec 5, 2011 at 8:59 AM, Jason Wang  wrote: >>> >>> +static int virtnet_set_fd(struct net_device *dev, u32 pfn) >>> +{ >>> +       struct virtnet_info *vi = netdev_priv(dev); >>> +