linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [mtd] possible bug in nandsim
@ 2013-11-07 11:43 Tanya Brokhman
  2013-11-07 14:35 ` Richard Weinberger
  0 siblings, 1 reply; 11+ messages in thread
From: Tanya Brokhman @ 2013-11-07 11:43 UTC (permalink / raw)
  To: dedekind, linux-mtd, dedekind, pratibha

Hi

I've recently started working with the nand simulator. For my testing 
purposes I have to use it with a cache file. Bellow are the commands I run:

modprobe nandsim first_id_byte=0x20 second_id_byte=0xaa 
third_id_byte=0x00 fourth_id_byte=0x15 cache_file=cache_file.txt
modprobe ubi mtd=0 fm_autoconvert=1

Unfortunately, when trying the above I noticed that the next time i load 
nandsim and ubi on top of it the fastmap data is not saved at 
cache_file.txt and the device comes up as clean. Meaning, the cache file 
feature of the nandsim isn't working properly.

So while debugging this I think I found the root cause:
unsigned long *pages_written from struct nandsim also needs saving. 
Otherwise while reading a page (at read_page()) we enter the following 
code flow:

if (!test_bit(ns->regs.row, ns->pages_written)) {
		memset(ns->buf.byte, 0xFF, num);
} else {

thus, ignoring the content of the cache file.

I've fixed this internally in my build by just saving the content of 
pages_written to a file on __exit and reading from that file on __init.

I was wondering if someone had done this in a more elegant way perhaps?

If not, I'll beautify my patch and share.

Thanks,
Tanya Brokhman
-- 
QUALCOMM ISRAEL, on behalf of Qualcomm Innovation Center, Inc. is a member
of Code Aurora Forum, hosted by The Linux Foundation

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

* Re: [mtd] possible bug in nandsim
  2013-11-07 11:43 [mtd] possible bug in nandsim Tanya Brokhman
@ 2013-11-07 14:35 ` Richard Weinberger
  2013-11-07 14:58   ` Ezequiel Garcia
  0 siblings, 1 reply; 11+ messages in thread
From: Richard Weinberger @ 2013-11-07 14:35 UTC (permalink / raw)
  To: Tanya Brokhman
  Cc: dedekind, dedekind, linux-mtd@lists.infradead.org, pratibha

On Thu, Nov 7, 2013 at 12:43 PM, Tanya Brokhman <tlinder@codeaurora.org> wrote:
> Hi
>
> I've recently started working with the nand simulator. For my testing
> purposes I have to use it with a cache file. Bellow are the commands I run:
>
> modprobe nandsim first_id_byte=0x20 second_id_byte=0xaa third_id_byte=0x00
> fourth_id_byte=0x15 cache_file=cache_file.txt
> modprobe ubi mtd=0 fm_autoconvert=1
>
> Unfortunately, when trying the above I noticed that the next time i load
> nandsim and ubi on top of it the fastmap data is not saved at cache_file.txt
> and the device comes up as clean. Meaning, the cache file feature of the
> nandsim isn't working properly.

IIRC this feature is really meant as a cache and not persistent storage.

> So while debugging this I think I found the root cause:
> unsigned long *pages_written from struct nandsim also needs saving.
> Otherwise while reading a page (at read_page()) we enter the following code
> flow:
>
> if (!test_bit(ns->regs.row, ns->pages_written)) {
>                 memset(ns->buf.byte, 0xFF, num);
> } else {
>
> thus, ignoring the content of the cache file.
>
> I've fixed this internally in my build by just saving the content of
> pages_written to a file on __exit and reading from that file on __init.
>
> I was wondering if someone had done this in a more elegant way perhaps?
>
> If not, I'll beautify my patch and share.
>
> Thanks,
> Tanya Brokhman
> --
> QUALCOMM ISRAEL, on behalf of Qualcomm Innovation Center, Inc. is a member
> of Code Aurora Forum, hosted by The Linux Foundation
>
> ______________________________________________________
> Linux MTD discussion mailing list
> http://lists.infradead.org/mailman/listinfo/linux-mtd/



-- 
Thanks,
//richard

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

* Re: [mtd] possible bug in nandsim
  2013-11-07 14:35 ` Richard Weinberger
