From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thomas Gleixner Subject: Re: [RFC PATCH v3 for 4.15 08/24] Provide cpu_opv system call Date: Fri, 17 Nov 2017 21:22:04 +0100 (CET) Message-ID: References: <20171114200414.2188-1-mathieu.desnoyers@efficios.com> <20171114200414.2188-9-mathieu.desnoyers@efficios.com> <20171117001410.GG2482@two.firstfloor.org> <1756446476.17265.1510938872121.JavaMail.zimbra@efficios.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Return-path: In-Reply-To: <1756446476.17265.1510938872121.JavaMail.zimbra@efficios.com> Sender: linux-kernel-owner@vger.kernel.org To: Mathieu Desnoyers Cc: Andi Kleen , Peter Zijlstra , "Paul E. McKenney" , Boqun Feng , Andy Lutomirski , Dave Watson , linux-kernel , linux-api , Paul Turner , Andrew Morton , Russell King , Ingo Molnar , "H. Peter Anvin" , Andrew Hunter , Chris Lameter , Ben Maurer , rostedt , Josh Triplett , Linus Torvalds , Catalin Marinas , Will List-Id: linux-api@vger.kernel.org On Fri, 17 Nov 2017, Mathieu Desnoyers wrote: > ----- On Nov 17, 2017, at 5:09 AM, Thomas Gleixner tglx@linutronix.de wrote: > 7) Allow libraries with multi-part algorithms to work on same per-cpu > data without affecting the allowed cpu mask > > I stumbled on an interesting use-case within the lttng-ust tracer > per-cpu buffers: the algorithm needs to update a "reserve" counter, > serialize data into the buffer, and then update a "commit" counter > _on the same per-cpu buffer_. My goal is to use rseq for both reserve > and commit. > > Clearly, if rseq reserve fails, the algorithm can retry on a different > per-cpu buffer. However, it's not that easy for the commit. It needs to > be performed on the same per-cpu buffer as the reserve. > > The cpu_opv system call solves that problem by receiving the cpu number > on which the operation needs to be performed as argument. It can push > the task to the right CPU if needed, and perform the operations there > with preemption disabled. If your transaction cannot be done in one go, then abusing that byte code interpreter for concluding it is just hillarious. That whole exercise is a gazillion times slower than the atomic operations which are neccesary to do it without all that. I'm even more convinced now that this is overengineered beyond repair. Thanks, tglx