mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] pvcalls-back: do not return error on inet_accept EAGAIN
@ 2018-02-03  1:34 Stefano Stabellini
  2018-02-04 19:20 ` Boris Ostrovsky
  2018-02-06 14:52 ` Juergen Gross
  0 siblings, 2 replies; 5+ messages in thread
From: Stefano Stabellini @ 2018-02-03  1:34 UTC (permalink / raw)
  To: jgross, boris.ostrovsky; +Cc: xen-devel, linux-kernel, sstabellini

When the client sends a regular blocking accept request, the backend is
expected to return only when the accept is completed, simulating a
blocking behavior, or return an error.

Specifically, on EAGAIN from inet_accept, the backend shouldn't return
"EAGAIN" to the client. Instead, it should simply continue the wait.
Otherwise, the client will send another accept request, which will cause
another EAGAIN to be sent back, which is a waste of resources and not
conforming to the expected behavior. Change the behavior by turning the
"goto error" into a return.

Signed-off-by: Stefano Stabellini <stefano@aporeto.com>

diff --git a/drivers/xen/pvcalls-back.c b/drivers/xen/pvcalls-back.c
index c7822d8..156e5ae 100644
--- a/drivers/xen/pvcalls-back.c
+++ b/drivers/xen/pvcalls-back.c
@@ -548,7 +548,7 @@ static void __pvcalls_back_accept(struct work_struct *work)
 	ret = inet_accept(mappass->sock, sock, O_NONBLOCK, true);
 	if (ret == -EAGAIN) {
 		sock_release(sock);
-		goto out_error;
+		return;
 	}
 
 	map = pvcalls_new_active_socket(fedata,

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] pvcalls-back: do not return error on inet_accept EAGAIN
  2018-02-03  1:34 [PATCH] pvcalls-back: do not return error on inet_accept EAGAIN Stefano Stabellini
@ 2018-02-04 19:20 ` Boris Ostrovsky
  2018-02-05 18:01   ` Stefano Stabellini
  2018-02-06 14:52 ` Juergen Gross
  1 sibling, 1 reply; 5+ messages in thread
From: Boris Ostrovsky @ 2018-02-04 19:20 UTC (permalink / raw)
  To: Stefano Stabellini, jgross; +Cc: xen-devel, linux-kernel



On 02/02/2018 08:34 PM, Stefano Stabellini wrote:
> When the client sends a regular blocking accept request, the backend is
> expected to return only when the accept is completed, simulating a
> blocking behavior, or return an error.
>
> Specifically, on EAGAIN from inet_accept, the backend shouldn't return
> "EAGAIN" to the client. Instead, it should simply continue the wait.
> Otherwise, the client will send another accept request, which will cause
> another EAGAIN to be sent back, which is a waste of resources and not
> conforming to the expected behavior. Change the behavior by turning the
> "goto error" into a return.
>
> Signed-off-by: Stefano Stabellini <stefano@aporeto.com>


I am looking at SYSCALL_DEFINE4(accept4) and sock->ops->accept (which *I 
think* is inet_accept, at least in some cases) passes all errors 
(including EAGAIN)  back to the caller. Is this a different case?

-boris

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] pvcalls-back: do not return error on inet_accept EAGAIN
  2018-02-04 19:20 ` Boris Ostrovsky
@ 2018-02-05 18:01   ` Stefano Stabellini
  2018-02-05 18:34     ` Boris Ostrovsky
  0 siblings, 1 reply; 5+ messages in thread
From: Stefano Stabellini @ 2018-02-05 18:01 UTC (permalink / raw)
  To: Boris Ostrovsky; +Cc: Stefano Stabellini, jgross, xen-devel, linux-kernel

