Deadlock in cfi_cmdset_0001.c on simultaneous write operations.
Korolev, Alexey
alexey.korolev at intel.com
Wed Nov 23 11:26:04 EST 2005
Hi All,
I faced a halting issue on multi partitioned chip when I tried to
execute simultaneous write operations.
Platform has halted, on execution of this sequence:
dd if=random of=/dev/mtd4 bs=4k count=1k&
dd if=random of=/dev/mtd5 bs=4k count=1k&
dd if=random of=/dev/mtd6 bs=4k count=1k
Halt didn't happens on two simultaneous write operations
Execution of
dd if=random of=/dev/mtd5 bs=4k count=1k&
dd if=random of=/dev/mtd6 bs=4k count=1k
was ok.
I made small investigation. Platform falls to deadlock in get_chip
function.
I was unable to definetly locate the place of the halt. But I gues it
happened here.
struct flchip_shared *shared = chip->priv;
struct flchip *contender;
spin_lock(&shared->lock);
contender = shared->writing;
if (contender && contender != chip) {
int ret = spin_trylock(contender->mutex);
spin_unlock(&shared->lock);
if (!ret)
goto retry;
spin_unlock(chip->mutex);
ret = get_chip(map, contender, contender->start, mode);
spin_lock(chip->mutex);
if (ret) {
spin_unlock(contender->mutex);
return ret;
}
timeo = jiffies + HZ;
spin_lock(&shared->lock);
}
shared->writing = chip;
if (mode == FL_ERASING)
shared->erasing = chip;
if (contender && contender != chip)
spin_unlock(contender->mutex);
spin_unlock(&shared->lock);
I slightly simplified functionality of the code and it helped, the
following code doesn't halt
struct flchip_shared *shared = chip->priv;
struct flchip *contender;
contender = shared->writing;
if (contender && contender != chip) {
yield();
timeo = jiffies + HZ;
goto retry;
}
/* We now own it */
spin_lock(&shared->lock);
shared->writing = chip;
if (mode == FL_ERASING)
shared->erasing = chip;
if (contender && contender != chip)
spin_unlock(contender->mutex);
spin_unlock(&shared->lock);
I know that it can not be solution because it reduces functionality.
I would be very much appreciate if someone advice me solution for
deadlock issue on simultaneous write operations.
Thanks,
Alexey
More information about the linux-mtd
mailing list