From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH 4/6] kvm tools: Add rwlock wrapper Date: Sat, 28 May 2011 21:12:00 +0300 Message-ID: <4DE13AF0.2080001@redhat.com> 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> <20110527110729.GA26920@elte.hu> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Mathieu Desnoyers , Pekka Enberg , 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 mx1.redhat.com ([209.132.183.28]:50733 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754294Ab1E1SM0 (ORCPT ); Sat, 28 May 2011 14:12:26 -0400 In-Reply-To: <20110527110729.GA26920@elte.hu> Sender: kvm-owner@vger.kernel.org List-ID: On 05/27/2011 02:07 PM, Ingo Molnar wrote: > * Ingo Molnar wrote: > > > > 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. > > I was thinking about that on and off so loudly that Peter implemented > it long ago via fasync support on the perf event fd! :-) > > So if you set a notification signal via fcntl(F_SETOWN) on the > scheduler context switch event fd, the user-space RCU code will get a > signal on every context switch. > Context switches are completely uninteresting for userspace rcu: rcu_read_lock(); ---> context switch have we learned anything from that? no. User code is always preemptible and migratable. If rcu_read_lock() prevented migration somehow, then we'd know that a context switch means we've started a grace period for this thread. But it doesn't, so we don't. What's needed are explicit notifications about grace periods. For the vcpu threads, calling KVM_VCPU_RUN seems like a good point. For I/O threads, completion of processing of an event is also a good point. -- I have a truly marvellous patch that fixes the bug which this signature is too narrow to contain.