FreeBSD Bugzilla – Attachment 204233 Details for
Bug 237758
dcons: Panic loading and subsequent unloading of the kernel module
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch for panic on kldunload dcons
dcons_deferred_free.diff (text/plain), 1.67 KB, created by
Ian Lepore
on 2019-05-06 04:37:05 UTC
(
hide
)
Description:
Patch for panic on kldunload dcons
Filename:
MIME Type:
Creator:
Ian Lepore
Created:
2019-05-06 04:37:05 UTC
Size:
1.67 KB
patch
obsolete
>Index: sys/dev/dcons/dcons_os.c >=================================================================== >--- sys/dev/dcons/dcons_os.c (revision 347133) >+++ sys/dev/dcons/dcons_os.c (working copy) >@@ -52,6 +52,7 @@ > #include <sys/proc.h> > #include <sys/ucred.h> > >+#include <machine/atomic.h> > #include <machine/bus.h> > > #include <dev/dcons/dcons.h> >@@ -135,12 +136,16 @@ extern struct gdb_dbgport *gdb_cur; > #endif > > static tsw_outwakeup_t dcons_outwakeup; >+static tsw_free_t dcons_free; > > static struct ttydevsw dcons_ttydevsw = { > .tsw_flags = TF_NOPREFIX, > .tsw_outwakeup = dcons_outwakeup, >+ .tsw_free = dcons_free, > }; > >+static int dcons_close_refs; >+ > #if (defined(GDB) || defined(DDB)) > static int > dcons_check_break(struct dcons_softc *dc, int c) >@@ -198,6 +203,14 @@ dcons_os_putc(struct dcons_softc *dc, int c) > } > > static void >+dcons_free(void *xsc __unused) >+{ >+ >+ /* Our deferred free has arrived, now we're waiting for one fewer. */ >+ atomic_subtract_rel_int(&dcons_close_refs, 1); >+} >+ >+static void > dcons_outwakeup(struct tty *tp) > { > struct dcons_softc *dc; >@@ -396,6 +409,8 @@ dcons_detach(int port) > dc = &sc[port]; > tp = dc->tty; > >+ /* tty_rel_gone() schedules a deferred free callback, count it. */ >+ atomic_add_int(&dcons_close_refs, 1); > tty_lock(tp); > tty_rel_gone(tp); > >@@ -430,6 +445,9 @@ dcons_modevent(module_t mode, int type, void *data > contigfree(dg.buf, DCONS_BUF_SIZE, M_DEVBUF); > } > >+ /* Wait for tty deferred free callbacks to complete. */ >+ while (atomic_load_acq_int(&dcons_close_refs) > 0) >+ pause_sbt("dcunld", mstosbt(50), mstosbt(10), 0); > break; > case MOD_SHUTDOWN: > #if 0 /* Keep connection after halt */
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 237758
:
204230
| 204233