Skip to contentSkip to conversation

Possible MTD bug in 2.6.15

DISCUSSION Jim Ramsay 3 participants 4 messages Apr 22, 2006 – Apr 23, 2006 1 message not in the archive

lore
Share & tools
lore

Jim Ramsay

author
#1 lore raw
In reply to a message not in the archive
Quoted 7 lines

From: "Pekka Enberg" <[email protected]>

Quoted 4 lines · Thiago Galesi

Ok, a couple of comments/questions

1 - Wouldn't it be better to map all flash, and leave the unneeded part as read only?

In general, yes. But this should either be enforced somewhere nicer (ie, die gracefully) so the kernel doesn't panic later, or be allowed as in my patch.

Quoted 6 lines
Quoted 4 lines

2 - Please follow Documentation/SubmittingPatches format for sending patches (especially the signed-off part and sending patches inline)

3 - No C++ style comments, please

4 - Read Documentation/CodingStyle before resubmitting the patch.

My apologies, I will do so, and resubmit when the patch is ready :)

--
Jim Ramsay
"Me fail English? That's unpossible!"

#2 lore raw
Quoted 8 lines
Quoted 4 lines
Quoted 4 lines

Ok, a couple of comments/questions

1 - Wouldn't it be better to map all flash, and leave the unneeded part as read only?

In general, yes. But this should either be enforced somewhere nicer (ie, die gracefully) so the kernel doesn't panic later, or be allowed as in my patch.

The fundamental problem there seems to be a mismatch between what is set by the user and what is read from the flash chip. As you mention in your first message, (what it came across is that) you don't have (physical / electrical) access to all the flash; not something I would recommend (that is, having limited electrical connection to the flash)

As for the options you propose - enforce and die gracefully (that is, if there is a size mismatch, warning and purposely not working) seems more correct than the second option.

author
#3 lore raw
Quoted 9 lines · Thiago Galesi
Quoted 8 lines
Quoted 4 lines
Quoted 4 lines

Ok, a couple of comments/questions

1 - Wouldn't it be better to map all flash, and leave the unneeded part as read only?

In general, yes. But this should either be enforced somewhere nicer (ie, die gracefully) so the kernel doesn't panic later, or be allowed as in my patch.

Quoted 5 lines

The fundamental problem there seems to be a mismatch between what is set by the user and what is read from the flash chip. As you mention in your first message, (what it came across is that) you don't have (physical / electrical) access to all the flash; not something I would recommend (that is, having limited electrical connection to the flash)

Yes, that is exactly what is going on - we have only have electrical access to 32M of addresses regardless of the size of the actual chip installed, and unfortunately I can't change that. However, it's not really a problem from the electrical side of things - We can still access the lowest 32M on the chip, just the highest address pin isn't connected to anything.

Quoted 3 lines

As for the options you propose - enforce and die gracefully (that is, if there is a size mismatch, warning and purposely not working) seems more correct than the second option.

I don't see why - The size mismatch doesn't prevent the flash chip from functioning. Isn't it better to help things work in more circumstances rather than in less?

And really, it's not a big stretch from what the code currently does to what my patch changes. At this point in the code, we know for a fact that we already have at least one flash chip. The math that's going on here with the 'max_chips' variable is to check if there is actually more than one physical chip implementing the entire reported size. The only mistake is that the math goes too far, shifting the count down to zero if the reported size is too small. This 'max_chips' should never be allowed to be lower than 1, because we really do know that there is at least one flash chip.

I agree with you that it's probably "more correct" to actually specify the real size of the chip in the 'map' struct before the CFI probe, but I can't think of any reason why specifying a smaller size should die (even gracefully) when it still works just fine.

Of course, maybe there are some models of flash chips where this wouldn't work and a graceful prevention of this would be important. But with our CFI-compliant chip, we don't see any problem with my patch applied.

--
Jim Ramsay
"Me fail English? That's unpossible!"

#4 lore raw
Quoted 10 lines · Jim Ramsay

And really, it's not a big stretch from what the code currently does to what my patch changes. At this point in the code, we know for a fact that we already have at least one flash chip. The math that's going on here with the 'max_chips' variable is to check if there is actually more than one physical chip implementing the entire reported size. The only mistake is that the math goes too far, shifting the count down to zero if the reported size is too small. This 'max_chips' should never be allowed to be lower than 1, because we really do know that there is at least one flash chip.

In a setup like yours, someone should go and educate hardware developers.

Anyway, if you add a CONFIG_BROKEN_HARDWARE of some sorts to your patch and send it to the proper list ([email protected]), I don't have a problem with your patch.

Jörn

Signature · 4 lines
To announce that there must be no criticism of the President, or that we
are to stand by the President, right or wrong, is not only unpatriotic
and servile, but is morally treasonable to the American public.
-- Theodore Roosevelt, Kansas City Star, 1918