Module Name:    src
Committed By:   mrg
Date:           Wed Feb 27 21:37:24 UTC 2019

Modified Files:
        src/sys/net/npf: npf_os.c

Log Message:
work around a GCC 7 vs sparc (32 bit) issue i haven't figured out
the real cause of yet.

mark npf_init() as non-static.  for a yet-unknown reason, when this
function is inlined by the compiler (or a human!) into the single
caller, some CPUs end up in a hung state that can't be interrupted
eventually leading to system hang.  eg:

[   8.9693040] root on hme0
[   8.9862690] nfs_boot: trying DHCP/BOOTP
xcall(cpu2,0xf0240ac8) from 0xf0241170: couldn't ping cpus: cpu1

is the symptom though sometimes nfs_boot is actually able to
complete mountroot before it hangs.

this may be a compiler bug but the symptom and the trigger are
far removed and my so-far reading of the "broken" npf_init
inlining has shown no issues, however, i haven't completed a
full scan of this asm in the past month so i'm commiting this
workaround for now.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/net/npf/npf_os.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/net/npf/npf_os.c
diff -u src/sys/net/npf/npf_os.c:1.10 src/sys/net/npf/npf_os.c:1.11
--- src/sys/net/npf/npf_os.c:1.10	Sat Sep 29 14:41:36 2018
+++ src/sys/net/npf/npf_os.c	Wed Feb 27 21:37:24 2019
@@ -33,7 +33,7 @@
 
 #ifdef _KERNEL
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: npf_os.c,v 1.10 2018/09/29 14:41:36 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: npf_os.c,v 1.11 2019/02/27 21:37:24 mrg Exp $");
 
 #ifdef _KERNEL_OPT
 #include "pf.h"
@@ -140,7 +140,19 @@ npf_fini(void)
 	return 0;
 }
 
+#if 1
+/*
+ * When npf_init() is static and inlined into npf_modcmd() directly (either
+ * by the human or GCC 7), then GCC 7 on 32 bit sparc do * something wrong
+ * and CPUs hang up.  Making it not static works for some reason.
+ *
+ * Revert this when the real problem is found.
+ */
+int npf_init(void);
+int
+#else
 static int
+#endif
 npf_init(void)
 {
 	npf_t *npf;

Reply via email to