From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH 4/6] kvm tools: Add rwlock wrapper Date: Sun, 29 May 2011 15:48:29 +0300 Message-ID: <4DE2409D.1050701@redhat.com> References: <20110526202531.GA2765@elte.hu> <20110526230508.GA15983@Krystal> <20110527102533.GA24608@elte.hu> <20110527110729.GA26920@elte.hu> <4DE13AF0.2080001@redhat.com> <20110528183259.GA15019@elte.hu> <4DE1EA93.6040401@redhat.com> <20110529073550.GA21254@elte.hu> <4DE1FBA5.6080905@redhat.com> <20110529123755.GC26627@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]:31299 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752631Ab1E2Msq (ORCPT ); Sun, 29 May 2011 08:48:46 -0400 In-Reply-To: <20110529123755.GC26627@elte.hu> Sender: kvm-owner@vger.kernel.org List-ID: On 05/29/2011 03:37 PM, Ingo Molnar wrote: > > > > > > It's not transparent at all if you index RCU data structures by > > > the current CPU index, which the kernel implementation does. > > > > But that's completely broken for userspace. The "current cpu > > index" doesn't even exist, since you can't disable preemption. > > It does exist, if the signal handler notification of a migration is > instantaneous (which it is). Something like rcu_preempt_qs(), which expects to be called with interrupts disabled, cannot be made to work. I don't understand how you expect per_cpu to work in userspace. As soon as you calculate the per-cpu address, it can be invalidated. It doesn't help that you get a signal; you've already calculated the address. Also, in the kernel, using per-cpu data implies mutual exclusion (since you've disabled preemption). That doesn't apply to userspace. > > > Doing that has the advantage of being much more cache-compressed > > > than the TID index, > > > > If you have more tasks than cpus; which isn't a given. > > Sure there are special cases but in general there can be many more > tasks (threads) than CPUs ;-) Sure; that was just a side note. Note that for server virtualization you usually have less tasks (in a process, not globally) than host cpus. -- error compiling committee.c: too many arguments to function