@ 2013-11-07 14:58   ` Ezequiel Garcia
  2013-11-07 18:02     ` Tanya Brokhman
  2014-02-12  9:51     ` Tanya Brokhman
  0 siblings, 2 replies; 11+ messages in thread
From: Ezequiel Garcia @ 2013-11-07 14:58 UTC (permalink / raw)
  To: Richard Weinberger, Tanya Brokhman
  Cc: dedekind, dedekind, linux-mtd@lists.infradead.org, fastcat,
	pratibha

Hello Richard, Tanya:

On Thu, Nov 07, 2013 at 03:35:30PM +0100, Richard Weinberger wrote:
> On Thu, Nov 7, 2013 at 12:43 PM, Tanya Brokhman <tlinder@codeaurora.org> wrote:
> > Hi
> >
> > I've recently started working with the nand simulator. For my testing
> > purposes I have to use it with a cache file. Bellow are the commands I run:
> >
> > modprobe nandsim first_id_byte=0x20 second_id_byte=0xaa third_id_byte=0x00
> > fourth_id_byte=0x15 cache_file=cache_file.txt
> > modprobe ubi mtd=0 fm_autoconvert=1
> >
> > Unfortunately, when trying the above I noticed that the next time i load
> > nandsim and ubi on top of it the fastmap data is not saved at cache_file.txt
> > and the device comes up as clean. Meaning, the cache file feature of the
> > nandsim isn't working properly.
> 
> IIRC this feature is really meant as a cache and not persistent storage.
> 

AFAIK Richard is right, the feature is just a non-persistent cache.

However a patch was submitted (and never reviewed) recently to
apparently add persistent behavior:

  http://patchwork.ozlabs.org/patch/277974/

Tanya: Can you test or review the patch and provide a formal
Tested/Reviewed-by? I'd be interested in seeing that move forward :)

Thanks!
-- 
Ezequiel García, Free Electrons
Embedded Linux, Kernel and Android Engineering
http://free-electrons.com

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

* Re: [mtd] possible bug in nandsim
  2013-11-07 14:58   ` Ezequiel Garcia
@ 2013-11-07 18:02     ` Tanya Brokhman
  2013-11-07 18:47       ` Ezequiel Garcia
  2014-02-12  9:51     ` Tanya Brokhman
  1 sibling, 1 reply; 11+ messages in thread
From: Tanya Brokhman @ 2013-11-07 18:02 UTC (permalink / raw)
  To: Ezequiel Garcia
  Cc: pratibha, Richard Weinberger, dedekind, fastcat, dedekind,
	linux-mtd@lists.infradead.org

Hello Ezequiel,

On 11/7/2013 4:58 PM, Ezequiel Garcia wrote:
> AFAIK Richard is right, the feature is just a non-persistent cache.
>
> However a patch was submitted (and never reviewed) recently to
> apparently add persistent behavior:
>
>    http://patchwork.ozlabs.org/patch/277974/
>
> Tanya: Can you test or review the patch and provide a formal
> Tested/Reviewed-by? I'd be interested in seeing that move forward :)
>
> Thanks!
>

This is exactly the behavior I need for my testing purposes! Thank you. 
At the moment I have that with my (ugly) fix. I will try to validate 
your patch and help it get integrated.

-- 
QUALCOMM ISRAEL, on behalf of Qualcomm Innovation Center, Inc. is a member
of Code Aurora Forum, hosted by The Linux Foundation

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

* Re: [mtd] possible bug in nandsim
  2013-11-07 18:02     ` Tanya Brokhman
