[Midnightbsd-cvs] src [12361] trunk/sys/sys: sync with FreeBSD 11-stable
laffer1 at midnightbsd.org
laffer1 at midnightbsd.org
Sun Feb 9 13:31:04 EST 2020
Revision: 12361
http://svnweb.midnightbsd.org/src/?rev=12361
Author: laffer1
Date: 2020-02-09 13:31:04 -0500 (Sun, 09 Feb 2020)
Log Message:
-----------
sync with FreeBSD 11-stable
Modified Paths:
--------------
trunk/sys/sys/sdt.h
trunk/sys/sys/seq.h
Modified: trunk/sys/sys/sdt.h
===================================================================
--- trunk/sys/sys/sdt.h 2020-02-09 18:30:15 UTC (rev 12360)
+++ trunk/sys/sys/sdt.h 2020-02-09 18:31:04 UTC (rev 12361)
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $FreeBSD: stable/10/sys/sys/sdt.h 289795 2015-10-23 07:37:44Z avg $
+ * $FreeBSD: stable/11/sys/sys/sdt.h 331722 2018-03-29 02:50:57Z eadler $
*
* Statically Defined Tracing (SDT) definitions.
*
@@ -81,6 +81,8 @@
#include <sys/cdefs.h>
#include <sys/linker_set.h>
+extern volatile bool sdt_probes_enabled;
+
#ifndef KDTRACE_HOOKS
#define SDT_PROVIDER_DEFINE(prov)
@@ -162,10 +164,12 @@
extern struct sdt_probe sdt_##prov##_##mod##_##func##_##name[1]
#define SDT_PROBE(prov, mod, func, name, arg0, arg1, arg2, arg3, arg4) do { \
- if (sdt_##prov##_##mod##_##func##_##name->id) \
+ if (__predict_false(sdt_probes_enabled)) { \
+ if (__predict_false(sdt_##prov##_##mod##_##func##_##name->id)) \
(*sdt_probe_func)(sdt_##prov##_##mod##_##func##_##name->id, \
(uintptr_t) arg0, (uintptr_t) arg1, (uintptr_t) arg2, \
(uintptr_t) arg3, (uintptr_t) arg4); \
+ } \
} while (0)
#define SDT_PROBE_ARGTYPE(prov, mod, func, name, num, type, xtype) \
Modified: trunk/sys/sys/seq.h
===================================================================
--- trunk/sys/sys/seq.h 2020-02-09 18:30:15 UTC (rev 12360)
+++ trunk/sys/sys/seq.h 2020-02-09 18:31:04 UTC (rev 12361)
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $FreeBSD: stable/10/sys/sys/seq.h 273109 2014-10-14 21:19:23Z mjg $
+ * $FreeBSD: stable/11/sys/sys/seq.h 312714 2017-01-24 19:39:24Z mjg $
*/
#ifndef _SYS_SEQ_H_
@@ -60,7 +60,6 @@
* lobj = gobj;
* if (seq_consistent(&gobj->seq, seq))
* break;
- * cpu_spinwait();
* }
* foo(lobj);
*/
@@ -70,25 +69,6 @@
#include <machine/cpu.h>
-/*
- * This is a temporary hack until memory barriers are cleaned up.
- *
- * atomic_load_acq_int at least on amd64 provides a full memory barrier,
- * in a way which affects perforance.
- *
- * Hack below covers all architectures and avoids most of the penalty at least
- * on amd64.
- */
-static __inline int
-atomic_load_acq_rmb_int(volatile u_int *p)
-{
- volatile u_int v;
-
- v = *p;
- atomic_load_acq_int(&v);
- return (v);
-}
-
static __inline bool
seq_in_modify(seq_t seqp)
{
@@ -101,7 +81,8 @@
{
MPASS(!seq_in_modify(*seqp));
- atomic_add_acq_int(seqp, 1);
+ *seqp += 1;
+ atomic_thread_fence_rel();
}
static __inline void
@@ -108,17 +89,17 @@
seq_write_end(seq_t *seqp)
{
- atomic_add_rel_int(seqp, 1);
+ atomic_store_rel_int(seqp, *seqp + 1);
MPASS(!seq_in_modify(*seqp));
}
static __inline seq_t
-seq_read(seq_t *seqp)
+seq_read(const seq_t *seqp)
{
seq_t ret;
for (;;) {
- ret = atomic_load_acq_rmb_int(seqp);
+ ret = atomic_load_acq_int(__DECONST(seq_t *, seqp));
if (seq_in_modify(ret)) {
cpu_spinwait();
continue;
@@ -130,17 +111,18 @@
}
static __inline seq_t
-seq_consistent(seq_t *seqp, seq_t oldseq)
+seq_consistent_nomb(const seq_t *seqp, seq_t oldseq)
{
- return (atomic_load_acq_rmb_int(seqp) == oldseq);
+ return (*seqp == oldseq);
}
static __inline seq_t
-seq_consistent_nomb(seq_t *seqp, seq_t oldseq)
+seq_consistent(const seq_t *seqp, seq_t oldseq)
{
- return (*seqp == oldseq);
+ atomic_thread_fence_acq();
+ return (seq_consistent_nomb(seqp, oldseq));
}
#endif /* _KERNEL */
More information about the Midnightbsd-cvs
mailing list