All of lore.kernel.org
 help / color / mirror / Atom feed
From: Faiz Abbas <faiz_abbas@ti.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [BUG] cb8af8af5ba0 "fs: fat: support write with non-zero offset" fatwrite followed by fatload and then cmp fails
Date: Fri, 22 Mar 2019 14:43:01 +0530	[thread overview]
Message-ID: <907c0d0a-b56d-cbff-c5ae-5f4dee8a464a@ti.com> (raw)
In-Reply-To: <405c904f-e321-fac7-a121-5855003aea4f@ti.com>

Hi,

On 21/03/19 12:20 PM, Faiz Abbas wrote:
> Tom, Akashi,
> 
> On 18/03/19 7:29 AM, Tom Rini wrote:
>> On Mon, Mar 18, 2019 at 10:57:37AM +0900, Akashi, Takahiro wrote:
>>> On Sun, Mar 17, 2019 at 09:44:20PM -0400, Tom Rini wrote:
>>>> On Mon, Mar 18, 2019 at 10:42:31AM +0900, Akashi, Takahiro wrote:
>>>>> Hi Faiz,
>>>>>
>>>>> On Tue, Mar 12, 2019 at 02:11:08PM +0530, Faiz Abbas wrote:
>>>>>> Hi Akashi,
>>>>>>
>>>>>> On 11/09/18 12:29 PM, Akashi, Takahiro wrote:
>>>>>>> From: AKASHI Takahiro <takahiro.akashi@linaro.org>
>>>>>>>
>>>>>>> The current write implementation is quite simple: remove existing clusters
>>>>>>> and then allocating new ones and filling them with data. This, inevitably,
>>>>>>> enforces always writing from the beginning of a file.
>>>>>>>
>>>>>>> As the first step to lift this restriction, fat_file_write() and
>>>>>>> set_contents() are modified to accept an additional parameter, file offset
>>>>>>> and further re-factored so that, in the next patch, all the necessary code
>>>>>>> will be put into set_contents().
>>>>>>>
>>>>>>> Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
>>>>>>> ---
>>>>>>
>>>>>> My fatwrite, fatload and compare tests are failing in MMC with this
>>>>>> commit. This is what I see:
>>>>>>
>>>>>> => fatwrite mmc 0 ${loadaddr} test 0x2000000
>>>>>> 33554432 bytes written
>>>>>> => fatload mmc 0 84000000 test
>>>>>> 33554432 bytes read in 2149 ms (14.9 MiB/s)
>>>>>> => cmp.b 82000000 84000000 0x2000000
>>>>>> byte at 0x820c5000 (0x85) != byte at 0x840c5000 (0x9d)
>>>>>> Total of 806912 byte(s) were the same
>>>>>> =>
>>>>>
>>>>> I tried, but could not reproduce this issue.
>>>>> (v2019.04-rc2)
>>>>>
>>>>> What I did was:
>>>>> - On host, create a vfat file system and a random data file.
>>>>>      dd of=vfat128M.img bs=1M count=128
>>>>>      mkfs -t vfat vfat128M.img ; mount ...
>>>>>      head -c 32m /dev/urandom > 32m.data
>>>>>
>>>>> - On qemu, try fatwrite
>>>>>   (try 1)
>>>>>   => fatload scsi 0:0 50000000 /32m.data 2000000
>>>>>   33554432 bytes read in 539 ms (59.4 MiB/s)
>>>>>   => fatwrite scsi 0:0 50000000 /32m_w.data 2000000
>>>>>   33554432 bytes written
>>>>>   => fatls scsi 0:0 /
>>>>>   33554432   32m.data
>>>>>   33554432   32m_w.data
>>>>>
>>>>>   2 file(s), 0 dir(s)
>>>>>
>>>>>   => fatload scsi 0:0 52000000 /32m_w.data
>>>>>   33554432 bytes read in 537 ms (59.6 MiB/s)
>>>>>   => cmp.b 50000000 52000000 2000000
>>>>>   Total of 33554432 byte(s) were the same
>>>>>
>>>>>   (try 2)
>>>>>   => fatwrite scsi 0:0 54000000 /32m_w2.data 2000000
>>>>>   33554432 bytes written
>>>>>   => fatload scsi 0:0 56000000 /32m_w2.data    
>>>>>   33554432 bytes read in 537 ms (59.6 MiB/s)
>>>>>   => cmp.b 54000000 56000000 2000000
>>>>>   Total of 33554432 byte(s) were the same
>>>>>
>>>>> - I also confirmed that 32m.data and 32m_w.data are the same
>>>>>   on the host.
>>>>>
>>>>>> Reverting this commit fixes this issue for me.
>>>>>
>>>>> So, first let me ask some questions:
>>>>> - What is the size of your mmc memory?
> It doesn't seem to be related to MMC size. It killed most of our boards
> and all of them have different sized SD cards. The fat partition would
> be around 100 MB on each.
> 
>>>>> - How did you format it?
> 
> Using the default ubuntu disks app.
> 
>>>>> - How many files are already there in the root directory?
> 
> Only MLO and U-boot.img
> 
>>>>
>>>> Since I think there's some timezone mismatches here, can you please try
>>>> your test in a loop?
>>>
>>> I'm afraid that I don't get your point. "in a loop"?
>>
>> Yes.  The process you describe above, put it in a script and let it run
>> over and over.
>>
>>>> And this is likely showing up on something like
>>>> am335x_evm or dra7xx_evm.  Thanks!>>
>>> Do you mean that this might have board dependency?
>>
>> Well, you were asking about the size of the MMC memory, so those boards
>> might be a good place to look for clues that may differ from your setup.
>> Thanks!
>>
> 
> Unfortunately, I am unable to reproduce it now either. I tried it on
> rc4, went back to offending commit and couldn't reproduce it there
> either. I tried with different boards and with reformatted partitions
> but it seems to have vanished. I will try out the read and write in a
> loop that Tom suggested.
> 
> It would be a good idea if you could get fat filesystem on an MMC device
> to reproduce it. It could be related to MMC only.
> 

