On Sun, Jun 14, 2020 at 05:31:26PM +0200, Marcus MERIGHI wrote:
> sema...@online.fr (Sebastien Marie), 2020.06.14 (Sun) 14:23 (CEST):
> > On Sun, Jun 14, 2020 at 12:45:46PM +0200, Marcus MERIGHI wrote:
> > > ddb{0}> bt
> > > db_enter() at db_enter+0x10
> > > comintr(ffff8000000cc000) at comintr+0x2af
> > > intr_handler(ffff8000225a01e0,ffff800000091080) at intr_handler+0x6e
> > > Xintr_ioapic_edge4_untramp() at Xintr_ioapic_edge4_untramp+0x19f
> > > cpu_idle_mwait_cycle() at cpu_idle_mwait_cycle+0x61
> > > end trace frame: 0x0, count: -5
> > 
> > Your system seems to detect a BREAK on the serial, and enter on ddb(4).
> 
> Is it the "comintr()" line that shows this? (just trying to learn)

Yes. The backtrace shows that db_enter() is called from comintr() function.

db_enter() is the function to enter in ddb(4). panic(9) usually calls it.

If you search comintr() function under /usr/src/sys, you will found it in
src/sys/dev/ic/com.c file (when grepping, uses '^comintr' pattern as OpenBSD
tends to respect style(9) which dictate that function name is written this way).

Next, by looking at the code, db_enter() is called only at one place in the
function. Please note that it isn't necessary as obvious: compiler could
obfuscate^Woptimize things (by inlining for example).

  1043 int
  1044 comintr(void *arg)
  1045 {
  [...]
  1066                                 data = com_read_reg(sc, com_data);
  1067                                 if (ISSET(lsr, LSR_BI)) {
  1068 #if defined(COM_CONSOLE) && defined(DDB)
  1069                                         if (ISSET(sc->sc_hwflags,
  1070                                             COM_HW_CONSOLE)) {
  1071                                                 if (db_console)
  1072                                                         db_enter();
  1073                                                 goto next;
  1074                                         }
  1075 #endif
  1076                                         data = 0;
  1077                                 }

The code implies db_console variable, and if you spent enough time in kernel,
you know it is the variable used by ddb.console sysctl knob. So if kernel called
db_enter(), it means you setted ddb.console=1 .

ddb.console=1 enables several ways to enter in ddb(4), and BREAK is one of them.
Without knowing where is the code that specifically detects the BREAK, from the
context, I could assume that comintr() is this specific code (and words like
COM_CONSOLE, COM_HW_CONSOLE, CRTSCTS helps).

And I already eared about BREAK that system could detect whereas not explicitly
send by remote.

> The APU2 and the machine that the serial line is connected to, both
> reboot at the same time! (after e.g. syspatch/pkg_add -u)
> 
> I suppose the BREAK is sent during shutdown of the other machine.

It seems to me that it isn't necessary a real BREAK, but could be some noise on
the line that it interpreted as a BREAK.

-- 
Sebastien Marie

Reply via email to