diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2018-08-20 15:53:03 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2018-09-21 10:29:39 +0200 |
commit | 18fa92c2dcc6c52e0bf27d214d80f0c25a89b47d (patch) | |
tree | a3020ac5b1f366f2f0920941b589808e435dbcee /freebsd/sys/sys | |
parent | Update to FreeBSD head 2017-12-01 (diff) | |
download | rtems-libbsd-18fa92c2dcc6c52e0bf27d214d80f0c25a89b47d.tar.bz2 |
Update to FreeBSD head 2018-02-01
Git mirror commit d079ae0442af8fa3cfd6d7ede190d04e64a2c0d4.
Update #3472.
Diffstat (limited to 'freebsd/sys/sys')
-rw-r--r-- | freebsd/sys/sys/_domainset.h | 60 | ||||
-rw-r--r-- | freebsd/sys/sys/bus_dma.h | 10 | ||||
-rw-r--r-- | freebsd/sys/sys/capsicum.h | 2 | ||||
-rw-r--r-- | freebsd/sys/sys/conf.h | 4 | ||||
-rw-r--r-- | freebsd/sys/sys/domainset.h | 102 | ||||
-rw-r--r-- | freebsd/sys/sys/gtaskqueue.h | 4 | ||||
-rw-r--r-- | freebsd/sys/sys/kernel.h | 33 | ||||
-rw-r--r-- | freebsd/sys/sys/libkern.h | 7 | ||||
-rw-r--r-- | freebsd/sys/sys/malloc.h | 44 | ||||
-rw-r--r-- | freebsd/sys/sys/mount.h | 3 | ||||
-rw-r--r-- | freebsd/sys/sys/mouse.h | 3 | ||||
-rw-r--r-- | freebsd/sys/sys/nv.h | 2 | ||||
-rw-r--r-- | freebsd/sys/sys/proc.h | 18 | ||||
-rw-r--r-- | freebsd/sys/sys/random.h | 1 | ||||
-rw-r--r-- | freebsd/sys/sys/rman.h | 2 | ||||
-rw-r--r-- | freebsd/sys/sys/sf_buf.h | 16 | ||||
-rw-r--r-- | freebsd/sys/sys/smp.h | 11 | ||||
-rw-r--r-- | freebsd/sys/sys/socketvar.h | 2 | ||||
-rw-r--r-- | freebsd/sys/sys/sysproto.h | 35 | ||||
-rw-r--r-- | freebsd/sys/sys/systm.h | 16 | ||||
-rw-r--r-- | freebsd/sys/sys/tslog.h | 62 | ||||
-rw-r--r-- | freebsd/sys/sys/vmmeter.h | 9 | ||||
-rw-r--r-- | freebsd/sys/sys/watchdog.h | 8 |
23 files changed, 396 insertions, 58 deletions
diff --git a/freebsd/sys/sys/_domainset.h b/freebsd/sys/sys/_domainset.h new file mode 100644 index 00000000..30d8501c --- /dev/null +++ b/freebsd/sys/sys/_domainset.h @@ -0,0 +1,60 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2017, Jeffrey Roberson <jeff@freebsd.org> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice unmodified, this list of conditions, and the following + * disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _SYS__DOMAINSET_H_ +#define _SYS__DOMAINSET_H_ + +#include <sys/_bitset.h> + +#ifdef _KERNEL +#define DOMAINSET_SETSIZE MAXMEMDOM +#endif + +#define DOMAINSET_MAXSIZE 256 + +#ifndef DOMAINSET_SETSIZE +#define DOMAINSET_SETSIZE DOMAINSET_MAXSIZE +#endif + +BITSET_DEFINE(_domainset, DOMAINSET_SETSIZE); +typedef struct _domainset domainset_t; + +/* + * This structure is intended to be embedded in objects which have policy + * attributes. Each object keeps its own iterator so round-robin is + * synchronized and accurate. + */ +struct domainset; +struct domainset_ref { + struct domainset * volatile dr_policy; + int dr_iterator; +}; + +#endif /* !_SYS__DOMAINSET_H_ */ diff --git a/freebsd/sys/sys/bus_dma.h b/freebsd/sys/sys/bus_dma.h index c5799661..2bf46ca8 100644 --- a/freebsd/sys/sys/bus_dma.h +++ b/freebsd/sys/sys/bus_dma.h @@ -1,7 +1,7 @@ /* $NetBSD: bus.h,v 1.12 1997/10/01 08:25:15 fvdl Exp $ */ /*- - * SPDX-License-Identifier: BSD-2-Clause-NetBSD + * SPDX-License-Identifier: (BSD-2-Clause-NetBSD AND BSD-4-Clause) * * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc. * All rights reserved. @@ -176,6 +176,14 @@ int bus_dma_tag_create(bus_dma_tag_t parent, bus_size_t alignment, bus_size_t maxsegsz, int flags, bus_dma_lock_t *lockfunc, void *lockfuncarg, bus_dma_tag_t *dmat); +/* + * Set the memory domain to be used for allocations. + * + * Automatic for PCI devices. Must be set prior to creating maps or + * allocating memory. + */ +int bus_dma_tag_set_domain(bus_dma_tag_t dmat, int domain); + int bus_dma_tag_destroy(bus_dma_tag_t dmat); /* diff --git a/freebsd/sys/sys/capsicum.h b/freebsd/sys/sys/capsicum.h index ae466952..847b4478 100644 --- a/freebsd/sys/sys/capsicum.h +++ b/freebsd/sys/sys/capsicum.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2008-2010, 2015 Robert N. M. Watson * Copyright (c) 2012 FreeBSD Foundation * All rights reserved. diff --git a/freebsd/sys/sys/conf.h b/freebsd/sys/sys/conf.h index 7f240f68..3980eba2 100644 --- a/freebsd/sys/sys/conf.h +++ b/freebsd/sys/sys/conf.h @@ -367,8 +367,8 @@ struct dumperinfo { off_t mediasize; /* Space available in bytes. */ void *blockbuf; /* Buffer for padding shorter dump blocks */ off_t dumpoff; /* Offset of ongoing kernel dump. */ - struct kerneldumpcrypto *kdc; /* Kernel dump crypto. */ - struct kerneldumpgz *kdgz; /* Kernel dump compression. */ + struct kerneldumpcrypto *kdcrypto; /* Kernel dump crypto. */ + struct kerneldumpcomp *kdcomp; /* Kernel dump compression. */ }; #ifndef __rtems__ diff --git a/freebsd/sys/sys/domainset.h b/freebsd/sys/sys/domainset.h new file mode 100644 index 00000000..6580e1ed --- /dev/null +++ b/freebsd/sys/sys/domainset.h @@ -0,0 +1,102 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2017, Jeffrey Roberson <jeff@freebsd.org> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice unmodified, this list of conditions, and the following + * disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _SYS_DOMAINSETSET_H_ +#define _SYS_DOMAINSETSET_H_ + +#include <sys/_domainset.h> + +#include <sys/bitset.h> + +#define _NDOMAINSETBITS _BITSET_BITS +#define _NDOMAINSETWORDS __bitset_words(DOMAINSET_SETSIZE) + +#define DOMAINSETSETBUFSIZ ((2 + sizeof(long) * 2) * _NDOMAINSETWORDS) + +#define DOMAINSET_CLR(n, p) BIT_CLR(DOMAINSET_SETSIZE, n, p) +#define DOMAINSET_COPY(f, t) BIT_COPY(DOMAINSET_SETSIZE, f, t) +#define DOMAINSET_ISSET(n, p) BIT_ISSET(DOMAINSET_SETSIZE, n, p) +#define DOMAINSET_SET(n, p) BIT_SET(DOMAINSET_SETSIZE, n, p) +#define DOMAINSET_ZERO(p) BIT_ZERO(DOMAINSET_SETSIZE, p) +#define DOMAINSET_FILL(p) BIT_FILL(DOMAINSET_SETSIZE, p) +#define DOMAINSET_SETOF(n, p) BIT_SETOF(DOMAINSET_SETSIZE, n, p) +#define DOMAINSET_EMPTY(p) BIT_EMPTY(DOMAINSET_SETSIZE, p) +#define DOMAINSET_ISFULLSET(p) BIT_ISFULLSET(DOMAINSET_SETSIZE, p) +#define DOMAINSET_SUBSET(p, c) BIT_SUBSET(DOMAINSET_SETSIZE, p, c) +#define DOMAINSET_OVERLAP(p, c) BIT_OVERLAP(DOMAINSET_SETSIZE, p, c) +#define DOMAINSET_CMP(p, c) BIT_CMP(DOMAINSET_SETSIZE, p, c) +#define DOMAINSET_OR(d, s) BIT_OR(DOMAINSET_SETSIZE, d, s) +#define DOMAINSET_AND(d, s) BIT_AND(DOMAINSET_SETSIZE, d, s) +#define DOMAINSET_NAND(d, s) BIT_NAND(DOMAINSET_SETSIZE, d, s) +#define DOMAINSET_CLR_ATOMIC(n, p) BIT_CLR_ATOMIC(DOMAINSET_SETSIZE, n, p) +#define DOMAINSET_SET_ATOMIC(n, p) BIT_SET_ATOMIC(DOMAINSET_SETSIZE, n, p) +#define DOMAINSET_SET_ATOMIC_ACQ(n, p) \ + BIT_SET_ATOMIC_ACQ(DOMAINSET_SETSIZE, n, p) +#define DOMAINSET_AND_ATOMIC(n, p) BIT_AND_ATOMIC(DOMAINSET_SETSIZE, n, p) +#define DOMAINSET_OR_ATOMIC(d, s) BIT_OR_ATOMIC(DOMAINSET_SETSIZE, d, s) +#define DOMAINSET_COPY_STORE_REL(f, t) \ + BIT_COPY_STORE_REL(DOMAINSET_SETSIZE, f, t) +#define DOMAINSET_FFS(p) BIT_FFS(DOMAINSET_SETSIZE, p) +#define DOMAINSET_FLS(p) BIT_FLS(DOMAINSET_SETSIZE, p) +#define DOMAINSET_COUNT(p) BIT_COUNT(DOMAINSET_SETSIZE, p) +#define DOMAINSET_FSET BITSET_FSET(_NDOMAINSETWORDS) +#define DOMAINSET_T_INITIALIZER BITSET_T_INITIALIZER + +#define DOMAINSET_POLICY_INVALID 0 +#define DOMAINSET_POLICY_ROUNDROBIN 1 +#define DOMAINSET_POLICY_FIRSTTOUCH 2 +#define DOMAINSET_POLICY_PREFER 3 +#define DOMAINSET_POLICY_MAX DOMAINSET_POLICY_PREFER + +#ifdef _KERNEL +#include <sys/queue.h> +LIST_HEAD(domainlist, domainset); + +struct domainset { + LIST_ENTRY(domainset) ds_link; + domainset_t ds_mask; /* allowed domains. */ + uint16_t ds_policy; /* Policy type. */ + int16_t ds_prefer; /* Preferred domain or -1. */ + uint16_t ds_cnt; /* popcnt from above. */ + uint16_t ds_max; /* Maximum domain in set. */ +}; + +void domainset_zero(void); + +#else +__BEGIN_DECLS +int cpuset_getdomain(cpulevel_t, cpuwhich_t, id_t, size_t, domainset_t *, + int *); +int cpuset_setdomain(cpulevel_t, cpuwhich_t, id_t, size_t, + const domainset_t *, int); + +__END_DECLS +#endif +#endif /* !_SYS_DOMAINSETSET_H_ */ diff --git a/freebsd/sys/sys/gtaskqueue.h b/freebsd/sys/sys/gtaskqueue.h index e8519637..41094603 100644 --- a/freebsd/sys/sys/gtaskqueue.h +++ b/freebsd/sys/sys/gtaskqueue.h @@ -1,6 +1,8 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2014 Jeffrey Roberson <jeff@freebsd.org> - * Copyright (c) 2016 Matthew Macy <mmacy@nextbsd.org> + * Copyright (c) 2016 Matthew Macy <mmacy@mattmacy.io> * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/freebsd/sys/sys/kernel.h b/freebsd/sys/sys/kernel.h index 1cc03275..81ceca04 100644 --- a/freebsd/sys/sys/kernel.h +++ b/freebsd/sys/sys/kernel.h @@ -54,6 +54,9 @@ /* for intrhook below */ #include <sys/queue.h> +/* for timestamping SYSINITs; other files may assume this is included here */ +#include <sys/tslog.h> + /* Global variables for the kernel. */ #ifndef __rtems__ @@ -240,6 +243,35 @@ struct sysinit { * correct warnings when -Wcast-qual is used. * */ +#ifdef TSLOG +struct sysinit_tslog { + sysinit_cfunc_t func; + const void * data; + const char * name; +}; +static inline void +sysinit_tslog_shim(const void * data) +{ + const struct sysinit_tslog * x = data; + + TSRAW(curthread, TS_ENTER, "SYSINIT", x->name); + (x->func)(x->data); + TSRAW(curthread, TS_EXIT, "SYSINIT", x->name); +} +#define C_SYSINIT(uniquifier, subsystem, order, func, ident) \ + static struct sysinit_tslog uniquifier ## _sys_init_tslog = { \ + func, \ + (ident), \ + #uniquifier \ + }; \ + static struct sysinit uniquifier ## _sys_init = { \ + subsystem, \ + order, \ + sysinit_tslog_shim, \ + &uniquifier ## _sys_init_tslog \ + }; \ + DATA_SET(sysinit_set,uniquifier ## _sys_init) +#else #ifndef __rtems__ #define C_SYSINIT(uniquifier, subsystem, order, func, ident) \ static struct sysinit uniquifier ## _sys_init = { \ @@ -274,6 +306,7 @@ struct sysinit { #define SYSINIT_DOMAIN_REFERENCE(dom) \ SYSINIT_REFERENCE(domain_add_ ## dom) #endif /* __rtems__ */ +#endif #define SYSINIT(uniquifier, subsystem, order, func, ident) \ C_SYSINIT(uniquifier, subsystem, order, \ diff --git a/freebsd/sys/sys/libkern.h b/freebsd/sys/sys/libkern.h index 4d043f5a..dc24036b 100644 --- a/freebsd/sys/sys/libkern.h +++ b/freebsd/sys/sys/libkern.h @@ -86,6 +86,13 @@ hex2ascii(int hex) return (hex2ascii_data[hex]); } +static inline bool +validbcd(int bcd) +{ + + return (bcd == 0 || (bcd > 0 && bcd <= 0x99 && bcd2bin_data[bcd] != 0)); +} + static __inline int imax(int a, int b) { return (a > b ? a : b); } static __inline int imin(int a, int b) { return (a < b ? a : b); } static __inline long lmax(long a, long b) { return (a > b ? a : b); } diff --git a/freebsd/sys/sys/malloc.h b/freebsd/sys/sys/malloc.h index c5ab6125..1920ff69 100644 --- a/freebsd/sys/sys/malloc.h +++ b/freebsd/sys/sys/malloc.h @@ -41,6 +41,7 @@ #include <sys/queue.h> #include <sys/_lock.h> #include <sys/_mutex.h> +#include <machine/_limits.h> #define MINALLOCSIZE UMA_SMALLEST_UNIT @@ -156,13 +157,6 @@ MALLOC_DECLARE(M_DEVBUF); MALLOC_DECLARE(M_TEMP); /* - * Deprecated macro versions of not-quite-malloc() and free(). - */ -#define MALLOC(space, cast, size, type, flags) \ - ((space) = (cast)malloc((u_long)(size), (type), (flags))) -#define FREE(addr, type) free((addr), (type)) - -/* * XXX this should be declared in <sys/uio.h>, but that tends to fail * because <sys/uio.h> is included in a header before the source file * has a chance to include <sys/malloc.h> to get MALLOC_DECLARE() defined. @@ -181,21 +175,45 @@ void *contigmalloc(unsigned long size, struct malloc_type *type, int flags, vm_paddr_t low, vm_paddr_t high, unsigned long alignment, vm_paddr_t boundary) __malloc_like __result_use_check __alloc_size(1) __alloc_align(6); +void *contigmalloc_domain(unsigned long size, struct malloc_type *type, + int domain, int flags, vm_paddr_t low, vm_paddr_t high, + unsigned long alignment, vm_paddr_t boundary) + __malloc_like __result_use_check __alloc_size(1) __alloc_align(6); void free(void *addr, struct malloc_type *type); -void *malloc(unsigned long size, struct malloc_type *type, int flags) - __malloc_like __result_use_check __alloc_size(1); +void free_domain(void *addr, struct malloc_type *type); +void *malloc(size_t size, struct malloc_type *type, int flags) __malloc_like + __result_use_check __alloc_size(1); +void *malloc_domain(size_t size, struct malloc_type *type, int domain, + int flags) __malloc_like __result_use_check __alloc_size(1); +void *mallocarray(size_t nmemb, size_t size, struct malloc_type *type, + int flags) __malloc_like __result_use_check + __alloc_size2(1, 2); void malloc_init(void *); int malloc_last_fail(void); void malloc_type_allocated(struct malloc_type *type, unsigned long size); void malloc_type_freed(struct malloc_type *type, unsigned long size); void malloc_type_list(malloc_type_list_func_t *, void *); void malloc_uninit(void *); -void *realloc(void *addr, unsigned long size, struct malloc_type *type, - int flags) __result_use_check __alloc_size(2); -void *reallocf(void *addr, unsigned long size, struct malloc_type *type, - int flags) __alloc_size(2); +void *realloc(void *addr, size_t size, struct malloc_type *type, int flags) + __result_use_check __alloc_size(2); +void *reallocf(void *addr, size_t size, struct malloc_type *type, int flags) + __result_use_check __alloc_size(2); struct malloc_type *malloc_desc2type(const char *desc); + +/* + * This is sqrt(SIZE_MAX+1), as s1*s2 <= SIZE_MAX + * if both s1 < MUL_NO_OVERFLOW and s2 < MUL_NO_OVERFLOW + */ +#define MUL_NO_OVERFLOW (1UL << (sizeof(size_t) * 8 / 2)) +static inline bool +WOULD_OVERFLOW(size_t nmemb, size_t size) +{ + + return ((nmemb >= MUL_NO_OVERFLOW || size >= MUL_NO_OVERFLOW) && + nmemb > 0 && __SIZE_T_MAX / nmemb < size); +} +#undef MUL_NO_OVERFLOW #endif /* _KERNEL */ #endif /* !_SYS_MALLOC_H_ */ diff --git a/freebsd/sys/sys/mount.h b/freebsd/sys/sys/mount.h index 362c54e9..9d499004 100644 --- a/freebsd/sys/sys/mount.h +++ b/freebsd/sys/sys/mount.h @@ -40,6 +40,7 @@ #ifdef _KERNEL #include <sys/lock.h> #include <sys/lockmgr.h> +#include <sys/tslog.h> #include <sys/_mutex.h> #include <sys/_sx.h> #endif @@ -708,9 +709,11 @@ vfs_statfs_t __vfs_statfs; #define VFS_MOUNT(MP) ({ \ int _rc; \ \ + TSRAW(curthread, TS_ENTER, "VFS_MOUNT", (MP)->mnt_vfc->vfc_name);\ VFS_PROLOGUE(MP); \ _rc = (*(MP)->mnt_op->vfs_mount)(MP); \ VFS_EPILOGUE(MP); \ + TSRAW(curthread, TS_EXIT, "VFS_MOUNT", (MP)->mnt_vfc->vfc_name);\ _rc; }) #define VFS_UNMOUNT(MP, FORCE) ({ \ diff --git a/freebsd/sys/sys/mouse.h b/freebsd/sys/sys/mouse.h index 9fd1d6d8..a1f950cf 100644 --- a/freebsd/sys/sys/mouse.h +++ b/freebsd/sys/sys/mouse.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-1-Clause + * * Copyright (c) 1992, 1993 Erik Forsberg. * Copyright (c) 1996, 1997 Kazutaka YOKOTA * All rights reserved. @@ -135,6 +137,7 @@ typedef struct synapticshw { int maximumYCoord; int infoXupmm; int infoYupmm; + int forcePad; } synapticshw_t; /* iftype */ diff --git a/freebsd/sys/sys/nv.h b/freebsd/sys/sys/nv.h index fcea2b3e..bf40f8f3 100644 --- a/freebsd/sys/sys/nv.h +++ b/freebsd/sys/sys/nv.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2009-2013 The FreeBSD Foundation * Copyright (c) 2013-2015 Mariusz Zaborski <oshogbo@FreeBSD.org> * All rights reserved. diff --git a/freebsd/sys/sys/proc.h b/freebsd/sys/sys/proc.h index 7178c316..ab292769 100644 --- a/freebsd/sys/sys/proc.h +++ b/freebsd/sys/sys/proc.h @@ -62,11 +62,18 @@ #include <sys/time.h> /* For structs itimerval, timeval. */ #else #include <sys/pcpu.h> +#include <sys/systm.h> #endif #include <sys/ucontext.h> #include <sys/ucred.h> -#include <sys/_vm_domain.h> +#include <sys/types.h> +#include <sys/domainset.h> + #include <machine/proc.h> /* Machine-dependent proc substruct. */ +#ifdef _KERNEL +#include <machine/cpu.h> +#endif + /* * One structure allocated per session. @@ -179,11 +186,14 @@ struct procdesc; struct racct; struct sbuf; struct sleepqueue; +struct socket; struct syscall_args; struct td_sched; struct thread; struct trapframe; struct turnstile; +struct vm_map; +struct vm_map_entry; /* * XXX: Does this belong in resource.h or resourcevar.h instead? @@ -239,6 +249,7 @@ struct thread { TAILQ_ENTRY(thread) td_lockq; /* (t) Lock queue. */ LIST_ENTRY(thread) td_hash; /* (d) Hash chain. */ struct cpuset *td_cpuset; /* (t) CPU affinity mask. */ + struct domainset_ref td_domain; /* (a) NUMA policy */ #endif /* __rtems__ */ struct seltd *td_sel; /* Select queue/channel. */ struct sleepqueue *td_sleepqueue; /* (k) Associated sleep queue. */ @@ -246,7 +257,6 @@ struct thread { struct turnstile *td_turnstile; /* (k) Associated turnstile. */ struct rl_q_entry *td_rlqe; /* (k) Associated range lock entry. */ struct umtx_q *td_umtxq; /* (c?) Link for when we're blocked. */ - struct vm_domain_policy td_vm_dom_policy; /* (c) current numa domain policy */ lwpid_t td_tid; /* (b) Thread ID. */ sigqueue_t td_sigqueue; /* (c) Sigs arrived, not delivered. */ #define td_siglist td_sigqueue.sq_signals @@ -315,7 +325,6 @@ struct thread { pid_t td_dbg_forked; /* (c) Child pid for debugger. */ u_int td_vp_reserv; /* (k) Count of reserved vnodes. */ int td_no_sleeping; /* (k) Sleeping disabled count. */ - int td_dom_rr_idx; /* (k) RR Numa domain selection. */ void *td_su; /* (k) FFS SU private */ sbintime_t td_sleeptimo; /* (t) Sleep timeout. */ int td_rtcgen; /* (s) rtc_generation of abs. sleep */ @@ -698,7 +707,6 @@ struct proc { uint64_t p_prev_runtime; /* (c) Resource usage accounting. */ struct racct *p_racct; /* (b) Resource accounting. */ int p_throttled; /* (c) Flag for racct pcpu throttling */ - struct vm_domain_policy p_vm_dom_policy; /* (c) process default VM domain, or -1 */ /* * An orphan is the child that has beed re-parented to the * debugger as a result of attaching to it. Need to keep @@ -1060,6 +1068,8 @@ void fork_exit(void (*)(void *, struct trapframe *), void *, struct trapframe *); void fork_return(struct thread *, struct trapframe *); int inferior(struct proc *p); +void kern_proc_vmmap_resident(struct vm_map *map, struct vm_map_entry *entry, + int *resident_count, bool *super); #ifndef __rtems__ void kern_yield(int); void kick_proc0(void); diff --git a/freebsd/sys/sys/random.h b/freebsd/sys/sys/random.h index b022f5a3..78acaf9d 100644 --- a/freebsd/sys/sys/random.h +++ b/freebsd/sys/sys/random.h @@ -104,6 +104,7 @@ enum random_entropy_source { RANDOM_PURE_RNDTEST, RANDOM_PURE_VIRTIO, RANDOM_PURE_BROADCOM, + RANDOM_PURE_CCP, ENTROPYSOURCE }; diff --git a/freebsd/sys/sys/rman.h b/freebsd/sys/sys/rman.h index 4de6022f..9c2f4653 100644 --- a/freebsd/sys/sys/rman.h +++ b/freebsd/sys/sys/rman.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: MIT + * * Copyright 1998 Massachusetts Institute of Technology * * Permission to use, copy, modify, and distribute this software and diff --git a/freebsd/sys/sys/sf_buf.h b/freebsd/sys/sys/sf_buf.h index 08f1d9d7..b4ea671a 100644 --- a/freebsd/sys/sys/sf_buf.h +++ b/freebsd/sys/sys/sf_buf.h @@ -77,9 +77,6 @@ struct sfstat { /* sendfile statistics */ * that do no invalidate cache on the rest of CPUs. * SFBUF_NOMD This machine doesn't have machine/sf_buf.h * - * SFBUF_OPTIONAL_DIRECT_MAP Value of this define is used as boolean - * variable that tells whether machine is - * capable of direct map or not at runtime. * SFBUF_MAP This machine provides its own sf_buf_map() and * sf_buf_unmap(). * SFBUF_PROCESS_PAGE This machine provides sf_buf_process_page() @@ -109,9 +106,6 @@ struct sf_buf; #ifndef SFBUF_NOMD #include <machine/sf_buf.h> #endif -#ifdef SFBUF_OPTIONAL_DIRECT_MAP -#include <machine/md_var.h> -#endif #ifdef SFBUF struct sf_buf *sf_buf_alloc(struct vm_page *, int); @@ -121,10 +115,8 @@ void sf_buf_ref(struct sf_buf *); static inline vm_offset_t sf_buf_kva(struct sf_buf *sf) { -#ifdef SFBUF_OPTIONAL_DIRECT_MAP - if (SFBUF_OPTIONAL_DIRECT_MAP) - return (SFBUF_PHYS_DMAP(VM_PAGE_TO_PHYS((vm_page_t)sf))); -#endif + if (PMAP_HAS_DMAP) + return (PHYS_TO_DMAP(VM_PAGE_TO_PHYS((vm_page_t)sf))); return (sf->kva); } @@ -132,10 +124,8 @@ sf_buf_kva(struct sf_buf *sf) static inline vm_page_t sf_buf_page(struct sf_buf *sf) { -#ifdef SFBUF_OPTIONAL_DIRECT_MAP - if (SFBUF_OPTIONAL_DIRECT_MAP) + if (PMAP_HAS_DMAP) return ((vm_page_t)sf); -#endif return (sf->m); } diff --git a/freebsd/sys/sys/smp.h b/freebsd/sys/sys/smp.h index f1950fa2..aa0c3119 100644 --- a/freebsd/sys/sys/smp.h +++ b/freebsd/sys/sys/smp.h @@ -155,10 +155,13 @@ struct cpu_group *smp_topo_find(struct cpu_group *top, int cpu); extern void (*cpustop_restartfunc)(void); extern int smp_cpus; -extern volatile cpuset_t started_cpus; -extern volatile cpuset_t stopped_cpus; -extern volatile cpuset_t suspended_cpus; -extern cpuset_t hlt_cpus_mask; +/* The suspend/resume cpusets are x86 only, but minimize ifdefs. */ +extern volatile cpuset_t resuming_cpus; /* woken up cpus in suspend pen */ +extern volatile cpuset_t started_cpus; /* cpus to let out of stop pen */ +extern volatile cpuset_t stopped_cpus; /* cpus in stop pen */ +extern volatile cpuset_t suspended_cpus; /* cpus [near] sleeping in susp pen */ +extern volatile cpuset_t toresume_cpus; /* cpus to let out of suspend pen */ +extern cpuset_t hlt_cpus_mask; /* XXX 'mask' is detail in old impl */ extern cpuset_t logical_cpus_mask; #endif /* SMP */ diff --git a/freebsd/sys/sys/socketvar.h b/freebsd/sys/sys/socketvar.h index d58ac2ea..f877a0df 100644 --- a/freebsd/sys/sys/socketvar.h +++ b/freebsd/sys/sys/socketvar.h @@ -71,7 +71,7 @@ struct socket; * (a) constant after allocation, no locking required. * (b) locked by SOCK_LOCK(so). * (cr) locked by SOCKBUF_LOCK(&so->so_rcv). - * (cs) locked by SOCKBUF_LOCK(&so->so_rcv). + * (cs) locked by SOCKBUF_LOCK(&so->so_snd). * (e) locked by SOLISTEN_LOCK() of corresponding listening socket. * (f) not locked since integer reads/writes are atomic. * (g) used only as a sleep/wakeup address, no value. diff --git a/freebsd/sys/sys/sysproto.h b/freebsd/sys/sys/sysproto.h index d5cda835..9148a395 100644 --- a/freebsd/sys/sys/sysproto.h +++ b/freebsd/sys/sys/sysproto.h @@ -11,6 +11,7 @@ #include <sys/signal.h> #include <sys/acl.h> #include <sys/cpuset.h> +#include <sys/domainset.h> #include <sys/_ffcounter.h> #include <sys/_semaphore.h> #include <sys/ucontext.h> @@ -1738,16 +1739,6 @@ struct utimensat_args { char times_l_[PADL_(struct timespec *)]; struct timespec * times; char times_r_[PADR_(struct timespec *)]; char flag_l_[PADL_(int)]; int flag; char flag_r_[PADR_(int)]; }; -struct numa_getaffinity_args { - char which_l_[PADL_(cpuwhich_t)]; cpuwhich_t which; char which_r_[PADR_(cpuwhich_t)]; - char id_l_[PADL_(id_t)]; id_t id; char id_r_[PADR_(id_t)]; - char policy_l_[PADL_(struct vm_domain_policy_entry *)]; struct vm_domain_policy_entry * policy; char policy_r_[PADR_(struct vm_domain_policy_entry *)]; -}; -struct numa_setaffinity_args { - char which_l_[PADL_(cpuwhich_t)]; cpuwhich_t which; char which_r_[PADR_(cpuwhich_t)]; - char id_l_[PADL_(id_t)]; id_t id; char id_r_[PADR_(id_t)]; - char policy_l_[PADL_(const struct vm_domain_policy_entry *)]; const struct vm_domain_policy_entry * policy; char policy_r_[PADR_(const struct vm_domain_policy_entry *)]; -}; struct fdatasync_args { char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)]; }; @@ -1808,6 +1799,22 @@ struct kevent_args { char timeout_l_[PADL_(const struct timespec *)]; const struct timespec * timeout; char timeout_r_[PADR_(const struct timespec *)]; }; #ifndef __rtems__ +struct cpuset_getdomain_args { + char level_l_[PADL_(cpulevel_t)]; cpulevel_t level; char level_r_[PADR_(cpulevel_t)]; + char which_l_[PADL_(cpuwhich_t)]; cpuwhich_t which; char which_r_[PADR_(cpuwhich_t)]; + char id_l_[PADL_(id_t)]; id_t id; char id_r_[PADR_(id_t)]; + char domainsetsize_l_[PADL_(size_t)]; size_t domainsetsize; char domainsetsize_r_[PADR_(size_t)]; + char mask_l_[PADL_(domainset_t *)]; domainset_t * mask; char mask_r_[PADR_(domainset_t *)]; + char policy_l_[PADL_(int *)]; int * policy; char policy_r_[PADR_(int *)]; +}; +struct cpuset_setdomain_args { + char level_l_[PADL_(cpulevel_t)]; cpulevel_t level; char level_r_[PADR_(cpulevel_t)]; + char which_l_[PADL_(cpuwhich_t)]; cpuwhich_t which; char which_r_[PADR_(cpuwhich_t)]; + char id_l_[PADL_(id_t)]; id_t id; char id_r_[PADR_(id_t)]; + char domainsetsize_l_[PADL_(size_t)]; size_t domainsetsize; char domainsetsize_r_[PADR_(size_t)]; + char mask_l_[PADL_(domainset_t *)]; domainset_t * mask; char mask_r_[PADR_(domainset_t *)]; + char policy_l_[PADL_(int)]; int policy; char policy_r_[PADR_(int)]; +}; int nosys(struct thread *, struct nosys_args *); void sys_sys_exit(struct thread *, struct sys_exit_args *); int sys_fork(struct thread *, struct fork_args *); @@ -2175,8 +2182,6 @@ int sys_procctl(struct thread *, struct procctl_args *); int sys_ppoll(struct thread *, struct ppoll_args *); int sys_futimens(struct thread *, struct futimens_args *); int sys_utimensat(struct thread *, struct utimensat_args *); -int sys_numa_getaffinity(struct thread *, struct numa_getaffinity_args *); -int sys_numa_setaffinity(struct thread *, struct numa_setaffinity_args *); int sys_fdatasync(struct thread *, struct fdatasync_args *); int sys_fstat(struct thread *, struct fstat_args *); int sys_fstatat(struct thread *, struct fstatat_args *); @@ -2188,6 +2193,8 @@ int sys_getfsstat(struct thread *, struct getfsstat_args *); int sys_fhstatfs(struct thread *, struct fhstatfs_args *); int sys_mknodat(struct thread *, struct mknodat_args *); int sys_kevent(struct thread *, struct kevent_args *); +int sys_cpuset_getdomain(struct thread *, struct cpuset_getdomain_args *); +int sys_cpuset_setdomain(struct thread *, struct cpuset_setdomain_args *); #ifdef COMPAT_43 @@ -3067,8 +3074,6 @@ int freebsd11_mknodat(struct thread *, struct freebsd11_mknodat_args *); #define SYS_AUE_ppoll AUE_POLL #define SYS_AUE_futimens AUE_FUTIMES #define SYS_AUE_utimensat AUE_FUTIMESAT -#define SYS_AUE_numa_getaffinity AUE_NULL -#define SYS_AUE_numa_setaffinity AUE_NULL #define SYS_AUE_fdatasync AUE_FSYNC #define SYS_AUE_fstat AUE_FSTAT #define SYS_AUE_fstatat AUE_FSTATAT @@ -3080,6 +3085,8 @@ int freebsd11_mknodat(struct thread *, struct freebsd11_mknodat_args *); #define SYS_AUE_fhstatfs AUE_FHSTATFS #define SYS_AUE_mknodat AUE_MKNODAT #define SYS_AUE_kevent AUE_KEVENT +#define SYS_AUE_cpuset_getdomain AUE_NULL +#define SYS_AUE_cpuset_setdomain AUE_NULL #endif /* __rtems__ */ #undef PAD_ diff --git a/freebsd/sys/sys/systm.h b/freebsd/sys/sys/systm.h index e89719b8..2dfe959b 100644 --- a/freebsd/sys/sys/systm.h +++ b/freebsd/sys/sys/systm.h @@ -610,6 +610,22 @@ void intr_prof_stack_use(struct thread *td, struct trapframe *frame); void counted_warning(unsigned *counter, const char *msg); +/* + * APIs to manage deprecation and obsolescence. + */ +struct device; +void _gone_in(int major, const char *msg); +void _gone_in_dev(struct device *dev, int major, const char *msg); +#ifdef NO_OBSOLETE_CODE +#define __gone_ok(m, msg) \ + _Static_assert(m < P_OSREL_MAJOR(__FreeBSD_version)), \ + "Obsolete code" msg); +#else +#define __gone_ok(m, msg) +#endif +#define gone_in(major, msg) __gone_ok(major, msg) _gone_in(major, msg) +#define gone_in_dev(dev, major, msg) __gone_ok(major, msg) _gone_in_dev(dev, major, msg) + __NULLABILITY_PRAGMA_POP #endif /* !_SYS_SYSTM_H_ */ diff --git a/freebsd/sys/sys/tslog.h b/freebsd/sys/sys/tslog.h new file mode 100644 index 00000000..4b2971e4 --- /dev/null +++ b/freebsd/sys/sys/tslog.h @@ -0,0 +1,62 @@ +/*- + * Copyright (c) 2017 Colin Percival + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _TSLOG_H_ +#define _TSLOG_H_ + +#ifdef TSLOG +#include <sys/_types.h> +#include <sys/pcpu.h> +#endif + +#define TS_ENTER 0 +#define TS_EXIT 1 +#define TS_THREAD 2 +#define TS_EVENT 3 + +#define TSENTER() TSRAW(curthread, TS_ENTER, __func__, NULL) +#define TSENTER2(x) TSRAW(curthread, TS_ENTER, __func__, x) +#define TSEXIT() TSRAW(curthread, TS_EXIT, __func__, NULL) +#define TSEXIT2(x) TSRAW(curthread, TS_EXIT, __func__, x) +#define TSTHREAD(td, x) TSRAW(td, TS_THREAD, x, NULL) +#define TSEVENT(x) TSRAW(curthread, TS_EVENT, x, NULL) +#define TSEVENT2(x, y) TSRAW(curthread, TS_EVENT, x, y) +#define TSLINE() TSEVENT2(__FILE__, __XSTRING(__LINE__)) +#define TSWAIT(x) TSEVENT2("WAIT", x); +#define TSUNWAIT(x) TSEVENT2("UNWAIT", x); +#define TSHOLD(x) TSEVENT2("HOLD", x); +#define TSRELEASE(x) TSEVENT2("RELEASE", x); + +#ifdef TSLOG +#define TSRAW(a, b, c, d) tslog(a, b, c, d) +void tslog(void *, int, const char *, const char *); +#else +#define TSRAW(a, b, c, d) /* Timestamp logging disabled */ +#endif + +#endif /* _TSLOG_H_ */ diff --git a/freebsd/sys/sys/vmmeter.h b/freebsd/sys/sys/vmmeter.h index 33d96b26..901604ae 100644 --- a/freebsd/sys/sys/vmmeter.h +++ b/freebsd/sys/sys/vmmeter.h @@ -41,7 +41,6 @@ */ #define MAXSLP 20 -/* Systemwide totals computed every five seconds. */ struct vmtotal { uint64_t t_vm; /* total virtual memory */ uint64_t t_avm; /* active virtual memory */ @@ -53,12 +52,12 @@ struct vmtotal { uint64_t t_armshr; /* active shared real memory */ uint64_t t_free; /* free memory pages */ int16_t t_rq; /* length of the run queue */ - int16_t t_dw; /* jobs in ``disk wait'' (neg + int16_t t_dw; /* threads in ``disk wait'' (neg priority) */ - int16_t t_pw; /* jobs in page wait */ - int16_t t_sl; /* jobs sleeping in core */ + int16_t t_pw; /* threads in page wait */ + int16_t t_sl; /* threads sleeping in core */ int16_t t_sw; /* swapped out runnable/short - block jobs */ + block threads */ uint16_t t_pad[3]; }; diff --git a/freebsd/sys/sys/watchdog.h b/freebsd/sys/sys/watchdog.h index 1b85ce7a..191456a4 100644 --- a/freebsd/sys/sys/watchdog.h +++ b/freebsd/sys/sys/watchdog.h @@ -112,6 +112,14 @@ EVENTHANDLER_DECLARE(watchdog_list, watchdog_fn); u_int wdog_kern_last_timeout(void); int wdog_kern_pat(u_int utim); + +/* + * The following function pointer is used to attach a software watchdog + * if no hardware watchdog has been attached, and if the software module + * has initialized the function pointer. + */ + +extern void (*wdog_software_attach)(void); #endif #endif /* _SYS_WATCHDOG_H */ |