tech-kern archive

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

Re: i386: 9.99.108 traps booting on VirtualBox



[ATTN: riastradh]

On Fri, Dec 09, 2022 at 02:59:12 +0300, Valery Ushakov wrote:

> [reposting from current-users]
> 
> On Wed, Nov 30, 2022 at 13:05:52 +0300, Valery Ushakov wrote:
> 
> > I tried to upgrade a 32-bit VBox VM from 9.99.99 to .107 and the
> > kernel from the yesterday's sources crashes on boot.  
> 
> Tried .108 and it crashes the same with:

> [   1.0091954] trap type 6 code 0 eip 0xc0d3d8f8 cs 0x8 eflags 0x10246 cr2 0x3c ilevel 0x7 esp 0x6
> [   1.0091954] curlwp 0xc1657840 pid 0 lid 0 lowest kstack 0xc192e2c0
> kernel: supervisor trap page fault, code=0
> Stopped in pid 0.0 (system) at  netbsd:hardclock+0x23:  movl    3c(%esi),%eax
> db{0}> bt
> hardclock(0,0,da3eef6c,c04ac8f1,0,0,0,0,0,0) at netbsd:hardclock+0x23
> clockintr(0,0,0,0,0,0,0,0,c2d72000,c010322a) at netbsd:clockintr+0x2a
> intr_kdtrace_wrapper(c2f50680,c1930d9c,0,0,0,0,0,0,0,0) at netbsd:intr_kdtrace_wrapper+0x21
> --- switch to interrupt stack ---

So the culprit is KDTRACE_HOOKS in sys/arch/x86/x86/intr.c

  revision 1.163
  date: 2022-10-29 16:59:04 +0300;  author: riastradh;  state: Exp;  lines: +38 -2;  commitid: w28zVvYhMCIOsCZD;
  x86: Add dtrace probes for interrupt handler entry and return.

The problem is that clockintr has magic calling convention that
intr_kdtrace_wrapper doesn't know about.  As a quick hack I changed
i8254_initclocks to pass a magic argument (that is ignored by
clockintr anyway) and told the hook code to ignore such handlers:

#ifdef KDTRACE_HOOKS
	if (arg != (void *)0x8042c10c) { /* clockintr is magic */
		ih->ih_fun = intr_kdtrace_wrapper;
		ih->ih_arg = ih;
	}
#endif

and that kernel doesn't crash.

It's *almost* fine, but I see the problem with com(4) that I suspect
is related to the recent commits by Nakahara-san:

  ----------------------------
  revision 1.382
  date: 2022-12-09 03:35:58 +0300;  author: knakahara;  state: Exp;  lines: +7 -29;  commitid: 9zcguFpBLJvxHO4E;
  Revert com.c:r1.381 because i386/qemu cannot boot.  Pointed out by gson@n.o and martin@n.o.
  ----------------------------
  revision 1.381
  date: 2022-12-08 12:08:49 +0300;  author: knakahara;  state: Exp;  lines: +29 -7;  commitid: 0xs100bYdUbwzJ4E;
  Fix hang up writing /dev/console rarely in specific environments.

  Some BMC seems to require these syncronous operations.  If not,
  it does not send transmit completion interrupts for some reason.

With KDTRACE_HOOKS enabled (modulo clockintr hack) and the serial
console (for debugging) I see the system stuck on console output when
rc runs.  It gets unstuck on a com interrupt (e.g. pressing a key).

Seems to work fine with KDTRACE_HOOKS disabled.

-uwe


Home | Main Index | Thread Index | Old Index