Prerequisite patch to D14599.
interrupts_enabled() simply returns a bool value of whether or not
the interrupt enable flag is currently set for a cpu.
Differential D14601
Add interrupts_enabled() to cpufunc.h mhorne063_gmail.com on Mar 6 2018, 9:00 PM. Authored by Tags None Referenced Files
Details
Diff Detail
Event TimelineComment Actions I have the global question about this function. Am I right that you use it to avoid collecting coverage data under inappropriate context ? Who did suggested to use this technique ? It is perhaps correct for x86 (i.e. i386 and amd64): we have interrupts disabled under spin locks, during kernel entry/exit, and during interrupt handling on x86. Note that while the spinlock property of disabling interrupts is MI, as much as interrupts are MI concept, the property of having interrupts disabled in interrupts handlers is MD for x86. I have no idea what other architectures do there.
Comment Actions @kib Yes, you are correct about the purpose of this function. This particular technique came from the brief discussion about it between yourself and @emaste, however, the (perhaps naive) assumption that it would apply equally to all architectures was mine. The coverage function also checks td->intr_nesting_level which I presume is a more MI way of avoiding some of the code in unwanted contexts, but is less effective (on x86) than checking this interrupts_enabled() function. That being said, it is not crucial that this works immediately on all platforms as we only really need it for x86 at the moment. The others would just be nice to have. |