All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tanya Brokhman <tlinder@codeaurora.org>
To: dedekind@infradead.org, linux-mtd@lists.infradead.org,
	dedekind@oktetlabs.ru, pratibha@codeaurora.org
Subject: [mtd] possible bug in nandsim
Date: Thu, 07 Nov 2013 13:43:13 +0200	[thread overview]
Message-ID: <527B7CD1.1020105@codeaurora.org> (raw)

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

             reply	other threads:[~2013-11-07 11:43 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-07 11:43 Tanya Brokhman [this message]
2013-11-07 14:35 ` [mtd] possible bug in nandsim 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

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=527B7CD1.1020105@codeaurora.org \
    --to=tlinder@codeaurora.org \
    --cc=dedekind@infradead.org \
    --cc=dedekind@oktetlabs.ru \
    --cc=linux-mtd@lists.infradead.org \
    --cc=pratibha@codeaurora.org \
    /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.