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

Hans Petter Selasky hps at selasky.org
Thu Jul 5 15:38:35 UTC 2018


On 07/05/18 15:50, Hans Petter Selasky wrote:
> Hi,
> 
> This change breaks all atomic usage in drm-next-kmod even after r335913.
> 
> The problem is simply that SMP is not defined at all for KLD's so all 
> non-kernel atomic usage is with MPLOCKED empty!
> 
> /*
>   * For userland, always use lock prefixes so that the binaries will run
>   * on both SMP and !SMP systems.
>   */
> #if defined(SMP) || !defined(_KERNEL)
> #define MPLOCKED        "lock ; "
> #else
> #define MPLOCKED
> #endif
> 
> 
> Should the check above be:
> #if defined(SMP) || !defined(_KERNEL) || defined(KLD_MODULE)

The problem seems more convoluted. There are more checks I wonder if has 
to be changed.

Currently testing this patch: Same applies for i386.

> Index: sys/amd64/include/atomic.h
> ===================================================================
> --- sys/amd64/include/atomic.h  (revision 335974)
> +++ sys/amd64/include/atomic.h  (working copy)
> @@ -132,7 +132,7 @@
>   * For userland, always use lock prefixes so that the binaries will run
>   * on both SMP and !SMP systems.
>   */
> -#if defined(SMP) || !defined(_KERNEL)
> +#if defined(SMP) || !defined(_KERNEL) || defined(KLD_MODULE)
>  #define        MPLOCKED        "lock ; "
>  #else
>  #define        MPLOCKED
> @@ -343,7 +343,7 @@
>   * and release.
>   */
>  
> -#if defined(_KERNEL)
> +#if defined(_KERNEL) || defined(KLD_MODULE)
>  
>  /*
>   * OFFSETOF_MONITORBUF == __pcpu_offset(pc_monitorbuf).
> @@ -354,7 +354,7 @@
>   */
>  #define        OFFSETOF_MONITORBUF     0x100
>  
> -#if defined(SMP)
> +#if defined(SMP) || defined(KLD_MODULE)
>  static __inline void
>  __storeload_barrier(void)
>  {


--HPS


More information about the svn-src-head mailing list