Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751860AbdIUS3v (ORCPT ); Thu, 21 Sep 2017 14:29:51 -0400 Received: from aserp1040.oracle.com ([141.146.126.69]:22681 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751621AbdIUS3u (ORCPT ); Thu, 21 Sep 2017 14:29:50 -0400 Subject: Re: [PATCH v4 05/13] xen/pvcalls: implement connect command To: Stefano Stabellini , xen-devel@lists.xen.org Cc: linux-kernel@vger.kernel.org, jgross@suse.com, Stefano Stabellini References: <1505516440-11111-1-git-send-email-sstabellini@kernel.org> <1505516440-11111-5-git-send-email-sstabellini@kernel.org> From: Boris Ostrovsky Message-ID: <092f915e-609c-928a-78b5-a832588ee3a3@oracle.com> Date: Thu, 21 Sep 2017 14:28:53 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: <1505516440-11111-5-git-send-email-sstabellini@kernel.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Source-IP: aserv0021.oracle.com [141.146.126.233] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1346 Lines: 47 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 Reviewed-by: Boris Ostrovsky 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