All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next 0/2] net: sched: fixes after recent qdisc->running changes
@ 2021-10-19  0:34 Eric Dumazet
  2021-10-19  0:34 ` [PATCH net-next 1/2] net: sched: fix logic error in qdisc_run_begin() Eric Dumazet
                   ` (2 more replies)
  0 siblings, 3 replies; 14+ messages in thread
From: Eric Dumazet @ 2021-10-19  0:34 UTC (permalink / raw)
  To: David S . Miller, Jakub Kicinski; +Cc: netdev, Eric Dumazet, Eric Dumazet

From: Eric Dumazet <edumazet@google.com>

First patch fixes a plain bug in qdisc_run_begin().
Second patch removes a pair of atomic operations, increasing performance.

Eric Dumazet (2):
  net: sched: fix logic error in qdisc_run_begin()
  net: sched: remove one pair of atomic operations

 include/net/sch_generic.h | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

-- 
2.33.0.1079.g6e70778dc9-goog


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

* [PATCH net-next 1/2] net: sched: fix logic error in qdisc_run_begin()
  2021-10-19  0:34 [PATCH net-next 0/2] net: sched: fixes after recent qdisc->running changes Eric Dumazet
@ 2021-10-19  0:34 ` Eric Dumazet
  2021-10-19  6:50   ` Ido Schimmel
                     ` (3 more replies)
  2021-10-19  0:34 ` [PATCH net-next 2/2] net: sched: remove one pair of atomic operations Eric Dumazet
  2021-10-20  0:00 ` [PATCH net-next 0/2] net: sched: fixes after recent qdisc->running changes patchwork-bot+netdevbpf
  2 siblings, 4 replies; 14+ messages in thread
From: Eric Dumazet @ 2021-10-19  0:34 UTC (permalink / raw)
  To: David S . Miller, Jakub Kicinski
  Cc: netdev, Eric Dumazet, Eric Dumazet, Ahmed S . Darwish,
	Sebastian Andrzej Siewior

From: Eric Dumazet <edumazet@google.com>

For non TCQ_F_NOLOCK qdisc, qdisc_run_begin() tries to set
__QDISC_STATE_RUNNING and should return true if the bit was not set.

test_and_set_bit() returns old bit value, therefore we need to invert.

Fixes: 29cbcd858283 ("net: sched: Remove Qdisc::running sequence counter")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Ahmed S. Darwish <a.darwish@linutronix.de>
Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
 include/net/sch_generic.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
index baad2ab4d971cd3fdc8d59acdd72d39fa6230370..e0988c56dd8fd7aa3dff6bd971da3c81f1a20626 100644
--- a/include/net/sch_generic.h
+++ b/include/net/sch_generic.h
@@ -217,7 +217,7 @@ static inline bool qdisc_run_begin(struct Qdisc *qdisc)
 		 */
 		return spin_trylock(&qdisc->seqlock);
 	}
-	return test_and_set_bit(__QDISC_STATE_RUNNING, &qdisc->state);
+	return !test_and_set_bit(__QDISC_STATE_RUNNING, &qdisc->state);
 }
 
 static inline void qdisc_run_end(struct Qdisc *qdisc)
-- 
2.33.0.1079.g6e70778dc9-goog


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

* [PATCH net-next 2/2] net: sched: remove one pair of atomic operations
  2021-10-19  0:34 [PATCH net-next 0/2] net: sched: fixes after recent qdisc->running changes Eric Dumazet
  2021-10-19  0:34 ` [PATCH net-next 1/2] net: sched: fix logic error in qdisc_run_begin() Eric Dumazet
@ 2021-10-19  0:34 ` Eric Dumazet
  2021-10-19  8:05   ` Sebastian Andrzej Siewior
  2021-10-19 10:46   ` Toke Høiland-Jørgensen
  2021-10-20  0:00 ` [PATCH net-next 0/2] net: sched: fixes after recent qdisc->running changes patchwork-bot+netdevbpf
  2 siblings, 2 replies; 14+ messages in thread
From: Eric Dumazet @ 2021-10-19  0:34 UTC (permalink / raw)
  To: David S . Miller, Jakub Kicinski
  Cc: netdev, Eric Dumazet, Eric Dumazet, Ahmed S . Darwish,
	Sebastian Andrzej Siewior

From: Eric Dumazet <edumazet@google.com>

__QDISC_STATE_RUNNING is only set/cleared from contexts owning qdisc lock.

