Some corrections on archosG9
Subsystems (2)
cover Some corrections on archosG9
In the patch series for archosG9 there were an attempt to improve file transfers by reading files at once, but finally this solution was discarded. Today I've checked the repository and found this solution there, perhaps this is a misunderstanding and it's corrected here.
Sorry for not checking before.
The other change is just the inverse: a submitted patch that was not applied.
Vicente Bergas (2):
uimage: fix misunderstanding in common/uimage.c
archosg9: improve configuration
arch/arm/boards/archosg9/env/config | 4 +++- arch/arm/boards/archosg9/env/init/usbboot | 9 +++++---- arch/arm/configs/archosg9_defconfig | 2 +- common/uimage.c | 24 ------------------------ 4 files changed, 9 insertions(+), 30 deletions(-)
Signature · 7 lines
1.8.0 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH 1/2 uimage: fix misunderstanding in common/uimage.c
The option of reading the file at once was discarded because the option of increasing the buffer size provided almost the same benefit.
--- common/uimage.c | 24 ------------------------ 1 file changed, 24 deletions(-)
common/uimage.c +0 -24
@@ -28,8 +28,6 @@#include <rtc.h> #include <filetype.h> #include <memory.h> -#include <linux/stat.h> -#include <sizes.h> #ifdef CONFIG_UIMAGE_MULTI static inline int uimage_is_multi_image (struct uimage_handle *handle)
@@ -384,33 +382,11 @@ struct resource *file_to_sdram(const char *filename, unsigned long adr)size_t ofs =0 ;size_t now;int fd; -struct stat s; fd =open (filename,O_RDONLY );if (fd <0 )return NULL ; -/* TODO: use fstat(fd, &s) when implemented and avoid reopening file */ -if (stat (filename, &s) ==0 && s.st_size <=SZ_1G ) { -/* -* As the file size is known we can read it at once and improve -* transfer speed. -*/ - size = s.st_size; - res =request_sdram_region ("image" , adr, size); -if (!res) { -printf ("unable to request SDRAM 0x%08lx-0x%08lx\n" , - adr, adr + size -1 ); - goto out; - } - - now =read_full (fd, (void *)(res->start), size); -if (now < size) { -release_sdram_region (res); - res =NULL ; - } - goto out; - }while (1 ) { res =request_sdram_region ("image" , adr, size);if (!res) {
Signature · 7 lines
1.8.0 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH 2/2 archosg9: improve configuration
In reply to Vicente Bergas--- arch/arm/boards/archosg9/env/config | 4 +++- arch/arm/boards/archosg9/env/init/usbboot | 9 +++++---- arch/arm/configs/archosg9_defconfig | 2 +- 3 files changed, 9 insertions(+), 6 deletions(-)
arch/arm/boards/archosg9/env/config +3 -1
@@ -1 +1,3 @@ -global.linux.bootargs.base="earlyprintk=serial console=ttyO1,1000000n8 keep_bootcon pm_disable initcall_debug ignore_loglevel no_console_suspend=1 root=/dev/ram0 init=/linuxrc" +global.bootm.image="${TARGET_ROOT}/boot/zImage" +global.bootm.initrd="${TARGET_ROOT}/boot/initrd" +global.linux.bootargs.base="console=ttyO0,115200n8 root=/dev/ram0"
arch/arm/boards/archosg9/env/init/usbboot +5 -4
@@ -1,5 +1,6 @@ -mkdir /usb -mount -t omap4_usbbootfs omap4_usbboot /usb +TARGET_ROOT="/mnt/usb" +mkdir ${TARGET_ROOT} +mount -t omap4_usbbootfs omap4_usbboot ${TARGET_ROOT} . /env/config -. /usb/boot/config -bootm -r /usb/boot/initrd /usb/boot/zImage +. ${TARGET_ROOT}/boot/config +bootm
arch/arm/configs/archosg9_defconfig +1 -1
@@ -55,7 +55,7 @@ CONFIG_CMD_I2C=y CONFIG_DRIVER_SERIAL_OMAP4_USBBOOT=y CONFIG_DRIVER_SERIAL_NS16550=y CONFIG_DRIVER_SERIAL_NS16550_OMAP_EXTENSIONS=y -CONFIG_BAUDRATE=1000000 +CONFIG_BAUDRATE=115200 # CONFIG_SPI is not set CONFIG_I2C=y CONFIG_I2C_OMAP=y
Signature · 7 lines
1.8.0 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Re: [PATCH 1/2] uimage: fix misunderstanding in common/uimage.c
In reply to Vicente BergasQuoted 3 lines · Vicente Bergas
The option of reading the file at once was discarded because the option of increasing the buffer size provided almost the same benefit.
nack
this is mandatory for tftp fs support
Best Regarfd,
J.
Quoted 61 lines
Signed-off-by Vicente Bergas <[email protected]>--- common/uimage.c | 24 ------------------------ 1 file changed, 24 deletions(-)common/uimage.c +0
-24@@ -28,8 +28,6 @@#include <rtc.h> #include <filetype.h> #include <memory.h> -#include <linux/stat.h> -#include <sizes.h> #ifdef CONFIG_UIMAGE_MULTI static inline int uimage_is_multi_image (struct uimage_handle *handle)@@ -384,33 +382,11 @@ struct resource *file_to_sdram(const char *filename, unsigned long adr)size_t ofs =0 ;size_t now;int fd; -struct stat s; fd =open (filename,O_RDONLY );if (fd <0 )return NULL ; -/* TODO: use fstat(fd, &s) when implemented and avoid reopening file */ -if (stat (filename, &s) ==0 && s.st_size <=SZ_1G ) { -/* -* As the file size is known we can read it at once and improve -* transfer speed. -*/ - size = s.st_size; - res =request_sdram_region ("image" , adr, size); -if (!res) { -printf ("unable to request SDRAM 0x%08lx-0x%08lx\n" , - adr, adr + size -1 ); - goto out; - } - - now =read_full (fd, (void *)(res->start), size); -if (now < size) { -release_sdram_region (res); - res =NULL ; - } - goto out; - }while (1 ) { res =request_sdram_region ("image" , adr, size);if (!res) {Signature · 7 lines
1.8.0 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Re: [PATCH 1/2] uimage: fix misunderstanding in common/uimage.c
Quoted 10 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 3 lines · Vicente Bergas
The option of reading the file at once was discarded because the option of increasing the buffer size provided almost the same benefit.
nack
this is mandatory for tftp fs support
Best Regarfd,
J.
I'll try to explain it more clearly:
Firstly file_to_sdram read files a chunck of 2 pages at a time because not all file systems (e.g. TFTP) didn't report the file size. This provided a slow transfer speed, because the overhead of reading each chunck is nonzero.
So I proposed a First patch to file_to_sdram which first checked for a known/correct file size. If the file size was unknown/incorrect the original method was still used (so TFTP worked), else the whole file was read at once.
Sascha Hauer proposed an alternative to this First patch of only increase the chunck size, which, after benchmarking, was set to 32 pages and was considered a reasonable size. This was the Second patch to file_to_sdram.
The performance between the First and the Second patches was comparable, so the First was discarded in favor of the Second, which is much more simple.
But yesterday I checked and found both patches were applied in git master. Hope this clarifies the issue.
Best Regards,
Vicente.
Quoted 57 lines
Quoted 57 lines
Signed-off-by Vicente Bergas <[email protected]>--- common/uimage.c | 24 ------------------------ 1 file changed, 24 deletions(-)common/uimage.c +0
-25@@ -28,8 +28,6 @@#include <rtc.h> #include <filetype.h> #include <memory.h> -#include <linux/stat.h> -#include <sizes.h> #ifdef CONFIG_UIMAGE_MULTI static inline int uimage_is_multi_image (struct uimage_handle *handle)@@ -384,33 +382,11 @@ struct resource *file_to_sdram(const char *filename, unsigned long adr)size_t ofs =0 ;size_t now;int fd; -struct stat s; fd =open (filename,O_RDONLY );if (fd <0 )return NULL ; -/* TODO: use fstat(fd, &s) when implemented and avoid reopening file */ -if (stat (filename, &s) ==0 && s.st_size <=SZ_1G ) { -/* -* As the file size is known we can read it at once and improve -* transfer speed. -*/ - size = s.st_size; - res =request_sdram_region ("image" , adr, size); -if (!res) { -printf ("unable to request SDRAM 0x%08lx-0x%08lx\n" , - adr, adr + size -1 ); - goto out; - } - - now =read_full (fd, (void *)(res->start), size); -if (now < size) { -release_sdram_region (res); - res =NULL ; - } - goto out; - }while (1 ) { res =request_sdram_region ("image" , adr, size);if (!res) { --1.8.0
Quoted 4 lines
Quoted 4 lines
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Sascha Hauer
AppliedQuoted 12 lines · Vicente Bergas
In the patch series for archosG9 there were an attempt to improve file transfers by reading files at once, but finally this solution was discarded. Today I've checked the repository and found this solution there, perhaps this is a misunderstanding and it's corrected here.
Sorry for not checking before.The other change is just the inverse: a submitted patch that was not applied.
Vicente Bergas (2):
uimage: fix misunderstanding incommon/uimage.c
archosg9: improve configuration
Quoted 5 lines
arch/arm/boards/archosg9/env/config | 4 +++- arch/arm/boards/archosg9/env/init/usbboot | 9 +++++---- arch/arm/configs/archosg9_defconfig | 2 +- common/uimage.c | 24 ------------------------ 4 files changed, 9 insertions(+), 30 deletions(-)
Applied, thanks
As a side note, I still have this patch in my queue which fixes read_file for tftp severs which do not pass the size. My tftp server at home is one of these, I'll repost the patch once I tested it again.
Sascha
From 1508618b3bc53abf122b9c7473f468e67b391b19 Mon Sep 17 00:00:00 2001
From: Sascha Hauer <[email protected]>
Date: Sun, 18 Mar 2012 17:59:46 +0100
Subject: [PATCH] read_file: Make it work on tftp servers which do not pass
size
--- fs/fs.c | 11 +++++++++++ fs/tftp.c | 5 ++++- include/fs.h | 2 ++ 3 files changed, 17 insertions(+), 1 deletion(-)
fs/fs.c +11 -0
@@ -41,10 +41,21 @@ void *read_file(const char *filename, size_t *size)int fd;struct stat s;void *buf =NULL ; +const char *tmpfile ="/_read_file_tmp" ; +int ret; +again:if (stat (filename, &s))return NULL ; +if (s.st_size ==FILESIZE_MAX ) { + ret =copy_file (filename, tmpfile,0 ); +if (ret) +return NULL ; + filename = tmpfile; + goto again; + } + buf =xzalloc (s.st_size +1 ); fd =open (filename,O_RDONLY );
fs/tftp.c +4 -1
@@ -590,7 +590,10 @@ static int tftp_stat(struct device_d *dev, const char *filename, struct stat *s)return PTR_ERR (priv); s->st_mode =S_IFREG |S_IRWXU |S_IRWXG |S_IRWXO ; - s->st_size = priv->filesize; +if (priv->filesize) + s->st_size = priv->filesize; +else + s->st_size =FILESIZE_MAX ;tftp_do_close (priv);
include/fs.h +2 -0
@@ -147,6 +147,8 @@ int protect(int fd, size_t count, unsigned long offset, int prot);int protect_file (const char *file,int prot);void *memmap (int fd,int flags); +#define FILESIZE_MAX ((size_t)-1) +#define PROT_READ 1#define PROT_WRITE 2
Signature · 12 lines
1.7.10.4 -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox