Linux-mtd Archive on lore.kernel.org
 help / color / mirror / Atom feed
* measuring the flash usage
@ 2011-09-20 11:22 Folkert van Heusden
  2011-09-20 21:02 ` Brian Norris
  0 siblings, 1 reply; 5+ messages in thread
From: Folkert van Heusden @ 2011-09-20 11:22 UTC (permalink / raw)
  To: linux-mtd

Hi,

For an embedded system I'm working on I'd like to monitor the health
of the flash memory.
On regular Linux systems one can look at /proc/diskstats to see how
often the system writes to a disk. It seems though that (at least
kernel 2.6.19) for flash these counters are not updated.
So I was wondering: are there any other ways?
E.g. will the kernel log a message when it has problems writing
to/reading from the flash memory? Are there any other counters
anywhere?

Thanks.

Folkert

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

* Re: measuring the flash usage
  2011-09-20 11:22 measuring the flash usage Folkert van Heusden
@ 2011-09-20 21:02 ` Brian Norris
  2011-09-21  6:27   ` Artem Bityutskiy
  2011-09-21  6:47   ` Folkert van Heusden
  0 siblings, 2 replies; 5+ messages in thread
From: Brian Norris @ 2011-09-20 21:02 UTC (permalink / raw)
  To: Folkert van Heusden; +Cc: linux-mtd

Hi,

On Tue, Sep 20, 2011 at 4:22 AM, Folkert van Heusden
<folkert.van.heusden@gmail.com> wrote:
> For an embedded system I'm working on I'd like to monitor the health
> of the flash memory.
> On regular Linux systems one can look at /proc/diskstats to see how
> often the system writes to a disk. It seems though that (at least
> kernel 2.6.19) for flash these counters are not updated.

I don't have much experience with the /proc/diskstats but for me, it
at least lists the mtdblockX devices I have on my system (which I
don't use). If you use those (for instance, for JFFS2?), then I would
imagine that Linux will track stats as with other block devices. Is
this not your experience?

> So I was wondering: are there any other ways?
> E.g. will the kernel log a message when it has problems writing
> to/reading from the flash memory? Are there any other counters
> anywhere?

Generally, MTD is pretty good at printing important messages, which
should get logged by your system. Also, bitflips/ECC errors can be
tracked with ioctl(ECCGETSTATS). This info is retrieved, for example,
by nanddump.

Others can probably comment better on other methods for tracking
health. Hope this helps.

Brian

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

* Re: measuring the flash usage
  2011-09-20 21:02 ` Brian Norris
@ 2011-09-21  6:27   ` Artem Bityutskiy
  2011-09-21  6:47   ` Folkert van Heusden
  1 sibling, 0 replies; 5+ messages in thread
From: Artem Bityutskiy @ 2011-09-21  6:27 UTC (permalink / raw)
  To: Brian Norris; +Cc: Folkert van Heusden, linux-mtd

On Tue, 2011-09-20 at 14:02 -0700, Brian Norris wrote:
> Hi,
> 
> On Tue, Sep 20, 2011 at 4:22 AM, Folkert van Heusden
> <folkert.van.heusden@gmail.com> wrote:
> > For an embedded system I'm working on I'd like to monitor the health
> > of the flash memory.
> > On regular Linux systems one can look at /proc/diskstats to see how
> > often the system writes to a disk. It seems though that (at least
> > kernel 2.6.19) for flash these counters are not updated.
> 
> I don't have much experience with the /proc/diskstats but for me, it
> at least lists the mtdblockX devices I have on my system (which I
> don't use).

That will only account I/O via mtdblock, but not via mtd devices.

I think we do not have proper I/O accounting for MTD. In N900 we hacked
/proc/diskstats to also show MTD I/O, but for some reasons (do not
remember) we decided that would not be upstreamable. You can try that,
or introduce mtd-specific sysfs entries for accounting.


-- 
Best Regards,
Artem Bityutskiy

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

* Re: measuring the flash usage
  2011-09-20 21:02 ` Brian Norris
  2011-09-21  6:27   ` Artem Bityutskiy
@ 2011-09-21  6:47   ` Folkert van Heusden
  2011-09-21 19:04     ` Brian Norris
  1 sibling, 1 reply; 5+ messages in thread
From: Folkert van Heusden @ 2011-09-21  6:47 UTC (permalink / raw)
  To: Brian Norris; +Cc: linux-mtd

>> For an embedded system I'm working on I'd like to monitor the health
>> of the flash memory.
>> On regular Linux systems one can look at /proc/diskstats to see how
>> often the system writes to a disk. It seems though that (at least
>> kernel 2.6.19) for flash these counters are not updated.
>
> I don't have much experience with the /proc/diskstats but for me, it
> at least lists the mtdblockX devices I have on my system (which I
> don't use). If you use those (for instance, for JFFS2?), then I would
> imagine that Linux will track stats as with other block devices. Is
> this not your experience?

They're there, they just won't get updated.

> Generally, MTD is pretty good at printing important messages, which
> should get logged by your system. Also, bitflips/ECC errors can be
> tracked with ioctl(ECCGETSTATS). This info is retrieved, for example,
> by nanddump.

Are these values retained accross power off/reboots?
And will this work for NOR flash?


Thanks.

Folkert.

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

* Re: measuring the flash usage
  2011-09-21  6:47   ` Folkert van Heusden
@ 2011-09-21 19:04     ` Brian Norris
  0 siblings, 0 replies; 5+ messages in thread
From: Brian Norris @ 2011-09-21 19:04 UTC (permalink / raw)
  To: Folkert van Heusden; +Cc: linux-mtd

On Tue, Sep 20, 2011 at 11:47 PM, Folkert van Heusden
<folkert.van.heusden@gmail.com> wrote:
>>> On regular Linux systems one can look at /proc/diskstats to see how
>>> often the system writes to a disk. It seems though that (at least
>>> kernel 2.6.19) for flash these counters are not updated.
>>
>> I don't have much experience with the /proc/diskstats but for me, it
>> at least lists the mtdblockX devices I have on my system (which I
>> don't use). If you use those (for instance, for JFFS2?), then I would
>> imagine that Linux will track stats as with other block devices. Is
>> this not your experience?
>
> They're there, they just won't get updated.

As Artem said: "That will only account I/O via mtdblock, but not via
mtd devices". I'll assume that you are not doing I/O via mtdblock. In
that case, they shouldn't get updated.

>> Generally, MTD is pretty good at printing important messages, which
>> should get logged by your system. Also, bitflips/ECC errors can be
>> tracked with ioctl(ECCGETSTATS). This info is retrieved, for example,
>> by nanddump.
>
> Are these values retained accross power off/reboots?

No, ECC stats are only kept in memory.

> And will this work for NOR flash?

I doubt it! For one, I didn't think NOR flash used ECC, so there are
no such stats to track. Also, nanddump isn't intended for NOR flash.

Brian

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

end of thread, other threads:[~2011-09-21 19:04 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-20 11:22 measuring the flash usage Folkert van Heusden
2011-09-20 21:02 ` Brian Norris
2011-09-21  6:27   ` Artem Bityutskiy
2011-09-21  6:47   ` Folkert van Heusden
2011-09-21 19:04     ` Brian Norris

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