Re: [PATCH v4 05/13] xen/pvcalls: implement connect command

From: Boris Ostrovsky
Date: Thu Sep 21 2017 - 14:29:56 EST




On 09/15/2017 07:00 PM, Stefano Stabellini wrote:
Send PVCALLS_CONNECT to the backend. Allocate a new ring and evtchn for
the active socket.

Introduce fields in struct sock_mapping to keep track of active sockets.
Introduce a waitqueue to allow the frontend to wait on data coming from
the backend on the active socket (recvmsg command).

Two mutexes (one of reads and one for writes) will be used to protect
the active socket in and out rings from concurrent accesses.

Signed-off-by: Stefano Stabellini <stefano@xxxxxxxxxxx>

Reviewed-by: Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx>

with a couple of nits below and comments from previous patch applicable here.


+ bytes = (void *)__get_free_pages(GFP_KERNEL | __GFP_ZERO,
+ PVCALLS_RING_ORDER);

I don't think the cast is needed.


+ map = (struct sock_mapping *) sock->sk->sk_send_head;

Space between cast and variable.

> + req = RING_GET_REQUEST(&bedata->ring, req_id);
> + req->req_id = req_id;
> + req->cmd = PVCALLS_CONNECT;
> + req->u.connect.id = (uint64_t)map;
> + memcpy(req->u.connect.addr, addr, sizeof(*addr));

Move this down (I don't think there are any dependencies)

> + req->u.connect.len = addr_len;
> + req->u.connect.flags = flags;
> + req->u.connect.ref = map->active.ref;
> + req->u.connect.evtchn = evtchn;
> +


-boris