@ 2013-11-07 18:47       ` Ezequiel Garcia
  0 siblings, 0 replies; 11+ messages in thread
From: Ezequiel Garcia @ 2013-11-07 18:47 UTC (permalink / raw)
  To: Tanya Brokhman
  Cc: pratibha, Richard Weinberger, dedekind, fastcat, dedekind,
	linux-mtd@lists.infradead.org

On Thu, Nov 07, 2013 at 08:02:42PM +0200, Tanya Brokhman wrote:
> Hello Ezequiel,
> 
> On 11/7/2013 4:58 PM, Ezequiel Garcia wrote:
> > AFAIK Richard is right, the feature is just a non-persistent cache.
> >
> > However a patch was submitted (and never reviewed) recently to
> > apparently add persistent behavior:
> >
> >    http://patchwork.ozlabs.org/patch/277974/
> >
> > Tanya: Can you test or review the patch and provide a formal
> > Tested/Reviewed-by? I'd be interested in seeing that move forward :)
> >
> > Thanks!
> >
> 
> This is exactly the behavior I need for my testing purposes! Thank you. 

You're welcome.

> At the moment I have that with my (ugly) fix. I will try to validate 
> your patch and help it get integrated.
> 

FWIW: it's not "my" patch.
-- 
Ezequiel García, Free Electrons
Embedded Linux, Kernel and Android Engineering
http://free-electrons.com

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

* Re: [mtd] possible bug in nandsim
  2013-11-07 14:58   ` Ezequiel Garcia
  2013-11-07 18:02     ` Tanya Brokhman
@ 2014-02-12  9:51     ` Tanya Brokhman
  2014-02-12  9:55       ` Richard Weinberger
  1 sibling, 1 reply; 11+ messages in thread
From: Tanya Brokhman @ 2014-02-12  9:51 UTC (permalink / raw)
  To: Ezequiel Garcia, Richard Weinberger
  Cc: dedekind, dedekind, pratibha, linux-mtd@lists.infradead.org,
	fastcat

Hi Richard

Sorry for taking so long but I got to testing your patch just now.
Unfortunately the device crashes as soon as soon as I try to load nandsim:

modprobe nandsim first_id_byte=0x20 second_id_byte=0xaa 
third_id_byte=0x00 fourth_id_byte=0x15 cache_file=cashe_file.txt 
cache_file_written=1

dmesg:
[  202.110263] BUG: unable to handle kernel paging request at d88fb000
[  202.111018] IP: [<d88f3a4c>] ns_init_module+0xa4c/0xcdc [nandsim]
[  202.111018] *pde = 1780f067 *pte = 00000000
[  202.111018] Oops: 0002 [#1] SMP
[  202.111018] Modules linked in: nandsim(+)
[  202.111018] CPU: 0 PID: 1531 Comm: modprobe Not tainted 
3.14.0-rc2-next-20140212+ #183
[  202.111018] Hardware name: Bochs Bochs, BIOS Bochs 01/01/2007
[  202.111018] task: d79e2e80 ti: d6c68000 task.ti: d6c68000
[  202.111018] EIP: 0060:[<d88f3a4c>] EFLAGS: 00010202 CPU: 0
[  202.111018] EIP is at ns_init_module+0xa4c/0xcdc [nandsim]
[  202.111018] EAX: d781f4ff EBX: d781f1d8 ECX: 0001c000 EDX: d88f7000
[  202.111018] ESI: d781f414 EDI: d88fb000 EBP: d6c69e24 ESP: d6c69dcc
[  202.111018]  DS: 007b ES: 007b FS: 00d8 GS: 0033 SS: 0068
[  202.111018] CR0: 8005003b CR2: d88fb000 CR3: 16e6a000 CR4: 00000690
[  202.111018] Stack:
[  202.111018]  d88eefb8 00000008 00000000 00000000 00000000 d781f1d8 
194bce9c 0000002f
[  202.111018]  194b37e7 00000040 d781f1d8 00000000 d781f414 d6c69e08 
10000000 00000000
[  202.111018]  d6c443c0 00000000 d6c69e24 d6c69f60 00000000 00000000 
d6c69e94 c1000360
[  202.111018] Call Trace:
[  202.111018]  [<c1000360>] do_one_initcall+0x30/0x140
[  202.111018]  [<c10bff71>] ? tracepoint_module_notify+0x121/0x180
[  202.111018]  [<d88f3000>] ? 0xd88f2fff
[  202.111018]  [<c1764003>] ? notifier_call_chain+0x43/0x60
[  202.111018]  [<c1061c84>] ? __blocking_notifier_call_chain+0x54/0x70
[  202.111018]  [<c10a5def>] load_module+0x14bf/0x1920
[  202.111018]  [<c10a3130>] ? mod_kobject_put+0x40/0x40
[  202.111018]  [<c10a6383>] SyS_init_module+0xa3/0xc0
[  202.111018]  [<c1767c5a>] sysenter_do_call+0x12/0x22
[  202.111018] Code: 04 24 10 0b 8f d8 bf f4 ff ff ff e8 d8 91 e6 e8 e9 
04 01 00 00 83 3d 40 13 8f d8 00 74 0f 8b 45 d8 89 d7 8b 88 d4 03 00 00 
b0 ff <f3> aa 8b 55 d8 8b 82 cc 03 00 00 ba d0 00 00 00 e8 cf 73 83 e8
[  202.111018] EIP: [<d88f3a4c>] ns_init_module+0xa4c/0xcdc [nandsim] 
SS:ESP 0068:d6c69dcc
[  202.111018] CR2: 00000000d88fb000
[  202.111018] ---[ end trace cdb11d3383abc7cc ]---

Thanks
Tanya



On 11/7/2013 4:58 PM, Ezequiel Garcia wrote:
> Hello Richard, Tanya:
>
> On Thu, Nov 07, 2013 at 03:35:30PM +0100, Richard Weinberger wrote:
>> On Thu, Nov 7, 2013 at 12:43 PM, Tanya Brokhman <tlinder@codeaurora.org> wrote:
>>> Hi
>>>
>>> I've recently started working with the nand simulator. For my testing
>>> purposes I have to use it with a cache file. Bellow are the commands I run:
>>>
>>> modprobe nandsim first_id_byte=0x20 second_id_byte=0xaa third_id_byte=0x00
>>> fourth_id_byte=0x15 cache_file=cache_file.txt
>>> modprobe ubi mtd=0 fm_autoconvert=1
>>>
>>> Unfortunately, when trying the above I noticed that the next time i load
>>> nandsim and ubi on top of it the fastmap data is not saved at cache_file.txt
>>> and the device comes up as clean. Meaning, the cache file feature of the
>>> nandsim isn't working properly.
>>
>> IIRC this feature is really meant as a cache and not persistent storage.
>>
>
> AFAIK Richard is right, the feature is just a non-persistent cache.
>
> However a patch was submitted (and never reviewed) recently to
> apparently add persistent behavior:
>
>    http://patchwork.ozlabs.org/patch/277974/
>
> Tanya: Can you test or review the patch and provide a formal
> Tested/Reviewed-by? I'd be interested in seeing that move forward :)
>
> Thanks!
>


-- 
QUALCOMM ISRAEL, on behalf of Qualcomm Innovation Center, Inc. is a member
of Code Aurora Forum, hosted by The Linux Foundation

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

* Re: [mtd] possible bug in nandsim
  2014-02-12  9:51     ` Tanya Brokhman
