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=-7.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_PASS,URIBL_BLOCKED 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 7FAAEC4360F for ; Tue, 2 Apr 2019 10:07:45 +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 500B420856 for ; Tue, 2 Apr 2019 10:07:45 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="rIKx+Pj4" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 500B420856 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:In-Reply-To:MIME-Version:Date: Message-ID:From:References:To:Subject:Reply-To:Content-ID:Content-Description :Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=W4bOoBJz0ZwEhaV2STfJv+ye2oF7FopwmYG1g95xdKo=; b=rIKx+Pj4h5io1l wHujVdkdEiJ2ZpUQgLFDShWDv59/gGoZ+ItR3GuBSRBjx+mgcuxZvJW+idW4fxIYpp9i0HUQefd2E P0G4ImukgQKon526i5ymn+nXLO2wfY0v4Sq2QlLYv1vLN05kogygWvj7AT+7AQEfATSwzRDjzXbRJ ezm2hNjopY6tXeWD2EiDTsjg4LQzTi8JysQn7Un/mBd0ytY7p1gAHBQXkyrBIFfUECzwmH0EU+YZP Ktqou22XWHVJUUMh6hrsXuGNCf3zjMFgLxPmwyOPQYAP7iz8HBufrai+0Ql8EnBstkrAjrokXF/Z6 OQuq+FQlD5xcVR/Es8nw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hBGKQ-0007uX-6n; Tue, 02 Apr 2019 10:07:38 +0000 Received: from mx1.redhat.com ([209.132.183.28]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hBGKM-0007ti-Au for linux-arm-kernel@lists.infradead.org; Tue, 02 Apr 2019 10:07:36 +0000 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 66034307D9CF; Tue, 2 Apr 2019 10:07:33 +0000 (UTC) Received: from [10.36.117.163] (ovpn-117-163.ams2.redhat.com [10.36.117.163]) by smtp.corp.redhat.com (Postfix) with ESMTPS id F28716402E; Tue, 2 Apr 2019 10:07:29 +0000 (UTC) Subject: Re: [PATCH 5/8] KVM: arm/arm64: Enforce PTE mappings at stage2 when needed To: Suzuki K Poulose References: <20190328133608.110805-1-marc.zyngier@arm.com> <20190328133608.110805-6-marc.zyngier@arm.com> <496ad70d-eaa5-c46e-ddf0-d07607522eeb@redhat.com> <20190402094716.GA1082@en101> From: Auger Eric Message-ID: Date: Tue, 2 Apr 2019 12:07:28 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 MIME-Version: 1.0 In-Reply-To: <20190402094716.GA1082@en101> Content-Language: en-US X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Tue, 02 Apr 2019 10:07:33 +0000 (UTC) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190402_030734_395190_B726CD3F X-CRM114-Status: GOOD ( 24.78 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kvm@vger.kernel.org, =?UTF-8?B?UmFkaW0gS3LEjW3DocWZ?= , Marc Zyngier , Julien Thierry , YueHaibing , Zheng Xiang , Shameerali Kolothum Thodi , Christoffer Dall , Julien Grall , James Morse , Nianyao Tang , Zenghui Yu , Paolo Bonzini , kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org 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 Hi Suzuki, On 4/2/19 11:47 AM, Suzuki K Poulose wrote: > On Mon, Apr 01, 2019 at 07:10:37PM +0200, Auger Eric wrote: >> Hi Suzuki, >> >> On 3/28/19 2:36 PM, Marc Zyngier wrote: >>> From: Suzuki K Poulose >>> >>> commit 6794ad5443a2118 ("KVM: arm/arm64: Fix unintended stage 2 PMD mappings") >>> made the checks to skip huge mappings, stricter. However it introduced >>> a bug where we still use huge mappings, ignoring the flag to >>> use PTE mappings, by not reseting the vma_pagesize to PAGE_SIZE. >>> >>> Also, the checks do not cover the PUD huge pages, that was >>> under review during the same period. This patch fixes both >>> the issues. >> >> I face a regression with this patch. My guest gets stuck. I am running >> on AMD Seattle. Reverting the patch makes things work again for me. I >> run with qemu. In this scenario I don't use hugepages. I use 64kB page >> size for both the host and guest. > > Hi Eric, > > Thanks for the testing. Does the following patch fix the issue for you ? Yes it does. Thanks Eric > > > ---8>--- > kvm: arm: Skip transparent huge pages in unaligned memslots > > We silently create stage2 huge mappings for a memslot with > unaligned IPA and user address. > > Signed-off-by: Suzuki K Poulose > --- > virt/kvm/arm/mmu.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > 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); > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel