<html><body><div style="font-family: times new roman, new york, times, serif; font-size: 12pt; color: #000000"><div>Hi,<br></div><div><br></div><div>Michael Sullivan proposed a clever hack abusing mprotect() to</div><div>perform the same effect as sys_membarrier() I submitted a few</div><div>years ago (<a href="https://lkml.org/lkml/2010/4/18/15">https://lkml.org/lkml/2010/4/18/15</a>).<br></div><div><br></div><div>At that time, the sys_membarrier implementation was deemed</div><div>technically sound, but there were not enough users of the system call</div><div>to justify its inclusion.<br></div><div><br></div><div>So far, the number of users of liburcu has increased, but liburcu<br></div><div>still appears to be the only direct user of sys_membarrier. On this</div><div>front, we could argue that many other system calls have only</div><div>one user: glibc. In that respect, liburcu is quite similar to glibc.<br></div><div><br></div><div>So the question as it stands appears to be: would you be comfortable<br></div><div>having users abuse mprotect(), relying on its side-effect of issuing<br></div><div>a smp_mb() on each targeted CPU for the TLB shootdown, as<br></div><div>an effective implementation of process-wide memory barrier ?<br></div><div><br></div><div>Thoughts ?<br></div><div><br></div><div>Thanks!<br></div><div><br></div><div>Mathieu<br></div><div><br></div><div><br></div><hr id="zwchr"><blockquote style="border-left:2px solid #1010FF;margin-left:5px;padding-left:5px;color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;"><b>From: </b>"Michael Sullivan" <sully@msully.net><br><b>To: </b>"Mathieu Desnoyers" <mathieu.desnoyers@efficios.com><br><b>Cc: </b>lttng-dev@lists.lttng.org<br><b>Sent: </b>Thursday, March 12, 2015 12:04:07 PM<br><b>Subject: </b>Re: [lttng-dev] Alternative to signals/sys_membarrier() in liburcu<br><div><br></div><div dir="ltr">On Thu, Mar 12, 2015 at 10:57 AM, Mathieu Desnoyers <span dir="ltr"><<a href="mailto:mathieu.desnoyers@efficios.com" target="_blank">mathieu.desnoyers@efficios.com</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><div style="font-family:times new roman,new york,times,serif;font-size:12pt;color:rgb(0,0,0)"><br><div>Even though it depends on internal behavior not currently specified by mprotect,<br></div><div>I'd very much like to see the prototype you have,<br></div><div><br></div></div></div></blockquote><div><br>I ended up posting my code at <a href="https://github.com/msullivan/userspace-rcu/tree/msync-barrier" target="_blank">https://github.com/msullivan/userspace-rcu/tree/msync-barrier</a>.<br>The interesting patch is <a href="https://github.com/msullivan/userspace-rcu/commit/04656b468d418efbc5d934ab07954eb8395a7ab0" target="_blank">https://github.com/msullivan/userspace-rcu/commit/04656b468d418efbc5d934ab07954eb8395a7ab0</a>.<br><div><br></div></div><div>Quick blog post I wrote about it at <a href="http://www.msully.net/blog/2015/02/24/forcing-memory-barriers-on-other-cpus-with-mprotect2/" target="_blank">http://www.msully.net/blog/2015/02/24/forcing-memory-barriers-on-other-cpus-with-mprotect2/</a>.<br></div><div>(I talked briefly about sys_membarrier in the post as best as I could piece together from LKML; if my comment on it is inaccurate I can edit the post.)<br></div><div><br></div><div>-Michael Sullivan<br></div></div></div></div>
</blockquote><div><br><br></div><div><br></div><div>-- <br></div><div><span name="x"></span>Mathieu Desnoyers<br>EfficiOS Inc.<br>http://www.efficios.com<span name="x"></span><br></div></div></body></html>