From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 78444C43603 for ; Thu, 19 Dec 2019 19:29:37 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4154321D7D for ; Thu, 19 Dec 2019 19:29:37 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="JcNv/8/c"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="JqnujWVe"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="UQqnXXdB" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4154321D7D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=5XhytrHSjBNqkBlYXAXxexUnxCs/zk32EM5rhbeBnC4=; b=JcNv/8/cT7vG4A FQqh3beczB1Gh2+0BTPUSMq0oOUcA96qcc9uQSlGdjHNM7Afrr7MlS55/f6RpPVlYs8SSwEqOltqt 3JLTN1FATlN7RPesZWbEP75CXlQfCx8577HonXeCNA8makhT3LbLDSr0k/izOTGpMupfrggMgyVNV 900d6WCI2I18fMLC3zQ5RjMuGaZqG8AG0oKHtZ/oIgUve+edD9KHm0CXqln6kthVJ+A7sqVH2kHDp LsaipGgxBRZRtB7XbqcNNgQDBnFMvPtnuw32YdTpFS4nR6g2MHBbzF7CoMHvp4mYVS6Kw1m4EXZ1t /T0P9vkLMfY6/mXQkE9g==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1ii1UF-0004K9-IM; Thu, 19 Dec 2019 19:29:27 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1ii1UE-0004K1-RP for linux-arm-kernel@bombadil.infradead.org; Thu, 19 Dec 2019 19:29:26 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:Content-Type: MIME-Version:References:In-Reply-To:Message-ID:Subject:Cc:To:From:Date:Sender :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=vAIxDhFZG4KNnWbcoM1z/eNh1hoZhidyKE5sG/UkD5w=; b=JqnujWVerCByZe4JXIDeE3r6vM 9GL4PeDMQssx/qcARH8HQoV9flYLkfm2LPiITNaHGTNu5ffMzvBzt+CKz07TSHqObA0OW+BV4CaK9 stRStbgtzkDIqRmR2e7kVZvbyz2AIqg5Gh0P6RR7gozxcxGweIbA7lsP1NKGyXUCNVILPRmDb10kh Iak1GpTAxeFb9CuFBnKtE03eoYIDMrgBIMf8R/QdKr/Om8CydDf69omEPOLI3CuezxXgOkxMdY/kk KMX9N7ctqfiUvw2uaE0msrl6b9APE4EIuma5H98PZnAhkcgja3Pj6Im9P2Sbpwn06PVVnHPl5KB/l 8RuxVNfQ==; Received: from us-smtp-1.mimecast.com ([205.139.110.61]) by casper.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1ii1Ue-0004Yb-Q5 for linux-arm-kernel@lists.infradead.org; Thu, 19 Dec 2019 19:29:54 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576783732; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=vAIxDhFZG4KNnWbcoM1z/eNh1hoZhidyKE5sG/UkD5w=; b=UQqnXXdBDGKP3+9Ry1tMnVfKZXec6Tx2/MONmteD49i1iQKr1iXIWWJGSk+D2HmKpH/j3Y /4Z+FJmofeXsafu03CYqTxr8zRIfdQGIGqYQC6jV1aR2WnB+qx4A+DXGXzxyXy+qUmu+Er Tfr9Nk9LjwdxeRhr3F/JK59vfeNkt7o= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-22-7KuzwdpAO0uhdJbA8J3gpA-1; Thu, 19 Dec 2019 14:28:48 -0500 X-MC-Unique: 7KuzwdpAO0uhdJbA8J3gpA-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 3B2CA18FF698; Thu, 19 Dec 2019 19:28:45 +0000 (UTC) Received: from gondolin (ovpn-117-134.ams2.redhat.com [10.36.117.134]) by smtp.corp.redhat.com (Postfix) with ESMTP id 01C375DA70; Thu, 19 Dec 2019 19:28:37 +0000 (UTC) Date: Thu, 19 Dec 2019 20:28:35 +0100 From: Cornelia Huck To: Sean Christopherson Subject: Re: [PATCH v2 24/45] KVM: Add kvm_arch_vcpu_precreate() to handle pre-allocation issues Message-ID: <20191219202835.06fc6f2f.cohuck@redhat.com> In-Reply-To: <20191218215530.2280-25-sean.j.christopherson@intel.com> References: <20191218215530.2280-1-sean.j.christopherson@intel.com> <20191218215530.2280-25-sean.j.christopherson@intel.com> Organization: Red Hat GmbH MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20191219_192952_955541_9F5B6F8A X-CRM114-Status: GOOD ( 20.34 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Wanpeng Li , Janosch Frank , kvm@vger.kernel.org, Suzuki K Poulose , Marc Zyngier , Joerg Roedel , David Hildenbrand , linux-mips@vger.kernel.org, kvm-ppc@vger.kernel.org, linux-kernel@vger.kernel.org, Paul Mackerras , Christian Borntraeger , Greg Kurz , James Morse , linux-arm-kernel@lists.infradead.org, James Hogan , Paolo Bonzini , Vitaly Kuznetsov , kvmarm@lists.cs.columbia.edu, Julien Thierry , Jim Mattson Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, 18 Dec 2019 13:55:09 -0800 Sean Christopherson wrote: > Add a pre-allocation arch hook to handle checks that are currently done > by arch specific code prior to allocating the vCPU object. This paves > the way for moving the allocation to common KVM code. > > Acked-by: Christoffer Dall > Signed-off-by: Sean Christopherson > --- > arch/mips/kvm/mips.c | 5 +++++ > arch/powerpc/kvm/powerpc.c | 5 +++++ > arch/s390/kvm/kvm-s390.c | 12 ++++++++---- > arch/x86/kvm/x86.c | 14 +++++++++----- > include/linux/kvm_host.h | 1 + > virt/kvm/arm/arm.c | 21 +++++++++++---------- > virt/kvm/kvm_main.c | 4 ++++ > 7 files changed, 43 insertions(+), 19 deletions(-) > (...) > diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c > index d9e6bf3d54f0..57c6838dff37 100644 > --- a/arch/s390/kvm/kvm-s390.c > +++ b/arch/s390/kvm/kvm-s390.c > @@ -3035,15 +3035,19 @@ int kvm_arch_vcpu_setup(struct kvm_vcpu *vcpu) > return rc; > } > > +int kvm_arch_vcpu_precreate(struct kvm *kvm, unsigned int id) > +{ > + if (!kvm_is_ucontrol(kvm) && !sca_can_add_vcpu(kvm, id)) > + return -EINVAL; > + return 0; > +} > + > struct kvm_vcpu *kvm_arch_vcpu_create(struct kvm *kvm, > unsigned int id) > { > struct kvm_vcpu *vcpu; > struct sie_page *sie_page; > - int rc = -EINVAL; > - > - if (!kvm_is_ucontrol(kvm) && !sca_can_add_vcpu(kvm, id)) > - goto out; > + int rc; You might want to make this int rc = -ENOMEM; instead. > > rc = -ENOMEM; > (...) Regardless, Reviewed-by: Cornelia Huck _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel