JIRA: https://issues.redhat.com/browse/RHEL-24101
Upstream Status: v6.5-rc1
commit 227c6c832303cec3941166d3335ecbccd980d615
Author: Andrzej Hajda <andrzej.hajda@intel.com>
AuthorDate: Fri Jun 2 12:21:35 2023 +0200
Commit: Jakub Kicinski <kuba@kernel.org>
CommitDate: Mon Jun 5 15:28:42 2023 -0700
Similar to stack_(depot|trace)_snprint the patch
adds helper to printing stats to memory buffer.
It will be helpful in case of debugfs.
Signed-off-by: Andrzej Hajda <andrzej.hajda@intel.com>
Reviewed-by: Andi Shyti <andi.shyti@linux.intel.com>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
JIRA: https://issues.redhat.com/browse/RHEL-24101
Upstream Status: v6.5-rc1
This doesn't backport the namespace chunk that isn't
in RHEL yet.
Conflicts:
net/core/net_namespace.c
commit b6d7c0eb2dcbd238fa233a3a1737654e380e784a
Author: Andrzej Hajda <andrzej.hajda@intel.com>
AuthorDate: Fri Jun 2 12:21:34 2023 +0200
Commit: Jakub Kicinski <kuba@kernel.org>
CommitDate: Mon Jun 5 15:28:42 2023 -0700
In case the library is tracking busy subsystem, simply
printing stack for every active reference will spam log
with long, hard to read, redundant stack traces. To improve
readabilty following changes have been made:
- reports are printed per stack_handle - log is more compact,
- added display name for ref_tracker_dir - it will differentiate
multiple subsystems,
- stack trace is printed indented, in the same printk call,
- info about dropped references is printed as well.
Signed-off-by: Andrzej Hajda <andrzej.hajda@intel.com>
Reviewed-by: Andi Shyti <andi.shyti@linux.intel.com>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
JIRA: https://issues.redhat.com/browse/RHEL-24101
Upstream Status: v6.5-rc1
commit 7a113ff6355944283402fb617dc97122f68d5a41
Author: Andrzej Hajda <andrzej.hajda@intel.com>
AuthorDate: Fri Jun 2 12:21:33 2023 +0200
Commit: Jakub Kicinski <kuba@kernel.org>
CommitDate: Mon Jun 5 15:28:42 2023 -0700
To have reliable detection of leaks, caller must be able to check under
the same lock both: tracked counter and the leaks. dir.lock is natural
candidate for such lock and unlocked print helper can be called with this
lock taken.
As a bonus we can reuse this helper in ref_tracker_dir_exit.
Signed-off-by: Andrzej Hajda <andrzej.hajda@intel.com>
Reviewed-by: Andi Shyti <andi.shyti@linux.intel.com>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Bugzilla: https://bugzilla.redhat.com/2120352
commit c2d1e3df4af59261777b39c2e47476acd4d1cbeb
Author: Eric Dumazet <edumazet@google.com>
Date: Sat Feb 5 09:27:11 2022 -0800
ref_tracker: remove filter_irq_stacks() call
After commit e94006608949 ("lib/stackdepot: always do filter_irq_stacks()
in stack_depot_save()") it became unnecessary to filter the stack
before calling stack_depot_save().
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Marco Elver <elver@google.com>
Cc: Alexander Potapenko <glider@google.com>
Cc: Dmitry Vyukov <dvyukov@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Chris von Recklinghausen <crecklin@redhat.com>
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2096377
Conflicts:
- context conflict due to missing 2dba5eb1c73b ("lib/stackdepot: allow
optional init and stack_table allocation by kvmalloc()")
commit 8fd5522f44dcd7f05454ddc4f16d0f821b676cd9
Author: Eric Dumazet <edumazet@google.com>
Date: Fri Feb 4 14:42:36 2022 -0800
ref_tracker: add a count of untracked references
We are still chasing a netdev refcount imbalance, and we suspect
we have one rogue dev_put() that is consuming a reference taken
from a dev_hold_track()
To detect this case, allow ref_tracker_alloc() and ref_tracker_free()
to be called with a NULL @trackerp parameter, and use a dedicated
refcount_t just for them.
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Ivan Vecera <ivecera@redhat.com>
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2096377
commit e3ececfe668facd87d920b608349a32607060e66
Author: Eric Dumazet <edumazet@google.com>
Date: Fri Feb 4 14:42:35 2022 -0800
ref_tracker: implement use-after-free detection
Whenever ref_tracker_dir_init() is called, mark the struct ref_tracker_dir
as dead.
Test the dead status from ref_tracker_alloc() and ref_tracker_free()
This should detect buggy dev_put()/dev_hold() happening too late
in netdevice dismantle process.
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Ivan Vecera <ivecera@redhat.com>
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2096377
commit 4e66934eaadc83b27ada8d42b60894018f3bfabf
Author: Eric Dumazet <edumazet@google.com>
Date: Sat Dec 4 20:21:55 2021 -0800
lib: add reference counting tracking infrastructure
It can be hard to track where references are taken and released.
In networking, we have annoying issues at device or netns dismantles,
and we had various proposals to ease root causing them.
This patch adds new infrastructure pairing refcount increases
and decreases. This will self document code, because programmers
will have to associate increments/decrements.
This is controled by CONFIG_REF_TRACKER which can be selected
by users of this feature.
This adds both cpu and memory costs, and thus should probably be
used with care.
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Ivan Vecera <ivecera@redhat.com>