> I found that I don't need to expose the metrics in vmcore info at all to > be able to read them from vmcore, given crash/drgn can read those > symbols. > > Global variable hwerror_tracking will be write-only during kernel > run-time, and only read during post morten analyzes. I am still not sure > if the compiler might not get rid of them completely, given no on reads. > I am wondering if I should EXPORT_SYMBOL_GPL(hwerror_tracking) to avoid > any optimization there.
Thanks for fleshing this out into a patch. It looks very much like I imagined. I'd be amazed if a compiler did elide all this code and data because it noticed it was written but never read. Is the spinlock when logging really helping anything? You weren't worried about locking/atomics in your original patch because users mostly care about zero vs. non-zero (or maybe vs. "many"). If the count is slightly off when many logs happen, it may not matter. The spinlock doesn't help with the timestamp part at all. > Anyway, this is the patch I am using and it solves the problem I am > interested in. Any opinion? -Tony