Page MenuHomeFreeBSD

netdump: Ref the interface we're attached to
ClosedPublic

Authored by cem on May 9 2019, 12:12 AM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Dec 13, 5:01 PM
Unknown Object (File)
Oct 20 2024, 12:02 AM
Unknown Object (File)
Oct 2 2024, 6:04 PM
Unknown Object (File)
Sep 23 2024, 4:59 PM
Unknown Object (File)
Sep 22 2024, 1:20 PM
Unknown Object (File)
Sep 22 2024, 9:03 AM
Unknown Object (File)
Sep 21 2024, 9:15 PM
Unknown Object (File)
Sep 18 2024, 8:14 PM
Subscribers

Details

Summary

Serialize netdump configuration / deconfiguration, and discard our
configuration when the affiliated interface goes away.

Test Plan
$ dumpon ... vtnet0
$ dumpon -lv
...
vtnet0
...
$ devctl detach vtnet0
$ ifconfig
...
(no vtnet0)
$ dumpon -lv
...
(no vtnet0)

No witness warnings I could see with that workflow on GENERIC.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

This revision is now accepted and ready to land.May 10 2019, 4:06 PM
sys/netinet/netdump/netdump_client.c
1432 ↗(On Diff #57203)

Since you're modifying this function, go ahead and fix this copy-pasto.

1436 ↗(On Diff #57203)

...and this one.

1460 ↗(On Diff #57203)

Shouldn't you

		if_rele(nd_ifp);
		nd_ifp = NULL;

here, too? (if it's not NULL)

In fact, there is enough duplication between this block and netdump_ifdetach() that you could refactor into a new netdump_unconfigure().

cem planned changes to this revision.May 10 2019, 7:38 PM
cem added inline comments.
sys/netinet/netdump/netdump_client.c
1432 ↗(On Diff #57203)

I'll do that separately — it's logically distinct from this change.

1460 ↗(On Diff #57203)

Yes, good catch on both counts, thanks!

I thought nd_enabled <==> (nd_ifp != NULL), but it doesn't really appear to be the case. I think it probably should be; the only added complexity is the net.netdump.enabled sysctl becomes a proc instead.

This also suggests that various places that set nd_enabled = 0 should also release the interface ref — probably using your proposed netdump_unconfigure();

cem marked an inline comment as done.
  • Refactor de-configuration into netdump_unconfigure() routine
  • Rebase on D20233
markj added inline comments.
sys/netinet/netdump/netdump_client.c
1273 ↗(On Diff #57289)

Perhaps consider using a bool netdump_enabled(void) predicate which asserts that the conf lock is held.

This revision is now accepted and ready to land.May 10 2019, 9:20 PM
sys/netinet/netdump/netdump_client.c
1273 ↗(On Diff #57289)

Ok

cem marked an inline comment as done.
  • Add and use netdump_enabled() predicate. We rely on sx_assert neutering

during kdb/panic to obviate the lock assertion during the dump-time code, which
generally does not take locks.

This revision now requires review to proceed.May 10 2019, 9:54 PM
In D20206#435984, @cem wrote:
  • Add and use netdump_enabled() predicate. We rely on sx_assert neutering

during kdb/panic to obviate the lock assertion during the dump-time code, which
generally does not take locks.

Where are we calling netdump_enabled() after a panic?

Where are we calling netdump_enabled() after a panic?

netdump_send, netdump_network_poll, etc. Via MPASS().

markj added inline comments.
sys/netinet/netdump/netdump_client.c
997 ↗(On Diff #57290)

This seems redundant now.

1193 ↗(On Diff #57290)

Style: missing newline after '{'.

This revision is now accepted and ready to land.May 10 2019, 10:39 PM
cem marked 2 inline comments as done.May 10 2019, 11:09 PM
cem added inline comments.
sys/netinet/netdump/netdump_client.c
997 ↗(On Diff #57290)

Ah, thanks. Will fix before commit.

1193 ↗(On Diff #57290)

Will fix.

This revision was automatically updated to reflect the committed changes.
cem marked 2 inline comments as done.