From patchwork Tue Sep 1 13:33:55 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandru Elisei X-Patchwork-Id: 11748157 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 01B9A722 for ; Tue, 1 Sep 2020 13:34:32 +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 CBB22206EB for ; Tue, 1 Sep 2020 13:34:31 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="V5zLTvxo" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CBB22206EB Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.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:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To:From: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=GjprsX18njmJo0a8hm7vqylJlrg9p1Zf2PF8q2Uauew=; b=V5zLTvxo8VQpU+6D1CzgE/PXwH 5Ld1HRzlA31gqn1KnT3MqCYL0RvSXPDTozKEXrvnSB+QFkRmef+zx4b/98k/Wa0cmx/2wawwISeB5 +tp3swHH1qm7QjUeD710cdBgJhagOcnWsfDD8mTdK/aICnIvxiUel/qSxTobf/125j79bTb2+qq6i A6BXHkLFbfR9ZxqSiRn3BEPLUqR8zaJA/ZIkKbk9vkl9ttMeYPMzlgZOUF+e5QP2sq5wSR+o3b4Ms zRrgKxALFu8Ata+KLheM8oEBXmtgkNRpCYhalcmXUfba0t97Sdd3BDtK611R4GZkv8KzKIyPQ+V03 q6/HU1hA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kD6PJ-0003EC-GI; Tue, 01 Sep 2020 13:33:05 +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 1kD6PG-0003CR-EP for linux-arm-kernel@lists.infradead.org; Tue, 01 Sep 2020 13:33:03 +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 48CE71063; Tue, 1 Sep 2020 06:33:00 -0700 (PDT) Received: from monolith.localdoman (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 5F17E3F66F; Tue, 1 Sep 2020 06:32:59 -0700 (PDT) From: Alexandru Elisei To: linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu Subject: [PATCH 0/2] KVM: arm64: user_mem_abort() improvements Date: Tue, 1 Sep 2020 14:33:55 +0100 Message-Id: <20200901133357.52640-1-alexandru.elisei@arm.com> X-Mailer: git-send-email 2.28.0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200901_093302_568319_8F5D58CD X-CRM114-Status: GOOD ( 11.83 ) X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [217.140.110.172 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 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: maz@kernel.org, james.morse@arm.com, julien.thierry.kdev@gmail.com, suzuki.poulose@arm.com Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org The first patch is a fix for a bug that I found by code inspection. The second patch is an enhancement for the way user_mem_abort() handles hugetlbfs backed VM memory. Tested on a rockpro64 with 4K pages and hugetlbfs hugepagesz=1G (PUD sized block mappings). First test, guest RAM starts at 0x8100 0000 (memslot->base_gfn not aligned to 1GB); second test, guest RAM starts at 0x8000 0000, but is only 512 MB. In both cases using PUD mappings is not possible because either the memslot base address is not aligned, or the mapping would extend beyond the memslot. Without the changes, user_mem_abort() uses 4K pages to map the guest IPA. With the patches, user_mem_abort() uses PMD block mappings (2MB) to map the guest RAM, which means less TLB pressure and fewer stage 2 aborts. Alexandru Elisei (2): KVM: arm64: Update page shift if stage 2 block mapping not supported KVM: arm64: Try PMD block mappings if PUD mappings are not supported arch/arm64/kvm/mmu.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-)