All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Glass <sjg@chromium.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 0/57] RFC: Move arch-specific global data into its own structure
Date: Wed, 5 Dec 2012 16:33:34 -0800	[thread overview]
Message-ID: <CAPnjgZ3OPNbbruWy81md5z-b-2fp9xAhd_RFrpjcf9NVU9Nkaw@mail.gmail.com> (raw)
In-Reply-To: <CALButC+PqjsBeQYM7HAJvTftebNe01NjryKmOz0-nKPGQ5aYAQ@mail.gmail.com>

Hi,

On Tue, Dec 4, 2012 at 5:14 PM, Graeme Russ <graeme.russ@gmail.com> wrote:
> Hi Wolfgang,
>
> On Wed, Dec 5, 2012 at 6:25 AM, Wolfgang Denk <wd@denx.de> wrote:
>> Dear Simon Glass,
>>
>> In message <CAPnjgZ2KVHV6JCvOjiQBrXFCfHMeWfEfj9bLHFw_Qyf5_7dj8Q@mail.gmail.com> you wrote:
>>>
>>> > To be honest, I think gd should only be a temporary structure used to
>>> > carry specific data through the initialisation process up to the point
>>> > BSS becomes available. With the 'early malloc' patches in the
>>> > pipeline, it might even be possible to malloc the gd structure early
>>> > and then when BSS is available, copy the data into the final global
>>> > data structure in BSS. I think that would be complicated by functions
>>> > that need to use gd both before and after BSS becomes available.
>>>
>>> I mostly agree, but that sounds like an exercise in removing fields
>>> from the gd one by one in the source code. The bit I am not sure of is
>>> whether it is useful for gd to hang around post relocation to provide
>>> access to the data that was decided on early in boot (after all, the
>>> position in memory of gd changes post relocation, so why maintain two
>>> structures for the same info?).
>>
>> Sure.  If you look back how this developed, then initially there was
>> only struct bd_info.  Then it turned out that it costs too much of
>> code size (and performance, actually) to pass around the same struct
>> as parameter to about each and every functiuon, so I invented GD - wit
>> the intention to drop it as soon as writable global data becomes
>> available, i. e. after relocation.  I even think the first versions
>> worked that way.  Only later that code code optimized because it
>> seemed easier to keep this struct and be able to use the same code
>> before and after relocation.  And open Pandora's box was...
>
> Yes, the old 'cost versus complexity' problem. Seriously, take a look at
> arch/x86/lib/board.c, it's nice and clean and give a good view of how we
> can move forward.
>
> For starters, the functions listed in init_sequence_f and init_sequence_f_r
> never need to be copied into RAM (there are functions they call that may
> need to be though). Like the Linux kernel, these can be moved into a
> dedicated linker section and not copied (and their relocation entries can
> be skipped as well). For x86, there are not a lot of functions in these
> two lists. Maybe these can have 'gd' passed to them
>
> init_sequence_r is the big list so passing 'gd' to each of these will
> result in massive code bloat. But by this stage, we have BSS, so global
> data is writable and there is no need to pass gd.
>
> BSS is actually available during the processing of init_sequence_f_r,
> so in theory it would be possible to copy data from gd (used during
> init_sequence_f) into BSS during the processing of init_sequence_f_r
>
> All that would be left is dealing with the (handful?) of functions that
> are called from both init_sequence_f and init_sequence_r (I doubt any
> common functions will be called during init_sequence_f_r). One option
> may be to pass a point to gd to these functions. If it is NULL, use
> the variable in BSS, otherwise use gd.

Sounds reasonable to me.

I modified buildman to summarise image sizes for each architecture.
Here are the code size results:

       x86: (3 boards)   text -26.7
   sandbox: (1 boards)   text +64.0   bss +96.0
      m68k: (50 boards)   text +1.5
   powerpc: (621 boards)   text +2.4   data +0.0
        sh: (20 boards)   text +14.4
microblaze: (1 boards)   text -24.0   bss -8.0
       arm: (283 boards)   spl/u-boot-spl:text -0.2   text -21.5
spl/u-boot-spl:data +4.8   bss +0.5
     nds32: (3 boards)   text -8.0

The numbers indicate the average number of bytes increase(+) or
decrease(-) with this series applied, for each element of the image
size. So for example, powerpc text increases by an average of 2.4
bytes, ARM text reduces by an average of 21.5 bytes. ARM spl data
increases by an average of 4.8 bytes.