Thus we can use less expensive bit operations, as we were doing
before commit f9eb8aea2a1e ("net_sched: transform qdisc running bit into a seqcount")

Fixes: 29cbcd858283 ("net: sched: Remove Qdisc::running sequence counter")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Ahmed S. Darwish <a.darwish@linutronix.de>
Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
 include/net/sch_generic.h | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
index e0988c56dd8fd7aa3dff6bd971da3c81f1a20626..ada02c4a4f518b732d62561a22b1d9033516b494 100644
--- a/include/net/sch_generic.h
+++ b/include/net/sch_generic.h
@@ -38,10 +38,13 @@ enum qdisc_state_t {
 	__QDISC_STATE_DEACTIVATED,
 	__QDISC_STATE_MISSED,
 	__QDISC_STATE_DRAINING,
+};
+
+enum qdisc_state2_t {
 	/* Only for !TCQ_F_NOLOCK qdisc. Never access it directly.
 	 * Use qdisc_run_begin/end() or qdisc_is_running() instead.
 	 */
-	__QDISC_STATE_RUNNING,
+	__QDISC_STATE2_RUNNING,
 };
 
 #define QDISC_STATE_MISSED	BIT(__QDISC_STATE_MISSED)
@@ -114,6 +117,7 @@ struct Qdisc {
 	struct gnet_stats_basic_sync bstats;
 	struct gnet_stats_queue	qstats;
 	unsigned long		state;
+	unsigned long		state2; /* must be written under qdisc spinlock */
 	struct Qdisc            *next_sched;
 	struct sk_buff_head	skb_bad_txq;
 
@@ -154,7 +158,7 @@ static inline bool qdisc_is_running(struct Qdisc *qdisc)
 {
 	if (qdisc->flags & TCQ_F_NOLOCK)
 		return spin_is_locked(&qdisc->seqlock);
-	return test_bit(__QDISC_STATE_RUNNING, &qdisc->state);
+	return test_bit(__QDISC_STATE2_RUNNING, &qdisc->state2);
 }
 
 static inline bool nolock_qdisc_is_empty(const struct Qdisc *qdisc)
@@ -217,7 +221,7 @@ static inline bool qdisc_run_begin(struct Qdisc *qdisc)
 		 */
 		return spin_trylock(&qdisc->seqlock);
 	}
-	return !test_and_set_bit(__QDISC_STATE_RUNNING, &qdisc->state);
+	return !__test_and_set_bit(__QDISC_STATE2_RUNNING, &qdisc->state2);
 }
 
 static inline void qdisc_run_end(struct Qdisc *qdisc)
@@ -229,7 +233,7 @@ static inline void qdisc_run_end(struct Qdisc *qdisc)
 				      &qdisc->state)))
 			__netif_schedule(qdisc);
 	} else {
-		clear_bit(__QDISC_STATE_RUNNING, &qdisc->state);
+		__clear_bit(__QDISC_STATE2_RUNNING, &qdisc->state2);
 	}
 }
 
-- 
2.33.0.1079.g6e70778dc9-goog


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

* Re: [PATCH net-next 1/2] net: sched: fix logic error in qdisc_run_begin()
  2021-10-19  0:34 ` [PATCH net-next 1/2] net: sched: fix logic error in qdisc_run_begin() Eric Dumazet
@ 2021-10-19  6:50   ` Ido Schimmel
  2021-10-19  7:51   ` Sebastian Andrzej Siewior
                     ` (2 subsequent siblings)
  3 siblings, 0 replies; 14+ messages in thread
From: Ido Schimmel @ 2021-10-19  6:50 UTC (permalink / raw)
  To: Eric Dumazet
  Cc: David S . Miller, Jakub Kicinski, netdev, Eric Dumazet,
	Ahmed S . Darwish, Sebastian Andrzej Siewior

On Mon, Oct 18, 2021 at 05:34:01PM -0700, Eric Dumazet wrote:
> From: Eric Dumazet <edumazet@google.com>
> 
> For non TCQ_F_NOLOCK qdisc, qdisc_run_begin() tries to set
> __QDISC_STATE_RUNNING and should return true if the bit was not set.
> 
> test_and_set_bit() returns old bit value, therefore we need to invert.
> 
> Fixes: 29cbcd858283 ("net: sched: Remove Qdisc::running sequence counter")
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> Cc: Ahmed S. Darwish <a.darwish@linutronix.de>
> Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>

Tested-by: Ido Schimmel <idosch@nvidia.com>

