2014-06-05 14:59:32

by Daniel Vetter

[permalink] [raw]
Subject: [PATCH 1/5] vt: Fix replacement console check when unbinding

I don't fully understand the magic of the vt register/unregister
logic, but apparently everything but the inital console (as set
in the conswitchp pointer) is marked with FLAG_MODULE. Which means
if something unregistered the boot vt driver (e.g. i915.ko kicking
out vga_con) there's nothing left when trying to unbind e.g. fbcon
through sysfs.

But we always have the dummy console hanging around, so this test
is fairly dubious. What we actually want is simply a different console
than the one we want to unbind.

Cc: Greg Kroah-Hartman <[email protected]>
Cc: Jiri Slaby <[email protected]>
Signed-off-by: Daniel Vetter <[email protected]>
---
drivers/tty/vt/vt.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c
index 3ad0b61e35b4..ea600f482eeb 100644
--- a/drivers/tty/vt/vt.c
+++ b/drivers/tty/vt/vt.c
@@ -3155,8 +3155,7 @@ int do_unbind_con_driver(const struct consw *csw, int first, int last, int deflt
for (i = 0; i < MAX_NR_CON_DRIVER; i++) {
con_back = &registered_con_driver[i];

- if (con_back->con &&
- !(con_back->flag & CON_DRIVER_FLAG_MODULE)) {
+ if (con_back->con && con_back->con != csw) {
defcsw = con_back->con;
retval = 0;
break;
--
1.8.1.4


2014-06-05 14:59:38

by Daniel Vetter

[permalink] [raw]
Subject: [PATCH 4/5] drm/i915: Fixup global gtt cleanup

The global gtt is setup up in 2 parts, so we need to be careful
with the cleanup. For consistency shovel it all into the ->cleanup
callback, like with ppgtt.

Noticed because it blew up in the out_gtt: cleanup code while
fiddling with the vgacon code.

Signed-off-by: Daniel Vetter <[email protected]>
---
drivers/gpu/drm/i915/i915_dma.c | 4 ----
drivers/gpu/drm/i915/i915_gem_gtt.c | 9 ++++++++-
2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
index b9159ade5e85..27fe65ac5940 100644
--- a/drivers/gpu/drm/i915/i915_dma.c
+++ b/drivers/gpu/drm/i915/i915_dma.c
@@ -1386,7 +1386,6 @@ cleanup_gem:
i915_gem_context_fini(dev);
mutex_unlock(&dev->struct_mutex);
WARN_ON(dev_priv->mm.aliasing_ppgtt);
- drm_mm_takedown(&dev_priv->gtt.base.mm);
cleanup_irq:
drm_irq_uninstall(dev);
cleanup_gem_stolen:
@@ -1756,8 +1755,6 @@ out_mtrrfree:
arch_phys_wc_del(dev_priv->gtt.mtrr);
io_mapping_free(dev_priv->gtt.mappable);
out_gtt:
- list_del(&dev_priv->gtt.base.global_link);
- drm_mm_takedown(&dev_priv->gtt.base.mm);
dev_priv->gtt.base.cleanup(&dev_priv->gtt.base);
out_regs:
intel_uncore_fini(dev);
@@ -1846,7 +1843,6 @@ int i915_driver_unload(struct drm_device *dev)
i915_free_hws(dev);
}

- list_del(&dev_priv->gtt.base.global_link);
WARN_ON(!list_empty(&dev_priv->vm_list));

drm_vblank_cleanup(dev);
diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c
index 931b906f292a..41e864ec5632 100644
--- a/drivers/gpu/drm/i915/i915_gem_gtt.c
+++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
@@ -1985,7 +1985,10 @@ static void gen6_gmch_remove(struct i915_address_space *vm)

struct i915_gtt *gtt = container_of(vm, struct i915_gtt, base);

- drm_mm_takedown(&vm->mm);
+ if (drm_mm_initialized(&vm->mm)) {
+ drm_mm_takedown(&vm->mm);
+ list_del(&vm->global_link);
+ }
iounmap(gtt->gsm);
teardown_scratch_page(vm->dev);
}
@@ -2018,6 +2021,10 @@ static int i915_gmch_probe(struct drm_device *dev,

static void i915_gmch_remove(struct i915_address_space *vm)
{
+ if (drm_mm_initialized(&vm->mm)) {
+ drm_mm_takedown(&vm->mm);
+ list_del(&vm->global_link);
+ }
intel_gmch_remove();
}

--
1.8.1.4

2014-06-05 14:59:36

by Daniel Vetter

[permalink] [raw]
Subject: [PATCH 2/5] vt: Fix up unregistration of vt drivers

A bunch of issues:
- We should not kick out the default console (which is tracked in
conswitchp), so check for that.
- Add better error codes so callers can differentiate between "something
went wrong" and "your driver isn't registered already". i915 needs
that so it doesn't fall over when reloading the driver and hence
vga_con is already unregistered.
- There's a mess with the driver flags: What we need to check for is
that the driver isn't used any more, i.e. unbound completely (FLAG_INIT).
And not whether it's the boot console or not (which is the only one
which doesn't have FLAG_MODULE). Otherwise there's no way to kick
out the boot console, which i915 wants to do to prevent havoc with
vga_con interferring (which tends to hang machines).

Cc: Greg Kroah-Hartman <[email protected]>
Cc: Jiri Slaby <[email protected]>
Signed-off-by: Daniel Vetter <[email protected]>
---
drivers/tty/vt/vt.c | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c
index ea600f482eeb..5077fe87324d 100644
--- a/drivers/tty/vt/vt.c
+++ b/drivers/tty/vt/vt.c
@@ -3573,17 +3573,20 @@ err:
*/
int do_unregister_con_driver(const struct consw *csw)
{
- int i, retval = -ENODEV;
+ int i;

/* cannot unregister a bound driver */
if (con_is_bound(csw))
- goto err;
+ return -EBUSY;
+
+ if (csw == conswitchp)
+ return -EINVAL;

for (i = 0; i < MAX_NR_CON_DRIVER; i++) {
struct con_driver *con_driver = &registered_con_driver[i];

if (con_driver->con == csw &&
- con_driver->flag & CON_DRIVER_FLAG_MODULE) {
+ con_driver->flag & CON_DRIVER_FLAG_INIT) {
vtconsole_deinit_device(con_driver);
device_destroy(vtconsole_class,
MKDEV(0, con_driver->node));
@@ -3594,12 +3597,11 @@ int do_unregister_con_driver(const struct consw *csw)
con_driver->flag = 0;
con_driver->first = 0;
con_driver->last = 0;
- retval = 0;
- break;
+ return 0;
}
}
-err:
- return retval;
+
+ return -ENODEV;
}
EXPORT_SYMBOL_GPL(do_unregister_con_driver);

--
1.8.1.4

2014-06-05 14:59:57

by Daniel Vetter

[permalink] [raw]
Subject: [PATCH 3/5] vt: Don't ignore unbind errors in vt_unbind

Otherwise the loop will never stop since we don't make any
forward progress. Noticed while breaking this accidentally
in a painful attempt to make vga_con unregistering work.

With this patch we'll bail out on the first attempt, which
at least leaves a useful enough system behind for debugging.
Livelocks on console_lock just aren't fun.

Cc: Greg Kroah-Hartman <[email protected]>
Cc: Jiri Slaby <[email protected]>
Signed-off-by: Daniel Vetter <[email protected]>
---
drivers/tty/vt/vt.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c
index 5077fe87324d..3c00dcb3b145 100644
--- a/drivers/tty/vt/vt.c
+++ b/drivers/tty/vt/vt.c
@@ -3260,6 +3260,7 @@ static int vt_unbind(struct con_driver *con)
{
const struct consw *csw = NULL;
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))
@@ -3285,8 +3286,10 @@ static int vt_unbind(struct con_driver *con)

if (first != -1) {
console_lock();
- do_unbind_con_driver(csw, first, last, deflt);
+ ret = do_unbind_con_driver(csw, first, last, deflt);
console_unlock();
+ if (ret != 0)
+ return ret;
}

first = -1;
--
1.8.1.4

2014-06-05 14:59:43

by Daniel Vetter

[permalink] [raw]
Subject: [PATCH 5/5] drm/i915: Kick out vga console

Touching the VGA resources on an IVB EFI machine causes hard hangs when
we then kick out the efifb. Ouch.

Apparently this also prevents unclaimed register errors on hsw and
hard machine hangs on my i855gm when trying to unbind fbcon.

Also, we want this to make I915_FBDEV=n safe.

v2: Rebase and pimp commit message.

v3: We also need to unregister the vga console, otherwise the unbind
of the fb console before module unload might resurrect it again.

v4: Ignore errors when the vga console is already unregistered - this
can happen when e.g. reloading i915.ko.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=67813
Cc: David Herrmann <[email protected]>
Cc: Jean-Christophe Plagniol-Villard <[email protected]>
Cc: Tomi Valkeinen <[email protected]>
Cc: [email protected]
Cc: Jani Nikula <[email protected]>
Signed-off-by: Chris Wilson <[email protected]> (v1)
Signed-off-by: Daniel Vetter <[email protected]>
---
drivers/gpu/drm/i915/i915_dma.c | 43 +++++++++++++++++++++++++++++++++++++++-
drivers/video/console/dummycon.c | 1 +
drivers/video/console/vgacon.c | 1 +
3 files changed, 44 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
index 27fe65ac5940..bcb66ddd649e 100644
--- a/drivers/gpu/drm/i915/i915_dma.c
+++ b/drivers/gpu/drm/i915/i915_dma.c
@@ -36,6 +36,8 @@
#include "i915_drv.h"
#include "i915_trace.h"
#include <linux/pci.h>
+#include <linux/console.h>
+#include <linux/vt.h>
#include <linux/vgaarb.h>
#include <linux/acpi.h>
#include <linux/pnp.h>
@@ -1449,6 +1451,38 @@ static void i915_kick_out_firmware_fb(struct drm_i915_private *dev_priv)
}
#endif

+#if !defined(CONFIG_VGA_CONSOLE)
+static int i915_kick_out_vgacon(struct drm_i915_private *dev_priv)
+{
+ return 0;
+}
+#elif !defined(CONFIG_DUMMY_CONSOLE)
+static int i915_kick_out_vgacon(struct drm_i915_private *dev_priv)
+{
+ return -ENODEV;
+}
+#else
+static int i915_kick_out_vgacon(struct drm_i915_private *dev_priv)
+{
+ int ret;
+
+ DRM_INFO("Replacing VGA console driver\n");
+
+ console_lock();
+ ret = do_take_over_console(&dummy_con, 0, MAX_NR_CONSOLES - 1, 1);
+ if (ret == 0) {
+ ret = do_unregister_con_driver(&vga_con);
+
+ /* Ignore "already unregistered". */
+ if (ret == -ENODEV)
+ ret = 0;
+ }
+ console_unlock();
+
+ return ret;
+}
+#endif
+
static void i915_dump_device_info(struct drm_i915_private *dev_priv)
{
const struct intel_device_info *info = &dev_priv->info;
@@ -1622,8 +1656,15 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags)
if (ret)
goto out_regs;

- if (drm_core_check_feature(dev, DRIVER_MODESET))
+ if (drm_core_check_feature(dev, DRIVER_MODESET)) {
+ ret = i915_kick_out_vgacon(dev_priv);
+ if (ret) {
+ DRM_ERROR("failed to remove conflicting VGA console\n");
+ goto out_gtt;
+ }
+
i915_kick_out_firmware_fb(dev_priv);
+ }

pci_set_master(dev->pdev);

diff --git a/drivers/video/console/dummycon.c b/drivers/video/console/dummycon.c
index b63860f7beab..40bec8d64b0a 100644
--- a/drivers/video/console/dummycon.c
+++ b/drivers/video/console/dummycon.c
@@ -77,3 +77,4 @@ const struct consw dummy_con = {
.con_set_palette = DUMMY,
.con_scrolldelta = DUMMY,
};
+EXPORT_SYMBOL_GPL(dummy_con);
diff --git a/drivers/video/console/vgacon.c b/drivers/video/console/vgacon.c
index 9d8feac67637..84acd6223dc5 100644
--- a/drivers/video/console/vgacon.c
+++ b/drivers/video/console/vgacon.c
@@ -1440,5 +1440,6 @@ const struct consw vga_con = {
.con_build_attr = vgacon_build_attr,
.con_invert_region = vgacon_invert_region,
};
+EXPORT_SYMBOL(vga_con);

MODULE_LICENSE("GPL");
--
1.8.1.4

2014-06-06 07:13:42

by David Herrmann

[permalink] [raw]
Subject: Re: [PATCH 3/5] vt: Don't ignore unbind errors in vt_unbind

Hi

On Thu, Jun 5, 2014 at 4:58 PM, Daniel Vetter <[email protected]> wrote:
> Otherwise the loop will never stop since we don't make any
> forward progress. Noticed while breaking this accidentally
> in a painful attempt to make vga_con unregistering work.
>
> With this patch we'll bail out on the first attempt, which
> at least leaves a useful enough system behind for debugging.
> Livelocks on console_lock just aren't fun.
>
> Cc: Greg Kroah-Hartman <[email protected]>
> Cc: Jiri Slaby <[email protected]>
> Signed-off-by: Daniel Vetter <[email protected]>

We used to return 0 on errors here, which is very backwards to me.. so
your change to use "retval" looks fine to me. This is:

Reviewed-by: David Herrmann <[email protected]>

Thanks
David

> ---
> drivers/tty/vt/vt.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c
> index 5077fe87324d..3c00dcb3b145 100644
> --- a/drivers/tty/vt/vt.c
> +++ b/drivers/tty/vt/vt.c
> @@ -3260,6 +3260,7 @@ static int vt_unbind(struct con_driver *con)
> {
> const struct consw *csw = NULL;
> 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))
> @@ -3285,8 +3286,10 @@ static int vt_unbind(struct con_driver *con)
>
> if (first != -1) {
> console_lock();
> - do_unbind_con_driver(csw, first, last, deflt);
> + ret = do_unbind_con_driver(csw, first, last, deflt);
> console_unlock();
> + if (ret != 0)
> + return ret;
> }
>
> first = -1;
> --
> 1.8.1.4
>
> _______________________________________________
> dri-devel mailing list
> [email protected]
> http://lists.freedesktop.org/mailman/listinfo/dri-devel

2014-06-06 07:16:16

by David Herrmann

[permalink] [raw]
Subject: Re: [PATCH 1/5] vt: Fix replacement console check when unbinding

Hi

On Thu, Jun 5, 2014 at 4:58 PM, Daniel Vetter <[email protected]> wrote:
> I don't fully understand the magic of the vt register/unregister
> logic, but apparently everything but the inital console (as set
> in the conswitchp pointer) is marked with FLAG_MODULE. Which means
> if something unregistered the boot vt driver (e.g. i915.ko kicking
> out vga_con) there's nothing left when trying to unbind e.g. fbcon
> through sysfs.
>
> But we always have the dummy console hanging around, so this test
> is fairly dubious. What we actually want is simply a different console
> than the one we want to unbind.

For unknown reasons, you can disable the dummy console via Kconfig, so
it's not guaranteed to be around. But your comment is still valid.

