Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752412AbdGaNmn (ORCPT ); Mon, 31 Jul 2017 09:42:43 -0400 Received: from foss.arm.com ([217.140.101.70]:51168 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752217AbdGaNm3 (ORCPT ); Mon, 31 Jul 2017 09:42:29 -0400 Subject: Re: [RFC] KVM: optimize the kvm_vcpu_on_spin To: "Longpeng(Mike)" , pbonzini@redhat.com, rkrcmar@redhat.com References: <1501309377-195256-1-git-send-email-longpeng2@huawei.com> Cc: agraf@suse.com, borntraeger@de.ibm.com, cohuck@redhat.com, christoffer.dall@linaro.org, james.hogan@imgtec.com, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, weidong.huang@huawei.com, arei.gonglei@huawei.com, wangxinxin.wang@huawei.com, longpeng.mike@gmail.com From: Marc Zyngier Organization: ARM Ltd Message-ID: <85acc922-2b76-3e52-1f77-c200949b0532@arm.com> Date: Mon, 31 Jul 2017 14:42:25 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: <1501309377-195256-1-git-send-email-longpeng2@huawei.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 764 Lines: 22 On 29/07/17 07:22, Longpeng(Mike) wrote: > We had disscuss the idea here: > https://www.spinics.net/lists/kvm/msg140593.html > > I think it's also suitable for other architectures. > > If the vcpu(me) exit due to request a usermode spinlock, then > the spinlock-holder may be preempted in usermode or kernmode. > But if the vcpu(me) is in kernmode, then the holder must be > preempted in kernmode, so we should choose a vcpu in kernmode > as the most eligible candidate. That seems to preclude any form of locking between userspace and kernel (which probably wouldn't be Linux). Are you sure that this form of construct is not used anywhere? I have the feeling this patch could break this scenario... Thanks, M. -- Jazz is not dead. It just smells funny...