@ 2014-02-12  9:55       ` Richard Weinberger
  2014-02-12 22:42         ` Matthew Gabeler-Lee
  0 siblings, 1 reply; 11+ messages in thread
From: Richard Weinberger @ 2014-02-12  9:55 UTC (permalink / raw)
  To: Tanya Brokhman, Ezequiel Garcia
  Cc: dedekind, dedekind, pratibha, linux-mtd@lists.infradead.org,
	fastcat

Am 12.02.2014 10:51, schrieb Tanya Brokhman:
> Hi Richard
> 
> Sorry for taking so long but I got to testing your patch just now.

What patch?

*confused*,
//richard

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

* Re: [mtd] possible bug in nandsim
  2014-02-12  9:55       ` Richard Weinberger
@ 2014-02-12 22:42         ` Matthew Gabeler-Lee
  2014-02-13 13:06           ` Tanya Brokhman
  0 siblings, 1 reply; 11+ messages in thread
From: Matthew Gabeler-Lee @ 2014-02-12 22:42 UTC (permalink / raw)
  To: Richard Weinberger
  Cc: Tanya Brokhman, dedekind, dedekind, pratibha,
	linux-mtd@lists.infradead.org, Ezequiel Garcia

On Feb 12, 2014 4:55 AM, "Richard Weinberger" <richard@nod.at> wrote:
>
> Am 12.02.2014 10:51, schrieb Tanya Brokhman:
> > Hi Richard
> >
> > Sorry for taking so long but I got to testing your patch just now.
>
> What patch?
>
> *confused*,
> //richard

I think Tanya means my patch
(http://patchwork.ozlabs.org/patch/277974/) that Ezequiel Garcia
previously pointed out (see list mails under this subject from
2013-11-07).

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

* Re: [mtd] possible bug in nandsim
  2014-02-12 22:42         ` Matthew Gabeler-Lee
@ 2014-02-13 13:06           ` Tanya Brokhman
  2014-02-13 13:21             ` Ezequiel Garcia
  0 siblings, 1 reply; 11+ messages in thread
From: Tanya Brokhman @ 2014-02-13 13:06 UTC (permalink / raw)
  To: Matthew Gabeler-Lee, Richard Weinberger
  Cc: dedekind, dedekind, linux-mtd@lists.infradead.org,
	Ezequiel Garcia, pratibha

yes, was referring to http://patchwork.ozlabs.org/patch/277974/. sorry