Thanks!

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

* Re: [PATCH net-next 1/2] net: sched: fix logic error in qdisc_run_begin()
  2021-10-19  0:34 ` [PATCH net-next 1/2] net: sched: fix logic error in qdisc_run_begin() Eric Dumazet
  2021-10-19  6:50   ` Ido Schimmel
@ 2021-10-19  7:51   ` Sebastian Andrzej Siewior
  2021-10-19 10:45   ` Toke Høiland-Jørgensen
  2021-10-20  7:32   ` Vlad Buslov
  3 siblings, 0 replies; 14+ messages in thread
From: Sebastian Andrzej Siewior @ 2021-10-19  7:51 UTC (permalink / raw)
  To: Eric Dumazet
  Cc: David S . Miller, Jakub Kicinski, netdev, Eric Dumazet,
	Ahmed S . Darwish

On 2021-10-18 17:34:01 [-0700], Eric Dumazet wrote:
> From: Eric Dumazet <edumazet@google.com>
> 
> For non TCQ_F_NOLOCK qdisc, qdisc_run_begin() tries to set
> __QDISC_STATE_RUNNING and should return true if the bit was not set.
> 
> test_and_set_bit() returns old bit value, therefore we need to invert.
> 
> Fixes: 29cbcd858283 ("net: sched: Remove Qdisc::running sequence counter")
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> Cc: Ahmed S. Darwish <a.darwish@linutronix.de>
> Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>

Acked-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>

Sebastian

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

* Re: [PATCH net-next 2/2] net: sched: remove one pair of atomic operations
  2021-10-19  0:34 ` [PATCH net-next 2/2] net: sched: remove one pair of atomic operations Eric Dumazet
@ 2021-10-19  8:05   ` Sebastian Andrzej Siewior
  2021-10-19 10:46   ` Toke Høiland-Jørgensen
  1 sibling, 0 replies; 14+ messages in thread
From: Sebastian Andrzej Siewior @ 2021-10-19  8:05 UTC (permalink / raw)
  To: Eric Dumazet
  Cc: David S . Miller, Jakub Kicinski, netdev, Eric Dumazet,
	Ahmed S . Darwish

On 2021-10-18 17:34:02 [-0700], Eric Dumazet wrote:
> From: Eric Dumazet <edumazet@google.com>
> 
> __QDISC_STATE_RUNNING is only set/cleared from contexts owning qdisc lock.
> 
> Thus we can use less expensive bit operations, as we were doing
> before commit f9eb8aea2a1e ("net_sched: transform qdisc running bit into a seqcount")
> 
> Fixes: 29cbcd858283 ("net: sched: Remove Qdisc::running sequence counter")
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> Cc: Ahmed S. Darwish <a.darwish@linutronix.de>
> Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>

Acked-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>

Sebastian

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

* Re: [PATCH net-next 1/2] net: sched: fix logic error in qdisc_run_begin()
  2021-10-19  0:34 ` [PATCH net-next 1/2] net: sched: fix logic error in qdisc_run_begin() Eric Dumazet
  2021-10-19  6:50   ` Ido Schimmel
  2021-10-19  7:51   ` Sebastian Andrzej Siewior
@ 2021-10-19 10:45   ` Toke Høiland-Jørgensen
  2021-10-20  7:32   ` Vlad Buslov
  3 siblings, 0 replies; 14+ messages in thread
From: Toke Høiland-Jørgensen @ 2021-10-19 10:45 UTC (permalink / raw)
  To: Eric Dumazet, David S . Miller, Jakub Kicinski
  Cc: netdev, Eric Dumazet, Eric Dumazet, Ahmed S . Darwish,
	Sebastian Andrzej Siewior

Eric Dumazet <eric.dumazet@gmail.com> writes:

> From: Eric Dumazet <edumazet@google.com>
>
> For non TCQ_F_NOLOCK qdisc, qdisc_run_begin() tries to set
> __QDISC_STATE_RUNNING and should return true if the bit was not set.
>
> test_and_set_bit() returns old bit value, therefore we need to invert.
>
> Fixes: 29cbcd858283 ("net: sched: Remove Qdisc::running sequence counter")
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> Cc: Ahmed S. Darwish <a.darwish@linutronix.de>
> Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>

Ah! I had just finished bisecting that lockup on qdisc install and
figured I'd check the list before I started investigating further. And
indeed you had beaten me to the punch with a fix - thanks! :)

Tested-by: Toke Høiland-Jørgensen <toke@redhat.com>


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

* Re: [PATCH net-next 2/2] net: sched: remove one pair of atomic operations
  2021-10-19  0:34 ` [PATCH net-next 2/2] net: sched: remove one pair of atomic operations Eric Dumazet
  2021-10-19  8:05   ` Sebastian Andrzej Siewior
@ 2021-10-19 10:46   ` Toke Høiland-Jørgensen
  1 sibling, 0 replies; 14+ messages in thread
