i915 framebuffer init too slow to find logo

Started by S. Gilles on Jan 29, 2015 · 3 messages from 2 authors · Last reply Jan 29, 2015

open the first message on its own page

Message details and related content
Since commit 92b004d1aa9f367c372511ca0330f58216b25703 : prevent use of
logs after they have been freed, my i915 machine has no logo on boot
(reverting that commit brings it back on recent trees). My .config
builds nothing but wireless as =m, so I think this is a genuine false
positive (as predicted by the commit). Examining an augmented dmesg,
it appears that the framebuffer setup is too slow by about 0.3s, which
I wouldn't really expect from this system/driver.

Is this slowness considered worth fixing, or is this issue considered
too cosmetic? (Or is this just PEBKAC?)

Possibly useful information:

$ lspci | grep VGA
00:02.0 VGA compatible controller: Intel Corporation 2nd Generation Core Processor Family Integrated Graphics Controller (rev 09)

From various printk()s, it looks like the slow portion of
fb_console_init() is restore_fbdev_mode(), specifically
drm_mode_set_config_internal(), which takes about 0.45s, while the
fb_logo_late_init() call happens about 0.15s into that. I can give the
full details if requested.

Possibly relevant .config bits:

# Graphics support
CONFIG_AGP=y
CONFIG_AGP_INTEL=y
CONFIG_INTEL_GTT=y
CONFIG_VGA_ARB=y
CONFIG_VGA_ARB_MAX_GPUS

# Direct Rendering Manager
CONFIG_DRM=y
CONFIG_DRM_KMS_HELPER=y
CONFIG_DRM_KMS_FB_HELPER=y

# I2C encoder or helper chips
CONFIG_DRM_I915=y
CONFIG_DRM_I915_KMS=y
CONFIG_DRM_I915_FBDEV=y

31 more lines

Message details and related content
On 29/01/15 04:32, S. Gilles wrote:
Since commit 92b004d1aa9f367c372511ca0330f58216b25703 : prevent use of
logs after they have been freed, my i915 machine has no logo on boot
(reverting that commit brings it back on recent trees). My .config
builds nothing but wireless as =m, so I think this is a genuine false
positive (as predicted by the commit). Examining an augmented dmesg,
It's not so much about modules, but when the code tries to use the
logos. Drivers as modules might cause the use of logos to happen later,
but that's only one possible reason.
it appears that the framebuffer setup is too slow by about 0.3s, which
I wouldn't really expect from this system/driver.

Is this slowness considered worth fixing, or is this issue considered
too cosmetic? (Or is this just PEBKAC?)

Possibly useful information:

$ lspci | grep VGA
00:02.0 VGA compatible controller: Intel Corporation 2nd Generation Core Processor Family Integrated Graphics Controller (rev 09)

From various printk()s, it looks like the slow portion of
fb_console_init() is restore_fbdev_mode(), specifically
drm_mode_set_config_internal(), which takes about 0.45s, while the
fb_logo_late_init() call happens about 0.15s into that. I can give the
full details if requested.
When does the driver probe() happen? Does the initialization happen
outside of the probe(), via workqueue or such? If so, then the fix is
valid for your case also, as the work could be ran after the logos have
been freed.

However, it does seem that the fix seems to cause logos to disappear for
many people. I'd be interesting to know how many of those cases were
working by luck, either by

1) an async work being ran fast enough, before the logos had been freed
2) the use of logos happening after the logos had been freed, but if no
one had trashed the logo memory yet, it still works

I don't care so much about the logo myself but people do seem to like
it, so perhaps we need to change the code as Thierry suggested:
allocating memory for the logos and keeping them in memory until someone
uses them the first time, and then free the memory.

 Tomi

Message details and related content
On 2015-01-29T10:09:39+0200, Tomi Valkeinen wrote:
On 29/01/15 04:32, S. Gilles wrote:
quoted
Since commit 92b004d1aa9f367c372511ca0330f58216b25703 : prevent use of
logs after they have been freed, my i915 machine has no logo on boot
(reverting that commit brings it back on recent trees). My .config
builds nothing but wireless as =m, so I think this is a genuine false
positive (as predicted by the commit). Examining an augmented dmesg,
It's not so much about modules, but when the code tries to use the
logos. Drivers as modules might cause the use of logos to happen later,
but that's only one possible reason.
quoted
it appears that the framebuffer setup is too slow by about 0.3s, which
I wouldn't really expect from this system/driver.

Is this slowness considered worth fixing, or is this issue considered
too cosmetic? (Or is this just PEBKAC?)

Possibly useful information:

$ lspci | grep VGA
00:02.0 VGA compatible controller: Intel Corporation 2nd Generation Core Processor Family Integrated Graphics Controller (rev 09)