On 2/13/2014 12:42 AM, Matthew Gabeler-Lee wrote:
> On Feb 12, 2014 4:55 AM, "Richard Weinberger" <richard@nod.at> wrote:
>>
>> Am 12.02.2014 10:51, schrieb Tanya Brokhman:
>>> Hi Richard
>>>
>>> Sorry for taking so long but I got to testing your patch just now.
>>
>> What patch?
>>
>> *confused*,
>> //richard
>
> I think Tanya means my patch
> (http://patchwork.ozlabs.org/patch/277974/) that Ezequiel Garcia
> previously pointed out (see list mails under this subject from
> 2013-11-07).
>
> ______________________________________________________
> Linux MTD discussion mailing list
> http://lists.infradead.org/mailman/listinfo/linux-mtd/
>


-- 
QUALCOMM ISRAEL, on behalf of Qualcomm Innovation Center, Inc. is a member
of Code Aurora Forum, hosted by The Linux Foundation

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

* Re: [mtd] possible bug in nandsim
  2014-02-13 13:06           ` Tanya Brokhman
@ 2014-02-13 13:21             ` Ezequiel Garcia
  2014-02-13 13:39               ` Tanya Brokhman
  0 siblings, 1 reply; 11+ messages in thread
From: Ezequiel Garcia @ 2014-02-13 13:21 UTC (permalink / raw)
  To: Tanya Brokhman
  Cc: pratibha, dedekind, Richard Weinberger, Matthew Gabeler-Lee,
	linux-mtd@lists.infradead.org, dedekind

Hi Tanya,

On Thu, Feb 13, 2014 at 03:06:37PM +0200, Tanya Brokhman wrote:
> yes, was referring to http://patchwork.ozlabs.org/patch/277974/. sorry
> 

I'm sure you're smart enough to see nobody top-posts around here.

Why are *you* doing it?

> On 2/13/2014 12:42 AM, Matthew Gabeler-Lee wrote:
> > On Feb 12, 2014 4:55 AM, "Richard Weinberger" <richard@nod.at> wrote:
> >>
> >> Am 12.02.2014 10:51, schrieb Tanya Brokhman:
> >>> Hi Richard
> >>>
> >>> Sorry for taking so long but I got to testing your patch just now.
> >>
> >> What patch?
> >>
> >> *confused*,
> >> //richard
> >
> > I think Tanya means my patch
> > (http://patchwork.ozlabs.org/patch/277974/) that Ezequiel Garcia
> > previously pointed out (see list mails under this subject from
> > 2013-11-07).
> >

See? We're all replying *after* the mail we want to reply to.
-- 
Ezequiel García, Free Electrons
Embedded Linux, Kernel and Android Engineering
http://free-electrons.com

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

* Re: [mtd] possible bug in nandsim
  2014-02-13 13:21             ` Ezequiel Garcia
@ 2014-02-13 13:39               ` Tanya Brokhman
  0 siblings, 0 replies; 11+ messages in thread
From: Tanya Brokhman @ 2014-02-13 13:39 UTC (permalink / raw)
  To: Ezequiel Garcia
  Cc: pratibha, dedekind, Richard Weinberger, Matthew Gabeler-Lee,
	linux-mtd@lists.infradead.org, dedekind

On 2/13/2014 3:21 PM, Ezequiel Garcia wrote:
> Hi Tanya,
>
> On Thu, Feb 13, 2014 at 03:06:37PM +0200, Tanya Brokhman wrote:
>> yes, was referring to http://patchwork.ozlabs.org/patch/277974/. sorry
>>
>
> I'm sure you're smart enough to see nobody top-posts around here.
>
> Why are *you* doing it?
>
>> On 2/13/2014 12:42 AM, Matthew Gabeler-Lee wrote:
>>> On Feb 12, 2014 4:55 AM, "Richard Weinberger" <richard@nod.at> wrote:
>>>>
>>>> Am 12.02.2014 10:51, schrieb Tanya Brokhman:
>>>>> Hi Richard
>>>>>
>>>>> Sorry for taking so long but I got to testing your patch just now.
>>>>
>>>> What patch?
>>>>
>>>> *confused*,
>>>> //richard
>>>
>>> I think Tanya means my patch
>>> (http://patchwork.ozlabs.org/patch/277974/) that Ezequiel Garcia
>>> previously pointed out (see list mails under this subject from
>>> 2013-11-07).
>>>
>
> See? We're all replying *after* the mail we want to reply to.
>

A habit. Wasn't aware of the fact that this is such an issue. wont 
happen again. Sorry if it offended anyone.

-- 
QUALCOMM ISRAEL, on behalf of Qualcomm Innovation Center, Inc. is a member
of Code Aurora Forum, hosted by The Linux Foundation

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

end of thread, other threads:[~2014-02-13 13:40 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-07 11:43 [mtd] possible bug in nandsim Tanya Brokhman
2013-11-07 14:35 ` Richard Weinberger
2013-11-07 14:58   ` Ezequiel Garcia
2013-11-07 18:02     ` Tanya Brokhman
2013-11-07 18:47       ` Ezequiel Garcia
2014-02-12  9:51     ` Tanya Brokhman
2014-02-12  9:55       ` Richard Weinberger
2014-02-12 22:42         ` Matthew Gabeler-Lee
2014-02-13 13:06           ` Tanya Brokhman
2014-02-13 13:21             ` Ezequiel Garcia
2014-02-13 13:39               ` Tanya Brokhman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).