Re: vmd testers: serial console hangs fix
Hello, I've applied diff to 7.3. it works I can paste to serial console, hitting tab, etc.. Everything seems to work as expected. thanks and regards sashan On Mon, Oct 09, 2023 at 10:51:05AM -0400, Dave Voutila wrote: > Looking for folks that use the serial console connection in vmd(8) and > experience the host CPU spikes & delays associated with things like > hitting the up key (to cycle shell command history) or copy/paste in X. > > vmd(8) approximates edge triggered interrupts with the emulated i8259 > interrupt controller. Some core devices (serial console, rtc, timer) try > "toggling" an irq...but it's pointless in how our emulated i8259 is > implemented. The deassert does nothing for edge triggered interrupts > other than causing race conditions and extra syscalls. > > I've tested on two of my machines and this resolves the issue I've been > seeing off and on. It should fix the report[1] on bugs@ from months ago. > > -dv > > [1] https://marc.info/?l=openbsd-bugs=169669132915760=2 > > diff refs/heads/master refs/heads/vmd-edge > commit - 7869b2fdaac7e118bfd1783874fe25ce3b8b0f09 > commit + 00d448cdbe2461f27419aaf79520a0cef720aefc > blob - b98e7bdc69ac6a12eb84eaaf97ec43ecdbe83733 > blob + 248e3b161e88be505a88411156dc57a2772bd4fa > --- usr.sbin/vmd/i8253.c > +++ usr.sbin/vmd/i8253.c > @@ -371,7 +371,6 @@ i8253_fire(int fd, short type, void *arg) > struct i8253_channel *ctr = (struct i8253_channel *)arg; > > vcpu_assert_pic_irq(ctr->vm_id, 0, 0); > - vcpu_deassert_pic_irq(ctr->vm_id, 0, 0); > > if (ctr->mode != TIMER_INTTC) { > timerclear(); > blob - 43dce7b10d1467a5b7ac7f3308d01e32b4d0b9ee > blob + 4fc147b19c99627e386ab26355b8f90a6ae5872b > --- usr.sbin/vmd/mc146818.c > +++ usr.sbin/vmd/mc146818.c > @@ -150,7 +150,6 @@ rtc_fireper(int fd, short type, void *arg) > rtc.regs[MC_REGC] |= MC_REGC_PF; > > vcpu_assert_pic_irq((ptrdiff_t)arg, 0, 8); > - vcpu_deassert_pic_irq((ptrdiff_t)arg, 0, 8); > > evtimer_add(, _tv); > } > blob - bc23876bf0392312335da0d00e143583a87549af > blob + 98ed7dbecf2120ccbf9a16198ee479cb15aebc5f > --- usr.sbin/vmd/ns8250.c > +++ usr.sbin/vmd/ns8250.c > @@ -82,7 +82,6 @@ ratelimit(int fd, short type, void *arg) > com1_dev.regs.iir &= ~IIR_NOPEND; > > vcpu_assert_pic_irq(com1_dev.vmid, 0, com1_dev.irq); > - vcpu_deassert_pic_irq(com1_dev.vmid, 0, com1_dev.irq); > mutex_unlock(_dev.mutex); > } > > @@ -160,7 +159,6 @@ com_rcv_event(int fd, short kind, void *arg) > if ((com1_dev.regs.iir & IIR_NOPEND) == 0) { > /* XXX: vcpu_id */ > vcpu_assert_pic_irq((uintptr_t)arg, 0, com1_dev.irq); > - vcpu_deassert_pic_irq((uintptr_t)arg, 0, com1_dev.irq); > } > > mutex_unlock(_dev.mutex); >
Re: vmd testers: serial console hangs fix
Klemens Nanni writes: > On Sun, Oct 15, 2023 at 07:51:00AM -0400, Dave Voutila wrote: >> >> Dave Voutila writes: >> >> > Looking for folks that use the serial console connection in vmd(8) and >> > experience the host CPU spikes & delays associated with things like >> > hitting the up key (to cycle shell command history) or copy/paste in X. >> > >> > vmd(8) approximates edge triggered interrupts with the emulated i8259 >> > interrupt controller. Some core devices (serial console, rtc, timer) try >> > "toggling" an irq...but it's pointless in how our emulated i8259 is >> > implemented. The deassert does nothing for edge triggered interrupts >> > other than causing race conditions and extra syscalls. >> > >> > I've tested on two of my machines and this resolves the issue I've been >> > seeing off and on. It should fix the report[1] on bugs@ from months ago. >> >> Still looking for testers as the origin bug reporter has not responded. > > I know and saw that typing certain things or pasting into the serial > console had really annoying issues, but now during tests I failed to > reproduce this, with or without your diff. Some of my recent fixes probably reduced the probability of hitting the race condition. > > Interacting wth OpenBSD and Alpine Linux guests via 'vmctl console' works > fine for me with this diff. > That's good news. Thanks. >> >> > >> > -dv >> > >> > [1] https://marc.info/?l=openbsd-bugs=169669132915760=2 >> > >> > diff refs/heads/master refs/heads/vmd-edge >> > commit - 7869b2fdaac7e118bfd1783874fe25ce3b8b0f09 >> > commit + 00d448cdbe2461f27419aaf79520a0cef720aefc >> > blob - b98e7bdc69ac6a12eb84eaaf97ec43ecdbe83733 >> > blob + 248e3b161e88be505a88411156dc57a2772bd4fa >> > --- usr.sbin/vmd/i8253.c >> > +++ usr.sbin/vmd/i8253.c >> > @@ -371,7 +371,6 @@ i8253_fire(int fd, short type, void *arg) >> >struct i8253_channel *ctr = (struct i8253_channel *)arg; >> > >> >vcpu_assert_pic_irq(ctr->vm_id, 0, 0); >> > - vcpu_deassert_pic_irq(ctr->vm_id, 0, 0); >> > >> >if (ctr->mode != TIMER_INTTC) { >> >timerclear(); >> > blob - 43dce7b10d1467a5b7ac7f3308d01e32b4d0b9ee >> > blob + 4fc147b19c99627e386ab26355b8f90a6ae5872b >> > --- usr.sbin/vmd/mc146818.c >> > +++ usr.sbin/vmd/mc146818.c >> > @@ -150,7 +150,6 @@ rtc_fireper(int fd, short type, void *arg) >> >rtc.regs[MC_REGC] |= MC_REGC_PF; >> > >> >vcpu_assert_pic_irq((ptrdiff_t)arg, 0, 8); >> > - vcpu_deassert_pic_irq((ptrdiff_t)arg, 0, 8); >> > >> >evtimer_add(, _tv); >> > } >> > blob - bc23876bf0392312335da0d00e143583a87549af >> > blob + 98ed7dbecf2120ccbf9a16198ee479cb15aebc5f >> > --- usr.sbin/vmd/ns8250.c >> > +++ usr.sbin/vmd/ns8250.c >> > @@ -82,7 +82,6 @@ ratelimit(int fd, short type, void *arg) >> >com1_dev.regs.iir &= ~IIR_NOPEND; >> > >> >vcpu_assert_pic_irq(com1_dev.vmid, 0, com1_dev.irq); >> > - vcpu_deassert_pic_irq(com1_dev.vmid, 0, com1_dev.irq); >> >mutex_unlock(_dev.mutex); >> > } >> > >> > @@ -160,7 +159,6 @@ com_rcv_event(int fd, short kind, void *arg) >> >if ((com1_dev.regs.iir & IIR_NOPEND) == 0) { >> >/* XXX: vcpu_id */ >> >vcpu_assert_pic_irq((uintptr_t)arg, 0, com1_dev.irq); >> > - vcpu_deassert_pic_irq((uintptr_t)arg, 0, com1_dev.irq); >> >} >> > >> >mutex_unlock(_dev.mutex); >>
Re: vmd testers: serial console hangs fix
On Sun, Oct 15, 2023 at 07:51:00AM -0400, Dave Voutila wrote: > > Dave Voutila writes: > > > Looking for folks that use the serial console connection in vmd(8) and > > experience the host CPU spikes & delays associated with things like > > hitting the up key (to cycle shell command history) or copy/paste in X. > > > > vmd(8) approximates edge triggered interrupts with the emulated i8259 > > interrupt controller. Some core devices (serial console, rtc, timer) try > > "toggling" an irq...but it's pointless in how our emulated i8259 is > > implemented. The deassert does nothing for edge triggered interrupts > > other than causing race conditions and extra syscalls. > > > > I've tested on two of my machines and this resolves the issue I've been > > seeing off and on. It should fix the report[1] on bugs@ from months ago. > > Still looking for testers as the origin bug reporter has not responded. I know and saw that typing certain things or pasting into the serial console had really annoying issues, but now during tests I failed to reproduce this, with or without your diff. Interacting wth OpenBSD and Alpine Linux guests via 'vmctl console' works fine for me with this diff. > > > > > -dv > > > > [1] https://marc.info/?l=openbsd-bugs=169669132915760=2 > > > > diff refs/heads/master refs/heads/vmd-edge > > commit - 7869b2fdaac7e118bfd1783874fe25ce3b8b0f09 > > commit + 00d448cdbe2461f27419aaf79520a0cef720aefc > > blob - b98e7bdc69ac6a12eb84eaaf97ec43ecdbe83733 > > blob + 248e3b161e88be505a88411156dc57a2772bd4fa > > --- usr.sbin/vmd/i8253.c > > +++ usr.sbin/vmd/i8253.c > > @@ -371,7 +371,6 @@ i8253_fire(int fd, short type, void *arg) > > struct i8253_channel *ctr = (struct i8253_channel *)arg; > > > > vcpu_assert_pic_irq(ctr->vm_id, 0, 0); > > - vcpu_deassert_pic_irq(ctr->vm_id, 0, 0); > > > > if (ctr->mode != TIMER_INTTC) { > > timerclear(); > > blob - 43dce7b10d1467a5b7ac7f3308d01e32b4d0b9ee > > blob + 4fc147b19c99627e386ab26355b8f90a6ae5872b > > --- usr.sbin/vmd/mc146818.c > > +++ usr.sbin/vmd/mc146818.c > > @@ -150,7 +150,6 @@ rtc_fireper(int fd, short type, void *arg) > > rtc.regs[MC_REGC] |= MC_REGC_PF; > > > > vcpu_assert_pic_irq((ptrdiff_t)arg, 0, 8); > > - vcpu_deassert_pic_irq((ptrdiff_t)arg, 0, 8); > > > > evtimer_add(, _tv); > > } > > blob - bc23876bf0392312335da0d00e143583a87549af > > blob + 98ed7dbecf2120ccbf9a16198ee479cb15aebc5f > > --- usr.sbin/vmd/ns8250.c > > +++ usr.sbin/vmd/ns8250.c > > @@ -82,7 +82,6 @@ ratelimit(int fd, short type, void *arg) > > com1_dev.regs.iir &= ~IIR_NOPEND; > > > > vcpu_assert_pic_irq(com1_dev.vmid, 0, com1_dev.irq); > > - vcpu_deassert_pic_irq(com1_dev.vmid, 0, com1_dev.irq); > > mutex_unlock(_dev.mutex); > > } > > > > @@ -160,7 +159,6 @@ com_rcv_event(int fd, short kind, void *arg) > > if ((com1_dev.regs.iir & IIR_NOPEND) == 0) { > > /* XXX: vcpu_id */ > > vcpu_assert_pic_irq((uintptr_t)arg, 0, com1_dev.irq); > > - vcpu_deassert_pic_irq((uintptr_t)arg, 0, com1_dev.irq); > > } > > > > mutex_unlock(_dev.mutex); >
Re: vmd testers: serial console hangs fix
Dave Voutila writes: > Looking for folks that use the serial console connection in vmd(8) and > experience the host CPU spikes & delays associated with things like > hitting the up key (to cycle shell command history) or copy/paste in X. > > vmd(8) approximates edge triggered interrupts with the emulated i8259 > interrupt controller. Some core devices (serial console, rtc, timer) try > "toggling" an irq...but it's pointless in how our emulated i8259 is > implemented. The deassert does nothing for edge triggered interrupts > other than causing race conditions and extra syscalls. > > I've tested on two of my machines and this resolves the issue I've been > seeing off and on. It should fix the report[1] on bugs@ from months ago. Still looking for testers as the origin bug reporter has not responded. > > -dv > > [1] https://marc.info/?l=openbsd-bugs=169669132915760=2 > > diff refs/heads/master refs/heads/vmd-edge > commit - 7869b2fdaac7e118bfd1783874fe25ce3b8b0f09 > commit + 00d448cdbe2461f27419aaf79520a0cef720aefc > blob - b98e7bdc69ac6a12eb84eaaf97ec43ecdbe83733 > blob + 248e3b161e88be505a88411156dc57a2772bd4fa > --- usr.sbin/vmd/i8253.c > +++ usr.sbin/vmd/i8253.c > @@ -371,7 +371,6 @@ i8253_fire(int fd, short type, void *arg) > struct i8253_channel *ctr = (struct i8253_channel *)arg; > > vcpu_assert_pic_irq(ctr->vm_id, 0, 0); > - vcpu_deassert_pic_irq(ctr->vm_id, 0, 0); > > if (ctr->mode != TIMER_INTTC) { > timerclear(); > blob - 43dce7b10d1467a5b7ac7f3308d01e32b4d0b9ee > blob + 4fc147b19c99627e386ab26355b8f90a6ae5872b > --- usr.sbin/vmd/mc146818.c > +++ usr.sbin/vmd/mc146818.c > @@ -150,7 +150,6 @@ rtc_fireper(int fd, short type, void *arg) > rtc.regs[MC_REGC] |= MC_REGC_PF; > > vcpu_assert_pic_irq((ptrdiff_t)arg, 0, 8); > - vcpu_deassert_pic_irq((ptrdiff_t)arg, 0, 8); > > evtimer_add(, _tv); > } > blob - bc23876bf0392312335da0d00e143583a87549af > blob + 98ed7dbecf2120ccbf9a16198ee479cb15aebc5f > --- usr.sbin/vmd/ns8250.c > +++ usr.sbin/vmd/ns8250.c > @@ -82,7 +82,6 @@ ratelimit(int fd, short type, void *arg) > com1_dev.regs.iir &= ~IIR_NOPEND; > > vcpu_assert_pic_irq(com1_dev.vmid, 0, com1_dev.irq); > - vcpu_deassert_pic_irq(com1_dev.vmid, 0, com1_dev.irq); > mutex_unlock(_dev.mutex); > } > > @@ -160,7 +159,6 @@ com_rcv_event(int fd, short kind, void *arg) > if ((com1_dev.regs.iir & IIR_NOPEND) == 0) { > /* XXX: vcpu_id */ > vcpu_assert_pic_irq((uintptr_t)arg, 0, com1_dev.irq); > - vcpu_deassert_pic_irq((uintptr_t)arg, 0, com1_dev.irq); > } > > mutex_unlock(_dev.mutex);