sparc64: WITNESS broken

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

sparc64: WITNESS broken

Klemens Nanni-2
sparc64 (and arm mem.c) are the only architectures/places where
RWLOCK_INITIALIZER() is used with static function variables, all other
(mem.c) usages place it into the global scope.

sparc64 WITNESS enabled builds fail with:

/sys/arch/sparc64/sparc64/mem.c:93: error: initializer element is not constant
/sys/arch/sparc64/sparc64/mem.c:93: error: (near initialization for 'physlock.rwl_lock_obj.lo_type')

Diff below adjusts the two architecture's mem.c to align with the rest;
sparc64 then builds fine but dies immediately at boot:

        SPARC T4-2, No Keyboard
        Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved.
        OpenBoot 4.38.16, 8.0000 GB memory available, Serial #83392380.
        Ethernet address 0:14:4f:f8:77:7c, Host ID: 84f8777c.




        {0} ok boot
        Boot device: os  File and args: /bsd.witness
        OpenBSD IEEE 1275 Bootblock 2.0
        ..>> OpenBSD BOOT 1.17

        ERROR: /iscsi-hba: No iscsi-network-bootpath property
        Booting /virtual-devices@100/channel-devices@200/disk@0/bsd.witness
        9802360@0x1000000+3464@0x1959278+193344@0x1c00000+4000960@0x1c2f340
        symbols @ 0xfed62400 165+638136+437394 start=0x1000000
        [ using 1076728 bytes of bsd ELF symbol table ]

        ERROR: Last Trap: Fast Data Access MMU Miss


Index: /sys/arch/sparc64/sparc64/mem.c
===================================================================
RCS file: /cvs/src/sys/arch/sparc64/sparc64/mem.c,v
retrieving revision 1.19
diff -u -p -r1.19 mem.c
--- /sys/arch/sparc64/sparc64/mem.c 14 Dec 2017 03:30:43 -0000 1.19
+++ /sys/arch/sparc64/sparc64/mem.c 17 May 2020 03:06:35 -0000
@@ -87,10 +87,11 @@ mmclose(dev_t dev, int flag, int mode, s
  return (0);
 }
 
