[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [v2 1/6] Port WARN_ON_ONCE() from Linux





On 05/25/2018 01:07 AM, Jan Beulich wrote:
On 24.05.18 at 22:23, <sameer.goel@xxxxxxxxxx> wrote:
--- a/xen/include/xen/lib.h
+++ b/xen/include/xen/lib.h
@@ -11,6 +11,19 @@
   #define BUG_ON(p)  do { if (unlikely(p)) BUG();  } while (0)
   #define WARN_ON(p) do { if (unlikely(p)) WARN(); } while (0)
+#define WARN_ON_ONCE(p) \
+({                                                    \
+    static bool __section(".data.unlikely") warned;   \
Linux uses .data.once. That or .data.cold would seem better to me than
.data.unlikely.
I guess there is not reason to keep this in a specific section. I'll
just go ahead and remove the section here?
There certainly is a reason: We don't want such variables to sit in the
middle of an otherwise frequently accessed cache line. Hence the "cold"
part of the suggested alternatives name.
Till the last release Linux was using .data.unlikely to just keep this var in its own data section. I can change the name to cold. In Linux this was changed to once to enable a sys node that can reset the value of this section and for Xen this is not needed.

Thanks,
Sameer
Jan




_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.