Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751657AbdHAGvO (ORCPT ); Tue, 1 Aug 2017 02:51:14 -0400 Received: from mx1.redhat.com ([209.132.183.28]:42604 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750763AbdHAGvN (ORCPT ); Tue, 1 Aug 2017 02:51:13 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 96BF2107937 Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=cohuck@redhat.com Date: Tue, 1 Aug 2017 08:51:06 +0200 From: Cornelia Huck To: David Hildenbrand Cc: Christoffer Dall , "Longpeng(Mike)" , pbonzini@redhat.com, rkrcmar@redhat.com, agraf@suse.com, borntraeger@de.ibm.com, christoffer.dall@linaro.org, marc.zyngier@arm.com, 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 Subject: Re: [RFC] KVM: optimize the kvm_vcpu_on_spin Message-ID: <20170801085106.1d3813ab@gondolin> In-Reply-To: <8d64ea0f-4cd6-6b7d-8804-d29beeaef6e3@redhat.com> References: <1501309377-195256-1-git-send-email-longpeng2@huawei.com> <20170731132255.GZ5176@cbox> <8d64ea0f-4cd6-6b7d-8804-d29beeaef6e3@redhat.com> Organization: Red Hat GmbH MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Tue, 01 Aug 2017 06:51:12 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 632 Lines: 21 On Mon, 31 Jul 2017 19:32:26 +0200 David Hildenbrand wrote: > This one should work for s390x, no caching (or special access patterns > like on x86) needed: > > +++ b/arch/s390/kvm/kvm-s390.c > @@ -2447,6 +2447,11 @@ int kvm_arch_vcpu_runnable(struct kvm_vcpu *vcpu) > return kvm_s390_vcpu_has_irq(vcpu, 0); > } > > +bool kvm_arch_vcpu_in_kernel(struct kvm_vcpu *vcpu) > +{ > + return !(vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE); > +} > + > void kvm_s390_vcpu_block(struct kvm_vcpu *vcpu) > { > atomic_or(PROG_BLOCK_SIE, &vcpu->arch.sie_block->prog20); Yes, that should work.