From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christian Ehrhardt Subject: Re: [PATCH 3/3] kvm-s390: streamline memslot handling Date: Mon, 25 May 2009 13:40:10 +0200 Message-ID: <4A1A839A.6050406@linux.vnet.ibm.com> References: <1242826497-6797-1-git-send-email-ehrhardt@linux.vnet.ibm.com> <1242826497-6797-4-git-send-email-ehrhardt@linux.vnet.ibm.com> <4A195C0E.3000900@redhat.com> <4A1A57D8.4070203@linux.vnet.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: kvm@vger.kernel.org, borntraeger@de.ibm.com, cotte@de.ibm.com, heiko.carstens@de.ibm.com, schwidefsky@de.ibm.com, Marcelo Tosatti To: Avi Kivity Return-path: Received: from mtagate1.de.ibm.com ([195.212.17.161]:51494 "EHLO mtagate1.de.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751166AbZEYLkN (ORCPT ); Mon, 25 May 2009 07:40:13 -0400 Received: from d12nrmr1607.megacenter.de.ibm.com (d12nrmr1607.megacenter.de.ibm.com [9.149.167.49]) by mtagate1.de.ibm.com (8.13.1/8.13.1) with ESMTP id n4PBeFC0013911 for ; Mon, 25 May 2009 11:40:15 GMT Received: from d12av02.megacenter.de.ibm.com (d12av02.megacenter.de.ibm.com [9.149.165.228]) by d12nrmr1607.megacenter.de.ibm.com (8.13.8/8.13.8/NCO v9.2) with ESMTP id n4PBeEhp1880196 for ; Mon, 25 May 2009 13:40:14 +0200 Received: from d12av02.megacenter.de.ibm.com (loopback [127.0.0.1]) by d12av02.megacenter.de.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id n4PBeEK0026631 for ; Mon, 25 May 2009 13:40:14 +0200 In-Reply-To: <4A1A57D8.4070203@linux.vnet.ibm.com> Sender: kvm-owner@vger.kernel.org List-ID: Christian Ehrhardt wrote: > Avi Kivity wrote: >> ehrhardt@linux.vnet.ibm.com wrote: >>> From: Christian Ehrhardt >>> > [...] >>> - /* update sie control blocks, and unlock all vcpus */ >>> + /* request update of sie control block for all available vcpus= */ >>> for (i =3D 0; i < KVM_MAX_VCPUS; ++i) { >>> if (kvm->vcpus[i]) { >>> - kvm->vcpus[i]->arch.sie_block->gmsor =3D >>> - kvm->arch.guest_origin; >>> - kvm->vcpus[i]->arch.sie_block->gmslm =3D >>> - kvm->arch.guest_memsize + >>> - kvm->arch.guest_origin + >>> - VIRTIODESCSPACE - 1ul; >>> - mutex_unlock(&kvm->vcpus[i]->mutex); >>> + set_bit(KVM_REQ_MMU_RELOAD, &kvm->vcpus[i]->requests); >>> + kvm_s390_inject_sigp_stop(kvm->vcpus[i], >>> + ACTION_RELOADVCPU_ON_STOP); >>> } >>> } >>> =20 >> >> There already exists a loop which does this, see=20 >> make_all_cpus_request(). It uses an IPI (Marcelo, can't it use the=20 >> reschedule interrupt?). It has a couple of optimizations -- if the=20 >> request is already set, it skips the IPI, and it avoids the IPI for=20 >> vcpus out of guest mode. Maybe it could fit s390 too. > I assume that the IPI on x86 is a implicit consequence of the=20 > smp_call_function_many function, but I think this doesn't work that=20 > way for us. The kick implied by that call would be recieved, but not=20 > reach the code the checke vcpu->request. I could add that behaviour,=20 > but that could make our normal interrupt handling much slower.=20 > Therefore I don't want to call that function, but on the other hand I= =20 > like the "skip if the request is already set" functionality and think= =20 > about adding that in my loop. > =46or now I added the optimization to skip kicking vcpus out of guest t= hat=20 had the request bit already set to the s390 specific loop (sent as v2 i= n=20 a few minutes). We might one day consider standardizing some generic kickout levels e.g= =2E=20 kick to "inner loop", "arch vcpu run", "generic vcpu run", "userspace",= =20 =2E.. whatever levels fit *all* our use cases. And then let that kicks = be=20 implemented in an kvm_arch_* backend as it might be very different how=20 they behave on different architectures. In case an architecture cannot=20 achive reaching the specified kickout level it has to kick to the next=20 available upper level which eventually will reach the desired step on=20 the way to re-run the vcpu. Alltogether this should lead to a much more reliable and transparent=20 interface that finally should be used all across the generic code. --=20 Gr=FCsse / regards, Christian Ehrhardt IBM Linux Technology Center, Open Virtualization=20