From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mathieu Desnoyers Subject: Re: [PATCH 4/6] kvm tools: Add rwlock wrapper Date: Fri, 27 May 2011 09:22:52 -0400 Message-ID: <20110527132251.GD29744@Krystal> References: <1306419950-19064-1-git-send-email-levinsasha928@gmail.com> <1306419950-19064-4-git-send-email-levinsasha928@gmail.com> <1306426743.3065.34.camel@lappy> <20110526180518.GA3572@elte.hu> <4DDE97CE.4000302@redhat.com> <20110526202531.GA2765@elte.hu> <20110526230508.GA15983@Krystal> <20110527102533.GA24608@elte.hu> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Pekka Enberg , Avi Kivity , Sasha Levin , john@jfloren.net, kvm@vger.kernel.org, asias.hejun@gmail.com, gorcunov@gmail.com, prasadjoshi124@gmail.com, "Paul E. McKenney" To: Ingo Molnar Return-path: Received: from mail.openrapids.net ([64.15.138.104]:38788 "EHLO blackscsi.openrapids.net" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752129Ab1E0NWx (ORCPT ); Fri, 27 May 2011 09:22:53 -0400 Content-Disposition: inline In-Reply-To: <20110527102533.GA24608@elte.hu> Sender: kvm-owner@vger.kernel.org List-ID: * Ingo Molnar (mingo@elte.hu) wrote: > > * Mathieu Desnoyers wrote: > > > > - Check kernel/tinyrcu.c to see how RCU is implemented in its > > > simplest form. :) > > > > ...so simplistic it only works on UP systems, which are not so common > > these days on the systems targeted by kvm. > > As i said above, in its simplest form - which is UP. > > Obviously it's not tinyrcu.c that should be used by tools/kvm/ but > what i suggested, tree-RCU: I agree that tree-RCU has some grace-period management scalability benefits that would be interesting to have. > > > - Copy the tree-RCU code from kernel/treercu.c to tools/kvm/rcu/ > > > > This code is very much tied with the kernel scheduler. [...] > > It would not be particularly complex to enable user-space to request > a callback on context switch events. > > I was thinking on and off about allowing perf events to generate a > per sampling event notification signal on specific events, such as > page faults or context switches. > > Obviously this won't be enabled from NMI contexts due to atomicity > constraints, but the pagefault and maybe the context switch path > looks doable. > > That capability would be a rather simple kernel change and it would > allow a user-space RCU implementation to be notified of various key > events, context switches in particular. I'm worried about "self-recursion" behaviors that could be triggered though: if the userland callback code called from a page fault triggers a page fault all by itself, then it looks like a good way to bring the system to its knees. The same apply to context switches. Do you have a way to handle this in mind ? > > Would you be interested in helping code up such a facility? The urcu > library could make good use of it i think, regardless of what we do > in tools/kvm/. I'm open to try finding out the best possible approach to support RCU in user-space (disclaimer: I might need some help on this due to my time being fully taken by contracts currently). I guess the sweet spot will end up being at a crossroad between kernel-only and userland-only solution. Thanks, Mathieu > > Thanks, > > Ingo -- Mathieu Desnoyers Operating System Efficiency R&D Consultant EfficiOS Inc. http://www.efficios.com