Update on this:

I saw the issue in rc4 on a dra76x-evm one time but its really hard to
find out the exact steps and successive tries have failed to reproduce
it. I did setup an infinite while loop with tftp, write, read-back and
compare of boot images again and again, but that doesn't reproduce it
either after a few tens of tries. It seems some random writes and
read-backs should be able to reproduce it. Any ideas on a randomized
stress test?

Thanks,
Faiz

  reply	other threads:[~2019-03-22  9:13 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-11  6:58 [U-Boot] [PATCH v3 00/26] subject: fs: fat: extend FAT write operations Akashi, Takahiro
2018-09-11  6:58 ` [U-Boot] [PATCH v3 01/26] fs: fat: guard the content of include/fat.h Akashi, Takahiro
2018-09-11 10:12   ` Alexander Graf
2018-09-12  0:53     ` Akashi, Takahiro
2018-09-12  5:41       ` Alexander Graf
2018-09-12  6:55   ` [U-Boot] [PATCH v3.1 " Akashi, Takahiro
2018-09-23 14:42     ` Alexander Graf
2018-09-25  4:54       ` Akashi, Takahiro
2018-09-11  6:58 ` [U-Boot] [PATCH v3 02/26] fs: fat: extend get_fs_info() for write use Akashi, Takahiro
2018-09-11  6:58 ` [U-Boot] [PATCH v3 03/26] fs: fat: handle "." and ".." of root dir correctly with fat_itr_resolve() Akashi, Takahiro
2018-09-11  6:59 ` [U-Boot] [PATCH v3 04/26] fs: fat: assure iterator's ->dent belongs to ->clust Akashi, Takahiro
2018-09-11  6:59 ` [U-Boot] [PATCH v3 05/26] Revert "fs: fat: cannot write to subdirectories" Akashi, Takahiro
2018-09-11  6:59 ` [U-Boot] [PATCH v3 06/26] fs: fat: check and normalize file name Akashi, Takahiro
2018-09-11  6:59 ` [U-Boot] [PATCH v3 07/26] fs: fat: write returns error code instead of -1 Akashi, Takahiro
2018-09-11  6:59 ` [U-Boot] [PATCH v3 08/26] fs: fat: support write with sub-directory path Akashi, Takahiro
2018-09-11  6:59 ` [U-Boot] [PATCH v3 09/26] fs: fat: refactor write interface for a file offset Akashi, Takahiro
2019-03-12  8:41   ` [U-Boot] [BUG] cb8af8af5ba0 "fs: fat: support write with non-zero offset" fatwrite followed by fatload and then cmp fails Faiz Abbas
2019-03-13 17:11     ` Rizvi, Mohammad Faiz Abbas
2019-03-13 17:25       ` Tom Rini
2019-03-18  1:42     ` Akashi, Takahiro
2019-03-18  1:44       ` Tom Rini
2019-03-18  1:57         ` Akashi, Takahiro
2019-03-18  1:59           ` Tom Rini
2019-03-21  6:50             ` Faiz Abbas
2019-03-22  9:13               ` Faiz Abbas [this message]
2018-09-11  6:59 ` [U-Boot] [PATCH v3 10/26] fs: fat: support write with non-zero offset Akashi, Takahiro
2018-09-11 11:09   ` Alexander Graf
2018-09-12  2:14     ` Akashi, Takahiro
2018-09-12  5:42       ` Alexander Graf
2018-10-15 11:42   ` Jean-Jacques Hiblot
2018-10-31 10:00     ` Clément Péron
2018-10-31 12:22       ` Alexander Graf
2018-10-31 20:54         ` Heinrich Schuchardt
2018-11-01  5:11           ` AKASHI Takahiro
2018-11-05 16:44             ` Clément Péron
2019-02-25 18:20   ` [U-Boot] [BUG] cb8af8af5ba0 "fs: fat: support write with non-zero offset" leads to link error Heinrich Schuchardt
2018-09-11  6:59 ` [U-Boot] [PATCH v3 11/26] cmd: fat: add offset parameter to fatwrite Akashi, Takahiro
2018-09-11  6:59 ` [U-Boot] [PATCH v3 12/26] fs: add mkdir interface Akashi, Takahiro
2018-09-11  6:59 ` [U-Boot] [PATCH v3 13/26] fs: fat: remember the starting cluster number of directory Akashi, Takahiro
2018-09-11  6:59 ` [U-Boot] [PATCH v3 14/26] fs: fat: support mkdir Akashi, Takahiro
2018-09-11  6:59 ` [U-Boot] [PATCH v3 15/26] cmd: fat: add fatmkdir command Akashi, Takahiro
2018-09-11  6:59 ` [U-Boot] [PATCH v3 16/26] efi_loader: file: support creating a directory Akashi, Takahiro
2018-09-11  6:59 ` [U-Boot] [PATCH v3 17/26] fs: add unlink interface Akashi, Takahiro
2018-09-11  6:59 ` [U-Boot] [PATCH v3 18/26] fs: fat: support unlink Akashi, Takahiro
2018-09-11  6:59 ` [U-Boot] [PATCH v3 19/26] cmd: fat: add fatrm command Akashi, Takahiro
2018-09-11  6:59 ` [U-Boot] [PATCH v3 20/26] efi_loader: implement a file delete Akashi, Takahiro
2018-09-11  6:59 ` [U-Boot] [PATCH v3 21/26] fs-test: fix false positive error at Test Case 12 Akashi, Takahiro
2018-09-11  6:59 ` [U-Boot] [PATCH v3 22/26] fs-test: update the test result as of v2018.09 Akashi, Takahiro
2018-09-11  6:59 ` [U-Boot] [PATCH v3 23/26] test/py: convert fs-test.sh to pytest Akashi, Takahiro
2018-09-11  6:59 ` [U-Boot] [PATCH v3 24/26] test/py: fs: add extended write operation test Akashi, Takahiro
2018-09-11  6:59 ` [U-Boot] [PATCH v3 25/26] test/py: fs: add fstest/mkdir test Akashi, Takahiro

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=907c0d0a-b56d-cbff-c5ae-5f4dee8a464a@ti.com \
    --to=faiz_abbas@ti.com \
    --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.