From: Toke Høiland-Jørgensen @ 2021-10-19 10:46 UTC (permalink / raw)
  To: Eric Dumazet, David S . Miller, Jakub Kicinski
  Cc: netdev, Eric Dumazet, Eric Dumazet, Ahmed S . Darwish,
	Sebastian Andrzej Siewior

Eric Dumazet <eric.dumazet@gmail.com> writes:

> From: Eric Dumazet <edumazet@google.com>
>
> __QDISC_STATE_RUNNING is only set/cleared from contexts owning qdisc lock.
>
> Thus we can use less expensive bit operations, as we were doing
> before commit f9eb8aea2a1e ("net_sched: transform qdisc running bit into a seqcount")
>
> Fixes: 29cbcd858283 ("net: sched: Remove Qdisc::running sequence counter")
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> Cc: Ahmed S. Darwish <a.darwish@linutronix.de>
> Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>

Tested-by: Toke Høiland-Jørgensen <toke@redhat.com>


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

* Re: [PATCH net-next 0/2] net: sched: fixes after recent qdisc->running changes
  2021-10-19  0:34 [PATCH net-next 0/2] net: sched: fixes after recent qdisc->running changes Eric Dumazet
  2021-10-19  0:34 ` [PATCH net-next 1/2] net: sched: fix logic error in qdisc_run_begin() Eric Dumazet
  2021-10-19  0:34 ` [PATCH net-next 2/2] net: sched: remove one pair of atomic operations Eric Dumazet
@ 2021-10-20  0:00 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 14+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-10-20  0:00 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: davem, kuba, netdev, edumazet

Hello:

This series was applied to netdev/net-next.git (master)
by Jakub Kicinski <kuba@kernel.org>:

On Mon, 18 Oct 2021 17:34:00 -0700 you wrote:
> From: Eric Dumazet <edumazet@google.com>
> 
> First patch fixes a plain bug in qdisc_run_begin().
> Second patch removes a pair of atomic operations, increasing performance.
> 
> Eric Dumazet (2):
>   net: sched: fix logic error in qdisc_run_begin()
>   net: sched: remove one pair of atomic operations
> 
> [...]

Here is the summary with links:
  - [net-next,1/2] net: sched: fix logic error in qdisc_run_begin()
    https://git.kernel.org/netdev/net-next/c/4c57e2fac41c
  - [net-next,2/2] net: sched: remove one pair of atomic operations
    https://git.kernel.org/netdev/net-next/c/97604c65bcda

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