[-- Attachment #1: Type: TEXT/PLAIN, Size: 1488 bytes --]

On Sun, 4 Feb 2018, Boris Ostrovsky wrote:
> On 02/02/2018 08:34 PM, Stefano Stabellini wrote:
> > When the client sends a regular blocking accept request, the backend is
> > expected to return only when the accept is completed, simulating a
> > blocking behavior, or return an error.
> > 
> > Specifically, on EAGAIN from inet_accept, the backend shouldn't return
> > "EAGAIN" to the client. Instead, it should simply continue the wait.
> > Otherwise, the client will send another accept request, which will cause
> > another EAGAIN to be sent back, which is a waste of resources and not
> > conforming to the expected behavior. Change the behavior by turning the
> > "goto error" into a return.
> > 
> > Signed-off-by: Stefano Stabellini <stefano@aporeto.com>
> 
> 
> I am looking at SYSCALL_DEFINE4(accept4) and sock->ops->accept (which *I
> think* is inet_accept, at least in some cases) passes all errors (including
> EAGAIN)  back to the caller. Is this a different case?

Hi Boris,

I didn't explain myself well. You are right that inet_accept passes all
errors back to the caller, but this is different: not only it would be a
waste of resources to do so, but the different behavior is specified in
the PVCalls spec:

"The backend will reply to the request only when a new connection is
successfully accepted, i.e. the backend does not return EAGAIN or
EWOULDBLOCK."

https://xenbits.xen.org/docs/unstable/misc/pvcalls.html

Look under the "Accept" sub-chapter.

Cheers,

Stefano

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] pvcalls-back: do not return error on inet_accept EAGAIN
  2018-02-05 18:01   ` Stefano Stabellini
@ 2018-02-05 18:34     ` Boris Ostrovsky
  0 siblings, 0 replies; 5+ messages in thread
From: Boris Ostrovsky @ 2018-02-05 18:34 UTC (permalink / raw)
  To: Stefano Stabellini; +Cc: jgross, xen-devel, linux-kernel

On 02/05/2018 01:01 PM, Stefano Stabellini wrote:
> On Sun, 4 Feb 2018, Boris Ostrovsky wrote:
>> On 02/02/2018 08:34 PM, Stefano Stabellini wrote:
>>> When the client sends a regular blocking accept request, the backend is
>>> expected to return only when the accept is completed, simulating a
>>> blocking behavior, or return an error.
>>>
>>> Specifically, on EAGAIN from inet_accept, the backend shouldn't return
>>> "EAGAIN" to the client. Instead, it should simply continue the wait.
>>> Otherwise, the client will send another accept request, which will cause
>>> another EAGAIN to be sent back, which is a waste of resources and not
>>> conforming to the expected behavior. Change the behavior by turning the
>>> "goto error" into a return.
>>>
>>> Signed-off-by: Stefano Stabellini <stefano@aporeto.com>
>>
>> I am looking at SYSCALL_DEFINE4(accept4) and sock->ops->accept (which *I
>> think* is inet_accept, at least in some cases) passes all errors (including
>> EAGAIN)  back to the caller. Is this a different case?
> Hi Boris,
>
> I didn't explain myself well. You are right that inet_accept passes all
> errors back to the caller, but this is different: not only it would be a
> waste of resources to do so, but the different behavior is specified in
> the PVCalls spec:
>
> "The backend will reply to the request only when a new connection is
> successfully accepted, i.e. the backend does not return EAGAIN or
> EWOULDBLOCK."

Got it, thanks.

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


-boris


>
> https://xenbits.xen.org/docs/unstable/misc/pvcalls.html
>
> Look under the "Accept" sub-chapter.
>
> Cheers,
>
> Stefano

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] pvcalls-back: do not return error on inet_accept EAGAIN
  2018-02-03  1:34 [PATCH] pvcalls-back: do not return error on inet_accept EAGAIN Stefano Stabellini
  2018-02-04 19:20 ` Boris Ostrovsky
@ 2018-02-06 14:52 ` Juergen Gross
  1 sibling, 0 replies; 5+ messages in thread
From: Juergen Gross @ 2018-02-06 14:52 UTC (permalink / raw)
  To: Stefano Stabellini, boris.ostrovsky; +Cc: xen-devel, linux-kernel

On 03/02/18 02:34, Stefano Stabellini wrote:
> When the client sends a regular blocking accept request, the backend is
> expected to return only when the accept is completed, simulating a
> blocking behavior, or return an error.
> 
> Specifically, on EAGAIN from inet_accept, the backend shouldn't return
> "EAGAIN" to the client. Instead, it should simply continue the wait.
> Otherwise, the client will send another accept request, which will cause
> another EAGAIN to be sent back, which is a waste of resources and not
> conforming to the expected behavior. Change the behavior by turning the
> "goto error" into a return.
> 
> Signed-off-by: Stefano Stabellini <stefano@aporeto.com>

Committed to xen.tip for-linus-4.16


Juergen

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-02-06 14:52 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-03  1:34 [PATCH] pvcalls-back: do not return error on inet_accept EAGAIN Stefano Stabellini
2018-02-04 19:20 ` Boris Ostrovsky
2018-02-05 18:01   ` Stefano Stabellini
2018-02-05 18:34     ` Boris Ostrovsky
2018-02-06 14:52 ` Juergen Gross

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®