mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 0/2] USB fastboot onto eMMC: make 30% faster!
@ 2020-02-27 16:58 Ahmad Fatoum
  2020-02-27 16:58 ` [PATCH 1/2] usb: gadget: fastboot: call discard_range for sparse files as well Ahmad Fatoum
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Ahmad Fatoum @ 2020-02-27 16:58 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

I got a 2.9G image that I flash via fastboot to the eMMC and that takes
quite a while on my i.MX6Q.

Instead of fixing my image generation to make proper use of the sparse
format's don't care chunk types to save oneself from writing all these
holes at the end of the partitions, I went the easy route by tweaking the
block layer a bit:

barebox v2020.02.0: 445s
With first patch:   376s
With second patch:  300s

Of these 300s, 180s are spent writing zeroes...

Cheers,
Ahmad Fatoum (2):
  usb: gadget: fastboot: call discard_range for sparse files as well
  Revert "block: Adjust cache sizes"

 common/block.c                  | 4 ++--
 drivers/usb/gadget/f_fastboot.c | 2 ++
 2 files changed, 4 insertions(+), 2 deletions(-)

-- 
2.25.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/2] usb: gadget: fastboot: call discard_range for sparse files as well
  2020-02-27 16:58 [PATCH 0/2] USB fastboot onto eMMC: make 30% faster! Ahmad Fatoum
@ 2020-02-27 16:58 ` Ahmad Fatoum
  2020-02-28  9:58   ` [PATCH] fixup! " Ahmad Fatoum
  2020-02-27 16:58 ` [PATCH 2/2] Revert "block: Adjust cache sizes" Ahmad Fatoum
  2020-03-02  8:15 ` [PATCH 0/2] USB fastboot onto eMMC: make 30% faster! Sascha Hauer
  2 siblings, 1 reply; 5+ messages in thread
From: Ahmad Fatoum @ 2020-02-27 16:58 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

We can save some time by explicitly telling the block layer that a range
is unused before overwriting it. This brought time my sample write
from 445s to 376s.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 drivers/usb/gadget/f_fastboot.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/usb/gadget/f_fastboot.c b/drivers/usb/gadget/f_fastboot.c
index 35c4b8cf4c46..99c6a5c0cb83 100644
--- a/drivers/usb/gadget/f_fastboot.c
+++ b/drivers/usb/gadget/f_fastboot.c
@@ -941,6 +941,8 @@ static int fastboot_handle_sparse(struct f_fastboot *f_fb,
 				goto out;
 		}
 
+		discard_range(fd, retlen, pos);
+
 		if (fentry->flags & FILE_LIST_FLAG_UBI) {
 			if (!IS_ENABLED(CONFIG_UBIFORMAT)) {
 				ret = -ENOSYS;
-- 
2.25.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 2/2] Revert "block: Adjust cache sizes"
  2020-02-27 16:58 [PATCH 0/2] USB fastboot onto eMMC: make 30% faster! Ahmad Fatoum
  2020-02-27 16:58 ` [PATCH 1/2] usb: gadget: fastboot: call discard_range for sparse files as well Ahmad Fatoum
@ 2020-02-27 16:58 ` Ahmad Fatoum
  2020-03-02  8:15 ` [PATCH 0/2] USB fastboot onto eMMC: make 30% faster! Sascha Hauer
  2 siblings, 0 replies; 5+ messages in thread
From: Ahmad Fatoum @ 2020-02-27 16:58 UTC (permalink / raw)
  To: barebox; +Cc: Hubert Feurstein, Ahmad Fatoum

On 12/13/19 2:12 PM, Sascha Hauer wrote:
> On Tue, Dec 10, 2019 at 03:44:52PM +0100, Hubert Feurstein wrote:
>> With v2015.06.0 the indicated progress of the copy command is very
>> smooth. Calling "cp -v /dev/zero /dev/mmc3.root" takes about 80
>> seconds for 256MB. But with v2019.12.0 the progress is very bumpy and
>> the copy takes about 280 seconds.
>>
>> I've tracked this down to this commit which destroys the performance:
>> "block: Adjust cache sizes" (b6fef20c1215c6ef0004f6af4a9c4b77af51dc43)
>
> We could just revert this patch. I can't find any workload that gets
> faster with b6fef20c1215. It's rather the other way round.

Do this by reverting commit b6fef20c1215c6ef0004f6af4a9c4b77af51dc43.

Reported-by: Hubert Feurstein <h.feurstein@gmail.com>
Suggested-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 common/block.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/common/block.c b/common/block.c
index 8b43c3c83ae3..02be80d7ccf3 100644
--- a/common/block.c
+++ b/common/block.c
@@ -36,7 +36,7 @@ struct chunk {
 	struct list_head list;
 };
 
-#define BUFSIZE (PAGE_SIZE * 4)
+#define BUFSIZE (PAGE_SIZE * 16)
 
 static int writebuffer_io_len(struct block_device *blk, struct chunk *chunk)
 {
@@ -391,7 +391,7 @@ int blockdevice_register(struct block_device *blk)
 	dev_dbg(blk->dev, "rdbufsize: %d blockbits: %d blkmask: 0x%08x\n",
 		blk->rdbufsize, blk->blockbits, blk->blkmask);
 
-	for (i = 0; i < 32; i++) {
+	for (i = 0; i < 8; i++) {
 		struct chunk *chunk = xzalloc(sizeof(*chunk));
 		chunk->data = dma_alloc(BUFSIZE);
 		chunk->num = i;
-- 
2.25.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH] fixup! usb: gadget: fastboot: call discard_range for sparse files as well
  2020-02-27 16:58 ` [PATCH 1/2] usb: gadget: fastboot: call discard_range for sparse files as well Ahmad Fatoum
@ 2020-02-28  9:58   ` Ahmad Fatoum
  0 siblings, 0 replies; 5+ messages in thread
From: Ahmad Fatoum @ 2020-02-28  9:58 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

I've not tested it with ubi formatted partitions and if we want it
there, it's more effecient to do it once in the ubi_format probably.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 drivers/usb/gadget/f_fastboot.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/gadget/f_fastboot.c b/drivers/usb/gadget/f_fastboot.c
index 99c6a5c0cb83..96aecacc27e5 100644
--- a/drivers/usb/gadget/f_fastboot.c
+++ b/drivers/usb/gadget/f_fastboot.c
@@ -941,8 +941,6 @@ static int fastboot_handle_sparse(struct f_fastboot *f_fb,
 				goto out;
 		}
 
-		discard_range(fd, retlen, pos);
-
 		if (fentry->flags & FILE_LIST_FLAG_UBI) {
 			if (!IS_ENABLED(CONFIG_UBIFORMAT)) {
 				ret = -ENOSYS;
@@ -959,6 +957,8 @@ static int fastboot_handle_sparse(struct f_fastboot *f_fb,
 			if (ret)
 				goto out;
 		} else {
+			discard_range(fd, retlen, pos);
+
 			pos = lseek(fd, pos, SEEK_SET);
 			if (pos == -1) {
 				ret = -errno;
-- 
2.25.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 0/2] USB fastboot onto eMMC: make 30% faster!
  2020-02-27 16:58 [PATCH 0/2] USB fastboot onto eMMC: make 30% faster! Ahmad Fatoum
  2020-02-27 16:58 ` [PATCH 1/2] usb: gadget: fastboot: call discard_range for sparse files as well Ahmad Fatoum
  2020-02-27 16:58 ` [PATCH 2/2] Revert "block: Adjust cache sizes" Ahmad Fatoum
@ 2020-03-02  8:15 ` Sascha Hauer
  2 siblings, 0 replies; 5+ messages in thread
From: Sascha Hauer @ 2020-03-02  8:15 UTC (permalink / raw)
  To: Ahmad Fatoum; +Cc: barebox

On Thu, Feb 27, 2020 at 05:58:23PM +0100, Ahmad Fatoum wrote:
> I got a 2.9G image that I flash via fastboot to the eMMC and that takes
> quite a while on my i.MX6Q.
> 
> Instead of fixing my image generation to make proper use of the sparse
> format's don't care chunk types to save oneself from writing all these
> holes at the end of the partitions, I went the easy route by tweaking the
> block layer a bit:
> 
> barebox v2020.02.0: 445s
> With first patch:   376s
> With second patch:  300s
> 
> Of these 300s, 180s are spent writing zeroes...
> 
> Cheers,
> Ahmad Fatoum (2):
>   usb: gadget: fastboot: call discard_range for sparse files as well
>   Revert "block: Adjust cache sizes"

Applied, thanks

Sascha

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-03-02  8:15 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-27 16:58 [PATCH 0/2] USB fastboot onto eMMC: make 30% faster! Ahmad Fatoum
2020-02-27 16:58 ` [PATCH 1/2] usb: gadget: fastboot: call discard_range for sparse files as well Ahmad Fatoum
2020-02-28  9:58   ` [PATCH] fixup! " Ahmad Fatoum
2020-02-27 16:58 ` [PATCH 2/2] Revert "block: Adjust cache sizes" Ahmad Fatoum
2020-03-02  8:15 ` [PATCH 0/2] USB fastboot onto eMMC: make 30% faster! Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox