aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/firewire
diff options
context:
space:
mode:
authorGleb Smirnoff <glebius@FreeBSD.org>2019-10-07 22:40:05 +0000
committerGleb Smirnoff <glebius@FreeBSD.org>2019-10-07 22:40:05 +0000
commitb8a6e03fac922677455d8e0977831506cf8212e8 (patch)
tree28fc099c8daca3278068766b2863e110876865ce /sys/dev/firewire
parent746c7ae563142eaae423b0e6c0077ef2013c2435 (diff)
downloadsrc-b8a6e03fac922677455d8e0977831506cf8212e8.tar.gz
src-b8a6e03fac922677455d8e0977831506cf8212e8.zip
Widen NET_EPOCH coverage.
When epoch(9) was introduced to network stack, it was basically dropped in place of existing locking, which was mutexes and rwlocks. For the sake of performance mutex covered areas were as small as possible, so became epoch covered areas. However, epoch doesn't introduce any contention, it just delays memory reclaim. So, there is no point to minimise epoch covered areas in sense of performance. Meanwhile entering/exiting epoch also has non-zero CPU usage, so doing this less often is a win. Not the least is also code maintainability. In the new paradigm we can assume that at any stage of processing a packet, we are inside network epoch. This makes coding both input and output path way easier. On output path we already enter epoch quite early - in the ip_output(), in the ip6_output(). This patch does the same for the input path. All ISR processing, network related callouts, other ways of packet injection to the network stack shall be performed in net_epoch. Any leaf function that walks network configuration now asserts epoch. Tricky part is configuration code paths - ioctls, sysctls. They also call into leaf functions, so some need to be changed. This patch would introduce more epoch recursions (see EPOCH_TRACE) than we had before. They will be cleaned up separately, as several of them aren't trivial. Note, that unlike a lock recursion the epoch recursion is safe and just wastes a bit of resources. Reviewed by: gallatin, hselasky, cy, adrian, kristof Differential Revision: https://reviews.freebsd.org/D19111
Notes
Notes: svn path=/head/; revision=353292
Diffstat (limited to 'sys/dev/firewire')
-rw-r--r--sys/dev/firewire/if_fwip.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/sys/dev/firewire/if_fwip.c b/sys/dev/firewire/if_fwip.c
index 35a58c013707..6d2b3fb59221 100644
--- a/sys/dev/firewire/if_fwip.c
+++ b/sys/dev/firewire/if_fwip.c
@@ -708,6 +708,7 @@ fwip_start_send (void *arg, int count)
static void
fwip_stream_input(struct fw_xferq *xferq)
{
+ struct epoch_tracker et;
struct mbuf *m, *m0;
struct m_tag *mtag;
struct ifnet *ifp;
@@ -720,6 +721,7 @@ fwip_stream_input(struct fw_xferq *xferq)
fwip = (struct fwip_softc *)xferq->sc;
ifp = fwip->fw_softc.fwip_ifp;
+ NET_EPOCH_ENTER(et);
while ((sxfer = STAILQ_FIRST(&xferq->stvalid)) != NULL) {
STAILQ_REMOVE_HEAD(&xferq->stvalid, link);
fp = mtod(sxfer->mbuf, struct fw_pkt *);
@@ -808,6 +810,7 @@ fwip_stream_input(struct fw_xferq *xferq)
firewire_input(ifp, m, src);
if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1);
}
+ NET_EPOCH_EXIT(et);
if (STAILQ_FIRST(&xferq->stfree) != NULL)
fwip->fd.fc->irx_enable(fwip->fd.fc, fwip->dma_ch);
}