On Fri 2019-10-18 11:42:43, glider@xxxxxxxxxx wrote: > Petr Mladek suggested we use > this_cpu_read(printk_context) & PRINTK_SAFE_CONTEXT_MASK > instead of checking the spinlock status in kmsan_pr_err() I would like to understand why the check is needed. My guess is that it prevents a infinite recursion. Is this the case? It might be possible to debug this using trace_printk(). It is important. If it is the recursion then there are two possibilities how to prevent it. Either prevent calling the recursive printk(). Or prevent calling the memory checker recursive. I am not sure what makes more sense. Is printk() the only piece of code where you need to avoid recursion? I wonder how it is prevented in the other cases. > This appears to be less intrusive, although we'll need to declare > printk_context in some printk header. It is easier than the original approach. But the main motivation is that it is more reliable. The spinlock is a global lock. But it seems that it is enough to check the state of the local CPU. Finally, could you please CC me to the patch(es) that are using this variable? I would actually prefer to be in CC of entire patchsets so that I see the full context. Best Regards, Petr