Date: Mon, 20 Feb 2017 10:44:24 +0000 (UTC) From: Konstantin Belousov <kib@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r313989 - in stable/11/sys: arm/include arm64/include kern Message-ID: <201702201044.v1KAiOXd029384@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: kib Date: Mon Feb 20 10:44:24 2017 New Revision: 313989 URL: https://svnweb.freebsd.org/changeset/base/313989 Log: MFC r313345: Update arm and arm64 counters MD bits. MFC r313394 (by manu): subr_sfbus.c need sys/proc.h for struct thread definition. Modified: stable/11/sys/arm/include/counter.h stable/11/sys/arm64/include/counter.h stable/11/sys/kern/subr_sfbuf.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/arm/include/counter.h ============================================================================== --- stable/11/sys/arm/include/counter.h Mon Feb 20 08:10:41 2017 (r313988) +++ stable/11/sys/arm/include/counter.h Mon Feb 20 10:44:24 2017 (r313989) @@ -31,12 +31,9 @@ #include <sys/pcpu.h> #include <machine/atomic.h> -#ifdef INVARIANTS -#include <sys/proc.h> -#endif -#define counter_enter() critical_enter() -#define counter_exit() critical_exit() +#define counter_enter() do {} while (0) +#define counter_exit() do {} while (0) #ifdef IN_SUBR_COUNTER_C @@ -55,7 +52,7 @@ counter_u64_fetch_inline(uint64_t *p) int i; r = 0; - for (i = 0; i < mp_ncpus; i++) + CPU_FOREACH(i) r += counter_u64_read_one((uint64_t *)p, i); return (r); @@ -78,18 +75,13 @@ counter_u64_zero_inline(counter_u64_t c) } #endif -#define counter_u64_add_protected(c, inc) do { \ - CRITICAL_ASSERT(curthread); \ - atomic_add_64((uint64_t *)zpcpu_get(c), (inc)); \ -} while (0) +#define counter_u64_add_protected(c, inc) counter_u64_add(c, inc) static inline void counter_u64_add(counter_u64_t c, int64_t inc) { - counter_enter(); - counter_u64_add_protected(c, inc); - counter_exit(); + atomic_add_64((uint64_t *)zpcpu_get(c), inc); } #endif /* ! __MACHINE_COUNTER_H__ */ Modified: stable/11/sys/arm64/include/counter.h ============================================================================== --- stable/11/sys/arm64/include/counter.h Mon Feb 20 08:10:41 2017 (r313988) +++ stable/11/sys/arm64/include/counter.h Mon Feb 20 10:44:24 2017 (r313989) @@ -30,12 +30,10 @@ #define _MACHINE_COUNTER_H_ #include <sys/pcpu.h> -#ifdef INVARIANTS -#include <sys/proc.h> -#endif +#include <machine/atomic.h> -#define counter_enter() critical_enter() -#define counter_exit() critical_exit() +#define counter_enter() do {} while (0) +#define counter_exit() do {} while (0) #ifdef IN_SUBR_COUNTER_C static inline uint64_t @@ -52,13 +50,12 @@ counter_u64_fetch_inline(uint64_t *p) int i; r = 0; - for (i = 0; i < mp_ncpus; i++) + CPU_FOREACH(i) r += counter_u64_read_one((uint64_t *)p, i); return (r); } -/* XXXKIB might interrupt increment */ static void counter_u64_zero_one_cpu(void *arg) { @@ -76,18 +73,13 @@ counter_u64_zero_inline(counter_u64_t c) } #endif -#define counter_u64_add_protected(c, inc) do { \ - CRITICAL_ASSERT(curthread); \ - *(uint64_t *)zpcpu_get(c) += (inc); \ -} while (0) +#define counter_u64_add_protected(c, inc) counter_u64_add(c, inc) static inline void counter_u64_add(counter_u64_t c, int64_t inc) { - counter_enter(); - counter_u64_add_protected(c, inc); - counter_exit(); + atomic_add_64((uint64_t *)zpcpu_get(c), inc); } #endif /* ! _MACHINE_COUNTER_H_ */ Modified: stable/11/sys/kern/subr_sfbuf.c ============================================================================== --- stable/11/sys/kern/subr_sfbuf.c Mon Feb 20 08:10:41 2017 (r313988) +++ stable/11/sys/kern/subr_sfbuf.c Mon Feb 20 10:44:24 2017 (r313989) @@ -33,6 +33,7 @@ __FBSDID("$FreeBSD$"); #include <sys/lock.h> #include <sys/malloc.h> #include <sys/mutex.h> +#include <sys/proc.h> #include <sys/sf_buf.h> #include <sys/smp.h> #include <sys/sysctl.h>
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201702201044.v1KAiOXd029384>