tech-kern archive

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

Re: tty deadlock (PR 37915)



How about the appended one? Much simpler.

best regards
Matthias





-------------------------------------------------------------------
-------------------------------------------------------------------
Forschungszentrum Juelich GmbH
52425 Juelich

Sitz der Gesellschaft: Juelich
Eingetragen im Handelsregister des Amtsgerichts Dueren Nr. HR B 3498
Vorsitzende des Aufsichtsrats: MinDir'in Baerbel Brumme-Bothe
Geschaeftsfuehrung: Prof. Dr. Achim Bachem (Vorsitzender),
Dr. Ulrich Krafft (stellv. Vorsitzender), Prof. Dr. Harald Bolt,
Dr. Sebastian M. Schmidt
-------------------------------------------------------------------
-------------------------------------------------------------------
#
# old_revision [91a7102a2588ea146fef003ced76f32911897a43]
#
# patch "sys/dev/wscons/wsdisplay.c"
#  from [18ff4c875e11f2ff965e4be79166ade444da4f20]
#    to [f60e105cb806e9afe40d9a979d5d96a0fd790ec7]
# 
# patch "sys/kern/tty.c"
#  from [a190c868b878f4cf1b63a1228dd08e1605bc6031]
#    to [3332aac01d0ab875ccf4d4c6f3cad03d74806676]
# 
# patch "sys/sys/tty.h"
#  from [d257897c4c2fbc2161e36aa54c0d820fe24e890a]
#    to [134a833da3d2f5b9f03b4f9dec9eeb6cc838c775]
#
============================================================
--- sys/dev/wscons/wsdisplay.c  18ff4c875e11f2ff965e4be79166ade444da4f20
+++ sys/dev/wscons/wsdisplay.c  f60e105cb806e9afe40d9a979d5d96a0fd790ec7
@@ -1610,6 +1610,7 @@ wsdisplay_emulinput(void *v, const u_cha
 {
        struct wsscreen *scr = v;
        struct tty *tp;
+       int (*ifcn)(int, struct tty *);
 
        if (v == NULL)                  /* console, before real attach */
                return;
@@ -1620,8 +1621,14 @@ wsdisplay_emulinput(void *v, const u_cha
                return;
 
        tp = scr->scr_tty;
+
+       /* XXX bad hack to avoid recursive locking */
+       ifcn = tp->t_linesw->l_rint;
+       if (ifcn == ttyinput)
+               ifcn = ttyinput_wlock;
+
        while (count-- > 0)
-               (*tp->t_linesw->l_rint)(*data++, tp);
+               (*ifcn)(*data++, tp);
 }
 
 /*
============================================================
--- sys/kern/tty.c      a190c868b878f4cf1b63a1228dd08e1605bc6031
+++ sys/kern/tty.c      3332aac01d0ab875ccf4d4c6f3cad03d74806676
@@ -375,7 +375,7 @@ ttyclose(struct tty *tp)
  * ttyinput() helper.
  * Call with the tty lock held.
  */
-static int
+/* XXX static */ int
 ttyinput_wlock(int c, struct tty *tp)
 {
        int     iflag, lflag, i, error;
============================================================
--- sys/sys/tty.h       d257897c4c2fbc2161e36aa54c0d820fe24e890a
+++ sys/sys/tty.h       134a833da3d2f5b9f03b4f9dec9eeb6cc838c775
@@ -274,6 +274,7 @@ int  ttyinput(int, struct tty *);
 void    ttygetinfo(struct tty *, int, char *, size_t);
 void    ttyputinfo(struct tty *, char *);
 int     ttyinput(int, struct tty *);
+int     ttyinput_wlock(int, struct tty *); /* XXX */
 int     ttylclose(struct tty *, int);
 int     ttylopen(dev_t, struct tty *);
 int     ttykqfilter(dev_t, struct knote *);


Home | Main Index | Thread Index | Old Index