* Re: [PATCH net-next 1/2] net: sched: fix logic error in qdisc_run_begin()
  2021-10-19  0:34 ` [PATCH net-next 1/2] net: sched: fix logic error in qdisc_run_begin() Eric Dumazet
                     ` (2 preceding siblings ...)
  2021-10-19 10:45   ` Toke Høiland-Jørgensen
@ 2021-10-20  7:32   ` Vlad Buslov
  2021-10-20  8:11     ` Sebastian Andrzej Siewior
  3 siblings, 1 reply; 14+ messages in thread
From: Vlad Buslov @ 2021-10-20  7:32 UTC (permalink / raw)
  To: Ahmed S . Darwish, Eric Dumazet
  Cc: David S . Miller, Jakub Kicinski, netdev, Eric Dumazet,
	Sebastian Andrzej Siewior

On Tue 19 Oct 2021 at 03:34, Eric Dumazet <eric.dumazet@gmail.com> wrote:
> From: Eric Dumazet <edumazet@google.com>
>
> For non TCQ_F_NOLOCK qdisc, qdisc_run_begin() tries to set
> __QDISC_STATE_RUNNING and should return true if the bit was not set.
>
> test_and_set_bit() returns old bit value, therefore we need to invert.
>
> Fixes: 29cbcd858283 ("net: sched: Remove Qdisc::running sequence counter")
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> Cc: Ahmed S. Darwish <a.darwish@linutronix.de>
> Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
> ---

We've got a warning[0] in today's regression that was added by commit that
this patch fixes. I can't reproduce it manually and from changelog it is
hard to determine whether the fix is for the issue we experiencing or
something else. WDYT?

[0]:
[Wed Oct 20 09:08:06 2021] ------------[ cut here ]------------
[Wed Oct 20 09:08:06 2021] WARNING: CPU: 4 PID: 0 at net/core/gen_stats.c:157 gnet_stats_add_basic+0x1d9/0x240
[Wed Oct 20 09:08:06 2021] Modules linked in: act_vlan cls_flower act_tunnel_key sch_ingress openvswitch nsh mlx5_ib mlx5_core xt_conntrack xt_MASQUERADE nf_conntrack_netlink nfnetlink rpcrdma rdma_ucm ib_iser libiscsi scsi_transport_iscsi rdma_cm ib_umad iw_cm ib_ipoib ib_cm xt_addrtype iptable_nat nf_nat br_netfilter ib_uverbs ib_core overlay fuse [last unloaded: mlx5_core]
[Wed Oct 20 09:08:06 2021] CPU: 4 PID: 0 Comm: swapper/4 Not tainted 5.15.0-rc6_for_upstream_debug_2021_10_19_17_13 #1
[Wed Oct 20 09:08:06 2021] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.13.0-0-gf21b5a4aeb02-prebuilt.qemu.org 04/01/2014
[Wed Oct 20 09:08:06 2021] RIP: 0010:gnet_stats_add_basic+0x1d9/0x240
[Wed Oct 20 09:08:06 2021] Code: 25 a0 19 1e 02 0f 82 4a ff ff ff 48 8b 44 24 20 4c 01 28 44 8b 24 24 4c 01 60 08 48 83 c4 28 5b 5d 41 5c 41 5d 41 5e 41 5f c3 <0f> 0b e9 d1 fe ff ff 48 89 df e8 d8 4c 07 ff e9 62 fe ff ff 48 89
[Wed Oct 20 09:08:06 2021] RSP: 0018:ffff8882a4209b80 EFLAGS: 00010206
[Wed Oct 20 09:08:06 2021] RAX: 0000000080000102 RBX: ffff888116bda450 RCX: 0000000000000000
[Wed Oct 20 09:08:06 2021] RDX: ffff888116bda450 RSI: 0000607d5b844340 RDI: ffff8882a4209c90
[Wed Oct 20 09:08:06 2021] RBP: 0000607d5b844340 R08: 0000000000000001 R09: 0000000000000003
[Wed Oct 20 09:08:06 2021] R10: ffffed105484136e R11: 0000000000000001 R12: ffff888122b10608
[Wed Oct 20 09:08:06 2021] R13: ffff888122b10680 R14: ffff888122b10680 R15: ffff888122b10621
[Wed Oct 20 09:08:06 2021] FS:  0000000000000000(0000) GS:ffff8882a4200000(0000) knlGS:0000000000000000
[Wed Oct 20 09:08:06 2021] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[Wed Oct 20 09:08:06 2021] CR2: 0000561dba20e5b8 CR3: 0000000004026003 CR4: 0000000000370ea0
[Wed Oct 20 09:08:06 2021] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[Wed Oct 20 09:08:06 2021] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
[Wed Oct 20 09:08:06 2021] Call Trace:
[Wed Oct 20 09:08:06 2021]  <IRQ>
[Wed Oct 20 09:08:06 2021]  ? rcu_core+0x642/0x1fd0
[Wed Oct 20 09:08:06 2021]  est_fetch_counters+0xc8/0x150
[Wed Oct 20 09:08:06 2021]  ? __do_softirq+0x282/0x94e
[Wed Oct 20 09:08:06 2021]  ? __irq_exit_rcu+0x11f/0x170
[Wed Oct 20 09:08:06 2021]  est_timer+0x95/0x6f0
[Wed Oct 20 09:08:06 2021]  ? rcu_read_lock_sched_held+0x12/0x70
[Wed Oct 20 09:08:06 2021]  ? lock_acquire+0x38d/0x4c0
[Wed Oct 20 09:08:06 2021]  ? rcu_read_lock_sched_held+0x12/0x70
[Wed Oct 20 09:08:06 2021]  ? lockdep_hardirqs_on_prepare+0x400/0x400
[Wed Oct 20 09:08:06 2021]  ? est_fetch_counters+0x150/0x150
[Wed Oct 20 09:08:06 2021]  ? lock_release+0x460/0x750
[Wed Oct 20 09:08:06 2021]  ? scheduler_tick+0x290/0x860
[Wed Oct 20 09:08:06 2021]  ? est_fetch_counters+0x150/0x150
[Wed Oct 20 09:08:06 2021]  ? call_timer_fn+0x178/0x490
[Wed Oct 20 09:08:06 2021]  call_timer_fn+0x178/0x490
[Wed Oct 20 09:08:06 2021]  ? lock_release+0x460/0x750
[Wed Oct 20 09:08:06 2021]  ? msleep_interruptible+0x130/0x130
[Wed Oct 20 09:08:07 2021]  ? lock_downgrade+0x6e0/0x6e0
[Wed Oct 20 09:08:07 2021]  ? __next_timer_interrupt+0xfc/0x200
[Wed Oct 20 09:08:07 2021]  ? est_fetch_counters+0x150/0x150
[Wed Oct 20 09:08:07 2021]  __run_timers.part.0+0x545/0x890
[Wed Oct 20 09:08:07 2021]  ? call_timer_fn+0x490/0x490
[Wed Oct 20 09:08:07 2021]  ? lock_downgrade+0x6e0/0x6e0
[Wed Oct 20 09:08:07 2021]  ? kvm_clock_get_cycles+0x14/0x20
[Wed Oct 20 09:08:07 2021]  ? ktime_get+0xb3/0x180
[Wed Oct 20 09:08:07 2021]  ? lapic_next_deadline+0x3c/0x90
[Wed Oct 20 09:08:07 2021]  ? clockevents_program_event+0x1dc/0x2f0
[Wed Oct 20 09:08:07 2021]  run_timer_softirq+0x6a/0x100
[Wed Oct 20 09:08:07 2021]  __do_softirq+0x282/0x94e
[Wed Oct 20 09:08:07 2021]  __irq_exit_rcu+0x11f/0x170
[Wed Oct 20 09:08:07 2021]  irq_exit_rcu+0xa/0x20
[Wed Oct 20 09:08:07 2021]  sysvec_apic_timer_interrupt+0x6f/0x90
[Wed Oct 20 09:08:07 2021]  </IRQ>
[Wed Oct 20 09:08:07 2021]  asm_sysvec_apic_timer_interrupt+0x12/0x20
[Wed Oct 20 09:08:07 2021] RIP: 0010:default_idle+0x53/0x70
[Wed Oct 20 09:08:07 2021] Code: c1 83 e0 07 48 c1 e9 03 83 c0 03 0f b6 14 11 38 d0 7c 04 84 d2 75 14 8b 05 3a 9f f4 01 85 c0 7e 07 0f 00 2d 6f a7 4c 00 fb f4 <c3> 48 c7 c7 a0 d5 2c 85 e8 c0 52 57 fe eb de 66 66 2e 0f 1f 84 00
[Wed Oct 20 09:08:07 2021] RSP: 0018:ffff888100c57df8 EFLAGS: 00000246
[Wed Oct 20 09:08:07 2021] RAX: 0000000000000000 RBX: ffff888100c42000 RCX: 1ffffffff0a59ab4
[Wed Oct 20 09:08:07 2021] RDX: 0000000000000004 RSI: 0000000000000004 RDI: ffffffff852cd5a0
[Wed Oct 20 09:08:07 2021] RBP: 0000000000000004 R08: 0000000000000000 R09: 0000000000000003
[Wed Oct 20 09:08:07 2021] R10: fffffbfff0a59ab4 R11: 0000000000000001 R12: ffffed1020188400
[Wed Oct 20 09:08:07 2021] R13: ffffffff84a65440 R14: 0000000000000000 R15: dffffc0000000000
[Wed Oct 20 09:08:07 2021]  ? default_idle+0x16/0x70
[Wed Oct 20 09:08:07 2021]  default_idle_call+0x8c/0xd0
[Wed Oct 20 09:08:07 2021]  do_idle+0x394/0x450
[Wed Oct 20 09:08:07 2021]  ? arch_cpu_idle_exit+0x40/0x40
[Wed Oct 20 09:08:07 2021]  cpu_startup_entry+0x19/0x20
[Wed Oct 20 09:08:07 2021]  start_secondary+0x229/0x2f0
[Wed Oct 20 09:08:07 2021]  ? set_cpu_sibling_map+0x1830/0x1830
[Wed Oct 20 09:08:07 2021]  secondary_startup_64_no_verify+0xb0/0xbb
[Wed Oct 20 09:08:07 2021] irq event stamp: 4163175
[Wed Oct 20 09:08:07 2021] hardirqs last  enabled at (4163175): [<ffffffff83383ba4>] default_idle_call+0x54/0xd0
[Wed Oct 20 09:08:07 2021] hardirqs last disabled at (4163174): [<ffffffff813dc286>] do_idle+0x126/0x450
[Wed Oct 20 09:08:07 2021] softirqs last  enabled at (4163146): [<ffffffff813491bf>] __irq_exit_rcu+0x11f/0x170
[Wed Oct 20 09:08:07 2021] softirqs last disabled at (4163141): [<ffffffff813491bf>] __irq_exit_rcu+0x11f/0x170
[Wed Oct 20 09:08:07 2021] ---[ end trace 522aedc0980d5e9b ]---

>  include/net/sch_generic.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
> index baad2ab4d971cd3fdc8d59acdd72d39fa6230370..e0988c56dd8fd7aa3dff6bd971da3c81f1a20626 100644
> --- a/include/net/sch_generic.h
> +++ b/include/net/sch_generic.h
> @@ -217,7 +217,7 @@ static inline bool qdisc_run_begin(struct Qdisc *qdisc)
>  		 */
>  		return spin_trylock(&qdisc->seqlock);
>  	}
> -	return test_and_set_bit(__QDISC_STATE_RUNNING, &qdisc->state);
> +	return !test_and_set_bit(__QDISC_STATE_RUNNING, &qdisc->state);
>  }
>  
>  static inline void qdisc_run_end(struct Qdisc *qdisc)


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

* Re: [PATCH net-next 1/2] net: sched: fix logic error in qdisc_run_begin()
  2021-10-20  7:32   ` Vlad Buslov
