From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH 4/7] SMP: Implement on_one_cpu() Date: Thu, 24 May 2007 16:48:04 +0300 Message-ID: <46559794.50208@qumranet.com> References: <1180008615579-git-send-email-avi@qumranet.com> <11800086152009-git-send-email-avi@qumranet.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: kvm-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org, shaohua.li@intel.com, lhcs-devel@lists.sourceforge.net To: Roland Dreier Return-path: In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org List-Id: kvm.vger.kernel.org Roland Dreier wrote: > I don't see any documented restrictions about preemption being > disabled when this function is called, but... > > > +int on_one_cpu(int cpu, void (*func) (void *info), void *info, > > + int retry, int wait) > > +{ > > + int ret; > > + int this_cpu; > > + > > + this_cpu = get_cpu(); > > what if a preempt and reschedule to a different CPU happens right > here, after this_cpu is set? > > > + if (this_cpu == cpu) { > get_cpu() disables preemption (the return value would be meaningless otherwise). -- error compiling committee.c: too many arguments to function