From patchwork Tue Dec 1 15:01:52 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandru Elisei X-Patchwork-Id: 11943125 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=-13.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable 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 E3F11C64E7B for ; Tue, 1 Dec 2020 15:02:14 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 707E520691 for ; Tue, 1 Dec 2020 15:02:14 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Rx1iaxrm" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 707E520691 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+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=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe :List-Id:MIME-Version:Message-Id:Date:Subject:To:From:Reply-To:Cc:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Owner; bh=4V2ue/URoCmfAPCG1irZYhYXftQ3cSKi641TigfYmdY=; b=Rx1iaxrmklpS5gkaWrmT6FsReI A1o7i0FmF1/vloqsjJio4LfQl3aGyLr2zThrugE0bmIR5n2ckIlrGvhyMKdPT7K9bMNKj0UDRhHJK iElalRunl9bvp9XkoJ9OnD6eFmYjSyMNpzPqwl+wPlF5ivIgXGh0wimRRnRWpfy5mUfO6cNItOK3k yQrhVlE+f/ofhgbhnFI9ILT3Be/y4pS2ZrbwMNFUHNeNeye61nyCFt6JEe7VN2phZc1XGMFbatxp4 mX3/lonaPdJgh1VVZgbOM0HrCB1cVypQt9REoU/y/EB16vJN4gx2Yw5AlNpTIHb1MYQfwWK0q+EvW Air2LYKg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kk797-0006db-5O; Tue, 01 Dec 2020 15:00:49 +0000 Received: from foss.arm.com ([217.140.110.172]) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kk791-0006ac-22 for linux-arm-kernel@lists.infradead.org; Tue, 01 Dec 2020 15:00:44 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id EFD7530E; Tue, 1 Dec 2020 07:00:40 -0800 (PST) Received: from monolith.localdoman (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 863B23F575; Tue, 1 Dec 2020 07:00:39 -0800 (PST) From: Alexandru Elisei To: linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, maz@kernel.org, james.morse@arm.com, julien.thierry.kdev@gmail.com, suzuki.poulose@arm.com Subject: [PATCH 0/5] KVM: arm64: Miscellaneous improvements Date: Tue, 1 Dec 2020 15:01:52 +0000 Message-Id: <20201201150157.223625-1-alexandru.elisei@arm.com> X-Mailer: git-send-email 2.29.2 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201201_100043_206906_FC0CC706 X-CRM114-Status: GOOD ( 15.27 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The documentation update in the first patch was suggested by Marc [1]. When I was going through the code to track down all the places error codes were coming from I noticed a few things that in my opinion could be improved. The following patches aim to do just that. I'm fine dropping them if the churn looks unjustified. Tested the Documentation changes by building pdfdocs, didn't notice any warnings regarding api.rst. Tested the other patches on a rockpro64 on the little cores. I ran kvm-unit-tests with qemu and kvmtool. I also ran a Linux guest with qemu and ran perf: $ perf record -a -- iperf3 -c 127.0.0.1 -t 60 I checked that interrupts were firing and nothing looked out of the ordinary. I used qemu because qemu VCPUs do initialization concurrently from their own thread, not from the main thread like kvmtool. To check that kvm_timer_enable() is never reached if the VGIC is not initialized, I hacked kvmtool to remove the ioctl KVM_DEV_ARM_VGIC_GRP_CTRL(KVM_DEV_ARM_VGIC_CTRL_INIT) from gic__init_gic(). When trying to run a guest, I got the following error message: KVM_RUN failed: Device or resource busy which is consistent with the EBUSY return code from vgic_v3_map_resources(). Double checked that that's where the code is coming from by adding a pr_info statement to kvm_arch_vcpu_first_run_init(). [1] https://www.spinics.net/lists/arm-kernel/msg858024.html Alexandru Elisei (5): KVM: Documentation: Add arm64 KVM_RUN error codes KVM: arm64: arch_timer: Remove VGIC initialization check KVM: arm64: Move double-checked lock to kvm_vgic_map_resources() KVM: arm64: Update comment in kvm_vgic_map_resources() KVM: arm64: Remove redundant call to kvm_pmu_vcpu_reset() Documentation/virt/kvm/api.rst | 9 +++++++-- arch/arm64/kvm/arch_timer.c | 3 --- arch/arm64/kvm/arm.c | 8 +++----- arch/arm64/kvm/pmu-emul.c | 2 -- arch/arm64/kvm/vgic/vgic-init.c | 9 ++++++++- arch/arm64/kvm/vgic/vgic-v2.c | 3 --- arch/arm64/kvm/vgic/vgic-v3.c | 3 --- 7 files changed, 18 insertions(+), 19 deletions(-)