@ 2021-10-20  8:11     ` Sebastian Andrzej Siewior
  2021-10-20  8:36       ` Vlad Buslov
  0 siblings, 1 reply; 14+ messages in thread
From: Sebastian Andrzej Siewior @ 2021-10-20  8:11 UTC (permalink / raw)
  To: Vlad Buslov
  Cc: Ahmed S . Darwish, Eric Dumazet, David S . Miller,
	Jakub Kicinski, netdev, Eric Dumazet

On 2021-10-20 10:32:53 [+0300], Vlad Buslov wrote:
> We've got a warning[0] in today's regression that was added by commit that
> this patch fixes. I can't reproduce it manually and from changelog it is
> hard to determine whether the fix is for the issue we experiencing or
> something else. WDYT?

The backtrace looks like it has been fixed by
   https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git/commit/?id=e22db7bd552f7f7f19fe4ef60abfb7e7b364e3a8

Sorry for that.

Sebastian

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

* Re: [PATCH net-next 1/2] net: sched: fix logic error in qdisc_run_begin()
  2021-10-20  8:11     ` Sebastian Andrzej Siewior
@ 2021-10-20  8:36       ` Vlad Buslov
  0 siblings, 0 replies; 14+ messages in thread
From: Vlad Buslov @ 2021-10-20  8:36 UTC (permalink / raw)
  To: Sebastian Andrzej Siewior
  Cc: Ahmed S . Darwish, Eric Dumazet, David S . Miller,
	Jakub Kicinski, netdev, Eric Dumazet


