Re: [RFC][PATCH v2 -next 2/2] Adding lock operations tokmsg_dump()/pstore_dump()

From: Don Zickus
Date: Fri Oct 28 2011 - 14:35:03 EST


On Fri, Oct 21, 2011 at 05:21:35PM -0400, Seiji Aguchi wrote:
> pstore_dump()/kmsg_dump() may be called everywhere in kernel.
> So we have to care about following cases.
>
> - Panic path
> In this case, Logging message process is serialized via smp_send_stop().
> So, we can bust spin_locks.
>
> Currently, kmsg_dump() may be called twice (KMSG_DUMP_PANIC and KMSG_DUMP_EMERGY)
> So, for avoiding deadlock, I suggest to bust locks rather than skipping them.
>
> - NMI context
> While a cpu is in NMI handler, other cpus may be running.
> So, trylock should be called so that lockdep cheking works.
>
> - Process context
> In this case, we can simply take locks.

It ain't pretty but it moves things towards a more reliable message dump.
The odds of us needing to bust the spinlocks are really small. Most of
the time no one reads the pstore filesystem.

I would love to figure out a prettier solution for this locking mess, but
I can't think of anything. We have customers who want to utilize this
technology, so I am trying to make sure it is stable and robust for now.
A little selfish I suppose. But we are open to ideas?

Acked-by: Don Zickus <dzickus@xxxxxxxxxx>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/