Skip to contentSkip to conversation

OneNAND: Update OOB free table

DISCUSSION Kyungmin Park 2 participants 2 messages Dec 22, 2006 Memory technology devices (MTD)

lore
Share & tools
lore
#0 lore raw

Hi,

Quoted 14 lines
Quoted 14 lines · Kyungmin Park
Quoted 2 lines

How about the this patch?
It skips the ecc position which is defined in ecc layout in mtd drivers.

Here is my understanding of the problem.

Nowadays MTD supports nicer interface to work with OOB. This is the MTD_OOB_AUTO command. Currently JFFS2 uses old MTD_OOB_PLACE command.

The idea behind the MTD_OOB_AUTO command is that user provides buffer with his data, and MTD takes care about how to put it to the OOB area, MTD knows which OOB bytes may be used. Similar for reading OOB - MTD automatically reads data bytes, skips ECC, and returns the data.

Quoted 8 lines
Quoted 2 lines

So what we should do is to teach JFFS2 using MTD_OOB_AUTO instead of MTD_OOB_PLACE.

I may try to do this, but only in 2007. Vitaly said he may also try to do this later.

Also, dwmw2 is concerned about compatibility, so we should explore this too.

Okay, I understand the MTD_OOB_AUTO concept. but now JFFS2 only use the MTD_OOB_PLACE. so JFFS2 skip the ecc position for backward compatibility.

Quoted 3 lines

Kyungmin, may you make sure OneNAND is OK WRT MTD_OOB_AUTO?

Now OneNAND don't support MTD_OOB_AUTO, but if the jffs2 supports the this one. I will support it. I think it's more reasonable to handle oob in driver level instead of filesystem.

Quoted 3 lines

Also Kyungmin, in you driver I see touch_softlockup_watchdog() calls. I believe they should not be there. You must be hid a problem with this instead of fixing it. Please, look at that stuff.

Actually, I'm not sure where's the right place. But if we don't touch the watchdong. it will soft lockup when mounting the JFFS2 with big partition. (I just borrowed it from nand.)

Quoted 4 lines

Kyungmin, do you have your own OneNAND git tree? If yes, what's the URL? How about putting it on infradead.org, just like we have our UBI git there?

No, I used it in infradead.org. but I just used for commit.

http://git.infradead.org/?p=users/kmpark/onenand-mtd-2.6.git;a=summary

Today, I will commit the onenand patches for test.

Thank you,
Kyungmin Park

#1 lore raw
Quoted 2 lines · Kyungmin Park

Okay, I understand the MTD_OOB_AUTO concept. but now JFFS2 only use the MTD_OOB_PLACE. so JFFS2 skip the ecc position for backward compatibility.

...

Quoted 3 lines

Now OneNAND don't support MTD_OOB_AUTO, but if the jffs2 supports the this one. I will support it. I think it's more reasonable to handle oob in driver level instead of filesystem.

I take care about this in JFFS, you take care in OneNAND, OK?

Quoted 2 lines

Actually, I'm not sure where's the right place. But if we don't touch the watchdong. it will soft lockup when mounting the JFFS2 with big partition. (I just borrowed it from nand.)

Anyway, you should not touch watchdog. You problem is fixed by adding cond_resched() at the right places. What you did - you shut up watchdog which screamed about a real error, instead of solving the error.

I have prepared a patch - it is in my dedekind-mtd-2.6.git GIT tree. It is also attached.

Quoted 1 line

No, I used it in infradead.org. but I just used for commit.

Cool.

Signature · 2 lines
Best regards,
Artem Bityutskiy (Битюцкий Артём)
Quoted 1 line

From 6adeda7bf64b72a210c6ed518f3aaf3525d8d740 Mon Sep 17 00:00:00 2001

From: Artem Bityutskiy <[email protected]>
Date: Fri, 22 Dec 2006 11:13:40 +0200
Subject: [PATCH] [MTD] OneNAND: release CPU in cycles

This patch teaches OneNAND to release processor in read/write/erase cycles and let other processes proceed. Also, remove buggi touch watchdog call which only hides the problem instead of solving it.

---
 drivers/mtd/onenand/onenand_base.c |   17 +++++++++--------
 1 files changed, 9 insertions(+), 8 deletions(-)
drivers/mtd/onenand/onenand_base.c +9 -8
index 63ca61b..fbdc865 100644
@@ -310,7 +310,6 @@ static int onenand_wait(struct mtd_info *mtd, int state)
 
 		if (state != FL_READING)
 			cond_resched();
-		touch_softlockup_watchdog();
 	}
 	/* To get correct interrupt status in timeout case */
 	interrupt = this->read_word(this->base + ONENAND_REG_INTERRUPT);
@@ -372,11 +371,7 @@ static int onenand_interrupt_wait(struct mtd_info *mtd, int state)
 {
 	struct onenand_chip *this = mtd->priv;
 
-	/* To prevent soft lockup */
-	touch_softlockup_watchdog();
-
 	wait_for_completion(&this->complete);
-
 	return onenand_wait(mtd, state);
 }
 
@@ -395,9 +390,6 @@ static int onenand_try_interrupt_wait(struct mtd_info *mtd, int state)
 	/* We use interrupt wait first */
 	this->wait = onenand_interrupt_wait;
 
-	/* To prevent soft lockup */
-	touch_softlockup_watchdog();
-
 	timeout = msecs_to_jiffies(100);
 	remain = wait_for_completion_timeout(&this->complete, timeout);
 	if (!remain) {
@@ -739,6 +731,8 @@ static int onenand_read(struct mtd_info *mtd, loff_t from, size_t len,
 
 	stats = mtd->ecc_stats;
 	while (read < len) {
+		cond_resched();
+
 		thislen = min_t(int, mtd->writesize, len - read);
 
 		column = from & (mtd->writesize - 1);
@@ -820,6 +814,8 @@ int onenand_do_read_oob(struct mtd_info *mtd, loff_t from, size_t len,
 	column = from & (mtd->oobsize - 1);
 
 	while (read < len) {
+		cond_resched();
+
 		thislen = mtd->oobsize - column;
 		thislen = min_t(int, thislen, len);
 
@@ -984,6 +980,8 @@ static int onenand_write(struct mtd_info *mtd, loff_t to, size_t len,
 	while (written < len) {
 		int thislen = min_t(int, mtd->writesize, len - written);
 
+		cond_resched();
+
 		this->command(mtd, ONENAND_CMD_BUFFERRAM, to, mtd->writesize);
 
 		this->write_bufferram(mtd, ONENAND_DATARAM, buf, 0, thislen);
@@ -1059,6 +1057,8 @@ static int onenand_do_write_oob(struct mtd_info *mtd, loff_t to, size_t len,
 	while (written < len) {
 		int thislen = min_t(int, mtd->oobsize, len - written);
 
+		cond_resched();
+
 		column = to & (mtd->oobsize - 1);
 
 		this->command(mtd, ONENAND_CMD_BUFFERRAM, to, mtd->oobsize);
@@ -1186,6 +1186,7 @@ static int onenand_erase(struct mtd_info *mtd, struct erase_info *instr)
 	instr->state = MTD_ERASING;
 
 	while (len) {
+		cond_resched();
 
 		/* Check if we have a bad block, we do not erase bad blocks */
 		if (onenand_block_checkbad(mtd, addr, 0, 0)) {
Signature · 1 line
1.4.4.2