On Wed 20 Oct 2021 at 11:11, Sebastian Andrzej Siewior <bigeasy@linutronix.de> wrote:
> On 2021-10-20 10:32:53 [+0300], Vlad Buslov wrote:
>> We've got a warning[0] in today's regression that was added by commit that
>> this patch fixes. I can't reproduce it manually and from changelog it is
>> hard to determine whether the fix is for the issue we experiencing or
>> something else. WDYT?
>
> The backtrace looks like it has been fixed by
>    https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git/commit/?id=e22db7bd552f7f7f19fe4ef60abfb7e7b364e3a8
>
> Sorry for that.
>
> Sebastian

Thanks! I somehow missed that fix when searching in the mailing list.



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

* Re: [PATCH net-next 1/2] net: sched: fix logic error in qdisc_run_begin()
  2021-10-21 16:22 ` [PATCH net-next 1/2] net: sched: fix logic error in qdisc_run_begin() Eric Dumazet
@ 2021-10-21 16:24   ` Eric Dumazet
  0 siblings, 0 replies; 14+ messages in thread
From: Eric Dumazet @ 2021-10-21 16:24 UTC (permalink / raw)
  To: Eric Dumazet
  Cc: David S . Miller, Jakub Kicinski, netdev, Soheil Hassas Yeganeh,
	Neal Cardwell, Ahmed S . Darwish, Sebastian Andrzej Siewior

