From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christian Borntraeger Subject: Re: [PATCH/RFC] KVM: track pid for VCPU only on KVM_RUN ioctl Date: Tue, 19 Aug 2014 16:10:10 +0200 Message-ID: <53F35AC2.7010506@de.ibm.com> References: <1407249854-2953-1-git-send-email-borntraeger@de.ibm.com> <53E38193.8060206@redhat.com> <53F30CF3.5030606@de.ibm.com> <53F3187E.6080706@redhat.com> <20140819132842.41b3c637@thinkpad-w530> <53F33DCD.2030509@redhat.com> <20140819141403.067487b5@thinkpad-w530> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Cc: KVM , Gleb Natapov , Rik van Riel , Raghavendra K T , Michael Mueller To: David Hildenbrand , Paolo Bonzini Return-path: Received: from e06smtp14.uk.ibm.com ([195.75.94.110]:50828 "EHLO e06smtp14.uk.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752056AbaHSOKV (ORCPT ); Tue, 19 Aug 2014 10:10:21 -0400 Received: from /spool/local by e06smtp14.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 19 Aug 2014 15:10:19 +0100 Received: from b06cxnps3074.portsmouth.uk.ibm.com (d06relay09.portsmouth.uk.ibm.com [9.149.109.194]) by d06dlp03.portsmouth.uk.ibm.com (Postfix) with ESMTP id 51DD91B0804B for ; Tue, 19 Aug 2014 15:11:11 +0100 (BST) Received: from d06av12.portsmouth.uk.ibm.com (d06av12.portsmouth.uk.ibm.com [9.149.37.247]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id s7JEAGPs31981680 for ; Tue, 19 Aug 2014 14:10:16 GMT Received: from d06av12.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av12.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id s7JEAEHI021311 for ; Tue, 19 Aug 2014 08:10:16 -0600 In-Reply-To: <20140819141403.067487b5@thinkpad-w530> Sender: kvm-owner@vger.kernel.org List-ID: On 19/08/14 14:14, David Hildenbrand wrote: >> Il 19/08/2014 13:28, David Hildenbrand ha scritto: >>> Looking at the code, kvm_cpu_synchronize_state() seems to do these ioctls in >>> the vcpu thread (e.g. comming from cpu_synchronize_all_states()), any reasons >>> why kvm_cpu_synchronize_post_reset() doesn't do the same (e.g. called from >>> cpu_synchronize_all_post_reset())? >> >> No reason, feel free to post a patch for QEMU kvm-all.c. >> Documentation/virtual/kvm/api.txt clearly says: >> >> Only run vcpu ioctls from the same thread that was used to create the >> vcpu. >> >> Paolo >> > > Thanks! A little more tweaking in the other parts of s390x resets > and we should be able to reduce the number of "wrong" ioctls (I think I found > most cases that are responsible for the performance degradation). Hmm. We want to not only reduce, we want them be zero. In addition to a reworked MP_STATE patch set, we might be able to change the code to call "KVM_S390_INITIAL_RESET" only from the cpu thread itself. If that simplifies things, we could avoid doing KVM_S390_INITIAL_RESET on CPU creation, because we know that all kernel version will do an implicit cpu reset on cpu creation anyway. Can you have a try on this as well when reworking that code? We could then fix this rcu performance penalty independent from getting rid of that ioctl. Christian