From various printk()s, it looks like the slow portion of
fb_console_init() is restore_fbdev_mode(), specifically
drm_mode_set_config_internal(), which takes about 0.45s, while the
fb_logo_late_init() call happens about 0.15s into that. I can give the
full details if requested.
When does the driver probe() happen? Does the initialization happen
outside of the probe(), via workqueue or such? If so, then the fix is
valid for your case also, as the work could be ran after the logos have
been freed.
It looks like the fix is indeed valid, since the initialization
happens without probe() in the trace: the result of putting
dump_stack() at the beginning of the relevant functions is (in far too
much detail)

...
[    0.302391] CPU: 1 PID: 1 Comm: swapper/0 Not tainted 3.19.0-rc5+ #26
[    0.302476] Hardware name: LENOVO 4286CTO/4286CTO, BIOS 8DET42WW (1.12 ) 04/01/2011
[    0.302561]  ffff880138ffd000 ffff880139563c98 ffffffff817945db 0000000000000126
[    0.302882]  ffffffff81849d20 ffff880139563cc8 ffffffff813b7ec4 ffff880138ffd000
[    0.303189]  ffffffff81848b10 ffffffff81c3ad58 ffff880138ffd090 ffff880139563cf8
[    0.303511] Call Trace:
[    0.303578]  [<ffffffff817945db>] dump_stack+0x45/0x57
[    0.303677]  [<ffffffff813b7ec4>] i915_pci_probe+0x1a/0x68
[    0.303769]  [<ffffffff8131c209>] pci_device_probe+0x54/0xa3
[    0.303850]  [<ffffffff8144367d>] driver_probe_device+0x99/0x1c8
[    0.303916]  [<ffffffff81443841>] __driver_attach+0x5d/0x80
[    0.303980]  [<ffffffff814437e4>] ? __device_attach+0x38/0x38
[    0.305851]  [<ffffffff81441d7c>] bus_for_each_dev+0x7b/0x85
[    0.305914]  [<ffffffff81443240>] driver_attach+0x19/0x1b
[    0.305975]  [<ffffffff81442f28>] bus_add_driver+0x109/0x1d3
[    0.306038]  [<ffffffff81443c20>] driver_register+0x8a/0xc7
[    0.306141]  [<ffffffff8131bf4b>] __pci_register_driver+0x5c/0x60
[    0.306219]  [<ffffffff81d052cc>] ? ftrace_define_fields_drm_vblank_event_delivered+0x9f/0x9f
[    0.306329]  [<ffffffff813a5fa3>] drm_pci_init+0x4d/0xcd
[    0.306428]  [<ffffffff81d052cc>] ? ftrace_define_fields_drm_vblank_event_delivered+0x9f/0x9f
[    0.306505]  [<ffffffff81d05356>] i915_init+0x8a/0x92
[    0.306566]  [<ffffffff81d052cc>] ? ftrace_define_fields_drm_vblank_event_delivered+0x9f/0x9f
[    0.306650]  [<ffffffff8100030d>] do_one_initcall+0xe9/0x172
[    0.306746]  [<ffffffff81ccefb1>] kernel_init_freeable+0x117/0x19f
[    0.306827]  [<ffffffff81cce7c0>] ? initcall_blacklist+0xa3/0xa3
[    0.306926]  [<ffffffff8178e559>] ? rest_init+0xb6/0xb6
[    0.306993]  [<ffffffff8178e562>] kernel_init+0x9/0xd0
[    0.307085]  [<ffffffff8179ceec>] ret_from_fork+0x7c/0xb0
[    0.307176]  [<ffffffff8178e559>] ? rest_init+0xb6/0xb6
...
[    0.646722] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 3.19.0-rc5+ #26
[    0.646723] Hardware name: LENOVO 4286CTO/4286CTO, BIOS 8DET42WW (1.12 ) 04/01/2011
[    0.646726]  ffff8800b5aff000 ffff880139563e78 ffffffff817945db 0000000000000013

48 more lines

However, it does seem that the fix seems to cause logos to disappear for
many people. I'd be interesting to know how many of those cases were
working by luck, either by

1) an async work being ran fast enough, before the logos had been freed
2) the use of logos happening after the logos had been freed, but if no
one had trashed the logo memory yet, it still works
In my case, it looks like #1 is the case: free_initmem() was called
~6.96s into boot on the run matching the traces above, so the initdata
looks safe barring async trickery.
I don't care so much about the logo myself but people do seem to like
it, so perhaps we need to change the code as Thierry suggested:
allocating memory for the logos and keeping them in memory until someone
uses them the first time, and then free the memory.
I'm not too concerned about the pixels myself, but I was concerned
that the initialization was happening slow enough to be caught by this
(perhaps this might have been a warning sign if setting up the console
was depending unsafely on other initdata?). It is also rather obvious,
so it's something a novice like myself can easily bisect and report.

-- 
S. Gilles
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help