* [U-Boot] [PATCH 1/2] sunxi: Set SYS_MALLOC_CLEAR_ON_INIT to n @ 2015-05-05 11:21 Hans de Goede 2015-05-05 11:21 ` [U-Boot] [PATCH 2/2] console: Fix pre-console flushing via cfb_console being very slow Hans de Goede 2015-05-09 13:48 ` [U-Boot] [PATCH 1/2] sunxi: Set SYS_MALLOC_CLEAR_ON_INIT to n Ian Campbell 0 siblings, 2 replies; 6+ messages in thread From: Hans de Goede @ 2015-05-05 11:21 UTC (permalink / raw) To: u-boot We don't need this on sunxi, and not having is shaves some time of out boot time. Signed-off-by: Hans de Goede <hdegoede@redhat.com> --- board/sunxi/Kconfig | 3 +++ 1 file changed, 3 insertions(+) diff --git a/board/sunxi/Kconfig b/board/sunxi/Kconfig index bd1e988..940b6c7 100644 --- a/board/sunxi/Kconfig +++ b/board/sunxi/Kconfig @@ -549,6 +549,9 @@ config GMAC_TX_DELAY ---help--- Set the GMAC Transmit Clock Delay Chain value. +config SYS_MALLOC_CLEAR_ON_INIT + default n + config NET default y -- 2.3.6 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* [U-Boot] [PATCH 2/2] console: Fix pre-console flushing via cfb_console being very slow 2015-05-05 11:21 [U-Boot] [PATCH 1/2] sunxi: Set SYS_MALLOC_CLEAR_ON_INIT to n Hans de Goede @ 2015-05-05 11:21 ` Hans de Goede 2015-05-09 13:49 ` Ian Campbell 2015-05-10 14:07 ` Tom Rini 2015-05-09 13:48 ` [U-Boot] [PATCH 1/2] sunxi: Set SYS_MALLOC_CLEAR_ON_INIT to n Ian Campbell 1 sibling, 2 replies; 6+ messages in thread From: Hans de Goede @ 2015-05-05 11:21 UTC (permalink / raw) To: u-boot On my A10 OlinuxIno Lime I noticed a huge (5+ seconds) delay coming from console_init_r. This turns out to be caused by the preconsole buffer flushing to the cfb_console. The Lime only has a 16 bit memory bus and that is already heavy used to scan out the 1920x1080 framebuffer. The problem is that print_pre_console_buffer() was printing the buffer once character at a time and the cfb_console code then ends up doing a cache-flush for touched display lines for each character. This commit fixes this by first building a 0 terminated buffer and then printing it in one puts() call, avoiding unnecessary cache flushes. This changes the time for the flush from 5+ seconds to not noticable. The downside of this approach is that the pre-console buffer needs to fit on the stack, this is not that much to ask since we are talking about plain text here. This commit also adjusts the sunxi CONFIG_PRE_CON_BUF_SZ to actually fit on the stack. Sunxi currently is the only user of the pre-console code so no other boards need to be adjusted. Signed-off-by: Hans de Goede <hdegoede@redhat.com> --- README | 3 +++ common/console.c | 40 ++++++++++++++++++++++------------------ include/configs/sunxi-common.h | 2 +- 3 files changed, 26 insertions(+), 19 deletions(-) diff --git a/README b/README index ee65fdb..4e67c93 100644 --- a/README +++ b/README @@ -948,6 +948,9 @@ The following options need to be configured: bytes are output before the console is initialised, the earlier bytes are discarded. + Note that when printing the buffer a copy is made on the + stack so CONFIG_PRE_CON_BUF_SZ must fit on the stack. + 'Sane' compilers will generate smaller code if CONFIG_PRE_CON_BUF_SZ is a power of 2 diff --git a/common/console.c b/common/console.c index 3f25e76..0058222 100644 --- a/common/console.c +++ b/common/console.c @@ -200,15 +200,15 @@ static void console_putc(int file, const char c) } #ifdef CONFIG_PRE_CONSOLE_BUFFER -static void console_putc_noserial(int file, const char c) +static void console_puts_noserial(int file, const char *s) { int i; struct stdio_dev *dev; for (i = 0; i < cd_count[file]; i++) { dev = console_devices[file][i]; - if (dev->putc != NULL && strcmp(dev->name, "serial") != 0) - dev->putc(dev, c); + if (dev->puts != NULL && strcmp(dev->name, "serial") != 0) + dev->puts(dev, s); } } #endif @@ -251,10 +251,10 @@ static inline void console_putc(int file, const char c) } #ifdef CONFIG_PRE_CONSOLE_BUFFER -static inline void console_putc_noserial(int file, const char c) +static inline void console_puts_noserial(int file, const char *s) { if (strcmp(stdio_devices[file]->name, "serial") != 0) - stdio_devices[file]->putc(stdio_devices[file], c); + stdio_devices[file]->puts(stdio_devices[file], s); } #endif @@ -425,22 +425,26 @@ static void pre_console_puts(const char *s) static void print_pre_console_buffer(int flushpoint) { - unsigned long i = 0; - char *buffer = (char *)CONFIG_PRE_CON_BUF_ADDR; + unsigned long in = 0, out = 0; + char *buf_in = (char *)CONFIG_PRE_CON_BUF_ADDR; + char buf_out[CONFIG_PRE_CON_BUF_SZ + 1]; if (gd->precon_buf_idx > CONFIG_PRE_CON_BUF_SZ) - i = gd->precon_buf_idx - CONFIG_PRE_CON_BUF_SZ; + in = gd->precon_buf_idx - CONFIG_PRE_CON_BUF_SZ; - while (i < gd->precon_buf_idx) - switch (flushpoint) { - case PRE_CONSOLE_FLUSHPOINT1_SERIAL: - putc(buffer[CIRC_BUF_IDX(i++)]); - break; - case PRE_CONSOLE_FLUSHPOINT2_EVERYTHING_BUT_SERIAL: - console_putc_noserial(stdout, - buffer[CIRC_BUF_IDX(i++)]); - break; - } + while (in < gd->precon_buf_idx) + buf_out[out++] = buf_in[CIRC_BUF_IDX(in++)]; + + buf_out[out] = 0; + + switch (flushpoint) { + case PRE_CONSOLE_FLUSHPOINT1_SERIAL: + puts(buf_out); + break; + case PRE_CONSOLE_FLUSHPOINT2_EVERYTHING_BUT_SERIAL: + console_puts_noserial(stdout, buf_out); + break; + } } #else static inline void pre_console_putc(const char c) {} diff --git a/include/configs/sunxi-common.h b/include/configs/sunxi-common.h index c78141e..5d77e71 100644 --- a/include/configs/sunxi-common.h +++ b/include/configs/sunxi-common.h @@ -402,7 +402,7 @@ extern int soft_i2c_gpio_scl; /* Enable pre-console buffer to get complete log on the VGA console */ #define CONFIG_PRE_CONSOLE_BUFFER -#define CONFIG_PRE_CON_BUF_SZ (1024 * 1024) +#define CONFIG_PRE_CON_BUF_SZ 4096 /* Aprox 2 80*25 screens */ #ifdef CONFIG_MMC #define BOOT_TARGET_DEVICES_MMC(func) func(MMC, mmc, 0) #else -- 2.3.6 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* [U-Boot] [PATCH 2/2] console: Fix pre-console flushing via cfb_console being very slow 2015-05-05 11:21 ` [U-Boot] [PATCH 2/2] console: Fix pre-console flushing via cfb_console being very slow Hans de Goede @ 2015-05-09 13:49 ` Ian Campbell 2015-05-09 15:53 ` Hans de Goede 2015-05-10 14:07 ` Tom Rini 1 sibling, 1 reply; 6+ messages in thread From: Ian Campbell @ 2015-05-09 13:49 UTC (permalink / raw) To: u-boot On Tue, 2015-05-05 at 13:21 +0200, Hans de Goede wrote: > On my A10 OlinuxIno Lime I noticed a huge (5+ seconds) delay coming from > console_init_r. This turns out to be caused by the preconsole buffer flushing > to the cfb_console. The Lime only has a 16 bit memory bus and that is already > heavy used to scan out the 1920x1080 framebuffer. > > The problem is that print_pre_console_buffer() was printing the buffer once > character at a time and the cfb_console code then ends up doing a cache-flush > for touched display lines for each character. > > This commit fixes this by first building a 0 terminated buffer and then > printing it in one puts() call, avoiding unnecessary cache flushes. > > This changes the time for the flush from 5+ seconds to not noticable. > > The downside of this approach is that the pre-console buffer needs to fit > on the stack, this is not that much to ask since we are talking about plain > text here. This commit also adjusts the sunxi CONFIG_PRE_CON_BUF_SZ to > actually fit on the stack. Sunxi currently is the only user of the pre-console > code so no other boards need to be adjusted. > > Signed-off-by: Hans de Goede <hdegoede@redhat.com> > --- > README | 3 +++ > common/console.c | 40 ++++++++++++++++++++++------------------ I think you need an ack from the maintainer of this file more than you do from me. I'm happy for you to enable this option if that maintainer is happy for it to exist in the first place. > include/configs/sunxi-common.h | 2 +- > 3 files changed, 26 insertions(+), 19 deletions(-) > [...] > diff --git a/include/configs/sunxi-common.h b/include/configs/sunxi-common.h > index c78141e..5d77e71 100644 > --- a/include/configs/sunxi-common.h > +++ b/include/configs/sunxi-common.h > @@ -402,7 +402,7 @@ extern int soft_i2c_gpio_scl; > > /* Enable pre-console buffer to get complete log on the VGA console */ > #define CONFIG_PRE_CONSOLE_BUFFER > -#define CONFIG_PRE_CON_BUF_SZ (1024 * 1024) > +#define CONFIG_PRE_CON_BUF_SZ 4096 /* Aprox 2 80*25 screens */ "Approx". ^ permalink raw reply [flat|nested] 6+ messages in thread
* [U-Boot] [PATCH 2/2] console: Fix pre-console flushing via cfb_console being very slow 2015-05-09 13:49 ` Ian Campbell @ 2015-05-09 15:53 ` Hans de Goede 0 siblings, 0 replies; 6+ messages in thread From: Hans de Goede @ 2015-05-09 15:53 UTC (permalink / raw) To: u-boot Hi, On 09-05-15 15:49, Ian Campbell wrote: > On Tue, 2015-05-05 at 13:21 +0200, Hans de Goede wrote: >> On my A10 OlinuxIno Lime I noticed a huge (5+ seconds) delay coming from >> console_init_r. This turns out to be caused by the preconsole buffer flushing >> to the cfb_console. The Lime only has a 16 bit memory bus and that is already >> heavy used to scan out the 1920x1080 framebuffer. >> >> The problem is that print_pre_console_buffer() was printing the buffer once >> character at a time and the cfb_console code then ends up doing a cache-flush >> for touched display lines for each character. >> >> This commit fixes this by first building a 0 terminated buffer and then >> printing it in one puts() call, avoiding unnecessary cache flushes. >> >> This changes the time for the flush from 5+ seconds to not noticable. >> >> The downside of this approach is that the pre-console buffer needs to fit >> on the stack, this is not that much to ask since we are talking about plain >> text here. This commit also adjusts the sunxi CONFIG_PRE_CON_BUF_SZ to >> actually fit on the stack. Sunxi currently is the only user of the pre-console >> code so no other boards need to be adjusted. >> >> Signed-off-by: Hans de Goede <hdegoede@redhat.com> >> --- >> README | 3 +++ >> common/console.c | 40 ++++++++++++++++++++++------------------ > > I think you need an ack from the maintainer of this file more than you > do from me. I'm happy for you to enable this option if that maintainer > is happy for it to exist in the first place. I do not believe that anyone is actively maintaining this file. Last time we had changes to it we upstreamed them through the sunxi tree with Tom's ack. Tom can we have your ack for this patch ? : http://patchwork.ozlabs.org/patch/468076/ >> include/configs/sunxi-common.h | 2 +- >> 3 files changed, 26 insertions(+), 19 deletions(-) >> [...] >> diff --git a/include/configs/sunxi-common.h b/include/configs/sunxi-common.h >> index c78141e..5d77e71 100644 >> --- a/include/configs/sunxi-common.h >> +++ b/include/configs/sunxi-common.h >> @@ -402,7 +402,7 @@ extern int soft_i2c_gpio_scl; >> >> /* Enable pre-console buffer to get complete log on the VGA console */ >> #define CONFIG_PRE_CONSOLE_BUFFER >> -#define CONFIG_PRE_CON_BUF_SZ (1024 * 1024) >> +#define CONFIG_PRE_CON_BUF_SZ 4096 /* Aprox 2 80*25 screens */ > > "Approx". Will fix. Regards, Hans ^ permalink raw reply [flat|nested] 6+ messages in thread
* [U-Boot] [PATCH 2/2] console: Fix pre-console flushing via cfb_console being very slow 2015-05-05 11:21 ` [U-Boot] [PATCH 2/2] console: Fix pre-console flushing via cfb_console being very slow Hans de Goede 2015-05-09 13:49 ` Ian Campbell @ 2015-05-10 14:07 ` Tom Rini 1 sibling, 0 replies; 6+ messages in thread From: Tom Rini @ 2015-05-10 14:07 UTC (permalink / raw) To: u-boot On Tue, May 05, 2015 at 01:21:07PM +0200, Hans de Goede wrote: > On my A10 OlinuxIno Lime I noticed a huge (5+ seconds) delay coming from > console_init_r. This turns out to be caused by the preconsole buffer flushing > to the cfb_console. The Lime only has a 16 bit memory bus and that is already > heavy used to scan out the 1920x1080 framebuffer. > > The problem is that print_pre_console_buffer() was printing the buffer once > character at a time and the cfb_console code then ends up doing a cache-flush > for touched display lines for each character. > > This commit fixes this by first building a 0 terminated buffer and then > printing it in one puts() call, avoiding unnecessary cache flushes. > > This changes the time for the flush from 5+ seconds to not noticable. > > The downside of this approach is that the pre-console buffer needs to fit > on the stack, this is not that much to ask since we are talking about plain > text here. This commit also adjusts the sunxi CONFIG_PRE_CON_BUF_SZ to > actually fit on the stack. Sunxi currently is the only user of the pre-console > code so no other boards need to be adjusted. > > Signed-off-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Tom Rini <trini@konsulko.com> -- Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150510/68027e43/attachment.sig> ^ permalink raw reply [flat|nested] 6+ messages in thread
* [U-Boot] [PATCH 1/2] sunxi: Set SYS_MALLOC_CLEAR_ON_INIT to n 2015-05-05 11:21 [U-Boot] [PATCH 1/2] sunxi: Set SYS_MALLOC_CLEAR_ON_INIT to n Hans de Goede 2015-05-05 11:21 ` [U-Boot] [PATCH 2/2] console: Fix pre-console flushing via cfb_console being very slow Hans de Goede @ 2015-05-09 13:48 ` Ian Campbell 1 sibling, 0 replies; 6+ messages in thread From: Ian Campbell @ 2015-05-09 13:48 UTC (permalink / raw) To: u-boot On Tue, 2015-05-05 at 13:21 +0200, Hans de Goede wrote: > We don't need this on sunxi, Please say why here. I assume something like "we always use calloc or memset when initialised memory is required"? > and not having is shaves some time of out boot > time. > > Signed-off-by: Hans de Goede <hdegoede@redhat.com> With that added: Acked-by: Ian Campbell <ijc@hellion.org.uk> ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2015-05-10 14:07 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2015-05-05 11:21 [U-Boot] [PATCH 1/2] sunxi: Set SYS_MALLOC_CLEAR_ON_INIT to n Hans de Goede 2015-05-05 11:21 ` [U-Boot] [PATCH 2/2] console: Fix pre-console flushing via cfb_console being very slow Hans de Goede 2015-05-09 13:49 ` Ian Campbell 2015-05-09 15:53 ` Hans de Goede 2015-05-10 14:07 ` Tom Rini 2015-05-09 13:48 ` [U-Boot] [PATCH 1/2] sunxi: Set SYS_MALLOC_CLEAR_ON_INIT to n Ian Campbell
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox