svn commit: r335873 - in head: . sys/amd64/amd64 sys/amd64/include sys/conf sys/i386/i386 sys/i386/include sys/sys sys/vm

O. Hartmann ohartmann at walstatt.org
Tue Jul 3 09:01:17 UTC 2018


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

Am Mon, 2 Jul 2018 19:48:38 +0000 (UTC)
Matt Macy <mmacy at FreeBSD.org> schrieb:

> Author: mmacy
> Date: Mon Jul  2 19:48:38 2018
> New Revision: 335873
> URL: https://svnweb.freebsd.org/changeset/base/335873
> 
> Log:
>   inline atomics and allow tied modules to inline locks
>   
>   - inline atomics in modules on i386 and amd64 (they were always
>     inline on other arches)
>   - allow modules to opt in to inlining locks by specifying
>     MODULE_TIED=1 in the makefile
>   
>   Reviewed by: kib
>   Sponsored by: Limelight Networks
>   Differential Revision: https://reviews.freebsd.org/D16079
> 
> Deleted:
>   head/sys/amd64/amd64/atomic.c
>   head/sys/i386/i386/atomic.c
> Modified:
>   head/UPDATING
>   head/sys/amd64/include/atomic.h
>   head/sys/conf/files.amd64
>   head/sys/conf/files.i386
>   head/sys/conf/kmod.mk
>   head/sys/i386/include/atomic.h
>   head/sys/sys/lock.h
>   head/sys/sys/module.h
>   head/sys/sys/mutex.h
>   head/sys/sys/param.h
>   head/sys/vm/vm_map.h
>   head/sys/vm/vm_page.h
> 
> Modified: head/UPDATING
> ==============================================================================
> --- head/UPDATING	Mon Jul  2 19:33:26 2018	(r335872)
> +++ head/UPDATING	Mon Jul  2 19:48:38 2018	(r335873)
> @@ -31,6 +31,10 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 12.x IS SLOW:
>  	disable the most expensive debugging functionality run
>  	"ln -s 'abort:false,junk:false' /etc/malloc.conf".)
>  
> +20180702:
> +	On i386 and amd64 atomics are now inlined. Out of tree modules using
> +	atomics will need to be rebuilt.
> +
>  20180701:
>  	The '%I' format in the kern.corefile sysctl limits the number of
>  	core files that a process can generate to the number stored in the
> 
> Modified: head/sys/amd64/include/atomic.h
> ==============================================================================
> --- head/sys/amd64/include/atomic.h	Mon Jul  2 19:33:26 2018	(r335872)
> +++ head/sys/amd64/include/atomic.h	Mon Jul  2 19:48:38 2018	(r335873)
> @@ -96,7 +96,7 @@
>   * Kernel modules call real functions which are built into the kernel.
>   * This allows kernel modules to be portable between UP and SMP systems.
>   */
> -#if defined(KLD_MODULE) || !defined(__GNUCLIKE_ASM)
> +#if !defined(__GNUCLIKE_ASM)
>  #define	ATOMIC_ASM(NAME, TYPE, OP, CONS, V)			\
>  void atomic_##NAME##_##TYPE(volatile u_##TYPE *p, u_##TYPE v);	\
>  void atomic_##NAME##_barr_##TYPE(volatile u_##TYPE *p, u_##TYPE v)
> 
> Modified: head/sys/conf/files.amd64
> ==============================================================================
> --- head/sys/conf/files.amd64	Mon Jul  2 19:33:26 2018	(r335872)
> +++ head/sys/conf/files.amd64	Mon Jul  2 19:48:38 2018	(r335873)
> @@ -126,7 +126,6 @@ acpi_wakedata.h			optional
> acpi			\ clean		"acpi_wakedata.h"
>  #
>  #amd64/amd64/apic_vector.S	standard
> -amd64/amd64/atomic.c		standard
>  amd64/amd64/bios.c		standard
>  amd64/amd64/bpf_jit_machdep.c	optional	bpf_jitter
>  amd64/amd64/cpu_switch.S	standard
> 
> Modified: head/sys/conf/files.i386
> ==============================================================================
> --- head/sys/conf/files.i386	Mon Jul  2 19:33:26 2018	(r335872)
> +++ head/sys/conf/files.i386	Mon Jul  2 19:48:38 2018	(r335873)
> @@ -474,8 +474,6 @@ i386/bios/smapi.c		optional smapi
>  i386/bios/smapi_bios.S		optional smapi
>  i386/cloudabi32/cloudabi32_sysvec.c	optional compat_cloudabi32
>  #i386/i386/apic_vector.s		optional apic
> -i386/i386/atomic.c		standard		\
> -	compile-with	"${CC} -c ${CFLAGS}
> ${DEFINED_PROF:S/^$/-fomit-frame-pointer/} ${.IMPSRC}" i386/i386/bios.c
> standard i386/i386/bioscall.s		standard
>  i386/i386/bpf_jit_machdep.c	optional bpf_jitter
> 
> Modified: head/sys/conf/kmod.mk
> ==============================================================================
> --- head/sys/conf/kmod.mk	Mon Jul  2 19:33:26 2018	(r335872)
> +++ head/sys/conf/kmod.mk	Mon Jul  2 19:48:38 2018	(r335873)
> @@ -111,6 +111,9 @@ WERROR?=	-Werror
>  CFLAGS+=	${WERROR}
>  CFLAGS+=	-D_KERNEL
>  CFLAGS+=	-DKLD_MODULE
> +.if defined(MODULE_TIED)
> +CFLAGS+=	-DKLD_TIED
> +.endif
>  
>  # Don't use any standard or source-relative include directories.
>  NOSTDINC=	-nostdinc
> 
> Modified: head/sys/i386/include/atomic.h
> ==============================================================================
> --- head/sys/i386/include/atomic.h	Mon Jul  2 19:33:26 2018	(r335872)
> +++ head/sys/i386/include/atomic.h	Mon Jul  2 19:48:38 2018	(r335873)
> @@ -104,7 +104,7 @@ __mbu(void)
>   * Kernel modules call real functions which are built into the kernel.
>   * This allows kernel modules to be portable between UP and SMP systems.
>   */
> -#if defined(KLD_MODULE) || !defined(__GNUCLIKE_ASM)
> +#if !defined(__GNUCLIKE_ASM)
>  #define	ATOMIC_ASM(NAME, TYPE, OP, CONS, V)			\
>  void atomic_##NAME##_##TYPE(volatile u_##TYPE *p, u_##TYPE v);	\
>  void atomic_##NAME##_barr_##TYPE(volatile u_##TYPE *p, u_##TYPE v)
> 
> Modified: head/sys/sys/lock.h
> ==============================================================================
> --- head/sys/sys/lock.h	Mon Jul  2 19:33:26 2018	(r335872)
> +++ head/sys/sys/lock.h	Mon Jul  2 19:48:38 2018	(r335873)
> @@ -127,7 +127,7 @@ struct lock_class {
>   * calling conventions for this debugging code in modules so that modules can
>   * work with both debug and non-debug kernels.
>   */
> -#if defined(KLD_MODULE) || defined(WITNESS) || defined(INVARIANTS) || \
> +#if (defined(KLD_MODULE) && !defined(KLD_TIED)) || defined(WITNESS) ||
> defined(INVARIANTS) || \ defined(LOCK_PROFILING) || defined(KTR)
>  #define	LOCK_DEBUG	1
>  #else
> 
> Modified: head/sys/sys/module.h
> ==============================================================================
> --- head/sys/sys/module.h	Mon Jul  2 19:33:26 2018	(r335872)
> +++ head/sys/sys/module.h	Mon Jul  2 19:48:38 2018	(r335873)
> @@ -146,8 +146,13 @@ struct mod_pnp_match_info 
>  	SYSINIT(name##module, sub, order, module_register_init, &data);	\
>  	struct __hack
>  
> +#ifdef KLD_TIED
>  #define	DECLARE_MODULE(name, data, sub, order)				\
> +	DECLARE_MODULE_WITH_MAXVER(name, data, sub, order, __FreeBSD_version)
> +#else
> +#define	DECLARE_MODULE(name, data, sub,
> order)							\
> DECLARE_MODULE_WITH_MAXVER(name, data, sub, order, MODULE_KERNEL_MAXVER) +#endif
>  
>  /*
>   * The module declared with DECLARE_MODULE_TIED can only be loaded
> 
> Modified: head/sys/sys/mutex.h
> ==============================================================================
> --- head/sys/sys/mutex.h	Mon Jul  2 19:33:26 2018	(r335872)
> +++ head/sys/sys/mutex.h	Mon Jul  2 19:48:38 2018	(r335873)
> @@ -138,7 +138,7 @@ void	_thread_lock(struct thread *td, int opts, const c
>  void	_thread_lock(struct thread *);
>  #endif
>  
> -#if defined(LOCK_PROFILING) || defined(KLD_MODULE)
> +#if defined(LOCK_PROFILING) || (defined(KLD_MODULE) && !defined(KLD_TIED))
>  #define	thread_lock(tdp)						\
>  	thread_lock_flags_((tdp), 0, __FILE__, __LINE__)
>  #elif LOCK_DEBUG > 0
> 
> Modified: head/sys/sys/param.h
> ==============================================================================
> --- head/sys/sys/param.h	Mon Jul  2 19:33:26 2018	(r335872)
> +++ head/sys/sys/param.h	Mon Jul  2 19:48:38 2018	(r335873)
> @@ -60,7 +60,7 @@
>   *		in the range 5 to 9.
>   */
>  #undef __FreeBSD_version
> -#define __FreeBSD_version 1200069	/* Master, propagated to newvers */
> +#define __FreeBSD_version 1200070	/* Master, propagated to newvers */
>  
>  /*
>   * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD,
> 
> Modified: head/sys/vm/vm_map.h
> ==============================================================================
> --- head/sys/vm/vm_map.h	Mon Jul  2 19:33:26 2018	(r335872)
> +++ head/sys/vm/vm_map.h	Mon Jul  2 19:48:38 2018	(r335873)
> @@ -206,7 +206,7 @@ struct vm_map {
>  #define	MAP_BUSY_WAKEUP		0x02
>  
>  #ifdef	_KERNEL
> -#ifdef KLD_MODULE
> +#if defined(KLD_MODULE) && !defined(KLD_TIED)
>  #define	vm_map_max(map)		vm_map_max_KBI((map))
>  #define	vm_map_min(map)		vm_map_min_KBI((map))
>  #define	vm_map_pmap(map)	vm_map_pmap_KBI((map))
> 
> Modified: head/sys/vm/vm_page.h
> ==============================================================================
> --- head/sys/vm/vm_page.h	Mon Jul  2 19:33:26 2018	(r335872)
> +++ head/sys/vm/vm_page.h	Mon Jul  2 19:48:38 2018	(r335873)
> @@ -304,7 +304,7 @@ extern struct mtx_padalign pa_lock[];
>  
>  #define	PA_LOCK_ASSERT(pa, a)	mtx_assert(PA_LOCKPTR(pa), (a))
>  
> -#ifdef KLD_MODULE
> +#if defined(KLD_MODULE) && !defined(KLD_TIED)
>  #define	vm_page_lock(m)		vm_page_lock_KBI((m), LOCK_FILE,
> LOCK_LINE) #define	vm_page_unlock(m)	vm_page_unlock_KBI((m), LOCK_FILE,
> LOCK_LINE) #define	vm_page_trylock(m)	vm_page_trylock_KBI((m), LOCK_FILE,
> LOCK_LINE) @@ -734,7 +734,7 @@ vm_page_dirty(vm_page_t m)
>  {
>  
>  	/* Use vm_page_dirty_KBI() under INVARIANTS to save memory. */
> -#if defined(KLD_MODULE) || defined(INVARIANTS)
> +#if (defined(KLD_MODULE) && !defined(KLD_TIED)) || defined(INVARIANTS)
>  	vm_page_dirty_KBI(m);
>  #else
>  	m->dirty = VM_PAGE_BITS_ALL;
> _______________________________________________
> svn-src-head at freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/svn-src-head
> To unsubscribe, send any mail to "svn-src-head-unsubscribe at freebsd.org"

This patch breaks building of ports

emulators/virtualbox-ose-kmod
graphics/drm-stable-kmod

which we build via /etc/src.conf and PORTS_MODULES= .

Reverting CURRENT sources to pre-r335873 makes compiling emulators/virtualbox-ose-kmod
successing, but leaves graphics/drm-stable-kmod with some weird compiler errors (using
META_MODE).

The error shown revision 335884 when compiling the module
graphics/drm-stable-kmod is:

[...]
In file included from i915_drv.c:30:
In file included
from /usr/obj/usr/src/amd64.amd64/sys/WALHALL/usr/ports/graphics/drm-stable-kmod/work/kms-drm-a753215/linuxkpi/gplv2/include/linux/acpi.h:26:
In file included
from /usr/obj/usr/src/amd64.amd64/sys/WALHALL/usr/ports/graphics/drm-stable-kmod/work/kms-drm-a753215/linuxkpi/gplv2/include/linux/device.h:4:
In file included from /usr/src/sys/compat/linuxkpi/common/include/linux/device.h:35: In
file included from /usr/src/sys/compat/linuxkpi/common/include/linux/types.h:37: In file
included from /usr/src/sys/sys/systm.h:44: ./machine/atomic.h:450:29: error: invalid
operand for instruction ATOMIC_ASM(clear,    long,  "andq %1,%0",  "ir", ~v); ^
<inline asm>:1:7: note: instantiated into assembly here
        andq $9223372036854775807,40672(%r14)
             ^~~~~~~~~~~~~~~~~~~~~
1 error generated.
*** Error code 1
[...]

and  for emulators/virtualbox-ose-kmod

[...]
In file included from SUPDrv.c:33:
./SUPDrvInternal.h:495:5: error: type name requires a specifier or qualifier
    PVM                             pSessionVM;
    ^
/usr/src/sys/sys/priority.h:104:15: note: expanded from macro 'PVM'
#define PVM                     (PRI_MIN_KERN + 4)

[...]

- -- 
O. Hartmann

Ich widerspreche der Nutzung oder Übermittlung meiner Daten für
Werbezwecke oder für die Markt- oder Meinungsforschung (§ 28 Abs. 4 BDSG).
-----BEGIN PGP SIGNATURE-----

iLUEARMKAB0WIQQZVZMzAtwC2T/86TrS528fyFhYlAUCWzs7TQAKCRDS528fyFhY
lOCzAf9lBFWm82nJL6Riy6jNMnQrA+0M9CFv6J6UQGjjN9uWmL5iaT4CZFr6UxXQ
iSiJv93wWa0dqFT0iQQi8XIg+7guAf0bX2dZa1N7++WGcBVtoUUPPAT9iqEzXYYl
nihGzRBAvVavs7kcFfyz6VZs/H2zkDyyrc8Z6wJ1mv63EBuxa2lG
=M0SS
-----END PGP SIGNATURE-----


More information about the svn-src-all mailing list