2015-03-11 03:18:01

by Ying Xue

[permalink] [raw]
Subject: Re: net: Remove iocb argument from sendmsg and recvmsg

Sorry, I did not realize the case when I created the commit. However, although I
don't understand its scenario, in my opinion, adding one redundant argument for
all sockets to satisfy the special case seems unreasonable for us.

Regards,
Ying

On 03/11/2015 10:37 AM, Tadeusz Struk wrote:
> Hi,
> After couple of attempts to implement an user space interface to crypto HW that would meet our performance requirements, and after discussion with Herbert, we have come to conclusion that using AF_ALG sockets and AIO interface is the way to go.
> Unfortunately it looks like AIO operations will no longer be supported on sockets because of the commit 1b784140474e4fc94281a49e96c67d29df0efbde.
> My question is why do we want to abandon AIO support in the socket layer? Is it not worth keeping it for scenarios like this?
> Do we have any alternative?
> The mentioned patch attached for your reference.
> Regards,
> Tadeusz
>


2015-03-11 03:25:29

by Tadeusz Struk

[permalink] [raw]
Subject: Re: net: Remove iocb argument from sendmsg and recvmsg

On 03/10/2015 08:18 PM, Ying Xue wrote:
> Sorry, I did not realize the case when I created the commit. However, although I
> don't understand its scenario, in my opinion, adding one redundant argument for
> all sockets to satisfy the special case seems unreasonable for us.

In my opinion this is not about a single, special case, but rather about being able to support asynchronous operations on socket interface.
It is important for AF_ALG since we have crypto HW accelerators, that people want to access from user space, but in the future there might be other use cases.
Regards,
Tadeusz

2015-03-11 04:06:09

by David Miller

[permalink] [raw]
Subject: Re: net: Remove iocb argument from sendmsg and recvmsg

From: Ying Xue <[email protected]>
Date: Wed, 11 Mar 2015 11:18:01 +0800

> Sorry, I did not realize the case when I created the commit. However, although I
> don't understand its scenario, in my opinion, adding one redundant argument for
> all sockets to satisfy the special case seems unreasonable for us.

And the AIO socket mechanism was buggy and references freed up stack
objects.

That whole set of problems would need to be addressed fully before
we could even think of adding AIO support back to the socket layer.

2015-03-11 04:06:59

by David Miller

[permalink] [raw]
Subject: Re: net: Remove iocb argument from sendmsg and recvmsg

From: Tadeusz Struk <[email protected]>
Date: Tue, 10 Mar 2015 20:25:29 -0700

> In my opinion this is not about a single, special case, but rather
> about being able to support asynchronous operations on socket
> interface.

Nobody used the socket AIO facility for two decades, it just
rotted and turned out to be buggy and reference freed stack
memory on top of that.

I am absolutely not convinced this is the only way to solve your
problem.

2015-03-11 04:39:06

by Tadeusz Struk

[permalink] [raw]
Subject: Re: net: Remove iocb argument from sendmsg and recvmsg

On 03/10/2015 09:06 PM, David Miller wrote:
>> In my opinion this is not about a single, special case, but rather
>> > about being able to support asynchronous operations on socket
>> > interface.
> Nobody used the socket AIO facility for two decades, it just
> rotted and turned out to be buggy and reference freed stack
> memory on top of that.
>
> I am absolutely not convinced this is the only way to solve your
> problem.

Do you have any suggestion?

2015-03-11 16:28:13

by Tadeusz Struk

[permalink] [raw]
Subject: Re: net: Remove iocb argument from sendmsg and recvmsg

On 03/10/2015 09:06 PM, David Miller wrote:
> From: Ying Xue <[email protected]>
> Date: Wed, 11 Mar 2015 11:18:01 +0800
>
>> Sorry, I did not realize the case when I created the commit. However, although I
>> don't understand its scenario, in my opinion, adding one redundant argument for
>> all sockets to satisfy the special case seems unreasonable for us.
>
> And the AIO socket mechanism was buggy and references freed up stack
> objects.
>
> That whole set of problems would need to be addressed fully before
> we could even think of adding AIO support back to the socket layer.
>

Maybe we can add new sock_aio_read_iter() and sock_aio_write_iter() functions in socket.c, and set the
aio_read() and aio_write() ptrs to these in the socket_file_ops struct.
Then we can add new async_sendmsg() and async_recvmsg() to struct proto_ops that will still take the struct kiocb.
These new async_sendmsg() and async_recvmsg() functions will be called from the sock_aio_read_iter() and sock_aio_write_iter()?
Do you want me to put a patch together?