From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Hildenbrand Subject: Re: [PATCH RFC 1/2] KVM: don't check for PF_VCPU when yielding Date: Wed, 26 Nov 2014 10:23:19 +0100 Message-ID: <20141126102319.2f92c64b@thinkpad-w530> References: <1416931449-24585-1-git-send-email-dahi@linux.vnet.ibm.com> <1416931449-24585-2-git-send-email-dahi@linux.vnet.ibm.com> <54758692.5000906@de.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: kvm@vger.kernel.org, pbonzini@redhat.com, gleb@kernel.org, jfrei@linux.vnet.ibm.com, cornelia.huck@de.ibm.com To: Christian Borntraeger Return-path: Received: from e06smtp10.uk.ibm.com ([195.75.94.106]:49402 "EHLO e06smtp10.uk.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751053AbaKZJXY (ORCPT ); Wed, 26 Nov 2014 04:23:24 -0500 Received: from /spool/local by e06smtp10.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 26 Nov 2014 09:23:23 -0000 Received: from b06cxnps4074.portsmouth.uk.ibm.com (d06relay11.portsmouth.uk.ibm.com [9.149.109.196]) by d06dlp03.portsmouth.uk.ibm.com (Postfix) with ESMTP id 6C9091B0805F for ; Wed, 26 Nov 2014 09:23:36 +0000 (GMT) Received: from d06av11.portsmouth.uk.ibm.com (d06av11.portsmouth.uk.ibm.com [9.149.37.252]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id sAQ9NL8e61735084 for ; Wed, 26 Nov 2014 09:23:21 GMT Received: from d06av11.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av11.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id sAQ9NKh7005104 for ; Wed, 26 Nov 2014 02:23:21 -0700 In-Reply-To: <54758692.5000906@de.ibm.com> Sender: kvm-owner@vger.kernel.org List-ID: > This change is a trade-off. > PRO: This patch would improve the case of preemption on s390. This is probably a corner case as most distros have preemption off anyway. > CON: The downside is that kvm_vcpu_yield_to is called also from kvm_vcpu_on_spin. Here we want to avoid the scheduler overhead for a wrong decision. Won't most of that part be covered by: if (!ACCESS_ONCE(vcpu->preempted)) vcpu->preempted is only set when scheduled out involuntarily. It is cleared when scheduled in. s390 sets it manually, to speed up waking up a vcpu. So when our task is scheduled in (an PF_VCPU is set), this check will already avoid scheduler overhead in kvm_vcpu_on_spin() or am I missing something?