[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1732084.1685980332@warthog.procyon.org.uk>
Date: Mon, 05 Jun 2023 16:52:12 +0100
From: David Howells <dhowells@...hat.com>
To: David Laight <David.Laight@...LAB.COM>
Cc: dhowells@...hat.com,
'Linus Torvalds' <torvalds@...ux-foundation.org>,
Jakub Kicinski <kuba@...nel.org>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"David S. Miller" <davem@...emloft.net>,
"Eric
Dumazet" <edumazet@...gle.com>,
Paolo Abeni <pabeni@...hat.com>,
"Willem de
Bruijn" <willemdebruijn.kernel@...il.com>,
David Ahern <dsahern@...nel.org>,
Matthew Wilcox <willy@...radead.org>, Jens Axboe <axboe@...nel.dk>,
"linux-mm@...ck.org" <linux-mm@...ck.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Chuck Lever <chuck.lever@...cle.com>,
"Boris
Pismenny" <borisp@...dia.com>,
John Fastabend <john.fastabend@...il.com>,
Christoph Hellwig <hch@...radead.org>
Subject: Re: Bug in short splice to socket?
David Laight <David.Laight@...LAB.COM> wrote:
> > > However, this might well cause a malfunction in UDP, for example.
> > > MSG_MORE corks the current packet, so if I ask sendfile() say shove 32K
> > > into a packet, if, say, 16K is read from the source and entirely
> > > transcribed into the packet,
> >
> > If you use splice() for UDP, I don't think you would normally expect
> > to get all that well-defined packet boundaries.
>
> Especially since (assuming I've understood other bits of this thread)
> the splice() can get split into multiple sendmsg() calls for other
> reasons.
Yes - with SPLICE_F_MORE/MSG_MORE set on all but the last piece. The issue is
what happens if the input side gets a premature EOF after we've passed a chunk
with MSG_MORE set when the caller didn't indicate SPLICE_F_MORE?
> What semantics are you trying to implement for AF_TLS?
As I understand it, deasserting MSG_MORE causes a record boundary to be
interposed on TLS.
> MSG_MORE has different effects on different protocols.
Do you mean "different protocols" in relation to TLS specifically? Software vs
device vs device-specific like Chelsio-TLS?
> For UDP the next data is appended to the datagram being built.
> (This is really pretty pointless, doing it in the caller will be faster!)
Splice with SPLICE_F_MORE seems to work the same as sendmsg with MSG_MORE
here. You get an error if you try to append with splice or sendmsg more than
a single packet will hold.
> For TCP it stops the pending data being sent immediately.
> And more data is appended.
> I'm pretty sure it gets sent on timeout.
Yeah - corking is used by some network filesystem protocols, presumably to
better place RPC messages into TCP packets.
> For SCTP the data chunk created for the sendmsg() isn't sent immediately.
> Any more sendmsg(MSG_MORE) get queued until a full ethernet packet
> is buffered.
> The pending data is sent on timeout.
> This is pretty much the only way to get two (or more) DATA chunks
> into an ethernet frame when Nagle is disabled.
SCTP doesn't support sendpage, so that's not an issue.
> But I get the impression AF_TLS is deciding not to encode/send
> the data because 'there isn't enough'.
> That seems wrong.
>
> Note that you can't use a zero length sendmsg() to flush pending
> data - if there is no pending data some protocols will send a
> zero length data message.
> A socket option/ioctl (eg UNCORK) could be (ab)used to force
> queued data be sent.
Yeah - I've changed that, see v4. I've implemented Linus's ->splice_eof()
idea.
David
Powered by blists - more mailing lists