>
> Cc: Greg Kroah-Hartman <[email protected]>
> Cc: Jiri Slaby <[email protected]>
> Signed-off-by: Daniel Vetter <[email protected]>
> ---
> drivers/tty/vt/vt.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c
> index 3ad0b61e35b4..ea600f482eeb 100644
> --- a/drivers/tty/vt/vt.c
> +++ b/drivers/tty/vt/vt.c
> @@ -3155,8 +3155,7 @@ int do_unbind_con_driver(const struct consw *csw, int first, int last, int deflt
> for (i = 0; i < MAX_NR_CON_DRIVER; i++) {
> con_back = &registered_con_driver[i];
>
> - if (con_back->con &&
> - !(con_back->flag & CON_DRIVER_FLAG_MODULE)) {
> + if (con_back->con && con_back->con != csw) {

Funny thing is, if you run do_bind_con_driver() on the range first,
you kick out the existing driver and can then unload it regardless
whether the fallback was FLAG_MODULE or not. Therefore, I think that
change is safe. This is:

Reviewed-by: David Herrmann <[email protected]>

Thanks
David

> defcsw = con_back->con;
> retval = 0;
> break;
> --
> 1.8.1.4
>
> _______________________________________________
> dri-devel mailing list
> [email protected]
> http://lists.freedesktop.org/mailman/listinfo/dri-devel

2014-06-06 07:24:37

by David Herrmann

[permalink] [raw]
Subject: Re: [PATCH 2/5] vt: Fix up unregistration of vt drivers

Hi

On Thu, Jun 5, 2014 at 4:58 PM, Daniel Vetter <[email protected]> wrote:
> A bunch of issues:
> - We should not kick out the default console (which is tracked in
> conswitchp), so check for that.
> - Add better error codes so callers can differentiate between "something
> went wrong" and "your driver isn't registered already". i915 needs
> that so it doesn't fall over when reloading the driver and hence
> vga_con is already unregistered.
> - There's a mess with the driver flags: What we need to check for is
> that the driver isn't used any more, i.e. unbound completely (FLAG_INIT).
> And not whether it's the boot console or not (which is the only one
> which doesn't have FLAG_MODULE). Otherwise there's no way to kick
> out the boot console, which i915 wants to do to prevent havoc with
> vga_con interferring (which tends to hang machines).
>
> Cc: Greg Kroah-Hartman <[email protected]>
> Cc: Jiri Slaby <[email protected]>
> Signed-off-by: Daniel Vetter <[email protected]>
> ---
> drivers/tty/vt/vt.c | 16 +++++++++-------
> 1 file changed, 9 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c
> index ea600f482eeb..5077fe87324d 100644
> --- a/drivers/tty/vt/vt.c
> +++ b/drivers/tty/vt/vt.c
> @@ -3573,17 +3573,20 @@ err:
> */
> int do_unregister_con_driver(const struct consw *csw)
> {
> - int i, retval = -ENODEV;
> + int i;
>
> /* cannot unregister a bound driver */
> if (con_is_bound(csw))
> - goto err;
> + return -EBUSY;
> +
> + if (csw == conswitchp)
> + return -EINVAL;

Ugh, that fix is correct, but I'd rather like to see
do_unbind_con_driver() do the right thing. It currently resets
conswitchp _only_ if the new fallback is unbound. Why not _always_ set
conswitchp to defcsw _iff_ conswitchp == csw there?

This way, you _know_ here that if !con_is_bound(csw), then csw != conswitchp.

>
> for (i = 0; i < MAX_NR_CON_DRIVER; i++) {
> struct con_driver *con_driver = &registered_con_driver[i];
>
> if (con_driver->con == csw &&
> - con_driver->flag & CON_DRIVER_FLAG_MODULE) {
> + con_driver->flag & CON_DRIVER_FLAG_INIT) {

That makes FLAG_MODULE almost a no-op except for ->unbind(). I wonder
why FLAG_MODULE exists, anyway.

Otherwise looks good.

Thanks
David

> vtconsole_deinit_device(con_driver);
> device_destroy(vtconsole_class,
> MKDEV(0, con_driver->node));
> @@ -3594,12 +3597,11 @@ int do_unregister_con_driver(const struct consw *csw)
> con_driver->flag = 0;
> con_driver->first = 0;
> con_driver->last = 0;
> - retval = 0;
> - break;
> + return 0;
> }
> }
> -err:
> - return retval;
> +
> + return -ENODEV;
> }
> EXPORT_SYMBOL_GPL(do_unregister_con_driver);
>
> --
> 1.8.1.4
>
> _______________________________________________
> dri-devel mailing list
> [email protected]
> http://lists.freedesktop.org/mailman/listinfo/dri-devel

2014-06-06 07:28:08

by David Herrmann

[permalink] [raw]
Subject: Re: [PATCH 5/5] drm/i915: Kick out vga console

Hi

On Thu, Jun 5, 2014 at 4:58 PM, Daniel Vetter <[email protected]> wrote:
> Touching the VGA resources on an IVB EFI machine causes hard hangs when
> we then kick out the efifb. Ouch.
>
> Apparently this also prevents unclaimed register errors on hsw and
> hard machine hangs on my i855gm when trying to unbind fbcon.
>
> Also, we want this to make I915_FBDEV=n safe.
>
> v2: Rebase and pimp commit message.
>
> v3: We also need to unregister the vga console, otherwise the unbind
> of the fb console before module unload might resurrect it again.
>
> v4: Ignore errors when the vga console is already unregistered - this
> can happen when e.g. reloading i915.ko.
>
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=67813
> Cc: David Herrmann <[email protected]>
> Cc: Jean-Christophe Plagniol-Villard <[email protected]>
> Cc: Tomi Valkeinen <[email protected]>
> Cc: [email protected]
> Cc: Jani Nikula <[email protected]>
> Signed-off-by: Chris Wilson <[email protected]> (v1)
> Signed-off-by: Daniel Vetter <[email protected]>
> ---
> drivers/gpu/drm/i915/i915_dma.c | 43 +++++++++++++++++++++++++++++++++++++++-
> drivers/video/console/dummycon.c | 1 +
> drivers/video/console/vgacon.c | 1 +
> 3 files changed, 44 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
> index 27fe65ac5940..bcb66ddd649e 100644
> --- a/drivers/gpu/drm/i915/i915_dma.c
> +++ b/drivers/gpu/drm/i915/i915_dma.c
> @@ -36,6 +36,8 @@
> #include "i915_drv.h"
> #include "i915_trace.h"
> #include <linux/pci.h>
> +#include <linux/console.h>
> +#include <linux/vt.h>
> #include <linux/vgaarb.h>
> #include <linux/acpi.h>
> #include <linux/pnp.h>
> @@ -1449,6 +1451,38 @@ static void i915_kick_out_firmware_fb(struct drm_i915_private *dev_priv)
> }
> #endif
>
> +#if !defined(CONFIG_VGA_CONSOLE)
> +static int i915_kick_out_vgacon(struct drm_i915_private *dev_priv)
> +{
> + return 0;
> +}
> +#elif !defined(CONFIG_DUMMY_CONSOLE)

Why not "select DUMMY_CONSOLE if VT"? It's really stupid to disable
DUMMY_CONSOLE.. Furthermore, we already rely on HW_CONSOLE_BINDING so
this should be safe.

Patch looks good to me:

Reviewed-by: David Herrmann <[email protected]>

Thanks
David

> +static int i915_kick_out_vgacon(struct drm_i915_private *dev_priv)
> +{
> + return -ENODEV;
> +}
> +#else
> +static int i915_kick_out_vgacon(struct drm_i915_private *dev_priv)
> +{
> + int ret;
> +
> + DRM_INFO("Replacing VGA console driver\n");
> +
> + console_lock();
> + ret = do_take_over_console(&dummy_con, 0, MAX_NR_CONSOLES - 1, 1);
> + if (ret == 0) {
> + ret = do_unregister_con_driver(&vga_con);
> +
> + /* Ignore "already unregistered". */
> + if (ret == -ENODEV)
> + ret = 0;
> + }
> + console_unlock();
> +
> + return ret;
> +}
> +#endif
> +
> static void i915_dump_device_info(struct drm_i915_private *dev_priv)
> {
> const struct intel_device_info *info = &dev_priv->info;
> @@ -1622,8 +1656,15 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags)
> if (ret)
> goto out_regs;
>
> - if (drm_core_check_feature(dev, DRIVER_MODESET))
> + if (drm_core_check_feature(dev, DRIVER_MODESET)) {
> + ret = i915_kick_out_vgacon(dev_priv);
> + if (ret) {
> + DRM_ERROR("failed to remove conflicting VGA console\n");
> + goto out_gtt;
> + }
> +
> i915_kick_out_firmware_fb(dev_priv);
> + }
>
> pci_set_master(dev->pdev);
>
> diff --git a/drivers/video/console/dummycon.c b/drivers/video/console/dummycon.c
> index b63860f7beab..40bec8d64b0a 100644
> --- a/drivers/video/console/dummycon.c
> +++ b/drivers/video/console/dummycon.c
> @@ -77,3 +77,4 @@ const struct consw dummy_con = {
> .con_set_palette = DUMMY,
> .con_scrolldelta = DUMMY,
> };
> +EXPORT_SYMBOL_GPL(dummy_con);
> diff --git a/drivers/video/console/vgacon.c b/drivers/video/console/vgacon.c
> index 9d8feac67637..84acd6223dc5 100644
> --- a/drivers/video/console/vgacon.c
> +++ b/drivers/video/console/vgacon.c
> @@ -1440,5 +1440,6 @@ const struct consw vga_con = {
> .con_build_attr = vgacon_build_attr,
> .con_invert_region = vgacon_invert_region,
> };
> +EXPORT_SYMBOL(vga_con);
>
> MODULE_LICENSE("GPL");
> --
> 1.8.1.4
>

2014-06-06 07:48:08

by Daniel Vetter

[permalink] [raw]
Subject: Re: [PATCH 5/5] drm/i915: Kick out vga console

On Fri, Jun 06, 2014 at 09:28:03AM +0200, David Herrmann wrote:
> Hi
>
> On Thu, Jun 5, 2014 at 4:58 PM, Daniel Vetter <[email protected]> wrote:
> > Touching the VGA resources on an IVB EFI machine causes hard hangs when
> > we then kick out the efifb. Ouch.
> >
> > Apparently this also prevents unclaimed register errors on hsw and
> > hard machine hangs on my i855gm when trying to unbind fbcon.
> >
> > Also, we want this to make I915_FBDEV=n safe.
> >
> > v2: Rebase and pimp commit message.
> >
> > v3: We also need to unregister the vga console, otherwise the unbind
> > of the fb console before module unload might resurrect it again.
> >
> > v4: Ignore errors when the vga console is already unregistered - this
> > can happen when e.g. reloading i915.ko.
> >
> > Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=67813
> > Cc: David Herrmann <[email protected]>
> > Cc: Jean-Christophe Plagniol-Villard <[email protected]>
> > Cc: Tomi Valkeinen <[email protected]>
> > Cc: [email protected]
> > Cc: Jani Nikula <[email protected]>
> > Signed-off-by: Chris Wilson <[email protected]> (v1)
> > Signed-off-by: Daniel Vetter <[email protected]>
> > ---
> > drivers/gpu/drm/i915/i915_dma.c | 43 +++++++++++++++++++++++++++++++++++++++-
> > drivers/video/console/dummycon.c | 1 +
> > drivers/video/console/vgacon.c | 1 +
> > 3 files changed, 44 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
> > index 27fe65ac5940..bcb66ddd649e 100644
> > --- a/drivers/gpu/drm/i915/i915_dma.c
> > +++ b/drivers/gpu/drm/i915/i915_dma.c
> > @@ -36,6 +36,8 @@
> > #include "i915_drv.h"
> > #include "i915_trace.h"
> > #include <linux/pci.h>
> > +#include <linux/console.h>
> > +#include <linux/vt.h>
> > #include <linux/vgaarb.h>
> > #include <linux/acpi.h>
> > #include <linux/pnp.h>
> > @@ -1449,6 +1451,38 @@ static void i915_kick_out_firmware_fb(struct drm_i915_private *dev_priv)
> > }
> > #endif
> >
> > +#if !defined(CONFIG_VGA_CONSOLE)
> > +static int i915_kick_out_vgacon(struct drm_i915_private *dev_priv)
> > +{
> > + return 0;
> > +}
> > +#elif !defined(CONFIG_DUMMY_CONSOLE)
>
> Why not "select DUMMY_CONSOLE if VT"? It's really stupid to disable
> DUMMY_CONSOLE.. Furthermore, we already rely on HW_CONSOLE_BINDING so
> this should be safe.

Iirc this lead kconfig to complain about dep loops ... And I've tried to
figure it out, but I think it's actually impossible. So I let it be with
the -ENODEV to make sure if it's not impossible any more we'll catch it.
-Daniel

>
> Patch looks good to me:
>
> Reviewed-by: David Herrmann <[email protected]>
>
> Thanks
> David
>
> > +static int i915_kick_out_vgacon(struct drm_i915_private *dev_priv)
> > +{
> > + return -ENODEV;
> > +}
> > +#else
> > +static int i915_kick_out_vgacon(struct drm_i915_private *dev_priv)
> > +{
> > + int ret;
> > +
> > + DRM_INFO("Replacing VGA console driver\n");
> > +
> > + console_lock();
> > + ret = do_take_over_console(&dummy_con, 0, MAX_NR_CONSOLES - 1, 1);
> > + if (ret == 0) {
> > + ret = do_unregister_con_driver(&vga_con);
> > +
> > + /* Ignore "already unregistered". */
> > + if (ret == -ENODEV)
> > + ret = 0;
> > + }
> > + console_unlock();
> > +
> > + return ret;
> > +}
> > +#endif
> > +
> > static void i915_dump_device_info(struct drm_i915_private *dev_priv)
> > {
> > const struct intel_device_info *info = &dev_priv->info;
> > @@ -1622,8 +1656,15 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags)
> > if (ret)
> > goto out_regs;
> >
> > - if (drm_core_check_feature(dev, DRIVER_MODESET))
> > + if (drm_core_check_feature(dev, DRIVER_MODESET)) {
> > + ret = i915_kick_out_vgacon(dev_priv);
> > + if (ret) {
> > + DRM_ERROR("failed to remove conflicting VGA console\n");
> > + goto out_gtt;
> > + }
> > +
> > i915_kick_out_firmware_fb(dev_priv);
> > + }
> >
> > pci_set_master(dev->pdev);
> >
> > diff --git a/drivers/video/console/dummycon.c b/drivers/video/console/dummycon.c
> > index b63860f7beab..40bec8d64b0a 100644
> > --- a/drivers/video/console/dummycon.c
> > +++ b/drivers/video/console/dummycon.c
> > @@ -77,3 +77,4 @@ const struct consw dummy_con = {
> > .con_set_palette = DUMMY,
> > .con_scrolldelta = DUMMY,
> > };
> > +EXPORT_SYMBOL_GPL(dummy_con);
> > diff --git a/drivers/video/console/vgacon.c b/drivers/video/console/vgacon.c
> > index 9d8feac67637..84acd6223dc5 100644
> > --- a/drivers/video/console/vgacon.c
> > +++ b/drivers/video/console/vgacon.c
> > @@ -1440,5 +1440,6 @@ const struct consw vga_con = {
> > .con_build_attr = vgacon_build_attr,
> > .con_invert_region = vgacon_invert_region,
> > };
> > +EXPORT_SYMBOL(vga_con);
> >
> > MODULE_LICENSE("GPL");
> > --
> > 1.8.1.4
> >

--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch

2014-06-06 07:49:59

by Daniel Vetter

[permalink] [raw]
Subject: Re: [PATCH 1/5] vt: Fix replacement console check when unbinding

On Fri, Jun 06, 2014 at 09:16:13AM +0200, David Herrmann wrote:
> Hi
>
> On Thu, Jun 5, 2014 at 4:58 PM, Daniel Vetter <[email protected]> wrote:
> > I don't fully understand the magic of the vt register/unregister
> > logic, but apparently everything but the inital console (as set
> > in the conswitchp pointer) is marked with FLAG_MODULE. Which means
> > if something unregistered the boot vt driver (e.g. i915.ko kicking
> > out vga_con) there's nothing left when trying to unbind e.g. fbcon
> > through sysfs.
> >
> > But we always have the dummy console hanging around, so this test
> > is fairly dubious. What we actually want is simply a different console
> > than the one we want to unbind.
>
> For unknown reasons, you can disable the dummy console via Kconfig, so
> it's not guaranteed to be around. But your comment is still valid.

Right, I'll reword this a bit to clarify.
>
> >
> > Cc: Greg Kroah-Hartman <[email protected]>
> > Cc: Jiri Slaby <[email protected]>
> > Signed-off-by: Daniel Vetter <[email protected]>
> > ---
> > drivers/tty/vt/vt.c | 3 +--
> > 1 file changed, 1 insertion(+), 2 deletions(-)
> >
> > diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c
> > index 3ad0b61e35b4..ea600f482eeb 100644
> > --- a/drivers/tty/vt/vt.c
> > +++ b/drivers/tty/vt/vt.c
> > @@ -3155,8 +3155,7 @@ int do_unbind_con_driver(const struct consw *csw, int first, int last, int deflt
> > for (i = 0; i < MAX_NR_CON_DRIVER; i++) {
> > con_back = &registered_con_driver[i];
> >
> > - if (con_back->con &&
> > - !(con_back->flag & CON_DRIVER_FLAG_MODULE)) {
> > + if (con_back->con && con_back->con != csw) {
>
> Funny thing is, if you run do_bind_con_driver() on the range first,
> you kick out the existing driver and can then unload it regardless
> whether the fallback was FLAG_MODULE or not. Therefore, I think that
> change is safe. This is:
>
> Reviewed-by: David Herrmann <[email protected]>
>
> Thanks
> David
>
> > defcsw = con_back->con;
> > retval = 0;
> > break;
> > --
> > 1.8.1.4
> >
> > _______________________________________________
> > dri-devel mailing list
> > [email protected]
> > http://lists.freedesktop.org/mailman/listinfo/dri-devel

--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch

2014-06-06 07:57:03

by Daniel Vetter

[permalink] [raw]
Subject: Re: [PATCH 2/5] vt: Fix up unregistration of vt drivers

On Fri, Jun 06, 2014 at 09:24:35AM +0200, David Herrmann wrote:
> Hi
>
> On Thu, Jun 5, 2014 at 4:58 PM, Daniel Vetter <[email protected]> wrote:
> > A bunch of issues:
> > - We should not kick out the default console (which is tracked in
> > conswitchp), so check for that.
> > - Add better error codes so callers can differentiate between "something
> > went wrong" and "your driver isn't registered already". i915 needs
> > that so it doesn't fall over when reloading the driver and hence
> > vga_con is already unregistered.
> > - There's a mess with the driver flags: What we need to check for is
> > that the driver isn't used any more, i.e. unbound completely (FLAG_INIT).
> > And not whether it's the boot console or not (which is the only one
> > which doesn't have FLAG_MODULE). Otherwise there's no way to kick
> > out the boot console, which i915 wants to do to prevent havoc with
> > vga_con interferring (which tends to hang machines).
> >
> > Cc: Greg Kroah-Hartman <[email protected]>
> > Cc: Jiri Slaby <[email protected]>
> > Signed-off-by: Daniel Vetter <[email protected]>
> > ---
> > drivers/tty/vt/vt.c | 16 +++++++++-------
> > 1 file changed, 9 insertions(+), 7 deletions(-)
> >
> > diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c
> > index ea600f482eeb..5077fe87324d 100644
> > --- a/drivers/tty/vt/vt.c
> > +++ b/drivers/tty/vt/vt.c
> > @@ -3573,17 +3573,20 @@ err:
> > */
> > int do_unregister_con_driver(const struct consw *csw)
> > {
> > - int i, retval = -ENODEV;
> > + int i;
> >
> > /* cannot unregister a bound driver */
> > if (con_is_bound(csw))
> > - goto err;
> > + return -EBUSY;
> > +
> > + if (csw == conswitchp)
> > + return -EINVAL;
>
> Ugh, that fix is correct, but I'd rather like to see
> do_unbind_con_driver() do the right thing. It currently resets
> conswitchp _only_ if the new fallback is unbound. Why not _always_ set
> conswitchp to defcsw _iff_ conswitchp == csw there?

Ha, that's what I've thought, too. But do_unbind doesn't actually change
conswitchp, it only restores it because apparently the
vga_con->con_startup function is a real con and changes it behind
everyones back for no good reason. Or at least that's what the comment
claims. Note how defconsw != defcsw ...

I've tried to follow around how conswitchp is actually used, but besides
that it's used to select the boot console I'm not sure at all what's going
hence.

> This way, you _know_ here that if !con_is_bound(csw), then csw != conswitchp.

Hence why I dropped this approach again (I've done it originally) and
opted for the straightforward but albeit crude direct check.

> >
> > for (i = 0; i < MAX_NR_CON_DRIVER; i++) {
> > struct con_driver *con_driver = &registered_con_driver[i];
> >
> > if (con_driver->con == csw &&
> > - con_driver->flag & CON_DRIVER_FLAG_MODULE) {
> > + con_driver->flag & CON_DRIVER_FLAG_INIT) {
>
> That makes FLAG_MODULE almost a no-op except for ->unbind(). I wonder
> why FLAG_MODULE exists, anyway.

I've dug around in git history and it's less than useful. It was renamed
from FLAG_BIND (which makes somewhat sense, since it roughly tracks
whether a console is bound). But there's never been a justification for
it, neither in the original patch nor in the one that renamed it.

So I decided to not tempt fate and went with the small change here that
I've understood somewhat (I've tried other, more invasive changes and
failed).

> Otherwise looks good.

I'm really reluctant to do the right thing here since the code overall has
very unclear semantics with conswitchp and FLAG_MODULE. Can I convince
yout that the more direct approach here is the right one?

Thanks, Daniel
--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch

2014-06-06 08:47:29

by David Herrmann

[permalink] [raw]
Subject: Re: [PATCH 2/5] vt: Fix up unregistration of vt drivers

Hi

On Fri, Jun 6, 2014 at 9:56 AM, Daniel Vetter <[email protected]> wrote:
> On Fri, Jun 06, 2014 at 09:24:35AM +0200, David Herrmann wrote:
>> Hi
>>
>> On Thu, Jun 5, 2014 at 4:58 PM, Daniel Vetter <[email protected]> wrote:
>> > A bunch of issues:
>> > - We should not kick out the default console (which is tracked in
>> > conswitchp), so check for that.
>> > - Add better error codes so callers can differentiate between "something
>> > went wrong" and "your driver isn't registered already". i915 needs
>> > that so it doesn't fall over when reloading the driver and hence
>> > vga_con is already unregistered.
>> > - There's a mess with the driver flags: What we need to check for is
>> > that the driver isn't used any more, i.e. unbound completely (FLAG_INIT).
>> > And not whether it's the boot console or not (which is the only one
>> > which doesn't have FLAG_MODULE). Otherwise there's no way to kick
>> > out the boot console, which i915 wants to do to prevent havoc with
>> > vga_con interferring (which tends to hang machines).
>> >
>> > Cc: Greg Kroah-Hartman <[email protected]>
>> > Cc: Jiri Slaby <[email protected]>
>> > Signed-off-by: Daniel Vetter <[email protected]>
>> > ---
>> > drivers/tty/vt/vt.c | 16 +++++++++-------
>> > 1 file changed, 9 insertions(+), 7 deletions(-)
>> >
>> > diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c
>> > index ea600f482eeb..5077fe87324d 100644
>> > --- a/drivers/tty/vt/vt.c
>> > +++ b/drivers/tty/vt/vt.c
>> > @@ -3573,17 +3573,20 @@ err:
>> > */
>> > int do_unregister_con_driver(const struct consw *csw)
>> > {
>> > - int i, retval = -ENODEV;
>> > + int i;
>> >
>> > /* cannot unregister a bound driver */
>> > if (con_is_bound(csw))
>> > - goto err;
>> > + return -EBUSY;
>> > +
>> > + if (csw == conswitchp)
>> > + return -EINVAL;
>>
>> Ugh, that fix is correct, but I'd rather like to see
>> do_unbind_con_driver() do the right thing. It currently resets
>> conswitchp _only_ if the new fallback is unbound. Why not _always_ set
>> conswitchp to defcsw _iff_ conswitchp == csw there?
>
> Ha, that's what I've thought, too. But do_unbind doesn't actually change
> conswitchp, it only restores it because apparently the
> vga_con->con_startup function is a real con and changes it behind
> everyones back for no good reason. Or at least that's what the comment
> claims. Note how defconsw != defcsw ...
>
> I've tried to follow around how conswitchp is actually used, but besides
> that it's used to select the boot console I'm not sure at all what's going
> hence.

I missed that line:
const struct consw *defconsw = conswitchp;

Now that I looked at it again, this looks _really_ wrong. If
conswitchp is vgacon and startup fails, we keep it set to vgacon..
ugh, weird. But ok, that's up to the people who wrote that.

Btw., conswitchp is used for visual_init(), that is, every new VT
allocation gets assigned to conswitchp. Therefore, it must be a valid
driver. (VTs are allocated and deallocated by agetty/systemd after a
session is started/ended).

>> This way, you _know_ here that if !con_is_bound(csw), then csw != conswitchp.
>
> Hence why I dropped this approach again (I've done it originally) and
> opted for the straightforward but albeit crude direct check.
>
>> >
>> > for (i = 0; i < MAX_NR_CON_DRIVER; i++) {
>> > struct con_driver *con_driver = &registered_con_driver[i];
>> >
>> > if (con_driver->con == csw &&
>> > - con_driver->flag & CON_DRIVER_FLAG_MODULE) {
>> > + con_driver->flag & CON_DRIVER_FLAG_INIT) {
>>
>> That makes FLAG_MODULE almost a no-op except for ->unbind(). I wonder
>> why FLAG_MODULE exists, anyway.
>
> I've dug around in git history and it's less than useful. It was renamed
> from FLAG_BIND (which makes somewhat sense, since it roughly tracks
> whether a console is bound). But there's never been a justification for
> it, neither in the original patch nor in the one that renamed it.
>
> So I decided to not tempt fate and went with the small change here that
> I've understood somewhat (I've tried other, more invasive changes and
> failed).
>
>> Otherwise looks good.
>
> I'm really reluctant to do the right thing here since the code overall has
> very unclear semantics with conswitchp and FLAG_MODULE. Can I convince
> yout that the more direct approach here is the right one?

Yeah, patch looks good.

Reviewed-by: David Herrmann <[email protected]>

Thanks
David

2014-06-06 09:40:59

by Daniel Vetter

[permalink] [raw]
Subject: Re: [PATCH 2/5] vt: Fix up unregistration of vt drivers

On Fri, Jun 06, 2014 at 10:47:25AM +0200, David Herrmann wrote:
> Hi
>
> On Fri, Jun 6, 2014 at 9:56 AM, Daniel Vetter <[email protected]> wrote:
> > On Fri, Jun 06, 2014 at 09:24:35AM +0200, David Herrmann wrote:
> >> Hi
> >>
> >> On Thu, Jun 5, 2014 at 4:58 PM, Daniel Vetter <[email protected]> wrote:
> >> > A bunch of issues:
> >> > - We should not kick out the default console (which is tracked in
> >> > conswitchp), so check for that.
> >> > - Add better error codes so callers can differentiate between "something
> >> > went wrong" and "your driver isn't registered already". i915 needs
> >> > that so it doesn't fall over when reloading the driver and hence
> >> > vga_con is already unregistered.
> >> > - There's a mess with the driver flags: What we need to check for is
> >> > that the driver isn't used any more, i.e. unbound completely (FLAG_INIT).
> >> > And not whether it's the boot console or not (which is the only one
> >> > which doesn't have FLAG_MODULE). Otherwise there's no way to kick
> >> > out the boot console, which i915 wants to do to prevent havoc with
> >> > vga_con interferring (which tends to hang machines).
> >> >
> >> > Cc: Greg Kroah-Hartman <[email protected]>
> >> > Cc: Jiri Slaby <[email protected]>
> >> > Signed-off-by: Daniel Vetter <[email protected]>
> >> > ---
> >> > drivers/tty/vt/vt.c | 16 +++++++++-------
> >> > 1 file changed, 9 insertions(+), 7 deletions(-)
> >> >
> >> > diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c
> >> > index ea600f482eeb..5077fe87324d 100644
> >> > --- a/drivers/tty/vt/vt.c
> >> > +++ b/drivers/tty/vt/vt.c
> >> > @@ -3573,17 +3573,20 @@ err:
> >> > */
> >> > int do_unregister_con_driver(const struct consw *csw)
> >> > {
> >> > - int i, retval = -ENODEV;
> >> > + int i;
> >> >
> >> > /* cannot unregister a bound driver */
> >> > if (con_is_bound(csw))
> >> > - goto err;
> >> > + return -EBUSY;
> >> > +
> >> > + if (csw == conswitchp)
> >> > + return -EINVAL;
> >>
> >> Ugh, that fix is correct, but I'd rather like to see
> >> do_unbind_con_driver() do the right thing. It currently resets
> >> conswitchp _only_ if the new fallback is unbound. Why not _always_ set
> >> conswitchp to defcsw _iff_ conswitchp == csw there?
> >
> > Ha, that's what I've thought, too. But do_unbind doesn't actually change
> > conswitchp, it only restores it because apparently the
> > vga_con->con_startup function is a real con and changes it behind
> > everyones back for no good reason. Or at least that's what the comment
> > claims. Note how defconsw != defcsw ...
> >
> > I've tried to follow around how conswitchp is actually used, but besides
> > that it's used to select the boot console I'm not sure at all what's going
> > hence.
>
> I missed that line:
> const struct consw *defconsw = conswitchp;
>
> Now that I looked at it again, this looks _really_ wrong. If
> conswitchp is vgacon and startup fails, we keep it set to vgacon..
> ugh, weird. But ok, that's up to the people who wrote that.
>
> Btw., conswitchp is used for visual_init(), that is, every new VT
> allocation gets assigned to conswitchp. Therefore, it must be a valid
> driver. (VTs are allocated and deallocated by agetty/systemd after a
> session is started/ended).

Ah, I missed where conswitchp was used in the maze, was getting a bit hazy
;-)

Rules for changing/updateing conswitchp are indeed a bit strange, which is
why I really don't want to touch this too much.

> >> This way, you _know_ here that if !con_is_bound(csw), then csw != conswitchp.
> >
> > Hence why I dropped this approach again (I've done it originally) and
> > opted for the straightforward but albeit crude direct check.
> >
> >> >
> >> > for (i = 0; i < MAX_NR_CON_DRIVER; i++) {
> >> > struct con_driver *con_driver = &registered_con_driver[i];
> >> >
> >> > if (con_driver->con == csw &&
> >> > - con_driver->flag & CON_DRIVER_FLAG_MODULE) {
> >> > + con_driver->flag & CON_DRIVER_FLAG_INIT) {
> >>
> >> That makes FLAG_MODULE almost a no-op except for ->unbind(). I wonder
> >> why FLAG_MODULE exists, anyway.
> >
> > I've dug around in git history and it's less than useful. It was renamed
> > from FLAG_BIND (which makes somewhat sense, since it roughly tracks
> > whether a console is bound). But there's never been a justification for
> > it, neither in the original patch nor in the one that renamed it.
> >
> > So I decided to not tempt fate and went with the small change here that
> > I've understood somewhat (I've tried other, more invasive changes and
> > failed).
> >
> >> Otherwise looks good.
> >
> > I'm really reluctant to do the right thing here since the code overall has
> > very unclear semantics with conswitchp and FLAG_MODULE. Can I convince
> > yout that the more direct approach here is the right one?
>
> Yeah, patch looks good.
>
> Reviewed-by: David Herrmann <[email protected]>

Thanks for the review.

Greg, are you ok with these 3 vt patches and with me merging them through
drm-intel trees? We need them to properly kick out vgacon, which tends to
result in machine hangs (mostly across module reload, but also on driver
load on really unlucky systems) and other havoc.

Cheers, Daniel
--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch

2014-06-06 09:43:12

by Daniel Vetter

[permalink] [raw]
Subject: [PATCH] vt: Fix replacement console check when unbinding

I don't fully understand the magic of the vt register/unregister
logic, but apparently everything but the inital console (as set
in the conswitchp pointer) is marked with FLAG_MODULE. Which means
if something unregistered the boot vt driver (e.g. i915.ko kicking
out vga_con) there's nothing left when trying to unbind e.g. fbcon
through sysfs.

But in most cases have the dummy console hanging around besides the
boot console, so this test is fairly dubious. What we actually want is
simply a different console than the one we want to unbind.

v2: Correct the commit message to clarify that the dummy console isn't
always around, but only in most cases (David).

Cc: Greg Kroah-Hartman <[email protected]>
Cc: Jiri Slaby <[email protected]>
Cc: David Herrmann <[email protected]>
Reviewed-by: David Herrmann <[email protected]>
Signed-off-by: Daniel Vetter <[email protected]>
---
drivers/tty/vt/vt.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c
index 3ad0b61e35b4..ea600f482eeb 100644
--- a/drivers/tty/vt/vt.c
+++ b/drivers/tty/vt/vt.c
@@ -3155,8 +3155,7 @@ int do_unbind_con_driver(const struct consw *csw, int first, int last, int deflt
for (i = 0; i < MAX_NR_CON_DRIVER; i++) {
con_back = &registered_con_driver[i];

- if (con_back->con &&
- !(con_back->flag & CON_DRIVER_FLAG_MODULE)) {
+ if (con_back->con && con_back->con != csw) {
defcsw = con_back->con;
retval = 0;
break;
--
1.8.1.4

2014-06-06 13:22:23

by Imre Deak

[permalink] [raw]
Subject: Re: [PATCH 4/5] drm/i915: Fixup global gtt cleanup

On Thu, 2014-06-05 at 16:58 +0200, Daniel Vetter wrote:
> The global gtt is setup up in 2 parts, so we need to be careful
> with the cleanup. For consistency shovel it all into the ->cleanup
> callback, like with ppgtt.
>
> Noticed because it blew up in the out_gtt: cleanup code while
> fiddling with the vgacon code.
>
> Signed-off-by: Daniel Vetter <[email protected]>

Reviewed-by: Imre Deak <[email protected]>

> ---
> drivers/gpu/drm/i915/i915_dma.c | 4 ----
> drivers/gpu/drm/i915/i915_gem_gtt.c | 9 ++++++++-
> 2 files changed, 8 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
> index b9159ade5e85..27fe65ac5940 100644
> --- a/drivers/gpu/drm/i915/i915_dma.c
> +++ b/drivers/gpu/drm/i915/i915_dma.c
> @@ -1386,7 +1386,6 @@ cleanup_gem:
> i915_gem_context_fini(dev);
> mutex_unlock(&dev->struct_mutex);
> WARN_ON(dev_priv->mm.aliasing_ppgtt);
> - drm_mm_takedown(&dev_priv->gtt.base.mm);
> cleanup_irq:
> drm_irq_uninstall(dev);
> cleanup_gem_stolen:
> @@ -1756,8 +1755,6 @@ out_mtrrfree:
> arch_phys_wc_del(dev_priv->gtt.mtrr);
> io_mapping_free(dev_priv->gtt.mappable);
> out_gtt:
> - list_del(&dev_priv->gtt.base.global_link);
> - drm_mm_takedown(&dev_priv->gtt.base.mm);
> dev_priv->gtt.base.cleanup(&dev_priv->gtt.base);
> out_regs:
> intel_uncore_fini(dev);
> @@ -1846,7 +1843,6 @@ int i915_driver_unload(struct drm_device *dev)
> i915_free_hws(dev);
> }
>
> - list_del(&dev_priv->gtt.base.global_link);
> WARN_ON(!list_empty(&dev_priv->vm_list));
>
> drm_vblank_cleanup(dev);
> diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c
> index 931b906f292a..41e864ec5632 100644
> --- a/drivers/gpu/drm/i915/i915_gem_gtt.c
> +++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
> @@ -1985,7 +1985,10 @@ static void gen6_gmch_remove(struct i915_address_space *vm)
>
> struct i915_gtt *gtt = container_of(vm, struct i915_gtt, base);
>
> - drm_mm_takedown(&vm->mm);
> + if (drm_mm_initialized(&vm->mm)) {
> + drm_mm_takedown(&vm->mm);
> + list_del(&vm->global_link);
> + }
> iounmap(gtt->gsm);
> teardown_scratch_page(vm->dev);
> }
> @@ -2018,6 +2021,10 @@ static int i915_gmch_probe(struct drm_device *dev,
>
> static void i915_gmch_remove(struct i915_address_space *vm)
> {
> + if (drm_mm_initialized(&vm->mm)) {
> + drm_mm_takedown(&vm->mm);
> + list_del(&vm->global_link);
> + }
> intel_gmch_remove();
> }
>


Attachments:
signature.asc (490.00 B)
This is a digitally signed message part

2014-06-06 15:20:34

by Daniel Vetter

[permalink] [raw]
Subject: Re: [PATCH 5/5] drm/i915: Kick out vga console

Tomi/Jean can you please ack merging this through drm-intel trees? It
just exports the vga and dummy consoles so that i915 can do what it
needs to do.

Thanks, Daniel

On Thu, Jun 5, 2014 at 4:58 PM, Daniel Vetter <[email protected]> wrote:
> Touching the VGA resources on an IVB EFI machine causes hard hangs when
> we then kick out the efifb. Ouch.
>
> Apparently this also prevents unclaimed register errors on hsw and
> hard machine hangs on my i855gm when trying to unbind fbcon.
>
> Also, we want this to make I915_FBDEV=n safe.
>
> v2: Rebase and pimp commit message.
>
> v3: We also need to unregister the vga console, otherwise the unbind
> of the fb console before module unload might resurrect it again.
>
> v4: Ignore errors when the vga console is already unregistered - this
> can happen when e.g. reloading i915.ko.
>
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=67813
> Cc: David Herrmann <[email protected]>
> Cc: Jean-Christophe Plagniol-Villard <[email protected]>
> Cc: Tomi Valkeinen <[email protected]>
> Cc: [email protected]
> Cc: Jani Nikula <[email protected]>
> Signed-off-by: Chris Wilson <[email protected]> (v1)
> Signed-off-by: Daniel Vetter <[email protected]>
> ---
> drivers/gpu/drm/i915/i915_dma.c | 43 +++++++++++++++++++++++++++++++++++++++-
> drivers/video/console/dummycon.c | 1 +
> drivers/video/console/vgacon.c | 1 +
> 3 files changed, 44 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
> index 27fe65ac5940..bcb66ddd649e 100644
> --- a/drivers/gpu/drm/i915/i915_dma.c
> +++ b/drivers/gpu/drm/i915/i915_dma.c
> @@ -36,6 +36,8 @@
> #include "i915_drv.h"
> #include "i915_trace.h"
> #include <linux/pci.h>
> +#include <linux/console.h>
> +#include <linux/vt.h>
> #include <linux/vgaarb.h>
> #include <linux/acpi.h>
> #include <linux/pnp.h>
> @@ -1449,6 +1451,38 @@ static void i915_kick_out_firmware_fb(struct drm_i915_private *dev_priv)
> }
> #endif
>
> +#if !defined(CONFIG_VGA_CONSOLE)
> +static int i915_kick_out_vgacon(struct drm_i915_private *dev_priv)
> +{
> + return 0;
> +}
> +#elif !defined(CONFIG_DUMMY_CONSOLE)
> +static int i915_kick_out_vgacon(struct drm_i915_private *dev_priv)
> +{
> + return -ENODEV;
> +}
> +#else
> +static int i915_kick_out_vgacon(struct drm_i915_private *dev_priv)
> +{
> + int ret;
> +
> + DRM_INFO("Replacing VGA console driver\n");
> +
> + console_lock();
> + ret = do_take_over_console(&dummy_con, 0, MAX_NR_CONSOLES - 1, 1);
> + if (ret == 0) {
> + ret = do_unregister_con_driver(&vga_con);
> +
> + /* Ignore "already unregistered". */
> + if (ret == -ENODEV)
> + ret = 0;
> + }
> + console_unlock();
> +
> + return ret;
> +}
> +#endif
> +
> static void i915_dump_device_info(struct drm_i915_private *dev_priv)
> {
> const struct intel_device_info *info = &dev_priv->info;
> @@ -1622,8 +1656,15 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags)
> if (ret)
> goto out_regs;
>
> - if (drm_core_check_feature(dev, DRIVER_MODESET))
> + if (drm_core_check_feature(dev, DRIVER_MODESET)) {
> + ret = i915_kick_out_vgacon(dev_priv);
> + if (ret) {
> + DRM_ERROR("failed to remove conflicting VGA console\n");
> + goto out_gtt;
> + }
> +
> i915_kick_out_firmware_fb(dev_priv);
> + }
>
> pci_set_master(dev->pdev);
>
> diff --git a/drivers/video/console/dummycon.c b/drivers/video/console/dummycon.c
> index b63860f7beab..40bec8d64b0a 100644
> --- a/drivers/video/console/dummycon.c
> +++ b/drivers/video/console/dummycon.c
> @@ -77,3 +77,4 @@ const struct consw dummy_con = {
> .con_set_palette = DUMMY,
> .con_scrolldelta = DUMMY,
> };
> +EXPORT_SYMBOL_GPL(dummy_con);
> diff --git a/drivers/video/console/vgacon.c b/drivers/video/console/vgacon.c
> index 9d8feac67637..84acd6223dc5 100644
> --- a/drivers/video/console/vgacon.c
> +++ b/drivers/video/console/vgacon.c
> @@ -1440,5 +1440,6 @@ const struct consw vga_con = {
> .con_build_attr = vgacon_build_attr,
> .con_invert_region = vgacon_invert_region,
> };
> +EXPORT_SYMBOL(vga_con);
>
> MODULE_LICENSE("GPL");
> --
> 1.8.1.4
>



--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch

2014-06-06 15:51:42

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH 2/5] vt: Fix up unregistration of vt drivers

On Fri, Jun 06, 2014 at 11:40:50AM +0200, Daniel Vetter wrote:
> On Fri, Jun 06, 2014 at 10:47:25AM +0200, David Herrmann wrote:
> > Hi
> >
> > On Fri, Jun 6, 2014 at 9:56 AM, Daniel Vetter <[email protected]> wrote:
> > > On Fri, Jun 06, 2014 at 09:24:35AM +0200, David Herrmann wrote:
> > >> Hi
> > >>
> > >> On Thu, Jun 5, 2014 at 4:58 PM, Daniel Vetter <[email protected]> wrote:
> > >> > A bunch of issues:
> > >> > - We should not kick out the default console (which is tracked in
> > >> > conswitchp), so check for that.
> > >> > - Add better error codes so callers can differentiate between "something
> > >> > went wrong" and "your driver isn't registered already". i915 needs
> > >> > that so it doesn't fall over when reloading the driver and hence
> > >> > vga_con is already unregistered.
> > >> > - There's a mess with the driver flags: What we need to check for is
> > >> > that the driver isn't used any more, i.e. unbound completely (FLAG_INIT).
> > >> > And not whether it's the boot console or not (which is the only one
> > >> > which doesn't have FLAG_MODULE). Otherwise there's no way to kick
> > >> > out the boot console, which i915 wants to do to prevent havoc with
> > >> > vga_con interferring (which tends to hang machines).
> > >> >
> > >> > Cc: Greg Kroah-Hartman <[email protected]>
> > >> > Cc: Jiri Slaby <[email protected]>
> > >> > Signed-off-by: Daniel Vetter <[email protected]>
> > >> > ---
> > >> > drivers/tty/vt/vt.c | 16 +++++++++-------
> > >> > 1 file changed, 9 insertions(+), 7 deletions(-)
> > >> >
> > >> > diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c
> > >> > index ea600f482eeb..5077fe87324d 100644
> > >> > --- a/drivers/tty/vt/vt.c
> > >> > +++ b/drivers/tty/vt/vt.c
> > >> > @@ -3573,17 +3573,20 @@ err:
> > >> > */
> > >> > int do_unregister_con_driver(const struct consw *csw)
> > >> > {
> > >> > - int i, retval = -ENODEV;
> > >> > + int i;
> > >> >
> > >> > /* cannot unregister a bound driver */
> > >> > if (con_is_bound(csw))
> > >> > - goto err;
> > >> > + return -EBUSY;
> > >> > +
> > >> > + if (csw == conswitchp)
> > >> > + return -EINVAL;
> > >>
> > >> Ugh, that fix is correct, but I'd rather like to see
> > >> do_unbind_con_driver() do the right thing. It currently resets
> > >> conswitchp _only_ if the new fallback is unbound. Why not _always_ set
> > >> conswitchp to defcsw _iff_ conswitchp == csw there?
> > >
> > > Ha, that's what I've thought, too. But do_unbind doesn't actually change
> > > conswitchp, it only restores it because apparently the
> > > vga_con->con_startup function is a real con and changes it behind
> > > everyones back for no good reason. Or at least that's what the comment
> > > claims. Note how defconsw != defcsw ...
> > >
> > > I've tried to follow around how conswitchp is actually used, but besides
> > > that it's used to select the boot console I'm not sure at all what's going
> > > hence.
> >
> > I missed that line:
> > const struct consw *defconsw = conswitchp;
> >
> > Now that I looked at it again, this looks _really_ wrong. If
> > conswitchp is vgacon and startup fails, we keep it set to vgacon..
> > ugh, weird. But ok, that's up to the people who wrote that.
> >
> > Btw., conswitchp is used for visual_init(), that is, every new VT
> > allocation gets assigned to conswitchp. Therefore, it must be a valid
> > driver. (VTs are allocated and deallocated by agetty/systemd after a
> > session is started/ended).
>
> Ah, I missed where conswitchp was used in the maze, was getting a bit hazy
> ;-)
>
> Rules for changing/updateing conswitchp are indeed a bit strange, which is
> why I really don't want to touch this too much.
>
> > >> This way, you _know_ here that if !con_is_bound(csw), then csw != conswitchp.
> > >
> > > Hence why I dropped this approach again (I've done it originally) and
> > > opted for the straightforward but albeit crude direct check.
> > >
> > >> >
> > >> > for (i = 0; i < MAX_NR_CON_DRIVER; i++) {
> > >> > struct con_driver *con_driver = &registered_con_driver[i];
> > >> >
> > >> > if (con_driver->con == csw &&
> > >> > - con_driver->flag & CON_DRIVER_FLAG_MODULE) {
> > >> > + con_driver->flag & CON_DRIVER_FLAG_INIT) {
> > >>
> > >> That makes FLAG_MODULE almost a no-op except for ->unbind(). I wonder
> > >> why FLAG_MODULE exists, anyway.
> > >
> > > I've dug around in git history and it's less than useful. It was renamed
> > > from FLAG_BIND (which makes somewhat sense, since it roughly tracks
> > > whether a console is bound). But there's never been a justification for
> > > it, neither in the original patch nor in the one that renamed it.
> > >
> > > So I decided to not tempt fate and went with the small change here that
> > > I've understood somewhat (I've tried other, more invasive changes and
> > > failed).
> > >
> > >> Otherwise looks good.
> > >
> > > I'm really reluctant to do the right thing here since the code overall has
> > > very unclear semantics with conswitchp and FLAG_MODULE. Can I convince
> > > yout that the more direct approach here is the right one?
> >
> > Yeah, patch looks good.
> >
> > Reviewed-by: David Herrmann <[email protected]>
>
> Thanks for the review.
>
> Greg, are you ok with these 3 vt patches and with me merging them through
> drm-intel trees? We need them to properly kick out vgacon, which tends to
> result in machine hangs (mostly across module reload, but also on driver
> load on really unlucky systems) and other havoc.

Yes, no objection from me at all, please feel free to add:

Acked-by: Greg Kroah-Hartman <[email protected]>

to them.

greg k-h

2014-06-06 20:21:41

by Daniel Vetter

[permalink] [raw]
Subject: Re: [Intel-gfx] [PATCH 2/5] vt: Fix up unregistration of vt drivers

On Fri, Jun 06, 2014 at 08:51:31AM -0700, Greg Kroah-Hartman wrote:
> On Fri, Jun 06, 2014 at 11:40:50AM +0200, Daniel Vetter wrote:
> > On Fri, Jun 06, 2014 at 10:47:25AM +0200, David Herrmann wrote:
> > > Hi
> > >
> > > On Fri, Jun 6, 2014 at 9:56 AM, Daniel Vetter <[email protected]> wrote:
> > > > On Fri, Jun 06, 2014 at 09:24:35AM +0200, David Herrmann wrote:
> > > >> Hi
> > > >>
> > > >> On Thu, Jun 5, 2014 at 4:58 PM, Daniel Vetter <[email protected]> wrote:
> > > >> > A bunch of issues:
> > > >> > - We should not kick out the default console (which is tracked in
> > > >> > conswitchp), so check for that.
> > > >> > - Add better error codes so callers can differentiate between "something
> > > >> > went wrong" and "your driver isn't registered already". i915 needs
> > > >> > that so it doesn't fall over when reloading the driver and hence
> > > >> > vga_con is already unregistered.
> > > >> > - There's a mess with the driver flags: What we need to check for is
> > > >> > that the driver isn't used any more, i.e. unbound completely (FLAG_INIT).
> > > >> > And not whether it's the boot console or not (which is the only one
> > > >> > which doesn't have FLAG_MODULE). Otherwise there's no way to kick
> > > >> > out the boot console, which i915 wants to do to prevent havoc with
> > > >> > vga_con interferring (which tends to hang machines).
> > > >> >
> > > >> > Cc: Greg Kroah-Hartman <[email protected]>
> > > >> > Cc: Jiri Slaby <[email protected]>
> > > >> > Signed-off-by: Daniel Vetter <[email protected]>
> > > >> > ---
> > > >> > drivers/tty/vt/vt.c | 16 +++++++++-------
> > > >> > 1 file changed, 9 insertions(+), 7 deletions(-)
> > > >> >
> > > >> > diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c
> > > >> > index ea600f482eeb..5077fe87324d 100644
> > > >> > --- a/drivers/tty/vt/vt.c
> > > >> > +++ b/drivers/tty/vt/vt.c
> > > >> > @@ -3573,17 +3573,20 @@ err:
> > > >> > */
> > > >> > int do_unregister_con_driver(const struct consw *csw)
> > > >> > {
> > > >> > - int i, retval = -ENODEV;
> > > >> > + int i;
> > > >> >
> > > >> > /* cannot unregister a bound driver */
> > > >> > if (con_is_bound(csw))
> > > >> > - goto err;
> > > >> > + return -EBUSY;
> > > >> > +
> > > >> > + if (csw == conswitchp)
> > > >> > + return -EINVAL;
> > > >>
> > > >> Ugh, that fix is correct, but I'd rather like to see
> > > >> do_unbind_con_driver() do the right thing. It currently resets
> > > >> conswitchp _only_ if the new fallback is unbound. Why not _always_ set
> > > >> conswitchp to defcsw _iff_ conswitchp == csw there?
> > > >
> > > > Ha, that's what I've thought, too. But do_unbind doesn't actually change
> > > > conswitchp, it only restores it because apparently the
> > > > vga_con->con_startup function is a real con and changes it behind
> > > > everyones back for no good reason. Or at least that's what the comment
> > > > claims. Note how defconsw != defcsw ...
> > > >
> > > > I've tried to follow around how conswitchp is actually used, but besides
> > > > that it's used to select the boot console I'm not sure at all what's going
> > > > hence.
> > >
> > > I missed that line:
> > > const struct consw *defconsw = conswitchp;
> > >
> > > Now that I looked at it again, this looks _really_ wrong. If
> > > conswitchp is vgacon and startup fails, we keep it set to vgacon..
> > > ugh, weird. But ok, that's up to the people who wrote that.
> > >
> > > Btw., conswitchp is used for visual_init(), that is, every new VT
> > > allocation gets assigned to conswitchp. Therefore, it must be a valid
> > > driver. (VTs are allocated and deallocated by agetty/systemd after a
> > > session is started/ended).
> >
> > Ah, I missed where conswitchp was used in the maze, was getting a bit hazy
> > ;-)
> >
> > Rules for changing/updateing conswitchp are indeed a bit strange, which is
> > why I really don't want to touch this too much.
> >
> > > >> This way, you _know_ here that if !con_is_bound(csw), then csw != conswitchp.
> > > >
> > > > Hence why I dropped this approach again (I've done it originally) and
> > > > opted for the straightforward but albeit crude direct check.
> > > >
> > > >> >
> > > >> > for (i = 0; i < MAX_NR_CON_DRIVER; i++) {
> > > >> > struct con_driver *con_driver = &registered_con_driver[i];
> > > >> >
> > > >> > if (con_driver->con == csw &&
> > > >> > - con_driver->flag & CON_DRIVER_FLAG_MODULE) {
> > > >> > + con_driver->flag & CON_DRIVER_FLAG_INIT) {
> > > >>
> > > >> That makes FLAG_MODULE almost a no-op except for ->unbind(). I wonder
> > > >> why FLAG_MODULE exists, anyway.
> > > >
> > > > I've dug around in git history and it's less than useful. It was renamed
> > > > from FLAG_BIND (which makes somewhat sense, since it roughly tracks
> > > > whether a console is bound). But there's never been a justification for
> > > > it, neither in the original patch nor in the one that renamed it.
> > > >
> > > > So I decided to not tempt fate and went with the small change here that
> > > > I've understood somewhat (I've tried other, more invasive changes and
> > > > failed).
> > > >
> > > >> Otherwise looks good.
> > > >
> > > > I'm really reluctant to do the right thing here since the code overall has
> > > > very unclear semantics with conswitchp and FLAG_MODULE. Can I convince
> > > > yout that the more direct approach here is the right one?
> > >
> > > Yeah, patch looks good.
> > >
> > > Reviewed-by: David Herrmann <[email protected]>
> >
> > Thanks for the review.
> >
> > Greg, are you ok with these 3 vt patches and with me merging them through
> > drm-intel trees? We need them to properly kick out vgacon, which tends to
> > result in machine hangs (mostly across module reload, but also on driver
> > load on really unlucky systems) and other havoc.
>
> Yes, no objection from me at all, please feel free to add:
>
> Acked-by: Greg Kroah-Hartman <[email protected]>
>
> to them.

Thanks, I'll send the pull for these patches to Dave as soon as I have the
ack from video/console maintainers, too. So should land for -rc1/2 or so.
-Daniel
--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch

2014-06-09 13:23:05

by Tomi Valkeinen

[permalink] [raw]
Subject: Re: [PATCH 5/5] drm/i915: Kick out vga console

Hi,

On 06/06/14 18:20, Daniel Vetter wrote:
> Tomi/Jean can you please ack merging this through drm-intel trees? It
> just exports the vga and dummy consoles so that i915 can do what it
> needs to do.

Acked-by: Tomi Valkeinen <[email protected]>

Tomi



Attachments:
signature.asc (819.00 B)
OpenPGP digital signature

2014-06-29 03:55:26

by Ed Tomlinson

[permalink] [raw]
Subject: Re: [PATCH 5/5] drm/i915: Kick out vga console

On Saturday 28 June 2014 15:28:22 Ed Tomlinson wrote:

Resend without html krud which causes list to bounce the message.

> Hi
>
> This commit ( a4de05268e674e8ed31df6348269e22d6c6a1803 ) hangs my boot with 3.16-git. Reverting it lets the boot proceed.
>
> I have an i7 with a built-in i915 and an pcie r7 260x. The R7 is the primary console. The i915 is initialized
> but does not have a physical display attached.
>
> With the patch applied the boot stops at the messages:
>
> [drm] Memory usable by graphics device = 2048M
> [drm] Replacing VGA console driver
>
> and I need to interrupt or power off the box to get it back.
>
> (I did not notice messages about the R7 but they could have easily been missed - this box does not have a serial console)
>
> Without the patch I get:
>
> Jun 28 14:53:54 localhost kernel: [ 2.075351] e1000e: Intel(R) PRO/1000 Network Driver - 2.3.2-k
> Jun 28 14:53:54 localhost kernel: [ 2.075796] [drm] Initialized drm 1.1.0 20060810
> Jun 28 14:53:54 localhost kernel: [ 2.075958] microcode: CPU0 sig=0x306c3, pf=0x2, revision=0x17
> Jun 28 14:53:54 localhost kernel: [ 2.077289] microcode: CPU1 sig=0x306c3, pf=0x2, revision=0x17
> Jun 28 14:53:54 localhost kernel: [ 2.077299] microcode: CPU2 sig=0x306c3, pf=0x2, revision=0x17
> Jun 28 14:53:54 localhost kernel: [ 2.077307] microcode: CPU3 sig=0x306c3, pf=0x2, revision=0x17
> Jun 28 14:53:54 localhost kernel: [ 2.077315] microcode: CPU4 sig=0x306c3, pf=0x2, revision=0x17
> Jun 28 14:53:54 localhost kernel: [ 2.077325] microcode: CPU5 sig=0x306c3, pf=0x2, revision=0x17
> Jun 28 14:53:54 localhost kernel: [ 2.077335] microcode: CPU6 sig=0x306c3, pf=0x2, revision=0x17
> Jun 28 14:53:54 localhost kernel: [ 2.077342] microcode: CPU7 sig=0x306c3, pf=0x2, revision=0x17
> Jun 28 14:53:54 localhost kernel: [ 2.077378] microcode: Microcode Update Driver: v2.00 <[email protected]>, Peter Oruba
> Jun 28 14:53:54 localhost kernel: [ 2.079726] input: PC Speaker as /devices/platform/pcspkr/input/input4
> Jun 28 14:53:54 localhost kernel: [ 2.083930] e1000e: Copyright(c) 1999 - 2014 Intel Corporation.
> Jun 28 14:53:54 localhost kernel: [ 2.084787] ACPI Warning: SystemIO range 0x000000000000f040-0x000000000000f05f conflicts with OpRegion 0x000000000000f040-0x000000000000f04f (\_SB_.PCI0.SBUS.SMBI) (20140424/utaddress-258)
> Jun 28 14:53:54 localhost kernel: [ 2.084788] ACPI: If an ACPI driver is available for this device, you should use it instead of the native driver
> Jun 28 14:53:54 localhost kernel: [ 2.084894] e1000e 0000:00:19.0: Interrupt Throttling Rate (ints/sec) set to dynamic conservative mode
> Jun 28 14:53:54 localhost kernel: [ 2.084905] e1000e 0000:00:19.0: irq 44 for MSI/MSI-X
> Jun 28 14:53:54 localhost kernel: [ 2.096721] iTCO_vendor_support: vendor-support=0
> Jun 28 14:53:54 localhost kernel: [ 2.096780] AVX2 version of gcm_enc/dec engaged.
> Jun 28 14:53:54 localhost kernel: [ 2.098512] iTCO_wdt: Intel TCO WatchDog Timer Driver v1.11
> Jun 28 14:53:54 localhost kernel: [ 2.099042] iTCO_wdt: Found a Lynx Point TCO device (Version=2, TCOBASE=0x1860)
> Jun 28 14:53:54 localhost kernel: [ 2.099561] iTCO_wdt: initialized. heartbeat=30 sec (nowayout=0)
> Jun 28 14:53:54 localhost kernel: [ 2.100401] [drm] radeon kernel modesetting enabled.
> Jun 28 14:53:54 localhost kernel: [ 2.100918] checking generic (e0000000 300000) vs hw (e0000000 10000000)
> Jun 28 14:53:54 localhost kernel: [ 2.100919] fb: switching to radeondrmfb from simple
> Jun 28 14:53:54 localhost kernel: [ 2.101372] Console: switching to colour dummy device 80x25
> Jun 28 14:53:54 localhost kernel: [ 2.101527] [drm] initializing kernel modesetting (BONAIRE 0x1002:0x6658 0x174B:0xE253).
> Jun 28 14:53:54 localhost kernel: [ 2.101534] [drm] register mmio base: 0xF0800000
> Jun 28 14:53:54 localhost kernel: [ 2.101535] [drm] register mmio size: 262144
> Jun 28 14:53:54 localhost kernel: [ 2.101540] [drm] doorbell mmio base: 0xF0000000
> Jun 28 14:53:54 localhost kernel: [ 2.101541] [drm] doorbell mmio size: 8388608
> Jun 28 14:53:54 localhost kernel: [ 2.101579] ATOM BIOS: Bonaire
> Jun 28 14:53:54 localhost kernel: [ 2.101627] radeon 0000:01:00.0: VRAM: 2048M 0x0000000000000000 - 0x000000007FFFFFFF (2048M used)
> Jun 28 14:53:54 localhost kernel: [ 2.101629] radeon 0000:01:00.0: GTT: 1024M 0x0000000080000000 - 0x00000000BFFFFFFF
> Jun 28 14:53:54 localhost kernel: [ 2.101630] [drm] Detected VRAM RAM=2048M, BAR=256M
> Jun 28 14:53:54 localhost kernel: [ 2.101631] [drm] RAM width 128bits DDR
> Jun 28 14:53:54 localhost kernel: [ 2.101659] [TTM] Zone kernel: Available graphics memory: 8145364 kiB
> Jun 28 14:53:54 localhost kernel: [ 2.101660] [TTM] Zone dma32: Available graphics memory: 2097152 kiB
> Jun 28 14:53:54 localhost kernel: [ 2.101662] [TTM] Initializing pool allocator
> Jun 28 14:53:54 localhost kernel: [ 2.101664] [TTM] Initializing DMA pool allocator
> Jun 28 14:53:54 localhost kernel: [ 2.101674] [drm] radeon: 2048M of VRAM memory ready
> Jun 28 14:53:54 localhost kernel: [ 2.101675] [drm] radeon: 1024M of GTT memory ready.
> Jun 28 14:53:54 localhost kernel: [ 2.101681] [drm] Loading BONAIRE Microcode
> Jun 28 14:53:54 localhost kernel: [ 2.109479] [drm] radeon/BONAIRE_mc2.bin: 31792 bytes
> Jun 28 14:53:54 localhost kernel: [ 2.110510] [drm] Internal thermal controller with fan control
> Jun 28 14:53:54 localhost kernel: [ 2.110648] [drm] probing gen 2 caps for device 8086:c01 = 261ad03/e
> Jun 28 14:53:54 localhost kernel: [ 2.118508] [drm] radeon: dpm initialized
> Jun 28 14:53:54 localhost kernel: [ 2.122133] [drm] Found VCE firmware/feedback version 40.2.2 / 15!
> Jun 28 14:53:54 localhost kernel: [ 2.122140] [drm] GART: num cpu pages 262144, num gpu pages 262144
> Jun 28 14:53:54 localhost kernel: [ 2.122540] [drm] probing gen 2 caps for device 8086:c01 = 261ad03/e
> Jun 28 14:53:54 localhost kernel: [ 2.122544] [drm] PCIE gen 3 link speeds already enabled
> Jun 28 14:53:54 localhost kernel: [ 2.126118] Adding 5779452k swap on /dev/sdc2. Priority:-1 extents:1 across:5779452k FS
> Jun 28 14:53:54 localhost kernel: [ 2.133031] EXT4-fs (sda2): mounted filesystem with ordered data mode. Opts: discard
> Jun 28 14:53:54 localhost kernel: [ 2.136552] [drm] PCIE GART of 1024M enabled (table at 0x000000000078B000).
> Jun 28 14:53:54 localhost kernel: [ 2.136670] radeon 0000:01:00.0: WB enabled
> Jun 28 14:53:54 localhost kernel: [ 2.136697] radeon 0000:01:00.0: fence driver on ring 0 use gpu addr 0x0000000080000c00 and cpu addr 0xffff8802683e6c00
> Jun 28 14:53:54 localhost kernel: [ 2.136699] radeon 0000:01:00.0: fence driver on ring 1 use gpu addr 0x0000000080000c04 and cpu addr 0xffff8802683e6c04
> Jun 28 14:53:54 localhost kernel: [ 2.136701] radeon 0000:01:00.0: fence driver on ring 2 use gpu addr 0x0000000080000c08 and cpu addr 0xffff8802683e6c08
> Jun 28 14:53:54 localhost kernel: [ 2.136703] radeon 0000:01:00.0: fence driver on ring 3 use gpu addr 0x0000000080000c0c and cpu addr 0xffff8802683e6c0c
> Jun 28 14:53:54 localhost kernel: [ 2.136705] radeon 0000:01:00.0: fence driver on ring 4 use gpu addr 0x0000000080000c10 and cpu addr 0xffff8802683e6c10
> Jun 28 14:53:54 localhost kernel: [ 2.137230] radeon 0000:01:00.0: fence driver on ring 5 use gpu addr 0x0000000000076c98 and cpu addr 0xffffc90007936c98
> Jun 28 14:53:54 localhost kernel: [ 2.137293] radeon 0000:01:00.0: fence driver on ring 6 use gpu addr 0x0000000080000c18 and cpu addr 0xffff8802683e6c18
> Jun 28 14:53:54 localhost kernel: [ 2.137296] radeon 0000:01:00.0: fence driver on ring 7 use gpu addr 0x0000000080000c1c and cpu addr 0xffff8802683e6c1c
> Jun 28 14:53:54 localhost kernel: [ 2.137298] [drm] Supports vblank timestamp caching Rev 2 (21.10.2013).
> Jun 28 14:53:54 localhost kernel: [ 2.137299] [drm] Driver supports precise vblank timestamp query.
> Jun 28 14:53:54 localhost kernel: [ 2.137325] radeon 0000:01:00.0: irq 45 for MSI/MSI-X
> Jun 28 14:53:54 localhost kernel: [ 2.137331] radeon 0000:01:00.0: radeon: using MSI.
> Jun 28 14:53:54 localhost kernel: [ 2.137357] [drm] radeon: irq initialized.
> Jun 28 14:53:54 localhost kernel: [ 2.139870] [drm] ring test on 0 succeeded in 3 usecs
> Jun 28 14:53:54 localhost kernel: [ 2.139938] [drm] ring test on 1 succeeded in 3 usecs
> Jun 28 14:53:54 localhost kernel: [ 2.139950] [drm] ring test on 2 succeeded in 3 usecs
> Jun 28 14:53:54 localhost kernel: [ 2.140110] [drm] ring test on 3 succeeded in 2 usecs
> Jun 28 14:53:54 localhost kernel: [ 2.140116] [drm] ring test on 4 succeeded in 1 usecs
> Jun 28 14:53:54 localhost kernel: [ 2.142659] Adding 5779452k swap on /dev/sdb2. Priority:-2 extents:1 across:5779452k FS
> Jun 28 14:53:54 localhost kernel: [ 2.152066] usb 1-7: new full-speed USB device number 6 using xhci_hcd
> Jun 28 14:53:54 localhost kernel: [ 2.185418] raid6: sse2x1 13222 MB/s
> Jun 28 14:53:54 localhost kernel: [ 2.196219] [drm] ring test on 5 succeeded in 1 usecs
> Jun 28 14:53:54 localhost kernel: [ 2.216257] [drm] UVD initialized successfully.
> Jun 28 14:53:54 localhost kernel: [ 2.242145] raid6: sse2x2 17003 MB/s
> Jun 28 14:53:54 localhost kernel: [ 2.259077] e1000e 0000:00:19.0 eth0: registered PHC clock
> Jun 28 14:53:54 localhost kernel: [ 2.259080] e1000e 0000:00:19.0 eth0: (PCI Express:2.5GT/s:Width x1) bc:5f:f4:fc:fa:91
> Jun 28 14:53:54 localhost kernel: [ 2.259081] e1000e 0000:00:19.0 eth0: Intel(R) PRO/1000 Network Connection
> Jun 28 14:53:54 localhost kernel: [ 2.259119] e1000e 0000:00:19.0 eth0: MAC: 11, PHY: 12, PBA No: FFFFFF-0FF
> Jun 28 14:53:54 localhost kernel: [ 2.262208] snd_hda_intel 0000:00:1b.0: irq 46 for MSI/MSI-X
> Jun 28 14:53:54 localhost kernel: [ 2.265424] nct6775: Found NCT6776D/F or compatible chip at 0x2e:0x290
> Jun 28 14:53:54 localhost kernel: [ 2.286592] sound hdaudioC0D0: ALC1150: SKU not ready 0x00000000
> Jun 28 14:53:54 localhost kernel: [ 2.286961] sound hdaudioC0D0: autoconfig: line_outs=3 (0x14/0x15/0x16/0x0/0x0) type:line
> Jun 28 14:53:54 localhost kernel: [ 2.286963] sound hdaudioC0D0: speaker_outs=0 (0x0/0x0/0x0/0x0/0x0)
> Jun 28 14:53:54 localhost kernel: [ 2.286965] sound hdaudioC0D0: hp_outs=1 (0x1b/0x0/0x0/0x0/0x0)
> Jun 28 14:53:54 localhost kernel: [ 2.286966] sound hdaudioC0D0: mono: mono_out=0x0
> Jun 28 14:53:54 localhost kernel: [ 2.286967] sound hdaudioC0D0: dig-out=0x1e/0x0
> Jun 28 14:53:54 localhost kernel: [ 2.286968] sound hdaudioC0D0: inputs:
> Jun 28 14:53:54 localhost kernel: [ 2.286970] sound hdaudioC0D0: Front Mic=0x19
> Jun 28 14:53:54 localhost kernel: [ 2.286971] sound hdaudioC0D0: Rear Mic=0x18
> Jun 28 14:53:54 localhost kernel: [ 2.286972] sound hdaudioC0D0: Line=0x1a
> Jun 28 14:53:54 localhost kernel: [ 2.297632] input: HDA Digital PCBeep as /devices/pci0000:00/0000:00:1b.0/sound/card0/hdaudioC0D0/input5
> Jun 28 14:53:54 localhost kernel: [ 2.297798] input: HDA Intel PCH Front Mic as /devices/pci0000:00/0000:00:1b.0/sound/card0/input6
> Jun 28 14:53:54 localhost kernel: [ 2.297835] input: HDA Intel PCH Rear Mic as /devices/pci0000:00/0000:00:1b.0/sound/card0/input7
> Jun 28 14:53:54 localhost kernel: [ 2.297869] input: HDA Intel PCH Line as /devices/pci0000:00/0000:00:1b.0/sound/card0/input8
> Jun 28 14:53:54 localhost kernel: [ 2.297905] input: HDA Intel PCH Line Out Front as /devices/pci0000:00/0000:00:1b.0/sound/card0/input9
> Jun 28 14:53:54 localhost kernel: [ 2.297940] input: HDA Intel PCH Line Out Surround as /devices/pci0000:00/0000:00:1b.0/sound/card0/input10
> Jun 28 14:53:54 localhost kernel: [ 2.297973] input: HDA Intel PCH Line Out CLFE as /devices/pci0000:00/0000:00:1b.0/sound/card0/input11
> Jun 28 14:53:54 localhost kernel: [ 2.298005] input: HDA Intel PCH Front Headphone as /devices/pci0000:00/0000:00:1b.0/sound/card0/input12
> Jun 28 14:53:54 localhost kernel: [ 2.298888] raid6: sse2x4 18101 MB/s
> Jun 28 14:53:54 localhost kernel: [ 2.306396] zram: unknown parameter '#32' ignored
> Jun 28 14:53:54 localhost kernel: [ 2.306399] zram: unknown parameter 'is' ignored
> Jun 28 14:53:54 localhost kernel: [ 2.306400] zram: unknown parameter 'max' ignored
> Jun 28 14:53:54 localhost kernel: [ 2.306401] zram: unknown parameter 'zram' ignored
> Jun 28 14:53:54 localhost kernel: [ 2.306402] zram: unknown parameter 'devices' ignored
> Jun 28 14:53:54 localhost kernel: [ 2.312100] zram: Created 32 device(s) ...
> Jun 28 14:53:54 localhost kernel: [ 2.327478] [drm] ring test on 6 succeeded in 22 usecs
> Jun 28 14:53:54 localhost kernel: [ 2.327492] [drm] ring test on 7 succeeded in 4 usecs
> Jun 28 14:53:54 localhost kernel: [ 2.327493] [drm] VCE initialized successfully.
> Jun 28 14:53:54 localhost kernel: [ 2.327763] [drm] ib test on ring 0 succeeded in 0 usecs
> Jun 28 14:53:54 localhost kernel: [ 2.327925] [drm] ib test on ring 1 succeeded in 0 usecs
> Jun 28 14:53:54 localhost kernel: [ 2.328079] [drm] ib test on ring 2 succeeded in 0 usecs
> Jun 28 14:53:54 localhost kernel: [ 2.328237] [drm] ib test on ring 3 succeeded in 0 usecs
> Jun 28 14:53:54 localhost kernel: [ 2.328394] [drm] ib test on ring 4 succeeded in 0 usecs
> Jun 28 14:53:54 localhost kernel: [ 2.328707] usb 1-7: ep 0x85 - rounding interval to 64 microframes, ep desc says 80 microframes
> Jun 28 14:53:54 localhost kernel: [ 2.340997] Adding 254540k swap on /dev/zram0. Priority:32767 extents:1 across:254540k SSFS
> Jun 28 14:53:54 localhost kernel: [ 2.341054] Adding 254540k swap on /dev/zram1. Priority:32767 extents:1 across:254540k SSFS
> Jun 28 14:53:54 localhost kernel: [ 2.341110] Adding 254540k swap on /dev/zram2. Priority:32767 extents:1 across:254540k SSFS
> Jun 28 14:53:54 localhost kernel: [ 2.341162] Adding 254540k swap on /dev/zram3. Priority:32767 extents:1 across:254540k SSFS
> Jun 28 14:53:54 localhost kernel: [ 2.343872] [drm] ib test on ring 5 succeeded
> Jun 28 14:53:54 localhost kernel: [ 2.355627] raid6: avx2x1 16273 MB/s
> Jun 28 14:53:54 localhost kernel: [ 2.364832] [drm] ib test on ring 6 succeeded
> Jun 28 14:53:54 localhost kernel: [ 2.365591] [drm] ib test on ring 7 succeeded
> Jun 28 14:53:54 localhost kernel: [ 2.366015] [drm] Radeon Display Connectors
> Jun 28 14:53:54 localhost kernel: [ 2.366018] [drm] Connector 0:
> Jun 28 14:53:54 localhost kernel: [ 2.366019] [drm] DP-1
> Jun 28 14:53:54 localhost kernel: [ 2.366020] [drm] HPD2
> Jun 28 14:53:54 localhost kernel: [ 2.366022] [drm] DDC: 0x6530 0x6530 0x6534 0x6534 0x6538 0x6538 0x653c 0x653c
> Jun 28 14:53:54 localhost kernel: [ 2.366024] [drm] Encoders:
> Jun 28 14:53:54 localhost kernel: [ 2.366026] [drm] DFP1: INTERNAL_UNIPHY2
> Jun 28 14:53:54 localhost kernel: [ 2.366027] [drm] Connector 1:
> Jun 28 14:53:54 localhost kernel: [ 2.366028] [drm] HDMI-A-1
> Jun 28 14:53:54 localhost kernel: [ 2.366030] [drm] HPD3
> Jun 28 14:53:54 localhost kernel: [ 2.366032] [drm] DDC: 0x6550 0x6550 0x6554 0x6554 0x6558 0x6558 0x655c 0x655c
> Jun 28 14:53:54 localhost kernel: [ 2.366033] [drm] Encoders:
> Jun 28 14:53:54 localhost kernel: [ 2.366035] [drm] DFP2: INTERNAL_UNIPHY2
> Jun 28 14:53:54 localhost kernel: [ 2.366036] [drm] Connector 2:
> Jun 28 14:53:54 localhost kernel: [ 2.366037] [drm] DVI-D-1
> Jun 28 14:53:54 localhost kernel: [ 2.366039] [drm] HPD1
> Jun 28 14:53:54 localhost kernel: [ 2.366041] [drm] DDC: 0x6560 0x6560 0x6564 0x6564 0x6568 0x6568 0x656c 0x656c
> Jun 28 14:53:54 localhost kernel: [ 2.366043] [drm] Encoders:
> Jun 28 14:53:54 localhost kernel: [ 2.366044] [drm] DFP3: INTERNAL_UNIPHY1
> Jun 28 14:53:54 localhost kernel: [ 2.366045] [drm] Connector 3:
> Jun 28 14:53:54 localhost kernel: [ 2.366046] [drm] DVI-I-1
> Jun 28 14:53:54 localhost kernel: [ 2.366048] [drm] HPD6
> Jun 28 14:53:54 localhost kernel: [ 2.366049] [drm] DDC: 0x6580 0x6580 0x6584 0x6584 0x6588 0x6588 0x658c 0x658c
> Jun 28 14:53:54 localhost kernel: [ 2.366051] [drm] Encoders:
> Jun 28 14:53:54 localhost kernel: [ 2.366052] [drm] DFP4: INTERNAL_UNIPHY
> Jun 28 14:53:54 localhost kernel: [ 2.366053] [drm] CRT1: INTERNAL_KLDSCP_DAC1
> Jun 28 14:53:54 localhost kernel: [ 2.412356] raid6: avx2x2 20798 MB/s
> Jun 28 14:53:54 localhost kernel: [ 2.412358] Switched to clocksource tsc
> Jun 28 14:53:54 localhost kernel: [ 2.439066] usb 1-8: new low-speed USB device number 7 using xhci_hcd
> Jun 28 14:53:54 localhost kernel: [ 2.442481] e1000e 0000:00:19.0: irq 47 for MSI/MSI-X
> Jun 28 14:53:54 localhost kernel: [ 2.464181] [drm] fb mappable at 0xE098E000
> Jun 28 14:53:54 localhost kernel: [ 2.464183] [drm] vram apper at 0xE0000000
> Jun 28 14:53:54 localhost kernel: [ 2.464184] [drm] size 9216000
> Jun 28 14:53:54 localhost kernel: [ 2.464185] [drm] fb depth is 24
> Jun 28 14:53:54 localhost kernel: [ 2.464186] [drm] pitch is 7680
> Jun 28 14:53:54 localhost kernel: [ 2.464227] fbcon: radeondrmfb (fb0) is primary device
> Jun 28 14:53:54 localhost kernel: [ 2.469074] raid6: avx2x4 24141 MB/s
> Jun 28 14:53:54 localhost kernel: [ 2.469074] raid6: using algorithm avx2x4 (24141 MB/s)
> Jun 28 14:53:54 localhost kernel: [ 2.469075] raid6: using avx2x2 recovery algorithm
> Jun 28 14:53:54 localhost kernel: [ 2.469466] xor: automatically using best checksumming function:
> Jun 28 14:53:54 localhost kernel: [ 2.484840] Console: switching to colour frame buffer device 240x75
> Jun 28 14:53:54 localhost kernel: [ 2.487822] radeon 0000:01:00.0: fb0: radeondrmfb frame buffer device
> Jun 28 14:53:54 localhost kernel: [ 2.487836] radeon 0000:01:00.0: registered panic notifier
> Jun 28 14:53:54 localhost kernel: [ 2.502444] avx : 41036.400 MB/sec
> Jun 28 14:53:54 localhost kernel: [ 2.510424] Btrfs loaded
> Jun 28 14:53:54 localhost kernel: [ 2.510765] BTRFS: device fsid 9d4254aa-6715-4fa8-986a-1af0d51768ad devid 1 transid 303773 /dev/sdc1
> Jun 28 14:53:54 localhost kernel: [ 2.510907] BTRFS: device fsid 9d4254aa-6715-4fa8-986a-1af0d51768ad devid 2 transid 303773 /dev/sdb1
> Jun 28 14:53:54 localhost kernel: [ 2.513700] [drm] Initialized radeon 2.39.0 20080528 for 0000:01:00.0 on minor 0
> Jun 28 14:53:54 localhost kernel: [ 2.513800] snd_hda_intel 0000:01:00.1: Handle VGA-switcheroo audio client
> Jun 28 14:53:54 localhost kernel: [ 2.513878] snd_hda_intel 0000:01:00.1: irq 48 for MSI/MSI-X
> Jun 28 14:53:54 localhost kernel: [ 2.513971] [drm] Memory usable by graphics device = 2048M
> Jun 28 14:53:54 localhost kernel: [ 2.520123] input: HD-Audio Generic HDMI/DP,pcm=3 as /devices/pci0000:00/0000:00:01.0/0000:01:00.1/sound/card1/input13
> Jun 28 14:53:54 localhost kernel: [ 2.520184] input: HD-Audio Generic HDMI/DP,pcm=7 as /devices/pci0000:00/0000:00:01.0/0000:01:00.1/sound/card1/input14
> Jun 28 14:53:54 localhost kernel: [ 2.520258] input: HD-Audio Generic HDMI/DP,pcm=8 as /devices/pci0000:00/0000:00:01.0/0000:01:00.1/sound/card1/input15
> Jun 28 14:53:54 localhost kernel: [ 2.520368] input: HD-Audio Generic HDMI/DP,pcm=9 as /devices/pci0000:00/0000:00:01.0/0000:01:00.1/sound/card1/input16
> Jun 28 14:53:54 localhost kernel: [ 2.520440] input: HD-Audio Generic HDMI/DP,pcm=10 as /devices/pci0000:00/0000:00:01.0/0000:01:00.1/sound/card1/input17
> Jun 28 14:53:54 localhost kernel: [ 2.521215] input: HD-Audio Generic HDMI/DP,pcm=11 as /devices/pci0000:00/0000:00:01.0/0000:01:00.1/sound/card1/input18
> Jun 28 14:53:54 localhost kernel: [ 2.532558] i915 0000:00:02.0: irq 49 for MSI/MSI-X
> Jun 28 14:53:54 localhost kernel: [ 2.532565] [drm] Supports vblank timestamp caching Rev 2 (21.10.2013).
> Jun 28 14:53:54 localhost kernel: [ 2.532580] [drm] Driver supports precise vblank timestamp query.
> Jun 28 14:53:54 localhost kernel: [ 2.532607] vgaarb: device changed decodes: PCI:0000:01:00.0,olddecodes=io+mem,decodes=io+mem:owns=io+mem
> Jun 28 14:53:54 localhost kernel: [ 2.545934] e1000e 0000:00:19.0: irq 50 for MSI/MSI-X
> Jun 28 14:53:54 localhost kernel: [ 2.546018] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
> Jun 28 14:53:54 localhost kernel: [ 2.619122] usb 1-8: ep 0x81 - rounding interval to 512 microframes, ep desc says 800 microframes
> Jun 28 14:53:54 localhost kernel: [ 2.759949] i915 0000:00:02.0: fb1: inteldrmfb frame buffer device
> Jun 28 14:53:54 localhost kernel: [ 2.760226] [drm] Initialized i915 1.6.0 20080730 for 0000:00:02.0 on minor 1
> Jun 28 14:53:54 localhost kernel: [ 2.779511] usb 1-14: new high-speed USB device number 8 using xhci_hcd
>
> I am willing to try patches.
>
> Please fix or revert this commit.
>
> Thanks,
> Ed Tomlinson
>
>
> On Thursday 05 June 2014 16:58:28 Daniel Vetter wrote:
> > Touching the VGA resources on an IVB EFI machine causes hard hangs when
> > we then kick out the efifb. Ouch.
> >
> > Apparently this also prevents unclaimed register errors on hsw and
> > hard machine hangs on my i855gm when trying to unbind fbcon.
> >
> > Also, we want this to make I915_FBDEV=n safe.
> >
> > v2: Rebase and pimp commit message.
> >
> > v3: We also need to unregister the vga console, otherwise the unbind
> > of the fb console before module unload might resurrect it again.
> >
> > v4: Ignore errors when the vga console is already unregistered - this
> > can happen when e.g. reloading i915.ko.
> >
> > Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=67813
> > Cc: David Herrmann <[email protected]>
> > Cc: Jean-Christophe Plagniol-Villard <[email protected]>
> > Cc: Tomi Valkeinen <[email protected]>
> > Cc: [email protected]
> > Cc: Jani Nikula <[email protected]>
> > Signed-off-by: Chris Wilson <[email protected]> (v1)
> > Signed-off-by: Daniel Vetter <[email protected]>
> > ---
> > drivers/gpu/drm/i915/i915_dma.c | 43 +++++++++++++++++++++++++++++++++++++++-
> > drivers/video/console/dummycon.c | 1 +
> > drivers/video/console/vgacon.c | 1 +
> > 3 files changed, 44 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
> > index 27fe65ac5940..bcb66ddd649e 100644
> > --- a/drivers/gpu/drm/i915/i915_dma.c
> > +++ b/drivers/gpu/drm/i915/i915_dma.c
> > @@ -36,6 +36,8 @@
> > #include "i915_drv.h"
> > #include "i915_trace.h"
> > #include <linux/pci.h>
> > +#include <linux/console.h>
> > +#include <linux/vt.h>
> > #include <linux/vgaarb.h>
> > #include <linux/acpi.h>
> > #include <linux/pnp.h>
> > @@ -1449,6 +1451,38 @@ static void i915_kick_out_firmware_fb(struct drm_i915_private *dev_priv)
> > }
> > #endif
> >
> > +#if !defined(CONFIG_VGA_CONSOLE)
> > +static int i915_kick_out_vgacon(struct drm_i915_private *dev_priv)
> > +{
> > + return 0;
> > +}
> > +#elif !defined(CONFIG_DUMMY_CONSOLE)
> > +static int i915_kick_out_vgacon(struct drm_i915_private *dev_priv)
> > +{
> > + return -ENODEV;
> > +}
> > +#else
> > +static int i915_kick_out_vgacon(struct drm_i915_private *dev_priv)
> > +{
> > + int ret;
> > +
> > + DRM_INFO("Replacing VGA console driver\n");
> > +
> > + console_lock();
> > + ret = do_take_over_console(&dummy_con, 0, MAX_NR_CONSOLES - 1, 1);
> > + if (ret == 0) {
> > + ret = do_unregister_con_driver(&vga_con);
> > +
> > + /* Ignore "already unregistered". */
> > + if (ret == -ENODEV)
> > + ret = 0;
> > + }
> > + console_unlock();
> > +
> > + return ret;
> > +}
> > +#endif
> > +
> > static void i915_dump_device_info(struct drm_i915_private *dev_priv)
> > {
> > const struct intel_device_info *info = &dev_priv->info;
> > @@ -1622,8 +1656,15 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags)
> > if (ret)
> > goto out_regs;
> >
> > - if (drm_core_check_feature(dev, DRIVER_MODESET))
> > + if (drm_core_check_feature(dev, DRIVER_MODESET)) {
> > + ret = i915_kick_out_vgacon(dev_priv);
> > + if (ret) {
> > + DRM_ERROR("failed to remove conflicting VGA console\n");
> > + goto out_gtt;
> > + }
> > +
> > i915_kick_out_firmware_fb(dev_priv);
> > + }
> >
> > pci_set_master(dev->pdev);
> >
> > diff --git a/drivers/video/console/dummycon.c b/drivers/video/console/dummycon.c
> > index b63860f7beab..40bec8d64b0a 100644
> > --- a/drivers/video/console/dummycon.c
> > +++ b/drivers/video/console/dummycon.c
> > @@ -77,3 +77,4 @@ const struct consw dummy_con = {
> > .con_set_palette = DUMMY,
> > .con_scrolldelta = DUMMY,
> > };
> > +EXPORT_SYMBOL_GPL(dummy_con);
> > diff --git a/drivers/video/console/vgacon.c b/drivers/video/console/vgacon.c
> > index 9d8feac67637..84acd6223dc5 100644
> > --- a/drivers/video/console/vgacon.c
> > +++ b/drivers/video/console/vgacon.c
> > @@ -1440,5 +1440,6 @@ const struct consw vga_con = {
> > .con_build_attr = vgacon_build_attr,
> > .con_invert_region = vgacon_invert_region,
> > };
> > +EXPORT_SYMBOL(vga_con);
> >
> > MODULE_LICENSE("GPL");
> >
>

2014-06-30 07:00:16

by Chris Wilson

[permalink] [raw]
Subject: Re: [PATCH 5/5] drm/i915: Kick out vga console

On Sat, Jun 28, 2014 at 11:55:19PM -0400, Ed Tomlinson wrote:
> On Saturday 28 June 2014 15:28:22 Ed Tomlinson wrote:
>
> Resend without html krud which causes list to bounce the message.
>
> > Hi
> >
> > This commit ( a4de05268e674e8ed31df6348269e22d6c6a1803 ) hangs my boot with 3.16-git. Reverting it lets the boot proceed.
> >
> > I have an i7 with a built-in i915 and an pcie r7 260x. The R7 is the primary console. The i915 is initialized
> > but does not have a physical display attached.
> >
> > With the patch applied the boot stops at the messages:
> >
> > [drm] Memory usable by graphics device = 2048M
> > [drm] Replacing VGA console driver

The issue looks like that we are ripping out the radeon fb_con whilst it
is active and that upsets everyone. In which case, I think the
compromise is:


diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
index 5f44581..4915f1d 100644
--- a/drivers/gpu/drm/i915/i915_dma.c
+++ b/drivers/gpu/drm/i915/i915_dma.c
@@ -1439,18 +1439,20 @@ static int i915_kick_out_vgacon(struct drm_i915_private *dev_priv)
#else
static int i915_kick_out_vgacon(struct drm_i915_private *dev_priv)
{
- int ret;
+ int ret = 0;

DRM_INFO("Replacing VGA console driver\n");

console_lock();
- ret = do_take_over_console(&dummy_con, 0, MAX_NR_CONSOLES - 1, 1);
- if (ret == 0) {
- ret = do_unregister_con_driver(&vga_con);
-
- /* Ignore "already unregistered". */
- if (ret == -ENODEV)
- ret = 0;
+ if (con_is_bound(&vga_con)) {
+ ret = do_take_over_console(&dummy_con, 0, MAX_NR_CONSOLES - 1, 1);
+ if (ret == 0) {
+ ret = do_unregister_con_driver(&vga_con);
+
+ /* Ignore "already unregistered". */
+ if (ret == -ENODEV)
+ ret = 0;
+ }
}
console_unlock();

-Chris

--
Chris Wilson, Intel Open Source Technology Centre

2014-06-30 08:19:44

by David Herrmann

[permalink] [raw]
Subject: Re: [PATCH 5/5] drm/i915: Kick out vga console

Hi

On Mon, Jun 30, 2014 at 8:59 AM, Chris Wilson <[email protected]> wrote:
> On Sat, Jun 28, 2014 at 11:55:19PM -0400, Ed Tomlinson wrote:
>> On Saturday 28 June 2014 15:28:22 Ed Tomlinson wrote:
>>
>> Resend without html krud which causes list to bounce the message.
>>
>> > Hi
>> >
>> > This commit ( a4de05268e674e8ed31df6348269e22d6c6a1803 ) hangs my boot with 3.16-git. Reverting it lets the boot proceed.
>> >
>> > I have an i7 with a built-in i915 and an pcie r7 260x. The R7 is the primary console. The i915 is initialized
>> > but does not have a physical display attached.
>> >
>> > With the patch applied the boot stops at the messages:
>> >
>> > [drm] Memory usable by graphics device = 2048M
>> > [drm] Replacing VGA console driver
>
> The issue looks like that we are ripping out the radeon fb_con whilst it
> is active and that upsets everyone. In which case, I think the
> compromise is:

do_take_over_console() should only touch console-drivers like fbcon.
How does this affect the underlying fbdev device? Ripping out active
or inactive fbcon should be just fine, shouldn't it?

Given that this hard-locks at kick_out_vgacon(), this looks more like
a dead-lock to me.

Thanks
David

2014-07-01 13:51:47

by Ed Tomlinson

[permalink] [raw]
Subject: Re: [PATCH 5/5] drm/i915: Kick out vga console

Hi Chris,

I had to rediff to get a patch that applies... I am not hanging with this applied - it
does look like the i915 is starting is initialization later boot the new kernel.

[ 2.389796] [drm] Radeon Display Connectors
[ 2.389798] [drm] Connector 0:
[ 2.389799] [drm] DP-1
[ 2.389799] [drm] HPD2
[ 2.389801] [drm] DDC: 0x6530 0x6530 0x6534 0x6534 0x6538 0x6538 0x653c 0x653c
[ 2.389802] [drm] Encoders:
[ 2.389803] [drm] DFP1: INTERNAL_UNIPHY2
[ 2.389804] [drm] Connector 1:
[ 2.389805] [drm] HDMI-A-1
[ 2.389805] [drm] HPD3
[ 2.389806] [drm] DDC: 0x6550 0x6550 0x6554 0x6554 0x6558 0x6558 0x655c 0x655c
[ 2.389807] [drm] Encoders:
[ 2.389808] [drm] DFP2: INTERNAL_UNIPHY2
[ 2.389809] [drm] Connector 2:
[ 2.389810] [drm] DVI-D-1
[ 2.389811] [drm] HPD1
[ 2.389812] [drm] DDC: 0x6560 0x6560 0x6564 0x6564 0x6568 0x6568 0x656c 0x656c
[ 2.389813] [drm] Encoders:
[ 2.389814] [drm] DFP3: INTERNAL_UNIPHY1
[ 2.389815] [drm] Connector 3:
[ 2.389815] [drm] DVI-I-1
[ 2.389816] [drm] HPD6
[ 2.389817] [drm] DDC: 0x6580 0x6580 0x6584 0x6584 0x6588 0x6588 0x658c 0x658c
[ 2.389818] [drm] Encoders:
[ 2.389819] [drm] DFP4: INTERNAL_UNIPHY
[ 2.389820] [drm] CRT1: INTERNAL_KLDSCP_DAC1
[ 2.435689] raid6: avx2x2 24564 MB/s
[ 2.435691] Switched to clocksource tsc
[ 2.489087] usb 1-8: new low-speed USB device number 7 using xhci_hcd
[ 2.492403] raid6: avx2x4 34887 MB/s
[ 2.492404] raid6: using algorithm avx2x4 (34887 MB/s)
[ 2.492405] raid6: using avx2x2 recovery algorithm
[ 2.492789] xor: automatically using best checksumming function:
[ 2.502557] Adding 5779452k swap on /dev/sdb2. Priority:-2 extents:1 across:5779452k FS
[ 2.511532] [drm] fb mappable at 0xE098E000
[ 2.511536] [drm] vram apper at 0xE0000000
[ 2.511538] [drm] size 9216000
[ 2.511539] [drm] fb depth is 24
[ 2.511541] [drm] pitch is 7680
[ 2.511590] fbcon: radeondrmfb (fb0) is primary device
[ 2.516691] nct6775: Found NCT6776D/F or compatible chip at 0x2e:0x290
[ 2.525778] avx : 41474.400 MB/sec
[ 2.532408] Console: switching to colour frame buffer device 240x75
[ 2.535567] radeon 0000:01:00.0: fb0: radeondrmfb frame buffer device
[ 2.535567] radeon 0000:01:00.0: registered panic notifier
[ 2.544968] Btrfs loaded
[ 2.545276] BTRFS: device fsid 9d4254aa-6715-4fa8-986a-1af0d51768ad devid 1 transid 308068 /dev/sdc1
[ 2.545739] BTRFS: device fsid 9d4254aa-6715-4fa8-986a-1af0d51768ad devid 2 transid 308068 /dev/sdb1
[ 2.552946] [drm] Initialized radeon 2.39.0 20080528 for 0000:01:00.0 on minor 0
[ 2.553248] [drm] Memory usable by graphics device = 2048M
[ 2.553273] [drm] Replacing VGA console driver
[ 2.572539] i915 0000:00:02.0: irq 46 for MSI/MSI-X
[ 2.572546] [drm] Supports vblank timestamp caching Rev 2 (21.10.2013).
[ 2.572565] [drm] Driver supports precise vblank timestamp query.

If you are happy with this you can give this patch my tested by.

Thanks
Ed Tomlinson

On Monday 30 June 2014 07:59:55 Chris Wilson wrote:
> On Sat, Jun 28, 2014 at 11:55:19PM -0400, Ed Tomlinson wrote:
> > On Saturday 28 June 2014 15:28:22 Ed Tomlinson wrote:
> >
> > Resend without html krud which causes list to bounce the message.
> >
> > > Hi
> > >
> > > This commit ( a4de05268e674e8ed31df6348269e22d6c6a1803 ) hangs my boot with 3.16-git. Reverting it lets the boot proceed.
> > >
> > > I have an i7 with a built-in i915 and an pcie r7 260x. The R7 is the primary console. The i915 is initialized
> > > but does not have a physical display attached.
> > >
> > > With the patch applied the boot stops at the messages:
> > >
> > > [drm] Memory usable by graphics device = 2048M
> > > [drm] Replacing VGA console driver
>
> The issue looks like that we are ripping out the radeon fb_con whilst it
> is active and that upsets everyone. In which case, I think the
> compromise is:
>
>
> diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
> index 5f44581..4915f1d 100644
> --- a/drivers/gpu/drm/i915/i915_dma.c
> +++ b/drivers/gpu/drm/i915/i915_dma.c
> @@ -1439,18 +1439,20 @@ static int i915_kick_out_vgacon(struct drm_i915_private *dev_priv)
> #else
> static int i915_kick_out_vgacon(struct drm_i915_private *dev_priv)
> {
> - int ret;
> + int ret = 0;
>
> DRM_INFO("Replacing VGA console driver\n");
>
> console_lock();
> - ret = do_take_over_console(&dummy_con, 0, MAX_NR_CONSOLES - 1, 1);
> - if (ret == 0) {
> - ret = do_unregister_con_driver(&vga_con);
> -
> - /* Ignore "already unregistered". */
> - if (ret == -ENODEV)
> - ret = 0;
> + if (con_is_bound(&vga_con)) {
> + ret = do_take_over_console(&dummy_con, 0, MAX_NR_CONSOLES - 1, 1);
> + if (ret == 0) {
> + ret = do_unregister_con_driver(&vga_con);
> +
> + /* Ignore "already unregistered". */
> + if (ret == -ENODEV)
> + ret = 0;
> + }
> }
> console_unlock();
>
> -Chris
>
>

2014-07-07 08:48:22

by Daniel Vetter

[permalink] [raw]
Subject: Re: [Intel-gfx] [PATCH 5/5] drm/i915: Kick out vga console

On Mon, Jun 30, 2014 at 07:59:55AM +0100, Chris Wilson wrote:
> On Sat, Jun 28, 2014 at 11:55:19PM -0400, Ed Tomlinson wrote:
> > On Saturday 28 June 2014 15:28:22 Ed Tomlinson wrote:
> >
> > Resend without html krud which causes list to bounce the message.
> >
> > > Hi
> > >
> > > This commit ( a4de05268e674e8ed31df6348269e22d6c6a1803 ) hangs my boot with 3.16-git. Reverting it lets the boot proceed.
> > >
> > > I have an i7 with a built-in i915 and an pcie r7 260x. The R7 is the primary console. The i915 is initialized
> > > but does not have a physical display attached.
> > >
> > > With the patch applied the boot stops at the messages:
> > >
> > > [drm] Memory usable by graphics device = 2048M
> > > [drm] Replacing VGA console driver
>
> The issue looks like that we are ripping out the radeon fb_con whilst it
> is active and that upsets everyone. In which case, I think the
> compromise is:
>
>
> diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
> index 5f44581..4915f1d 100644
> --- a/drivers/gpu/drm/i915/i915_dma.c
> +++ b/drivers/gpu/drm/i915/i915_dma.c
> @@ -1439,18 +1439,20 @@ static int i915_kick_out_vgacon(struct drm_i915_private *dev_priv)
> #else
> static int i915_kick_out_vgacon(struct drm_i915_private *dev_priv)
> {
> - int ret;
> + int ret = 0;
>
> DRM_INFO("Replacing VGA console driver\n");
>
> console_lock();
> - ret = do_take_over_console(&dummy_con, 0, MAX_NR_CONSOLES - 1, 1);
> - if (ret == 0) {
> - ret = do_unregister_con_driver(&vga_con);
> -
> - /* Ignore "already unregistered". */
> - if (ret == -ENODEV)
> - ret = 0;
> + if (con_is_bound(&vga_con)) {
> + ret = do_take_over_console(&dummy_con, 0, MAX_NR_CONSOLES - 1, 1);
> + if (ret == 0) {
> + ret = do_unregister_con_driver(&vga_con);

Hm, we should only conditionalize the take_over_console - unregistering
vga_con is kinda the point to make sure it's gone for real. Ed, can you
please retest with the if (con_is_bound) check just for the
do_take_over_console call?

Still puzzled wtf is going on here since as David says this should be a
no-op.

Thanks, Daniel
> +
> + /* Ignore "already unregistered". */
> + if (ret == -ENODEV)
> + ret = 0;
> + }
> }
> console_unlock();
>
> -Chris
>
> --
> Chris Wilson, Intel Open Source Technology Centre
> _______________________________________________
> Intel-gfx mailing list
> [email protected]
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch

2014-07-07 10:45:55

by Ed Tomlinson

[permalink] [raw]
Subject: Re: [Intel-gfx] [PATCH 5/5] drm/i915: Kick out vga console

Daniel,

I am not quite sure I understand what you want me to test?
Do you want me to try it without:

> > + if (ret == 0) {
> > + ret = do_unregister_con_driver(&vga_con);

Thanks
Ed


On Monday 07 July 2014 10:48:26 Daniel Vetter wrote:
> On Mon, Jun 30, 2014 at 07:59:55AM +0100, Chris Wilson wrote:
> > On Sat, Jun 28, 2014 at 11:55:19PM -0400, Ed Tomlinson wrote:
> > > On Saturday 28 June 2014 15:28:22 Ed Tomlinson wrote:
> > >
> > > Resend without html krud which causes list to bounce the message.
> > >
> > > > Hi
> > > >
> > > > This commit ( a4de05268e674e8ed31df6348269e22d6c6a1803 ) hangs my boot with 3.16-git. Reverting it lets the boot proceed.
> > > >
> > > > I have an i7 with a built-in i915 and an pcie r7 260x. The R7 is the primary console. The i915 is initialized
> > > > but does not have a physical display attached.
> > > >
> > > > With the patch applied the boot stops at the messages:
> > > >
> > > > [drm] Memory usable by graphics device = 2048M
> > > > [drm] Replacing VGA console driver
> >
> > The issue looks like that we are ripping out the radeon fb_con whilst it
> > is active and that upsets everyone. In which case, I think the
> > compromise is:
> >
> >
> > diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
> > index 5f44581..4915f1d 100644
> > --- a/drivers/gpu/drm/i915/i915_dma.c
> > +++ b/drivers/gpu/drm/i915/i915_dma.c
> > @@ -1439,18 +1439,20 @@ static int i915_kick_out_vgacon(struct drm_i915_private *dev_priv)
> > #else
> > static int i915_kick_out_vgacon(struct drm_i915_private *dev_priv)
> > {
> > - int ret;
> > + int ret = 0;
> >
> > DRM_INFO("Replacing VGA console driver\n");
> >
> > console_lock();
> > - ret = do_take_over_console(&dummy_con, 0, MAX_NR_CONSOLES - 1, 1);
> > - if (ret == 0) {
> > - ret = do_unregister_con_driver(&vga_con);
> > -
> > - /* Ignore "already unregistered". */
> > - if (ret == -ENODEV)
> > - ret = 0;
> > + if (con_is_bound(&vga_con)) {
> > + ret = do_take_over_console(&dummy_con, 0, MAX_NR_CONSOLES - 1, 1);
> > + if (ret == 0) {
> > + ret = do_unregister_con_driver(&vga_con);
>
> Hm, we should only conditionalize the take_over_console - unregistering
> vga_con is kinda the point to make sure it's gone for real. Ed, can you
> please retest with the if (con_is_bound) check just for the
> do_take_over_console call?
>
> Still puzzled wtf is going on here since as David says this should be a
> no-op.
>
> Thanks, Daniel
> > +
> > + /* Ignore "already unregistered". */
> > + if (ret == -ENODEV)
> > + ret = 0;
> > + }
> > }
> > console_unlock();
> >
> > -Chris
> >
>
>

2014-07-07 10:59:54

by Ed Tomlinson

[permalink] [raw]
Subject: Re: [Intel-gfx] [PATCH 5/5] drm/i915: Kick out vga console

Daniel,

Just to be sure. The intel card here should not be claiming the real console. It does
not have an output device and the bios set set so the radeon is the primary device.

Ed


On Monday 07 July 2014 10:48:26 Daniel Vetter wrote:
> On Mon, Jun 30, 2014 at 07:59:55AM +0100, Chris Wilson wrote:
> > On Sat, Jun 28, 2014 at 11:55:19PM -0400, Ed Tomlinson wrote:
> > > On Saturday 28 June 2014 15:28:22 Ed Tomlinson wrote:
> > >
> > > Resend without html krud which causes list to bounce the message.
> > >
> > > > Hi
> > > >
> > > > This commit ( a4de05268e674e8ed31df6348269e22d6c6a1803 ) hangs my boot with 3.16-git. Reverting it lets the boot proceed.
> > > >
> > > > I have an i7 with a built-in i915 and an pcie r7 260x. The R7 is the primary console. The i915 is initialized
> > > > but does not have a physical display attached.
> > > >
> > > > With the patch applied the boot stops at the messages:
> > > >
> > > > [drm] Memory usable by graphics device = 2048M
> > > > [drm] Replacing VGA console driver
> >
> > The issue looks like that we are ripping out the radeon fb_con whilst it
> > is active and that upsets everyone. In which case, I think the
> > compromise is:
> >
> >
> > diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
> > index 5f44581..4915f1d 100644
> > --- a/drivers/gpu/drm/i915/i915_dma.c
> > +++ b/drivers/gpu/drm/i915/i915_dma.c
> > @@ -1439,18 +1439,20 @@ static int i915_kick_out_vgacon(struct drm_i915_private *dev_priv)
> > #else
> > static int i915_kick_out_vgacon(struct drm_i915_private *dev_priv)
> > {
> > - int ret;
> > + int ret = 0;
> >
> > DRM_INFO("Replacing VGA console driver\n");
> >
> > console_lock();
> > - ret = do_take_over_console(&dummy_con, 0, MAX_NR_CONSOLES - 1, 1);
> > - if (ret == 0) {
> > - ret = do_unregister_con_driver(&vga_con);
> > -
> > - /* Ignore "already unregistered". */
> > - if (ret == -ENODEV)
> > - ret = 0;
> > + if (con_is_bound(&vga_con)) {
> > + ret = do_take_over_console(&dummy_con, 0, MAX_NR_CONSOLES - 1, 1);
> > + if (ret == 0) {
> > + ret = do_unregister_con_driver(&vga_con);
>
> Hm, we should only conditionalize the take_over_console - unregistering
> vga_con is kinda the point to make sure it's gone for real. Ed, can you
> please retest with the if (con_is_bound) check just for the
> do_take_over_console call?
>
> Still puzzled wtf is going on here since as David says this should be a
> no-op.
>
> Thanks, Daniel
> > +
> > + /* Ignore "already unregistered". */
> > + if (ret == -ENODEV)
> > + ret = 0;
> > + }
> > }
> > console_unlock();
> >
> > -Chris
> >
>
>

2014-07-07 12:26:52

by Daniel Vetter

[permalink] [raw]
Subject: Re: [Intel-gfx] [PATCH 5/5] drm/i915: Kick out vga console

On Mon, Jul 07, 2014 at 06:45:49AM -0400, Ed Tomlinson wrote:
> Daniel,
>
> I am not quite sure I understand what you want me to test?
> Do you want me to try it without:
>
> > > + if (ret == 0) {
> > > + ret = do_unregister_con_driver(&vga_con);

Below the diff of what I mean.
-Daniel


diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
index 5e583a1838f8..bd8517151479 100644
--- a/drivers/gpu/drm/i915/i915_dma.c
+++ b/drivers/gpu/drm/i915/i915_dma.c
@@ -1466,12 +1466,13 @@ static int i915_kick_out_vgacon(struct drm_i915_private *dev_priv)
#else
static int i915_kick_out_vgacon(struct drm_i915_private *dev_priv)
{
- int ret;
+ int ret = 0;

DRM_INFO("Replacing VGA console driver\n");

console_lock();
- ret = do_take_over_console(&dummy_con, 0, MAX_NR_CONSOLES - 1, 1);
+ if (con_is_bound(&vga_con))
+ ret = do_take_over_console(&dummy_con, 0, MAX_NR_CONSOLES - 1, 1);
if (ret == 0) {
ret = do_unregister_con_driver(&vga_con);

--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch

2014-07-08 02:53:21

by Ed Tomlinson

[permalink] [raw]
Subject: Re: [Intel-gfx] [PATCH 5/5] drm/i915: Kick out vga console

Hi Daniel,

The patch below also works. You can use my Tested By for it.

Thanks
Ed Tomlinson <[email protected]>

PS. I _really_ need to get a serial console working on my i7 box.

On Monday 07 July 2014 14:26:54 Daniel Vetter wrote:
> On Mon, Jul 07, 2014 at 06:45:49AM -0400, Ed Tomlinson wrote:
> > Daniel,
> >
> > I am not quite sure I understand what you want me to test?
> > Do you want me to try it without:
> >
> > > > + if (ret == 0) {
> > > > + ret = do_unregister_con_driver(&vga_con);
>
> Below the diff of what I mean.
> -Daniel
>
>
> diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
> index 5e583a1838f8..bd8517151479 100644
> --- a/drivers/gpu/drm/i915/i915_dma.c
> +++ b/drivers/gpu/drm/i915/i915_dma.c
> @@ -1466,12 +1466,13 @@ static int i915_kick_out_vgacon(struct drm_i915_private *dev_priv)
> #else
> static int i915_kick_out_vgacon(struct drm_i915_private *dev_priv)
> {
> - int ret;
> + int ret = 0;
>
> DRM_INFO("Replacing VGA console driver\n");
>
> console_lock();
> - ret = do_take_over_console(&dummy_con, 0, MAX_NR_CONSOLES - 1, 1);
> + if (con_is_bound(&vga_con))
> + ret = do_take_over_console(&dummy_con, 0, MAX_NR_CONSOLES - 1, 1);
> if (ret == 0) {
> ret = do_unregister_con_driver(&vga_con);
>
>

2014-07-08 08:10:17

by Daniel Vetter

[permalink] [raw]
Subject: Re: [Intel-gfx] [PATCH 5/5] drm/i915: Kick out vga console

On Mon, Jul 07, 2014 at 10:53:16PM -0400, Ed Tomlinson wrote:
> Hi Daniel,
>
> The patch below also works. You can use my Tested By for it.

Thanks a lot for testing, patch submitted and should get forwarded asap.
>
> Thanks
> Ed Tomlinson <[email protected]>
>
> PS. I _really_ need to get a serial console working on my i7 box.

Usually this doesn't help a lot with gfx initialization issues since we do
an awful lot of setup while holding the console_lock. Which prevents any
dmesg output on any console :(

Cheers, Daniel

>
> On Monday 07 July 2014 14:26:54 Daniel Vetter wrote:
> > On Mon, Jul 07, 2014 at 06:45:49AM -0400, Ed Tomlinson wrote:
> > > Daniel,
> > >
> > > I am not quite sure I understand what you want me to test?
> > > Do you want me to try it without:
> > >
> > > > > + if (ret == 0) {
> > > > > + ret = do_unregister_con_driver(&vga_con);
> >
> > Below the diff of what I mean.
> > -Daniel
> >
> >
> > diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
> > index 5e583a1838f8..bd8517151479 100644
> > --- a/drivers/gpu/drm/i915/i915_dma.c
> > +++ b/drivers/gpu/drm/i915/i915_dma.c
> > @@ -1466,12 +1466,13 @@ static int i915_kick_out_vgacon(struct drm_i915_private *dev_priv)
> > #else
> > static int i915_kick_out_vgacon(struct drm_i915_private *dev_priv)
> > {
> > - int ret;
> > + int ret = 0;
> >
> > DRM_INFO("Replacing VGA console driver\n");
> >
> > console_lock();
> > - ret = do_take_over_console(&dummy_con, 0, MAX_NR_CONSOLES - 1, 1);
> > + if (con_is_bound(&vga_con))
> > + ret = do_take_over_console(&dummy_con, 0, MAX_NR_CONSOLES - 1, 1);
> > if (ret == 0) {
> > ret = do_unregister_con_driver(&vga_con);
> >
> >
>
> _______________________________________________
> Intel-gfx mailing list
> [email protected]
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch