Cake - FQ_codel the next generation
 help / color / mirror / Atom feed
* [Cake] cake srchost/dsthost stopped working?
@ 2021-08-03 16:03 Pete Heist
  2021-08-03 19:46 ` Pete Heist
  0 siblings, 1 reply; 12+ messages in thread
From: Pete Heist @ 2021-08-03 16:03 UTC (permalink / raw)
  To: Cake List

It seems like Cake's srchost and dsthost keywords may have stopped
working some time between kernel 5.4 and 5.10.

When the bug occurs, there seems to not be fairness between hosts, but
rather fairness between flows. It reproduces on any 5.10 series kernel
I've tried, and does not reproduce on any 5.4 series or lower. Here's a
standalone script to reproduce it with netns, and some sample output:

https://www.heistp.net/downloads/cake-hostfair/

It creates competition from one IP to two IPs, and from two IPs to one
IP, using the src/dsthost keywords as appropriate. It also tests
fq_codel with a tc-flow filter, and cake *dual*-(src|dst)host, which
are both unaffected by this.

Any ideas?

Pete



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

* Re: [Cake] cake srchost/dsthost stopped working?
  2021-08-03 16:03 [Cake] cake srchost/dsthost stopped working? Pete Heist
@ 2021-08-03 19:46 ` Pete Heist
  2021-08-04 11:14   ` Toke Høiland-Jørgensen
  0 siblings, 1 reply; 12+ messages in thread
From: Pete Heist @ 2021-08-03 19:46 UTC (permalink / raw)
  To: Cake List

One more tip, reverting this commit seems to fix it:

https://github.com/torvalds/linux/commit/b0c19ed6088ab41dd2a727b60594b7297c15d6ce

Pete

On Tue, 2021-08-03 at 18:03 +0200, Pete Heist wrote:
> It seems like Cake's srchost and dsthost keywords may have stopped
> working some time between kernel 5.4 and 5.10.
> 
> When the bug occurs, there seems to not be fairness between hosts, but
> rather fairness between flows. It reproduces on any 5.10 series kernel
> I've tried, and does not reproduce on any 5.4 series or lower. Here's a
> standalone script to reproduce it with netns, and some sample output:
> 
> https://www.heistp.net/downloads/cake-hostfair/
> 
> It creates competition from one IP to two IPs, and from two IPs to one
> IP, using the src/dsthost keywords as appropriate. It also tests
> fq_codel with a tc-flow filter, and cake *dual*-(src|dst)host, which
> are both unaffected by this.
> 
> Any ideas?
> 
> Pete
> 
> 



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

* Re: [Cake] cake srchost/dsthost stopped working?
  2021-08-03 19:46 ` Pete Heist
@ 2021-08-04 11:14   ` Toke Høiland-Jørgensen
  2021-08-04 11:36     ` Jonathan Morton
                       ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Toke Høiland-Jørgensen @ 2021-08-04 11:14 UTC (permalink / raw)
  To: Pete Heist, Cake List

Pete Heist <pete@heistp.net> writes:

> One more tip, reverting this commit seems to fix it:
>
> https://github.com/torvalds/linux/commit/b0c19ed6088ab41dd2a727b60594b7297c15d6ce

Ah, I think I see what the problem is; could you please try the patch
below?

-Toke

