On Tue, Aug 02, 2016 at 07:23:26PM +0200, ggar...@abra.uab.cat wrote: > From: Gerard Garcia <ggar...@deic.uab.cat>
Missing commit description. From your cover letter: Once the guest puts a packet in the virtqueue it is guaranteed that it will be delivered. This patch addresses the problem of packets being discarded when there is not available memory in the host. > > v3: > * Avoid race condition when freeing timer. > > v2: > * Use of ERR_PTR/PTR_ERR/IS_ERR > * Timer cleaned on device release. > * Do not process more packets on error. > > Signed-off-by: Gerard Garcia <ggar...@deic.uab.cat> > --- > drivers/vhost/vsock.c | 52 > +++++++++++++++++++++++++++++++++++++++++---------- > 1 file changed, 42 insertions(+), 10 deletions(-) The changelog must be below the '---' to prevent it from being included in git log. (The changelog isn't useful once the patch has been merged.) > > diff --git a/drivers/vhost/vsock.c b/drivers/vhost/vsock.c > index 028ca16..8d4fb13 100644 > --- a/drivers/vhost/vsock.c > +++ b/drivers/vhost/vsock.c > @@ -15,11 +15,13 @@ > #include <net/sock.h> > #include <linux/virtio_vsock.h> > #include <linux/vhost.h> > +#include <linux/timer.h> > > #include <net/af_vsock.h> > #include "vhost.h" > > #define VHOST_VSOCK_DEFAULT_HOST_CID 2 > +#define OOM_RETRY_MS 100 > > enum { > VHOST_VSOCK_FEATURES = VHOST_FEATURES, > @@ -43,6 +45,8 @@ struct vhost_vsock { > atomic_t queued_replies; > > u32 guest_cid; > + > + struct timer_list tx_kick; > }; > > static u32 vhost_transport_get_local_cid(void) > @@ -229,12 +233,13 @@ vhost_vsock_alloc_pkt(struct vhost_virtqueue *vq, > > if (in != 0) { > vq_err(vq, "Expected 0 input buffers, got %u\n", in); > - return NULL; > + return ERR_PTR(-EINVAL); > } > > pkt = kzalloc(sizeof(*pkt), GFP_KERNEL); > - if (!pkt) > - return NULL; > + if (!pkt){ > + return ERR_PTR(-ENOMEM); > + } Kernel coding style omits the curly braces in a single-line if statement.
signature.asc
Description: PGP signature