[Intel-gfx] [PATCH 1/2] drm/i915: Make the device_info structure __initconst

Damien Lespiau damien.lespiau at intel.com
Thu Jul 10 23:47:21 CEST 2014


On Thu, Jul 10, 2014 at 10:25:27PM +0200, Daniel Vetter wrote:
> On Thu, Jul 10, 2014 at 02:52:42PM +0100, Damien Lespiau wrote:
> > We don't need them past the module initialization as the correct
> > structure is copied into dev_priv in ->load(), called from
> > drm_pci_init(), called from the module init funtion.
> > 
> > I'm always hesitant about adding new members to struct intel_device_info
> > because it will add 30+ * sizeof(member) bytes to the driver. However,
> > if we can discard those table after init(), it changes everything.
> > 
> > After this change, the driver has a new .init.rodata section contains
> > the structures in question and .rodata has now 2848 fewer bytes.
> > 
> > lsmod shows -5425 bytes in its size field between before and after this
> > change. Not too sure why this (Vs the 2848 bytes lost in .rodata), but
> > that's enough for me.
> > 
> > Signed-off-by: Damien Lespiau <damien.lespiau at intel.com>
> 
> You want devinintconst which is being phased out afaik ... Currently the
> driver gets probed synchronously but you kinda never know what the device
> core people are up to:
> - init = removed after the module is loaded.
> - devinit = removed after the driver is initilialized, and never for
>   CONFIG_HOTPLUG=y.
> 
> If we want to trim down the size of our driver, especially on specific
> platforms we imo should have a) link time optimization b) some
> heavy-handed macro to return a static device info c) a much more clever
> gcc since last time I've tried this it failed to kick out large swats of
> code like all the dvo crap. Despite that it was clearly unreachable :(

Sigh, I followed the !DRIVER_MODESET code path, I am very sad now.

I was thinking about having a Kconfig option to select a specific
platform to compile the driver for and, by trying to make that work, we
could end up with a nice per-platform split of the code. Would people be
totally opposed to such a thing?

-- 
Damien



More information about the Intel-gfx mailing list