Thread (7 messages) flat view 7 messages, 3 authors, 2016-06-29

RE: [PATCH v12 net-next 1/1] hv_sock: introduce Hyper-V Sockets

From: Dexuan Cui <decui@microsoft.com>
Date: 2016-06-29 09:17:23
Also in: lkml

From: Rick Jones [mailto:rick.jones2@hpe.com]
Sent: Tuesday, June 28, 2016 23:43
To: Dexuan Cui <decui@microsoft.com>; David Miller <davem@davemloft.net>
Cc: gregkh@linuxfoundation.org; netdev@vger.kernel.org; linux-
kernel@vger.kernel.org; devel@linuxdriverproject.org; olaf@aepfle.de;
apw@canonical.com; jasowang@redhat.com; vkuznets@redhat.com;
cavery@redhat.com; KY Srinivasan [off-list ref]; Haiyang Zhang
[off-list ref]; joe@perches.com
Subject: Re: [PATCH v12 net-next 1/1] hv_sock: introduce Hyper-V Sockets

On 06/28/2016 02:59 AM, Dexuan Cui wrote:
quoted
The idea here is: IMO the syscalls sys_read()/write() shoudn't return
-ENOMEM, so I have to make sure the buffer allocation succeeds?

I tried to use kmalloc with __GFP_NOFAIL, but I hit a warning in
in mm/page_alloc.c:
WARN_ON_ONCE((gfp_flags & __GFP_NOFAIL) && (order > 1));

What error code do you think I should return?
EAGAIN, ERESTARTSYS, or something else?

May I have your suggestion? Thanks!
What happens as far as errno is concerned when an application makes a
read() call against a (say TCP) socket associated with a connection
which has been reset? 
I suppose it is ECONNRESET (Connection reset by peer).
 Is it limited to those errno values listed in the
read() manpage, or does it end-up getting an errno value from those
listed in the recv() manpage?  Or, perhaps even one not (presently)
listed in either?

rick jones
Actually "man read/write" says "Other errors may occur, depending on the
object connected to fd".

"man send/recv" indeed lists ENOMEM.

Considering AF_HYPERV is a new socket type, ENOMEM seems OK to me
and I'm going to post a new version of the patch.

In the long run, I think we should add a new API in the VMBus driver,
allowing data copy from VMBus ringbuffer into user mode buffer directly.
This way, we can even eliminate this temporary buffer.

Thanks,
-- Dexuan
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help