From patchwork Tue Apr 2 11:06:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suzuki K Poulose X-Patchwork-Id: 161624 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp1596028jan; Tue, 2 Apr 2019 04:06:35 -0700 (PDT) X-Google-Smtp-Source: APXvYqzGZv5h6jd7kXLc40lNb03i2kxSBOz2uWRREuYmhNRyT47DWzBt4UWzUJSqz9TzNTOL13G4 X-Received: by 2002:a62:205c:: with SMTP id g89mr66480908pfg.34.1554203195717; Tue, 02 Apr 2019 04:06:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554203195; cv=none; d=google.com; s=arc-20160816; b=XLJdUOPBHA3qbKbRcI7IK+6RAy0BAcc16fdw4Wi4p64os6pBn2UqAyYgkTyNg4oDaN up5mAxlmkBLRjJyuXjXey2IkiuGkr6RI8LUfn/FID0YmoRS6OLNcsfUX3bfdG/p87qJv k1WRZcsODzlKsagqKVyqZ0elTgMEa4kEGrVN3RtTmbKkndZQGT2y60/5DmYJXDtZDnY8 iS0BCBBdn4tOFEXL2zmeqlqkCvhgr8FvagMEo6Gi5dWJi/uK+dl9n+Fxvenzh7lNq5p2 V8cFY73mwJ6p9XDc5Pq6Qr83EGeo/yEmdn3rC8YmGiatJQuNNQr8uhFnp3jbNZgJzmNi Uwjw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=CGsFEBgLRRoG1SFLI8t2qQwYs8Dk1hpKum7cDXJodhY=; b=epMJ0Yj3NVTLLLRgd2ov91tce85XWjj0/nHQmD1epd9f91Dn0cQ33jLLY8V/xiqrWV a8WNUovNgh7Sr+ihgUEP0VxqJW4l0oHfMIE3dg4/17gGigAGvF+tJEtYJfXY8Osn0v4q Secz3/sklrFZ0/Ce2WVpp+e4RN11sJu5g8StBr420X4E1wR7jYs8B4S/NELyKIj5uPHh p3C2m1O8nWLbD/gWb1aW8fyojI+PWXJu53t4GSMhJeTU2S287amr7O1kOzXASTz5JQKj QVn/Lh12gYEtE8vnwomXCvYV2mOS9lMel98EX8dAoSFxQphBQSNOVVempgdXhLxTh/IA QZ8Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i67si11728791pfb.117.2019.04.02.04.06.35; Tue, 02 Apr 2019 04:06:35 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730366AbfDBLGe (ORCPT + 31 others); Tue, 2 Apr 2019 07:06:34 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:48892 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728748AbfDBLGd (ORCPT ); Tue, 2 Apr 2019 07:06:33 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 484C01688; Tue, 2 Apr 2019 04:06:33 -0700 (PDT) Received: from en101.cambridge.arm.com (en101.cambridge.arm.com [10.1.196.93]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 71DAE3F59C; Tue, 2 Apr 2019 04:06:31 -0700 (PDT) From: Suzuki K Poulose To: linux-arm-kernel@lists.infradead.org Cc: kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, eric.auger@redhat.com, Suzuki K Poulose , Marc Zyngier , Chirstoffer Dall , Zenghui Yu , Zheng Xiang Subject: [PATCH] kvm: arm: Skip stage2 huge mappings for unaligned ipa backed by THP Date: Tue, 2 Apr 2019 12:06:16 +0100 Message-Id: <1554203176-3958-1-git-send-email-suzuki.poulose@arm.com> X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org With commit a80868f398554842b14, we no longer ensure that the THP page is properly aligned in the guest IPA. Skip the stage2 huge mapping for unaligned IPA backed by transparent hugepages. Fixes: a80868f398554842b14 ("KVM: arm/arm64: Enforce PTE mappings at stage2 when needed") Reported-by: Eric Auger Cc: Marc Zyngier Cc: Chirstoffer Dall Cc: Zenghui Yu Cc: Zheng Xiang Tested-by: Eric Auger Signed-off-by: Suzuki K Poulose --- virt/kvm/arm/mmu.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) -- 2.7.4 Tested-by: Andrew Murray Signed-off-by: Zenghui Yu diff --git a/virt/kvm/arm/mmu.c b/virt/kvm/arm/mmu.c index 27c9583..4a22f5b 100644 --- a/virt/kvm/arm/mmu.c +++ b/virt/kvm/arm/mmu.c @@ -1412,7 +1412,9 @@ static bool transparent_hugepage_adjust(kvm_pfn_t *pfnp, phys_addr_t *ipap) * page accordingly. */ mask = PTRS_PER_PMD - 1; - VM_BUG_ON((gfn & mask) != (pfn & mask)); + /* Skip memslots with unaligned IPA and user address */ + if ((gfn & mask) != (pfn & mask)) + return false; if (pfn & mask) { *ipap &= PMD_MASK; kvm_release_pfn_clean(pfn);