To me this doesn't seem very significant and the differences are minor.

Regards,
Simon

>
> Regards,
>
> Graeme

  reply	other threads:[~2012-12-06  0:33 UTC|newest]

Thread overview: 78+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-16 21:19 [U-Boot] [PATCH 0/57] RFC: Move arch-specific global data into its own structure Simon Glass
2012-11-16 21:19 ` [U-Boot] [PATCH 01/57] Add architecture-specific global data Simon Glass
2012-11-16 21:19 ` [U-Boot] [PATCH 02/57] at91: Move at91 global data into arch_global_data Simon Glass
2012-11-16 21:19 ` [U-Boot] [PATCH 03/57] arm: Move timer_rate_hz " Simon Glass
2012-11-16 21:19 ` [U-Boot] [PATCH 04/57] arm: Move tbu to arch_global_data Simon Glass
2012-11-16 21:19 ` [U-Boot] [PATCH 05/57] arm: Move tbl " Simon Glass
2012-11-16 21:19 ` [U-Boot] [PATCH 06/57] arm: Move lastinc " Simon Glass
2012-11-16 21:19 ` [U-Boot] [PATCH 07/57] arm: Move timer_reset_value " Simon Glass
2012-11-16 21:19 ` [U-Boot] [PATCH 08/57] ixp: Move timestamp " Simon Glass
2012-11-16 22:22   ` Marek Vasut
2012-11-16 21:19 ` [U-Boot] [PATCH 09/57] nds32: Drop tlb_addr from global data Simon Glass
2012-11-16 21:19 ` [U-Boot] [PATCH 10/57] arm: Move tlb_addr to arch_global_data Simon Glass
2012-11-16 21:19 ` [U-Boot] [PATCH 11/57] x86: Move gdt_addr, new_gd_addr " Simon Glass
2012-11-16 21:19 ` [U-Boot] [PATCH 12/57] x86: Remove reset_status, relocoff from global_data Simon Glass
2012-11-16 21:19 ` [U-Boot] [PATCH 13/57] x86: Move new_gd_addr to arch_global_data Simon Glass
2012-11-18  1:07   ` Graeme Russ
2012-12-14  6:34     ` Simon Glass
2012-11-16 21:19 ` [U-Boot] [PATCH 14/57] ppc: Move brg_clk " Simon Glass
2012-11-16 21:20 ` [U-Boot] [PATCH 15/57] ppc: Remove extra pci_clk fields from global_data Simon Glass
2012-11-16 21:20 ` [U-Boot] [PATCH 16/57] ppc: Move clock fields to arch_global_data Simon Glass
2012-11-16 21:20 ` [U-Boot] [PATCH 17/57] ppc: Move mpc83xx " Simon Glass
2012-11-16 21:20 ` [U-Boot] [PATCH 18/57] ppc: Move lbc_clk and cpu " Simon Glass
2012-11-16 21:20 ` [U-Boot] [PATCH 19/57] ppc: m68k: Move i2c1_clk, i2c2_clk " Simon Glass
2012-11-16 21:20 ` [U-Boot] [PATCH 20/57] ppc: Move CONFIG_QE " Simon Glass
2012-11-16 21:20 ` [U-Boot] [PATCH 21/57] ppc: Move used_laws " Simon Glass
2012-11-16 21:20 ` [U-Boot] [PATCH 22/57] ppc: Move used_tlb_cams " Simon Glass
2012-11-16 21:20 ` [U-Boot] [PATCH 23/57] ppc: Move mpc5xxx clocks " Simon Glass
2012-11-16 21:20 ` [U-Boot] [PATCH 24/57] ppc: Move mpc512x " Simon Glass
2012-11-16 21:20 ` [U-Boot] [PATCH 25/57] ppc: Move mpc8220 " Simon Glass
2012-11-16 21:20 ` [U-Boot] [PATCH 26/57] ppc: Move reset_status " Simon Glass
2012-11-16 21:20 ` [U-Boot] [PATCH 27/57] ppc: Move arbiter fields " Simon Glass
2012-11-16 21:20 ` [U-Boot] [PATCH 28/57] ppc: Move dp_alloc_base, dp_alloc_top " Simon Glass
2012-11-16 21:20 ` [U-Boot] [PATCH 29/57] arm: Move uart_clk " Simon Glass
2012-11-16 21:20 ` [U-Boot] [PATCH 30/57] ppc: Move mirror_hack " Simon Glass
2012-11-16 21:20 ` [U-Boot] [PATCH 31/57] ppc: Remove console_addr from global data Simon Glass
2012-11-16 21:20 ` [U-Boot] [PATCH 32/57] ppc: Move fpga_state to arch_global_data Simon Glass
2012-11-16 21:20 ` [U-Boot] [PATCH 33/57] ppc: Move wdt_last " Simon Glass
2012-11-16 21:20 ` [U-Boot] [PATCH 34/57] ppc: Move kbd_status " Simon Glass
2012-11-16 21:20 ` [U-Boot] [PATCH 35/57] ppc: arm: Move sdhc_clk into arch_global_data Simon Glass
2012-11-16 21:20 ` [U-Boot] [PATCH 36/57] sparc: Drop kbd_status and reset_status from global_data Simon Glass
2012-11-16 21:20 ` [U-Boot] [PATCH 37/57] m68k: Move CONFIG_EXTRA_CLOCK to arch_global_data Simon Glass
2012-11-16 21:20 ` [U-Boot] [PATCH 38/57] mips: Move per_clk and dev_clk " Simon Glass
2012-11-16 21:20 ` [U-Boot] [PATCH 39/57] avr32: Move stack_end " Simon Glass
2012-11-16 21:20 ` [U-Boot] [PATCH 40/57] avr32: Move cpu_hz " Simon Glass
2012-11-16 21:20 ` [U-Boot] [PATCH 41/57] sandbox: Move ram_buf " Simon Glass
2012-11-16 21:20 ` [U-Boot] [PATCH 42/57] Add generic global_data Simon Glass
2012-11-16 21:20 ` [U-Boot] [PATCH 43/57] Only use fb_base if we have a display Simon Glass
2012-11-16 21:20 ` [U-Boot] [PATCH 44/57] arm: Use generic global_data Simon Glass
2012-11-16 21:20 ` [U-Boot] [PATCH 45/57] avr32: " Simon Glass
2012-11-16 21:20 ` [U-Boot] [PATCH 46/57] blackfin: " Simon Glass
2012-11-16 21:20 ` [U-Boot] [PATCH 47/57] m68k: " Simon Glass
2012-11-16 21:20 ` [U-Boot] [PATCH 48/57] microblaze: " Simon Glass
2012-11-16 21:20 ` [U-Boot] [PATCH 49/57] mips: " Simon Glass
2012-11-16 21:20 ` [U-Boot] [PATCH 50/57] nds32: " Simon Glass
2012-11-16 21:20 ` [U-Boot] [PATCH 51/57] nios2: " Simon Glass
2012-11-20  4:01   ` Thomas Chou
2012-11-16 21:20 ` [U-Boot] [PATCH 52/57] openrisc: " Simon Glass
2012-11-16 21:20 ` [U-Boot] [PATCH 53/57] powerpc: " Simon Glass
2012-11-16 21:20 ` [U-Boot] [PATCH 54/57] sandbox: " Simon Glass
2012-11-16 21:20 ` [U-Boot] [PATCH 55/57] sh: " Simon Glass
2012-11-16 21:20 ` [U-Boot] [PATCH 56/57] sparc: " Simon Glass
2012-11-16 21:20 ` [U-Boot] [PATCH 57/57] x86: " Simon Glass
2012-11-20  7:25 ` [U-Boot] [PATCH 0/57] RFC: Move arch-specific global data into its own structure Wolfgang Denk
2012-11-20 14:06   ` Simon Glass
2012-11-28 23:57     ` Simon Glass
2012-12-03 14:54     ` Tom Rini
2012-12-03 22:02       ` Graeme Russ
2012-12-03 22:19         ` Simon Glass
2012-12-03 23:39           ` Tom Rini
2012-12-03 23:45             ` Graeme Russ
2012-12-04 19:27               ` Wolfgang Denk
2012-12-05  0:02                 ` Simon Glass
2012-12-04 19:25           ` Wolfgang Denk
2012-12-05  1:14             ` Graeme Russ
2012-12-06  0:33               ` Simon Glass [this message]
2012-12-04 19:05         ` Wolfgang Denk
2012-12-04 19:20       ` Wolfgang Denk
2012-12-04 19:17     ` Wolfgang Denk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAPnjgZ3OPNbbruWy81md5z-b-2fp9xAhd_RFrpjcf9NVU9Nkaw@mail.gmail.com \
    --to=sjg@chromium.org \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.