+static struct rwlock physlock = RWLOCK_INITIALIZER("mmrw");
+
 int
 mmrw(dev_t dev, struct uio *uio, int flags)
 {
- static struct rwlock physlock = RWLOCK_INITIALIZER("mmrw");
  vaddr_t o, v;
  size_t c;
  struct iovec *iov;
Index: conf/GENERIC
===================================================================
RCS file: /cvs/src/sys/conf/GENERIC,v
retrieving revision 1.269
diff -u -p -r1.269 GENERIC
--- conf/GENERIC 9 May 2020 19:48:45 -0000 1.269
+++ conf/GENERIC 17 May 2020 03:21:30 -0000
@@ -14,7 +14,7 @@ option KTRACE # system call tracing, a
 option ACCOUNTING # acct(2) process accounting
 option KMEMSTATS # collect malloc(9) statistics
 option PTRACE # ptrace(2) system call
-#option WITNESS # witness(4) lock checker
+option WITNESS # witness(4) lock checker
 
 #option KVA_GUARDPAGES # slow virtual address recycling (+ guarding)
 option POOL_DEBUG # pool corruption detection

Reply | Threaded
Open this post in threaded view
|

Re: sparc64: WITNESS broken

Visa Hankala-2
On Sun, May 17, 2020 at 05:26:06AM +0200, Klemens Nanni wrote:

> Index: /sys/arch/sparc64/sparc64/mem.c
> ===================================================================
> RCS file: /cvs/src/sys/arch/sparc64/sparc64/mem.c,v
> retrieving revision 1.19
> diff -u -p -r1.19 mem.c
> --- /sys/arch/sparc64/sparc64/mem.c 14 Dec 2017 03:30:43 -0000 1.19
> +++ /sys/arch/sparc64/sparc64/mem.c 17 May 2020 03:06:35 -0000
> @@ -87,10 +87,11 @@ mmclose(dev_t dev, int flag, int mode, s
>   return (0);
>  }
>  
> +static struct rwlock physlock = RWLOCK_INITIALIZER("mmrw");
> +
>  int
>  mmrw(dev_t dev, struct uio *uio, int flags)
>  {
> - static struct rwlock physlock = RWLOCK_INITIALIZER("mmrw");
>   vaddr_t o, v;
>   size_t c;
>   struct iovec *iov;

This is OK.

> Index: conf/GENERIC
> ===================================================================
> RCS file: /cvs/src/sys/conf/GENERIC,v
> retrieving revision 1.269
> diff -u -p -r1.269 GENERIC
> --- conf/GENERIC 9 May 2020 19:48:45 -0000 1.269
> +++ conf/GENERIC 17 May 2020 03:21:30 -0000
> @@ -14,7 +14,7 @@ option KTRACE # system call tracing, a
>  option ACCOUNTING # acct(2) process accounting
>  option KMEMSTATS # collect malloc(9) statistics
>  option PTRACE # ptrace(2) system call
> -#option WITNESS # witness(4) lock checker
> +option WITNESS # witness(4) lock checker
>  
>  #option KVA_GUARDPAGES # slow virtual address recycling (+ guarding)
>  option POOL_DEBUG # pool corruption detection
>

Please keep the checker disabled by default.

Reply | Threaded
Open this post in threaded view
|

Re: sparc64: WITNESS broken

Klemens Nanni-2
On Sun, May 17, 2020 at 07:49:02AM +0000, Visa Hankala wrote:
> This is OK.
Should I commit arm as well?  I have no device to test.
 
> Please keep the checker disabled by default.
Obviously; just wanted to show explicitly which config I used.


Index: /sys/arch/arm/arm/mem.c
===================================================================
RCS file: /cvs/src/sys/arch/arm/arm/mem.c,v
retrieving revision 1.21
diff -u -p -r1.21 mem.c
--- /sys/arch/arm/arm/mem.c 19 Feb 2018 08:59:52 -0000 1.21
+++ /sys/arch/arm/arm/mem.c 17 May 2020 03:06:33 -0000
@@ -141,10 +141,11 @@ mmclose(dev_t dev, int flag, int mode, s
  return (0);
 }
 
+static struct rwlock physlock = RWLOCK_INITIALIZER("mmrw");
+
 int
 mmrw(dev_t dev, struct uio *uio, int flags)
 {
- static struct rwlock physlock = RWLOCK_INITIALIZER("mmrw");
  vaddr_t o, v;
  size_t c;
  struct iovec *iov;
Index: /sys/arch/sparc64/sparc64/mem.c
===================================================================
RCS file: /cvs/src/sys/arch/sparc64/sparc64/mem.c,v
retrieving revision 1.19
diff -u -p -r1.19 mem.c
--- /sys/arch/sparc64/sparc64/mem.c 14 Dec 2017 03:30:43 -0000 1.19
+++ /sys/arch/sparc64/sparc64/mem.c 17 May 2020 03:06:35 -0000
@@ -87,10 +87,11 @@ mmclose(dev_t dev, int flag, int mode, s
  return (0);
 }
 
+static struct rwlock physlock = RWLOCK_INITIALIZER("mmrw");
+
 int
 mmrw(dev_t dev, struct uio *uio, int flags)
 {
- static struct rwlock physlock = RWLOCK_INITIALIZER("mmrw");
  vaddr_t o, v;
  size_t c;
  struct iovec *iov;

Reply | Threaded
Open this post in threaded view
|

Re: sparc64: WITNESS broken

Visa Hankala-2
On Sun, May 17, 2020 at 12:26:11PM +0200, Klemens Nanni wrote:
> On Sun, May 17, 2020 at 07:49:02AM +0000, Visa Hankala wrote:
> > This is OK.
> Should I commit arm as well?  I have no device to test.

The arm code should be adjusted for WITNESS as well.

OK visa@

> Index: /sys/arch/arm/arm/mem.c
> ===================================================================
> RCS file: /cvs/src/sys/arch/arm/arm/mem.c,v
> retrieving revision 1.21
> diff -u -p -r1.21 mem.c
> --- /sys/arch/arm/arm/mem.c 19 Feb 2018 08:59:52 -0000 1.21
> +++ /sys/arch/arm/arm/mem.c 17 May 2020 03:06:33 -0000
> @@ -141,10 +141,11 @@ mmclose(dev_t dev, int flag, int mode, s
>   return (0);
>  }
>  
> +static struct rwlock physlock = RWLOCK_INITIALIZER("mmrw");
> +
>  int
>  mmrw(dev_t dev, struct uio *uio, int flags)
>  {
> - static struct rwlock physlock = RWLOCK_INITIALIZER("mmrw");
>   vaddr_t o, v;
>   size_t c;
>   struct iovec *iov;