On Thu, Oct 21, 2021 at 9:23 AM Eric Dumazet <eric.dumazet@gmail.com> wrote:
>
> From: Eric Dumazet <edumazet@google.com>
>
> For non TCQ_F_NOLOCK qdisc, qdisc_run_begin() tries to set
> __QDISC_STATE_RUNNING and should return true if the bit was not set.
>
> test_and_set_bit() returns old bit value, therefore we need to invert.
>
> Fixes: 29cbcd858283 ("net: sched: Remove Qdisc::running sequence counter")
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> Cc: Ahmed S. Darwish <a.darwish@linutronix.de>
> Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
> ---

Please disregard, I have accidentally resent this already merged patch.

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

* [PATCH net-next 1/2] net: sched: fix logic error in qdisc_run_begin()
  2021-10-21 16:22 [PATCH net-next 0/9] tcp: receive path optimizations Eric Dumazet
@ 2021-10-21 16:22 ` Eric Dumazet
  2021-10-21 16:24   ` Eric Dumazet
  0 siblings, 1 reply; 14+ messages in thread
From: Eric Dumazet @ 2021-10-21 16:22 UTC (permalink / raw)
  To: David S . Miller, Jakub Kicinski
  Cc: netdev, Eric Dumazet, Eric Dumazet, Soheil Hassas Yeganeh,
	Neal Cardwell, Ahmed S . Darwish, Sebastian Andrzej Siewior

From: Eric Dumazet <edumazet@google.com>

For non TCQ_F_NOLOCK qdisc, qdisc_run_begin() tries to set
__QDISC_STATE_RUNNING and should return true if the bit was not set.

test_and_set_bit() returns old bit value, therefore we need to invert.

Fixes: 29cbcd858283 ("net: sched: Remove Qdisc::running sequence counter")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Ahmed S. Darwish <a.darwish@linutronix.de>
Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
 include/net/sch_generic.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
index baad2ab4d971cd3fdc8d59acdd72d39fa6230370..e0988c56dd8fd7aa3dff6bd971da3c81f1a20626 100644
--- a/include/net/sch_generic.h
+++ b/include/net/sch_generic.h
@@ -217,7 +217,7 @@ static inline bool qdisc_run_begin(struct Qdisc *qdisc)
 		 */
 		return spin_trylock(&qdisc->seqlock);
 	}
-	return test_and_set_bit(__QDISC_STATE_RUNNING, &qdisc->state);
+	return !test_and_set_bit(__QDISC_STATE_RUNNING, &qdisc->state);
 }
 
 static inline void qdisc_run_end(struct Qdisc *qdisc)
-- 
2.33.0.1079.g6e70778dc9-goog


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

end of thread, other threads:[~2021-10-21 16:24 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-19  0:34 [PATCH net-next 0/2] net: sched: fixes after recent qdisc->running changes Eric Dumazet
2021-10-19  0:34 ` [PATCH net-next 1/2] net: sched: fix logic error in qdisc_run_begin() Eric Dumazet
2021-10-19  6:50   ` Ido Schimmel
2021-10-19  7:51   ` Sebastian Andrzej Siewior
2021-10-19 10:45   ` Toke Høiland-Jørgensen
2021-10-20  7:32   ` Vlad Buslov
2021-10-20  8:11     ` Sebastian Andrzej Siewior
2021-10-20  8:36       ` Vlad Buslov
2021-10-19  0:34 ` [PATCH net-next 2/2] net: sched: remove one pair of atomic operations Eric Dumazet
2021-10-19  8:05   ` Sebastian Andrzej Siewior
2021-10-19 10:46   ` Toke Høiland-Jørgensen
2021-10-20  0:00 ` [PATCH net-next 0/2] net: sched: fixes after recent qdisc->running changes patchwork-bot+netdevbpf
2021-10-21 16:22 [PATCH net-next 0/9] tcp: receive path optimizations Eric Dumazet
2021-10-21 16:22 ` [PATCH net-next 1/2] net: sched: fix logic error in qdisc_run_begin() Eric Dumazet
2021-10-21 16:24   ` Eric Dumazet

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.