diff --git a/net/sched/sch_cake.c b/net/sched/sch_cake.c
index 951542843cab..a83c4d4326da 100644
--- a/net/sched/sch_cake.c
+++ b/net/sched/sch_cake.c
@@ -720,7 +720,7 @@ static u32 cake_hash(struct cake_tin_data *q, const struct sk_buff *skb,
 skip_hash:
        if (flow_override)
                flow_hash = flow_override - 1;
-       else if (use_skbhash)
+       else if (use_skbhash && flow_mode & CAKE_FLOW_FLOWS)
                flow_hash = skb->hash;
        if (host_override) {
                dsthost_hash = host_override - 1;

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

* Re: [Cake] cake srchost/dsthost stopped working?
  2021-08-04 11:14   ` Toke Høiland-Jørgensen
@ 2021-08-04 11:36     ` Jonathan Morton
  2021-08-04 19:29       ` Toke Høiland-Jørgensen
  2021-08-04 20:49     ` Pete Heist
  2021-08-11  3:57     ` Stephen Hemminger
  2 siblings, 1 reply; 12+ messages in thread
From: Jonathan Morton @ 2021-08-04 11:36 UTC (permalink / raw)
  To: Toke Høiland-Jørgensen; +Cc: Pete Heist, Cake List

On Wed, 4 Aug 2021 at 14:14, Toke Høiland-Jørgensen via Cake
<cake@lists.bufferbloat.net> wrote:
>
> Pete Heist <pete@heistp.net> writes:
>
> > One more tip, reverting this commit seems to fix it:
> >
> > https://github.com/torvalds/linux/commit/b0c19ed6088ab41dd2a727b60594b7297c15d6ce
>
> Ah, I think I see what the problem is; could you please try the patch
> below?
>
> -Toke
>
> diff --git a/net/sched/sch_cake.c b/net/sched/sch_cake.c
> index 951542843cab..a83c4d4326da 100644
> --- a/net/sched/sch_cake.c
> +++ b/net/sched/sch_cake.c
> @@ -720,7 +720,7 @@ static u32 cake_hash(struct cake_tin_data *q, const struct sk_buff *skb,
>  skip_hash:
>         if (flow_override)
>                 flow_hash = flow_override - 1;
> -       else if (use_skbhash)
> +       else if (use_skbhash && flow_mode & CAKE_FLOW_FLOWS)
>                 flow_hash = skb->hash;
>         if (host_override) {
>                 dsthost_hash = host_override - 1;

Good catch - I was going to have to wade in and remind myself how this
lump of code worked.  But shouldn't the masking operation be in
brackets, to make the precedence explicit?

 - Jonathan Morton

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

* Re: [Cake] cake srchost/dsthost stopped working?
  2021-08-04 11:36     ` Jonathan Morton
@ 2021-08-04 19:29       ` Toke Høiland-Jørgensen
  0 siblings, 0 replies; 12+ messages in thread
From: Toke Høiland-Jørgensen @ 2021-08-04 19:29 UTC (permalink / raw)
  To: Jonathan Morton; +Cc: Pete Heist, Cake List

Jonathan Morton <chromatix99@gmail.com> writes:

> On Wed, 4 Aug 2021 at 14:14, Toke Høiland-Jørgensen via Cake
> <cake@lists.bufferbloat.net> wrote:
>>
>> Pete Heist <pete@heistp.net> writes:
>>
>> > One more tip, reverting this commit seems to fix it:
>> >
>> > https://github.com/torvalds/linux/commit/b0c19ed6088ab41dd2a727b60594b7297c15d6ce
>>
>> Ah, I think I see what the problem is; could you please try the patch
>> below?
>>
>> -Toke
>>
>> diff --git a/net/sched/sch_cake.c b/net/sched/sch_cake.c
>> index 951542843cab..a83c4d4326da 100644
>> --- a/net/sched/sch_cake.c
>> +++ b/net/sched/sch_cake.c
>> @@ -720,7 +720,7 @@ static u32 cake_hash(struct cake_tin_data *q, const struct sk_buff *skb,
>>  skip_hash:
>>         if (flow_override)
>>                 flow_hash = flow_override - 1;
>> -       else if (use_skbhash)
>> +       else if (use_skbhash && flow_mode & CAKE_FLOW_FLOWS)
>>                 flow_hash = skb->hash;
>>         if (host_override) {
>>                 dsthost_hash = host_override - 1;
>
> Good catch - I was going to have to wade in and remind myself how this
> lump of code worked.  But shouldn't the masking operation be in
> brackets, to make the precedence explicit?

Well, seeing as I introduced the bug, I think it's only fair that I fix
it as well ;)

I don't mind adding parenthesis; can do so when submitting a patch,
after Pete confirms that this fixes the issue...

-Toke

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

* Re: [Cake] cake srchost/dsthost stopped working?
  2021-08-04 11:14   ` Toke Høiland-Jørgensen
  2021-08-04 11:36     ` Jonathan Morton
@ 2021-08-04 20:49     ` Pete Heist
  2021-08-04 22:52       ` Pete Heist
  2021-08-11  3:57     ` Stephen Hemminger
  2 siblings, 1 reply; 12+ messages in thread
From: Pete Heist @ 2021-08-04 20:49 UTC (permalink / raw)
  To: Toke Høiland-Jørgensen; +Cc: Cake List

Great, that seems to fix it. :) For sanity, I confirmed that I can
apply/unapply the patch to fix/break it, so all seems well.

Is there anything that you'd want to make sure still works after the
patch? I don't have any official regression tests to run, but with this
setup ready I should be able to test something easily if needed...

Pete

On Wed, 2021-08-04 at 13:14 +0200, Toke Høiland-Jørgensen wrote:
> Pete Heist <pete@heistp.net> writes:
> 
> > One more tip, reverting this commit seems to fix it:
> > 
> > https://github.com/torvalds/linux/commit/b0c19ed6088ab41dd2a727b60594b7297c15d6ce
> 
> Ah, I think I see what the problem is; could you please try the patch
> below?
> 
> -Toke
> 
> diff --git a/net/sched/sch_cake.c b/net/sched/sch_cake.c
> index 951542843cab..a83c4d4326da 100644
> --- a/net/sched/sch_cake.c
> +++ b/net/sched/sch_cake.c
> @@ -720,7 +720,7 @@ static u32 cake_hash(struct cake_tin_data *q,
> const struct sk_buff *skb,
>  skip_hash:
>         if (flow_override)
>                 flow_hash = flow_override - 1;
> -       else if (use_skbhash)
> +       else if (use_skbhash && flow_mode & CAKE_FLOW_FLOWS)
>                 flow_hash = skb->hash;
>         if (host_override) {
>                 dsthost_hash = host_override - 1;



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

* Re: [Cake] cake srchost/dsthost stopped working?
  2021-08-04 20:49     ` Pete Heist
@ 2021-08-04 22:52       ` Pete Heist
  2021-08-04 23:26         ` Jonathan Morton
  2021-08-05  8:55         ` Pete Heist
  0 siblings, 2 replies; 12+ messages in thread
From: Pete Heist @ 2021-08-04 22:52 UTC (permalink / raw)
  To: Toke Høiland-Jørgensen; +Cc: Cake List

I ended up testing each of the keywords, with two src IPs then two dst
IPs, and I think everything makes sense:

https://www.heistp.net/downloads/cake-hostfair/cake-hostfair-patched.txt

I'm only not sure if we can tell from this test if triple-isolate is
doing what it should...

Pete

On Wed, 2021-08-04 at 22:49 +0200, Pete Heist wrote:
> Great, that seems to fix it. :) For sanity, I confirmed that I can
> apply/unapply the patch to fix/break it, so all seems well.
> 
> Is there anything that you'd want to make sure still works after the
> patch? I don't have any official regression tests to run, but with this
> setup ready I should be able to test something easily if needed...
> 
> Pete
> 
> On Wed, 2021-08-04 at 13:14 +0200, Toke Høiland-Jørgensen wrote:
> > Pete Heist <pete@heistp.net> writes:
> > 
> > > One more tip, reverting this commit seems to fix it:
> > > 
> > > https://github.com/torvalds/linux/commit/b0c19ed6088ab41dd2a727b60594b7297c15d6ce
> > 
> > Ah, I think I see what the problem is; could you please try the patch
> > below?
> > 
> > -Toke
> > 
> > diff --git a/net/sched/sch_cake.c b/net/sched/sch_cake.c
> > index 951542843cab..a83c4d4326da 100644
> > --- a/net/sched/sch_cake.c
> > +++ b/net/sched/sch_cake.c
> > @@ -720,7 +720,7 @@ static u32 cake_hash(struct cake_tin_data *q,
> > const struct sk_buff *skb,
> >  skip_hash:
> >         if (flow_override)
> >                 flow_hash = flow_override - 1;
> > -       else if (use_skbhash)
> > +       else if (use_skbhash && flow_mode & CAKE_FLOW_FLOWS)
> >                 flow_hash = skb->hash;
> >         if (host_override) {
> >                 dsthost_hash = host_override - 1;
> 
> 



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

* Re: [Cake] cake srchost/dsthost stopped working?
  2021-08-04 22:52       ` Pete Heist
@ 2021-08-04 23:26         ` Jonathan Morton
  2021-08-05  8:55         ` Pete Heist
  1 sibling, 0 replies; 12+ messages in thread
From: Jonathan Morton @ 2021-08-04 23:26 UTC (permalink / raw)
  To: Pete Heist; +Cc: Toke Høiland-Jørgensen, Cake List

Those results look good to me as well.  The difference between the
dual modes and the pure host modes is visible in terms of looser
fairness in the latter case.

Don't worry too much about triple-isolate, as it is significantly more
complicated to test comprehensively.  I'm satisfied that if the dual
modes are working, we probably haven't broken triple-isolate either.

 - Jonathan Morton

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

* Re: [Cake] cake srchost/dsthost stopped working?
  2021-08-04 22:52       ` Pete Heist
  2021-08-04 23:26         ` Jonathan Morton
@ 2021-08-05  8:55         ` Pete Heist
  2021-08-05 14:56           ` Toke Høiland-Jørgensen
  1 sibling, 1 reply; 12+ messages in thread
From: Pete Heist @ 2021-08-05  8:55 UTC (permalink / raw)
  To: Toke Høiland-Jørgensen; +Cc: Cake List

As for triple-isolate, I added a test Jon suggested:

"I would recommend a W configuration of flows

one of the three hosts sends to or from both of the two hosts, while
the other two send to or from only one each

this should result in the two hosts getting equal throughput each, and
equal throughput in each of their two flows"

This is the last test in the output, and I think the behavior looks
correct for both the unpatched and patched versions:

https://www.heistp.net/downloads/cake-hostfair/cake-hostfair-unpatched.txt

https://www.heistp.net/downloads/cake-hostfair/cake-hostfair-patched.txt

Thanks guys, and that, I believe, is finally it for now... :)

Pete

On Thu, 2021-08-05 at 00:52 +0200, Pete Heist wrote:
> I ended up testing each of the keywords, with two src IPs then two dst
> IPs, and I think everything makes sense:
> 
> https://www.heistp.net/downloads/cake-hostfair/cake-hostfair-patched.txt
> 
> I'm only not sure if we can tell from this test if triple-isolate is
> doing what it should...
> 
> Pete
> 
> On Wed, 2021-08-04 at 22:49 +0200, Pete Heist wrote:
> > Great, that seems to fix it. :) For sanity, I confirmed that I can
> > apply/unapply the patch to fix/break it, so all seems well.
> > 
> > Is there anything that you'd want to make sure still works after the
> > patch? I don't have any official regression tests to run, but with
> > this
> > setup ready I should be able to test something easily if needed...
> > 
> > Pete
> > 
> > On Wed, 2021-08-04 at 13:14 +0200, Toke Høiland-Jørgensen wrote:
> > > Pete Heist <pete@heistp.net> writes:
> > > 
> > > > One more tip, reverting this commit seems to fix it:
> > > > 
> > > > https://github.com/torvalds/linux/commit/b0c19ed6088ab41dd2a727b60594b7297c15d6ce
> > > 
> > > Ah, I think I see what the problem is; could you please try the
> > > patch
> > > below?
> > > 
> > > -Toke
> > > 
> > > diff --git a/net/sched/sch_cake.c b/net/sched/sch_cake.c
> > > index 951542843cab..a83c4d4326da 100644
> > > --- a/net/sched/sch_cake.c
> > > +++ b/net/sched/sch_cake.c
> > > @@ -720,7 +720,7 @@ static u32 cake_hash(struct cake_tin_data *q,
> > > const struct sk_buff *skb,
> > >  skip_hash:
> > >         if (flow_override)
> > >                 flow_hash = flow_override - 1;
> > > -       else if (use_skbhash)
> > > +       else if (use_skbhash && flow_mode & CAKE_FLOW_FLOWS)
> > >                 flow_hash = skb->hash;
> > >         if (host_override) {
> > >                 dsthost_hash = host_override - 1;
> > 
> > 
> 
> 



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

* Re: [Cake] cake srchost/dsthost stopped working?
  2021-08-05  8:55         ` Pete Heist
@ 2021-08-05 14:56           ` Toke Høiland-Jørgensen
  2021-08-06 10:08             ` Pete Heist
  0 siblings, 1 reply; 12+ messages in thread
From: Toke Høiland-Jørgensen @ 2021-08-05 14:56 UTC (permalink / raw)
  To: Pete Heist; +Cc: Cake List

Pete Heist <pete@heistp.net> writes:

> As for triple-isolate, I added a test Jon suggested:
>
> "I would recommend a W configuration of flows
>
> one of the three hosts sends to or from both of the two hosts, while
> the other two send to or from only one each
>
> this should result in the two hosts getting equal throughput each, and
> equal throughput in each of their two flows"
>
> This is the last test in the output, and I think the behavior looks
> correct for both the unpatched and patched versions:
>
> https://www.heistp.net/downloads/cake-hostfair/cake-hostfair-unpatched.txt
>
> https://www.heistp.net/downloads/cake-hostfair/cake-hostfair-patched.txt
>
> Thanks guys, and that, I believe, is finally it for now... :)

Awesome, thank you both! I'll send a proper patch upstream :)

-Toke

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

* Re: [Cake] cake srchost/dsthost stopped working?
  2021-08-05 14:56           ` Toke Høiland-Jørgensen
@ 2021-08-06 10:08             ` Pete Heist
  0 siblings, 0 replies; 12+ messages in thread
From: Pete Heist @ 2021-08-06 10:08 UTC (permalink / raw)
  To: Toke Høiland-Jørgensen; +Cc: Cake List

Fyi I threw the test script up in a repo, so in case we need to test
the flow isolation keywords again we can just run that:

https://github.com/heistp/cake-flowiso

Pete

On Thu, 2021-08-05 at 16:56 +0200, Toke Høiland-Jørgensen wrote:
> Pete Heist <pete@heistp.net> writes:
> 
> > As for triple-isolate, I added a test Jon suggested:
> > 
> > "I would recommend a W configuration of flows
> > 
> > one of the three hosts sends to or from both of the two hosts, while
> > the other two send to or from only one each
> > 
> > this should result in the two hosts getting equal throughput each,
> > and
> > equal throughput in each of their two flows"
> > 
> > This is the last test in the output, and I think the behavior looks
> > correct for both the unpatched and patched versions:
> > 
> > https://www.heistp.net/downloads/cake-hostfair/cake-hostfair-unpatched.txt
> > 
> > https://www.heistp.net/downloads/cake-hostfair/cake-hostfair-patched.txt
> > 
> > Thanks guys, and that, I believe, is finally it for now... :)
> 
> Awesome, thank you both! I'll send a proper patch upstream :)
> 
> -Toke



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

* Re: [Cake] cake srchost/dsthost stopped working?
  2021-08-04 11:14   ` Toke Høiland-Jørgensen
  2021-08-04 11:36     ` Jonathan Morton
  2021-08-04 20:49     ` Pete Heist
@ 2021-08-11  3:57     ` Stephen Hemminger
  2 siblings, 0 replies; 12+ messages in thread
From: Stephen Hemminger @ 2021-08-11  3:57 UTC (permalink / raw)
  To: Toke Høiland-Jørgensen via Cake

On Wed, 04 Aug 2021 13:14:30 +0200
Toke Høiland-Jørgensen via Cake <cake@lists.bufferbloat.net> wrote:

> +       else if (use_skbhash && flow_mode & CAKE_FLOW_FLOWS)

I think some compilers and static checkers are going to give a warning unless
you add a parenthesis in this statement.

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

end of thread, other threads:[~2021-08-11  3:57 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-03 16:03 [Cake] cake srchost/dsthost stopped working? Pete Heist
2021-08-03 19:46 ` Pete Heist
2021-08-04 11:14   ` Toke Høiland-Jørgensen
2021-08-04 11:36     ` Jonathan Morton
2021-08-04 19:29       ` Toke Høiland-Jørgensen
2021-08-04 20:49     ` Pete Heist
2021-08-04 22:52       ` Pete Heist
2021-08-04 23:26         ` Jonathan Morton
2021-08-05  8:55         ` Pete Heist
2021-08-05 14:56           ` Toke Høiland-Jørgensen
2021-08-06 10:08             ` Pete Heist
2021-08-11  3:57     ` Stephen Hemminger

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