NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: port-amiga/55233: Process hangs indefinitely if not calling syscalls for a while



The following reply was made to PR port-amiga/55233; it has been noted by GNATS.

From: Kamil Rytarowski <n54%gmx.com@localhost>
To: gnats-bugs%netbsd.org@localhost, Andrew Doran <ad%netbsd.org@localhost>
Cc: 
Subject: Re: port-amiga/55233: Process hangs indefinitely if not calling
 syscalls for a while
Date: Tue, 5 May 2020 03:14:02 +0200

 On 05.05.2020 03:10, rokuyama.rk%gmail.com@localhost wrote:
 >> Number:         55233
 >> Category:       port-amiga
 >> Synopsis:       Process hangs indefinitely if not calling syscalls for =
 a while
 >> Confidential:   no
 >> Severity:       critical
 >> Priority:       high
 >> Responsible:    port-amiga-maintainer
 >> State:          open
 >> Class:          sw-bug
 >> Submitter-Id:   net
 >> Arrival-Date:   Tue May 05 01:10:00 +0000 2020
 >> Originator:     Rin Okuyama
 >> Release:        9.99.59
 >> Organization:
 > Department of Physics, Meiji University
 >> Environment:
 > NetBSD a1200 9.99.59 NetBSD 9.99.59 (A1200) #17: Mon May  4 22:58:45 JST=
  2020  rin@latipes:/build/work/work/sys/arch/amiga/compile/A1200 amiga
 > Amiga 1200 with 68060
 >> Description:
 > Process not calling syscalls does not accept ^C:
 >
 > ----
 > % cat loop.c
 > int main(void) {
 > 	for (;;) continue;
 > 	return 0;
 > }
 > % cc loop.c && ./a.out
 > ^C^C^C^C
 > ----
 >
 > Then, system gets stalled at this process, and I cannot do anything but
 > entering DDB from console. Trace for that process is not interesting:
 >
 > ----
 > ~Stopped in pid 85.85 (a.out) at netbsd:cpu_Debugger+0x6:        unlk   =
  a6
 > db> ps
 > PID    LID S CPU     FLAGS       STRUCT LWP *               NAME WAIT
 > 85   >  85 7   0     40000             bf7c40              a.out
 > ...
 > db> trace/a bf7c40
 > trace: pid 85 lid 85 at 0xbbf3db4
 > ?(0,0,10,4f8398,0) at a
 > ?() at bbf3f2a
 > db>
 > ----
 >
 > A similar failure occurs for a process which does not call syscalls for
 > a while. For example, this one:
 >
 > ----
 > #include <signal.h> /* for signal */
 > #include <string.h> /* for strstr */
 > #include <stdlib.h> /* for malloc */
 > #include <unistd.h> /* for alarm */
 > static void quit (int sig) { _exit (sig + 128); }
 >
 > int
 > main ()
 > {
 >
 >     int result =3D 0;
 >     size_t m =3D 1000000;
 >     char *haystack =3D (char *) malloc (2 * m + 2);
 >     char *needle =3D (char *) malloc (m + 2);
 >     /* Failure to compile this test due to missing alarm is okay,
 >        since all such platforms (mingw) also have quadratic strstr.  */
 >     signal (SIGALRM, quit);
 >     alarm (5);
 >     /* Check for quadratic performance.  */
 >     if (haystack && needle)
 >       {
 >         memset (haystack, 'A', 2 * m);
 >         haystack[2 * m] =3D 'B';
 >         haystack[2 * m + 1] =3D 0;
 >         memset (needle, 'A', m);
 >         needle[m] =3D 'B';
 >         needle[m + 1] =3D 0;
 >         if (!strstr (haystack, needle))
 >           result |=3D 1;
 >       }
 >     return result;
 >
 >   ;
 >   return 0;
 > }
 > ----
 >
 > taken from "strstr works in linear time" check from configure script,
 > does not complete indefinitely and causes system freeze.
 >
 > Note that this is on my amiga with 68060:
 >
 > - amiga (68060; Amiga 1200)
 >
 > whereas the failure does not occur for other m68k ports:
 >
 > - sun3 (68020; TME)
 > - mac68k (68040; Quadra 840AV)
 >> How-To-Repeat:
 > Described above.
 >> Fix:
 > Bisectioning revealed that the failure starts with this commit:
 >
 > http://www.nerv.org/netbsd/?q=3Did:20200326T201906Z.ba5eaa1d6fe1c81297a0=
 39db52867c4c67b65575
 >
 >> Module Name:	src
 >> Committed By:	ad
 >> Date:		Thu Mar 26 20:19:06 UTC 2020
 >>
 >> Modified Files:
 >> 	src/sys/kern: kern_lwp.c kern_softint.c
 >> 	src/sys/sys: intr.h userret.h
 >>
 >> Log Message:
 >> softint_overlay() (slow case) gains ~nothing but creates potential head=
 aches.
 >> In the interests of simplicity remove it and always use the kthreads.
 >>
 >> To generate a diff of this commit:
 >> cvs rdiff -u -r1.229 -r1.230 src/sys/kern/kern_lwp.c
 >> cvs rdiff -u -r1.62 -r1.63 src/sys/kern/kern_softint.c
 >> cvs rdiff -u -r1.19 -r1.20 src/sys/sys/intr.h
 >> cvs rdiff -u -r1.32 -r1.33 src/sys/sys/userret.h
 >
 > By reverting this commit, -current as of yesterday works fine without
 > this problem.
 >
 
 I reported a very similar behavior of GDB. I was frequently forced to
 kill the debugger with SIGKILL.
 


Home | Main Index | Thread Index | Old Index