Unlike tcp_transmit_skb,
sctp_packet_transmit does not set ooo_okay explicitly,
causing unwanted Tx queue switching when multiqueue is in use;
Tx queue switching may cause out-of-order packets.
Change sctp_packet_transmit to allow Tx queue switching only for
the first in flight packet, to avoid unwanted Tx queue switching.
Signed-off-by: Wally Zhao <redacted>
---
net/sctp/output.c | 4 ++++
1 file changed, 4 insertions(+)
@@ -626,6 +626,10 @@ int sctp_packet_transmit(struct sctp_packet *packet, gfp_t gfp)/* neighbour should be confirmed on successful transmission or*positiveerror*/++/* allow switch tx queue only for the first in flight pkt */+head->ooo_okay=asoc->outqueue.outstanding_bytes==0;+if(tp->af_specific->sctp_xmit(head,tp)>=0&&tp->dst_pending_confirm)tp->dst_pending_confirm=0;
On Wed, Oct 30, 2019 at 12:07:17PM -0400, Wally Zhao wrote:
Unlike tcp_transmit_skb,
sctp_packet_transmit does not set ooo_okay explicitly,
causing unwanted Tx queue switching when multiqueue is in use;
It is initialized to 0 by __alloc_skb() via:
memset(skb, 0, offsetof(struct sk_buff, tail));
and never set to 1 by anyone for SCTP.
The patch description seems off. I don't see how the unwanted Tx queue
switching can happen. IOW, it's not fixing it OOO packets, but
improving it by allowing switching on the first packet. Am I missing
something?
quoted hunk
Tx queue switching may cause out-of-order packets.
Change sctp_packet_transmit to allow Tx queue switching only for
the first in flight packet, to avoid unwanted Tx queue switching.
Signed-off-by: Wally Zhao <redacted>
---
net/sctp/output.c | 4 ++++
1 file changed, 4 insertions(+)
@@ -626,6 +626,10 @@ int sctp_packet_transmit(struct sctp_packet *packet, gfp_t gfp)/* neighbour should be confirmed on successful transmission or*positiveerror*/++/* allow switch tx queue only for the first in flight pkt */+head->ooo_okay=asoc->outqueue.outstanding_bytes==0;
Considering we are talking about NIC queues here, we would have a
better result with tp->flight_size instead. As in, we can switch
queues if, for this transport, the queue is empty.
On 10/30/19, Marcelo Ricardo Leitner [off-list ref] wrote:
On Wed, Oct 30, 2019 at 12:07:17PM -0400, Wally Zhao wrote:
quoted
Unlike tcp_transmit_skb,
sctp_packet_transmit does not set ooo_okay explicitly,
causing unwanted Tx queue switching when multiqueue is in use;
It is initialized to 0 by __alloc_skb() via:
memset(skb, 0, offsetof(struct sk_buff, tail));
and never set to 1 by anyone for SCTP.
The patch description seems off. I don't see how the unwanted Tx queue
switching can happen. IOW, it's not fixing it OOO packets, but
improving it by allowing switching on the first packet. Am I missing
something?
Thanks for pointing this out. You are right. This ooo_okay is default to false.
I was observing some Tx queue switching before when testing with
iperf3 (modified to be able to set window size, for higher throughput
with long RTT), so I thought ooo_okay was set to true somewhere else
after allocation. Just now I did the test again, it turns out that
iperf3 made a re-connect silently which caused the Tx queue change.
As for the improving purpose of this patch, that is not that critical
from my side, and the patch description is not correct for this
purpose. So I will give up this patch attempt. Thank you again for
your time on this.
quoted
Tx queue switching may cause out-of-order packets.
Change sctp_packet_transmit to allow Tx queue switching only for
the first in flight packet, to avoid unwanted Tx queue switching.
Signed-off-by: Wally Zhao <redacted>
---
net/sctp/output.c | 4 ++++
1 file changed, 4 insertions(+)
@@ -626,6 +626,10 @@ int sctp_packet_transmit(struct sctp_packet *packet,
gfp_t gfp)
/* neighbour should be confirmed on successful transmission or
* positive error
*/
+
+ /* allow switch tx queue only for the first in flight pkt */
+ head->ooo_okay = asoc->outqueue.outstanding_bytes == 0;
Considering we are talking about NIC queues here, we would have a
better result with tp->flight_size instead. As in, we can switch
queues if, for this transport, the queue is empty.
On Wed, Oct 30, 2019 at 11:54:45PM +0800, Wei Zhao wrote:
On 10/30/19, Marcelo Ricardo Leitner [off-list ref] wrote:
quoted
On Wed, Oct 30, 2019 at 12:07:17PM -0400, Wally Zhao wrote:
quoted
Unlike tcp_transmit_skb,
sctp_packet_transmit does not set ooo_okay explicitly,
causing unwanted Tx queue switching when multiqueue is in use;
It is initialized to 0 by __alloc_skb() via:
memset(skb, 0, offsetof(struct sk_buff, tail));
and never set to 1 by anyone for SCTP.
The patch description seems off. I don't see how the unwanted Tx queue
switching can happen. IOW, it's not fixing it OOO packets, but
improving it by allowing switching on the first packet. Am I missing
something?
Thanks for pointing this out. You are right. This ooo_okay is default to false.
I was observing some Tx queue switching before when testing with
iperf3 (modified to be able to set window size, for higher throughput
with long RTT), so I thought ooo_okay was set to true somewhere else
after allocation. Just now I did the test again, it turns out that
iperf3 made a re-connect silently which caused the Tx queue change.
Ah, okay.
As for the improving purpose of this patch, that is not that critical
from my side, and the patch description is not correct for this
purpose. So I will give up this patch attempt. Thank you again for
your time on this.
As you wish. If you don't have the time for it, ok, but the
improvement is welcomed. With a more accurate description and using
tp->flight_size instead, it should be good.
Thanks,
Marcelo
quoted
quoted
Tx queue switching may cause out-of-order packets.
Change sctp_packet_transmit to allow Tx queue switching only for
the first in flight packet, to avoid unwanted Tx queue switching.
Signed-off-by: Wally Zhao <redacted>
---
net/sctp/output.c | 4 ++++
1 file changed, 4 insertions(+)
@@ -626,6 +626,10 @@ int sctp_packet_transmit(struct sctp_packet *packet,
gfp_t gfp)
/* neighbour should be confirmed on successful transmission or
* positive error
*/
+
+ /* allow switch tx queue only for the first in flight pkt */
+ head->ooo_okay = asoc->outqueue.outstanding_bytes == 0;
Considering we are talking about NIC queues here, we would have a
better result with tp->flight_size instead. As in, we can switch
queues if, for this transport, the queue is empty.
From: Eric Dumazet <hidden> Date: 2019-10-30 19:03:47
On 10/30/19 9:07 AM, Wally Zhao wrote:
Unlike tcp_transmit_skb,
sctp_packet_transmit does not set ooo_okay explicitly,
causing unwanted Tx queue switching when multiqueue is in use;
Tx queue switching may cause out-of-order packets.
Change sctp_packet_transmit to allow Tx queue switching only for
the first in flight packet, to avoid unwanted Tx queue switching.
While the patch seems fine, the changelog is quite confusing.
When skb->ooo_olay is 0 (which is the default for freshly allocated skbs),
the core networking stack will stick to whatever TX queue was chosen
at the time the dst_entry was attached to the (connected) socket.
This means no reorder can happen at all by default.
By setting ooo_okay carefully (as you did in your patch), you allow
core networking stack to _switch_ to another TX queue based on
current CPU (XPS selection)
So even without your fix, SCTP should not experience out-of-order packets.
@@ -626,6 +626,10 @@ int sctp_packet_transmit(struct sctp_packet *packet, gfp_t gfp)/* neighbour should be confirmed on successful transmission or*positiveerror*/++/* allow switch tx queue only for the first in flight pkt */+head->ooo_okay=asoc->outqueue.outstanding_bytes==0;+if(tp->af_specific->sctp_xmit(head,tp)>=0&&tp->dst_pending_confirm)tp->dst_pending_confirm=0;
On Thu, Oct 31, 2019 at 3:03 AM Eric Dumazet [off-list ref] wrote:
On 10/30/19 9:07 AM, Wally Zhao wrote:
quoted
Unlike tcp_transmit_skb,
sctp_packet_transmit does not set ooo_okay explicitly,
causing unwanted Tx queue switching when multiqueue is in use;
Tx queue switching may cause out-of-order packets.
Change sctp_packet_transmit to allow Tx queue switching only for
the first in flight packet, to avoid unwanted Tx queue switching.
While the patch seems fine, the changelog is quite confusing.
When skb->ooo_olay is 0 (which is the default for freshly allocated skbs),
the core networking stack will stick to whatever TX queue was chosen
at the time the dst_entry was attached to the (connected) socket.
This means no reorder can happen at all by default.
By setting ooo_okay carefully (as you did in your patch), you allow
core networking stack to _switch_ to another TX queue based on
current CPU (XPS selection)
So even without your fix, SCTP should not experience out-of-order packets.
Yes, you are right, as Marcelo also pointed out.
The changelog was given based on incorrect observation of a test
result, as I replied to Marcelo.
Since ooo_okay is default to 0, this is good enough; no need for any
patch from my side.
Thank you for your time on this.
@@ -626,6 +626,10 @@ int sctp_packet_transmit(struct sctp_packet *packet, gfp_t gfp)/* neighbour should be confirmed on successful transmission or*positiveerror*/++/* allow switch tx queue only for the first in flight pkt */+head->ooo_okay=asoc->outqueue.outstanding_bytes==0;+if(tp->af_specific->sctp_xmit(head,tp)>=0&&tp->dst_pending_confirm)tp->dst_pending_confirm=0;
Right, as asoc can be NULL by then. (per the check on it a few lines
before the change here).
Yes, apologize for missing the NULL check (Actually I realized some
further check is need to correctly identify the first in flight
packet, as outstanding_bytes has already been increased by this first
in flight packet itself before getting into sctp_packet_transmit).
Anyway, I think I do not need further action, as the patch is anyway
not going to be merged, the 0day robot picks up the patch from the
mail list directly instead of git repo, right?
Thanks a lot,
Wally
Right, as asoc can be NULL by then. (per the check on it a few lines
before the change here).
Yes, apologize for missing the NULL check (Actually I realized some
further check is need to correctly identify the first in flight
packet, as outstanding_bytes has already been increased by this first
in flight packet itself before getting into sctp_packet_transmit).
Anyway, I think I do not need further action, as the patch is anyway
not going to be merged, the 0day robot picks up the patch from the
mail list directly instead of git repo, right?
That's my understanding as well. I double checked and the patch wasn't
applied by Dave, so we're good.
Thanks,
Marcelo