Message ID | 1428916581-13601-1-git-send-email-daniel.vetter@ffwll.ch (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Hi On Mon, Apr 13, 2015 at 11:16 AM, Daniel Vetter <daniel.vetter@ffwll.ch> wrote: > This was introduced in > > commit 6db4063c5b72b46e9793b0f141a7a3984ac6facf > Author: Antonino A. Daplas <adaplas@gmail.com> > Date: Mon Jun 26 00:27:12 2006 -0700 > > [PATCH] VT binding: Add sysfs control to the VT layer > > with the justification > > "In addition, if any of the consoles are in KD_GRAPHICS mode, binding and > unbinding will not succeed. KD_GRAPHICS mode usually indicates that the > underlying console hardware is used for other purposes other than displaying > text (ie X). This feature should prevent binding/unbinding from interfering > with a graphics application using the VT." > > I think we should lift this artificial restriction though: > - KD_GRAPHICS doesn't get cleaned up automatically, which means it's > easy to have terminals stuck in KD_GRAPHICS when hacking around on > X. > - X doesn't really care, especially with drm where kms already blocks > fbdev (and hence fbcon) when there's an active compositor. > - This is a root-only interface with a separate .config option and > it's possible to hang your machine already anyway if you > unload/reload drivers and don't know what you're doing. I think it tries to prevent vgacon (or other _hw_ consoles) from being loaded. However, this was only interesting for UMS drivers, which used this to prevent the kernel from messing with them. But nowadays we have kernel drivers which control hand-over and hardware ownership, so I cannot see why this protection is still needed: Acked-by: David Herrmann <dh.herrmann@gmail.com> Thanks David > With this patch i915.ko module reloading works again reliably, > something in the recent fedora upgrades broke things. > > Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> > Cc: Antonino A. Daplas <adaplas@gmail.com> > Cc: David Herrmann <dh.herrmann@gmail.com> > Cc: Peter Hurley <peter@hurleysoftware.com> > Cc: Imre Deak <imre.deak@intel.com> > Signed-off-by: Daniel Vetter <daniel.vetter@intel.com> > --- > drivers/tty/vt/vt.c | 22 ++-------------------- > 1 file changed, 2 insertions(+), 20 deletions(-) > > diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c > index 6e00572cbeb9..b84f7d80c8b4 100644 > --- a/drivers/tty/vt/vt.c > +++ b/drivers/tty/vt/vt.c > @@ -3185,22 +3185,6 @@ err: > > > #ifdef CONFIG_VT_HW_CONSOLE_BINDING > -static int con_is_graphics(const struct consw *csw, int first, int last) > -{ > - int i, retval = 0; > - > - for (i = first; i <= last; i++) { > - struct vc_data *vc = vc_cons[i].d; > - > - if (vc && vc->vc_mode == KD_GRAPHICS) { > - retval = 1; > - break; > - } > - } > - > - return retval; > -} > - > /* unlocked version of unbind_con_driver() */ > int do_unbind_con_driver(const struct consw *csw, int first, int last, int deflt) > { > @@ -3286,8 +3270,7 @@ static int vt_bind(struct con_driver *con) > const struct consw *defcsw = NULL, *csw = NULL; > int i, more = 1, first = -1, last = -1, deflt = 0; > > - if (!con->con || !(con->flag & CON_DRIVER_FLAG_MODULE) || > - con_is_graphics(con->con, con->first, con->last)) > + if (!con->con || !(con->flag & CON_DRIVER_FLAG_MODULE)) > goto err; > > csw = con->con; > @@ -3338,8 +3321,7 @@ static int vt_unbind(struct con_driver *con) > int i, more = 1, first = -1, last = -1, deflt = 0; > int ret; > > - if (!con->con || !(con->flag & CON_DRIVER_FLAG_MODULE) || > - con_is_graphics(con->con, con->first, con->last)) > + if (!con->con || !(con->flag & CON_DRIVER_FLAG_MODULE)) > goto err; > > csw = con->con; > -- > 2.1.0 >
diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c index 6e00572cbeb9..b84f7d80c8b4 100644 --- a/drivers/tty/vt/vt.c +++ b/drivers/tty/vt/vt.c @@ -3185,22 +3185,6 @@ err: #ifdef CONFIG_VT_HW_CONSOLE_BINDING -static int con_is_graphics(const struct consw *csw, int first, int last) -{ - int i, retval = 0; - - for (i = first; i <= last; i++) { - struct vc_data *vc = vc_cons[i].d; - - if (vc && vc->vc_mode == KD_GRAPHICS) { - retval = 1; - break; - } - } - - return retval; -} - /* unlocked version of unbind_con_driver() */ int do_unbind_con_driver(const struct consw *csw, int first, int last, int deflt) { @@ -3286,8 +3270,7 @@ static int vt_bind(struct con_driver *con) const struct consw *defcsw = NULL, *csw = NULL; int i, more = 1, first = -1, last = -1, deflt = 0; - if (!con->con || !(con->flag & CON_DRIVER_FLAG_MODULE) || - con_is_graphics(con->con, con->first, con->last)) + if (!con->con || !(con->flag & CON_DRIVER_FLAG_MODULE)) goto err; csw = con->con; @@ -3338,8 +3321,7 @@ static int vt_unbind(struct con_driver *con) int i, more = 1, first = -1, last = -1, deflt = 0; int ret; - if (!con->con || !(con->flag & CON_DRIVER_FLAG_MODULE) || - con_is_graphics(con->con, con->first, con->last)) + if (!con->con || !(con->flag & CON_DRIVER_FLAG_MODULE)) goto err; csw = con->con;
This was introduced in commit 6db4063c5b72b46e9793b0f141a7a3984ac6facf Author: Antonino A. Daplas <adaplas@gmail.com> Date: Mon Jun 26 00:27:12 2006 -0700 [PATCH] VT binding: Add sysfs control to the VT layer with the justification "In addition, if any of the consoles are in KD_GRAPHICS mode, binding and unbinding will not succeed. KD_GRAPHICS mode usually indicates that the underlying console hardware is used for other purposes other than displaying text (ie X). This feature should prevent binding/unbinding from interfering with a graphics application using the VT." I think we should lift this artificial restriction though: - KD_GRAPHICS doesn't get cleaned up automatically, which means it's easy to have terminals stuck in KD_GRAPHICS when hacking around on X. - X doesn't really care, especially with drm where kms already blocks fbdev (and hence fbcon) when there's an active compositor. - This is a root-only interface with a separate .config option and it's possible to hang your machine already anyway if you unload/reload drivers and don't know what you're doing. With this patch i915.ko module reloading works again reliably, something in the recent fedora upgrades broke things. Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: Antonino A. Daplas <adaplas@gmail.com> Cc: David Herrmann <dh.herrmann@gmail.com> Cc: Peter Hurley <peter@hurleysoftware.com> Cc: Imre Deak <imre.deak@intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com> --- drivers/tty/vt/vt.c | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-)