[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <BLUPR03MB1410C2ECCBDEFC62CDA9928CBF910@BLUPR03MB1410.namprd03.prod.outlook.com>
Date: Fri, 8 Apr 2016 01:56:06 +0000
From: Dexuan Cui <decui@...rosoft.com>
To: Joe Perches <joe@...ches.com>,
"gregkh@...uxfoundation.org" <gregkh@...uxfoundation.org>,
"davem@...emloft.net" <davem@...emloft.net>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"devel@...uxdriverproject.org" <devel@...uxdriverproject.org>,
"olaf@...fle.de" <olaf@...fle.de>,
"apw@...onical.com" <apw@...onical.com>,
"jasowang@...hat.com" <jasowang@...hat.com>,
"cavery@...hat.com" <cavery@...hat.com>,
KY Srinivasan <kys@...rosoft.com>,
Haiyang Zhang <haiyangz@...rosoft.com>
CC: "vkuznets@...hat.com" <vkuznets@...hat.com>
Subject: RE: [PATCH v8 net-next 1/1] hv_sock: introduce Hyper-V Sockets
> From: Joe Perches [mailto:joe@...ches.com]
> Sent: Friday, April 8, 2016 9:15
> On Thu, 2016-04-07 at 18:36 -0700, Dexuan Cui wrote:
> > diff --git a/include/net/af_hvsock.h b/include/net/af_hvsock.h
> []
> > +#define VMBUS_RINGBUFFER_SIZE_HVSOCK_RECV (5 * PAGE_SIZE)
> > +#define VMBUS_RINGBUFFER_SIZE_HVSOCK_SEND (5 * PAGE_SIZE)
> > +
> > +#define HVSOCK_RCV_BUF_SZ
> VMBUS_RINGBUFFER_SIZE_HVSOCK_RECV
> > +#define HVSOCK_SND_BUF_SZ PAGE_SIZE
> []
> > +struct hvsock_sock {
> []
> > + struct {
> > + struct vmpipe_proto_header hdr;
> > + char buf[HVSOCK_SND_BUF_SZ];
> > + } __packed send;
> > +
> > + struct {
> > + struct vmpipe_proto_header hdr;
> > + char buf[HVSOCK_RCV_BUF_SZ];
> > + unsigned int data_len;
> > + unsigned int data_offset;
> > + } __packed recv;
> > +};
>
> These bufs are not page aligned and so can span pages.
>
> Is there any value in allocating these bufs separately
> as pages instead of as a kmalloc?
The bufs are not required to be page aligned.
Here the 'hdr' and the 'buf' must be consecutive, i.e., the 'buf' must be
an array rather than a pointer: please see hvsock_send_data().
It looks to me there is no big value to make sure the 'buf' is page
aligned: on x86_64, at least it should already be 8-byte aligned due to the
adjacent channel pointer, so memcpy_from_msg() should work
enough good and in hvsock_send_data() -> vmbus_sendpacket(),
we don't copy the 'buf'.
Thanks,
-- Dexuan
Powered by blists - more mailing lists