From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrea Arcangeli Subject: Re: [PATCH] kvm: Drop obsolete cpu_get/put in make_all_cpus_request Date: Mon, 20 Jul 2009 21:46:30 +0200 Message-ID: <20090720194630.GD16136@random.random> References: <4A643924.6060908@siemens.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Marcelo Tosatti , kvm-devel To: Jan Kiszka Return-path: Received: from mx2.redhat.com ([66.187.237.31]:44903 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753175AbZGUNX4 (ORCPT ); Tue, 21 Jul 2009 09:23:56 -0400 Content-Disposition: inline In-Reply-To: <4A643924.6060908@siemens.com> Sender: kvm-owner@vger.kernel.org List-ID: Hi, I suggested this too first time around when I've seen the patch but they reminded it's needed to make life easier to preempt-rt... On Mon, Jul 20, 2009 at 11:30:12AM +0200, Jan Kiszka wrote: > spin_lock disables preemption, so we can simply read the current cpu. > > Signed-off-by: Jan Kiszka > --- > > virt/kvm/kvm_main.c | 3 +-- > 1 files changed, 1 insertions(+), 2 deletions(-) > > diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c > index 7cd1c10..98e4ec8 100644 > --- a/virt/kvm/kvm_main.c > +++ b/virt/kvm/kvm_main.c > @@ -741,8 +741,8 @@ static bool make_all_cpus_request(struct kvm *kvm, unsigned int req) > if (alloc_cpumask_var(&cpus, GFP_ATOMIC)) > cpumask_clear(cpus); > > - me = get_cpu(); > spin_lock(&kvm->requests_lock); > + me = smp_processor_id(); > kvm_for_each_vcpu(i, vcpu, kvm) { > if (test_and_set_bit(req, &vcpu->requests)) > continue; > @@ -757,7 +757,6 @@ static bool make_all_cpus_request(struct kvm *kvm, unsigned int req) > else > called = false; > spin_unlock(&kvm->requests_lock); > - put_cpu(); > free_cpumask_var(cpus); > return called; > } > -- > To unsubscribe from this list: send the line "unsubscribe kvm" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html