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.1 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, 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 38D51C43381 for ; Sun, 3 Mar 2019 15:14:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id EEF5C20836 for ; Sun, 3 Mar 2019 15:14:53 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="X9RuIhp1" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726367AbfCCPOw (ORCPT ); Sun, 3 Mar 2019 10:14:52 -0500 Received: from mail-wm1-f66.google.com ([209.85.128.66]:38064 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726228AbfCCPOv (ORCPT ); Sun, 3 Mar 2019 10:14:51 -0500 Received: by mail-wm1-f66.google.com with SMTP id a188so2313463wmf.3 for ; Sun, 03 Mar 2019 07:14:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=4VrZ5zk/YsYTYEWhFr1yM4k1yqQj7V8lxdL/Jl3sZTI=; b=X9RuIhp1Lpa/MWGDdF2c1BjTj3uF3XOdSTluji5fLpXFbU0IKG7yxrLsV5jE/RwE4t ddmSNyHxpxmnaS41/5ovjYAxx5ImPiXep3Lb77uyJwSkeskXEdDfmEnsRAKsQyD0CLUC hJMdOW1PofMRehlAsVka8Wb2lMcnx+rI+WtMsHPDHgTbTxGjIoN0w0sddaMWeY6HT844 pBXWE7dyUZi/j+e/oAKwk+3X5MIn9NImnuJcE/HCyZzp1LT/evULH+/OKojbo55m8y+Y sTVkgDrIhVS22EiEwer8GKMULE5zYV12F4J7BWz4s4PKptkDHLajJNXXMhu0WY8UwaFU FjIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=4VrZ5zk/YsYTYEWhFr1yM4k1yqQj7V8lxdL/Jl3sZTI=; b=PTbZzTC9r/LgEPItwbH+vmnSwf1w0B7urts4dGFa22XwC3lHJQSeGH7mfneHnaV/JV xHelMtq+LxF29eXKJI+vYogCpZKaZQHQtnZRUcLQ1HhivfwwhJvtJ3dS5LScGxzuk4iR 5y2Vqwr7X1IPruAiomYKfkCK9Apac46EU9Mhs8szSvCoQIGKqVmFR+jOhYIR2V2cX3Yr OD4YIKbkw+TFv7evI6UFWgKK1XIvSUuwNjIkMsUCqty0OOmW/oEDr0Hc8W31M2ykMdHu vxP82kAfCe+Woil4F8HNM2RLMVs7mV0ApyaU4RzRi+k1TD1a7WyB4DIfOLB26vAqnUUX ygjA== X-Gm-Message-State: AHQUAub+L7aVJSApT2mNUZvaslWjMDGMwe5Shfi+/i4ybzSMHaMrZ/Jc OvsHQTjOSO85+XdfeYD7W9kXBCCSuqOs7QT/gVA= X-Google-Smtp-Source: APXvYqw6ZWrfRjVcSAnKzX6N6sExROh917opCEwHRhj/Gbu2c42Tg1prI0LZvI8BHB1mZwDFEQaBGGw+H0bTXB/13UI= X-Received: by 2002:a1c:2348:: with SMTP id j69mr8332833wmj.100.1551626089592; Sun, 03 Mar 2019 07:14:49 -0800 (PST) MIME-Version: 1.0 References: <1551497728-12576-1-git-send-email-yuzenghui@huawei.com> In-Reply-To: <1551497728-12576-1-git-send-email-yuzenghui@huawei.com> From: Zenghui Yu Date: Sun, 3 Mar 2019 23:14:38 +0800 Message-ID: Subject: Re: [RFC PATCH] KVM: arm64: Force a PTE mapping when logging is enabled To: christoffer.dall@arm.com, marc.zyngier@arm.com Cc: Punit Agrawal , suzuki.poulose@arm.com, julien.thierry@arm.com, LKML , james.morse@arm.com, Zenghui Yu , wanghaibin.wang@huawei.com, kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org I think there're still some problems in this patch... Details below. On Sat, Mar 2, 2019 at 11:39 AM Zenghui Yu wrote: > > The idea behind this is: we don't want to keep tracking of huge pages when > logging_active is true, which will result in performance degradation. We > still need to set vma_pagesize to PAGE_SIZE, so that we can make use of it > to force a PTE mapping. > > Cc: Suzuki K Poulose > Cc: Punit Agrawal > Signed-off-by: Zenghui Yu > > --- > Atfer looking into https://patchwork.codeaurora.org/patch/647985/ , the > "vma_pagesize = PAGE_SIZE" logic was not intended to be deleted. As far > as I can tell, we used to have "hugetlb" to force the PTE mapping, but > we have "vma_pagesize" currently instead. We should set it properly for > performance reasons (e.g, in VM migration). Did I miss something important? > > --- > virt/kvm/arm/mmu.c | 7 +++++++ > 1 file changed, 7 insertions(+) > > diff --git a/virt/kvm/arm/mmu.c b/virt/kvm/arm/mmu.c > index 30251e2..7d41b16 100644 > --- a/virt/kvm/arm/mmu.c > +++ b/virt/kvm/arm/mmu.c > @@ -1705,6 +1705,13 @@ static int user_mem_abort(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa, > (vma_pagesize == PUD_SIZE && kvm_stage2_has_pmd(kvm))) && > !force_pte) { > gfn = (fault_ipa & huge_page_mask(hstate_vma(vma))) >> PAGE_SHIFT; > + } else { > + /* > + * Fallback to PTE if it's not one of the stage2 > + * supported hugepage sizes or the corresponding level > + * doesn't exist, or logging is enabled. First, Instead of "logging is enabled", it should be "force_pte is true", since "force_pte" will be true when: 1) fault_supports_stage2_pmd_mappings() return false; or 2) "logging is enabled" (e.g, in VM migration). Second, fallback some unsupported hugepage sizes (e.g, 64K hugepage with 4K pages) to PTE is somewhat strange. And it will then _unexpectedly_ reach transparent_hugepage_adjust(), though no real adjustment will happen since commit fd2ef358282c ("KVM: arm/arm64: Ensure only THP is candidate for adjustment"). Keeping "vma_pagesize" there as it is will be better, right? So I'd just simplify the logic like: } else if (force_pte) { vma_pagesize = PAGE_SIZE; } Will send a V2 later and waiting for your comments :) thanks, zenghui > + */ > + vma_pagesize = PAGE_SIZE; > } > up_read(¤t->mm->mmap_sem); > > -- > 1.8.3.1 > > > > _______________________________________________ > linux-arm-kernel mailing list > linux-arm-kernel@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel From mboxrd@z Thu Jan 1 00:00:00 1970 From: Zenghui Yu Subject: Re: [RFC PATCH] KVM: arm64: Force a PTE mapping when logging is enabled Date: Sun, 3 Mar 2019 23:14:38 +0800 Message-ID: References: <1551497728-12576-1-git-send-email-yuzenghui@huawei.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1551497728-12576-1-git-send-email-yuzenghui@huawei.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=m.gmane.org@lists.infradead.org To: christoffer.dall@arm.com, marc.zyngier@arm.com Cc: julien.thierry@arm.com, Punit Agrawal , LKML , james.morse@arm.com, linux-arm-kernel@lists.infradead.org, Zenghui Yu , wanghaibin.wang@huawei.com, kvmarm@lists.cs.columbia.edu, suzuki.poulose@arm.com List-Id: kvmarm@lists.cs.columbia.edu I think there're still some problems in this patch... Details below. On Sat, Mar 2, 2019 at 11:39 AM Zenghui Yu wrote: > > The idea behind this is: we don't want to keep tracking of huge pages when > logging_active is true, which will result in performance degradation. We > still need to set vma_pagesize to PAGE_SIZE, so that we can make use of it > to force a PTE mapping. > > Cc: Suzuki K Poulose > Cc: Punit Agrawal > Signed-off-by: Zenghui Yu > > --- > Atfer looking into https://patchwork.codeaurora.org/patch/647985/ , the > "vma_pagesize = PAGE_SIZE" logic was not intended to be deleted. As far > as I can tell, we used to have "hugetlb" to force the PTE mapping, but > we have "vma_pagesize" currently instead. We should set it properly for > performance reasons (e.g, in VM migration). Did I miss something important? > > --- > virt/kvm/arm/mmu.c | 7 +++++++ > 1 file changed, 7 insertions(+) > > diff --git a/virt/kvm/arm/mmu.c b/virt/kvm/arm/mmu.c > index 30251e2..7d41b16 100644 > --- a/virt/kvm/arm/mmu.c > +++ b/virt/kvm/arm/mmu.c > @@ -1705,6 +1705,13 @@ static int user_mem_abort(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa, > (vma_pagesize == PUD_SIZE && kvm_stage2_has_pmd(kvm))) && > !force_pte) { > gfn = (fault_ipa & huge_page_mask(hstate_vma(vma))) >> PAGE_SHIFT; > + } else { > + /* > + * Fallback to PTE if it's not one of the stage2 > + * supported hugepage sizes or the corresponding level > + * doesn't exist, or logging is enabled. First, Instead of "logging is enabled", it should be "force_pte is true", since "force_pte" will be true when: 1) fault_supports_stage2_pmd_mappings() return false; or 2) "logging is enabled" (e.g, in VM migration). Second, fallback some unsupported hugepage sizes (e.g, 64K hugepage with 4K pages) to PTE is somewhat strange. And it will then _unexpectedly_ reach transparent_hugepage_adjust(), though no real adjustment will happen since commit fd2ef358282c ("KVM: arm/arm64: Ensure only THP is candidate for adjustment"). Keeping "vma_pagesize" there as it is will be better, right? So I'd just simplify the logic like: } else if (force_pte) { vma_pagesize = PAGE_SIZE; } Will send a V2 later and waiting for your comments :) thanks, zenghui > + */ > + vma_pagesize = PAGE_SIZE; > } > up_read(¤t->mm->mmap_sem); > > -- > 1.8.3.1 > > > > _______________________________________________ > linux-arm-kernel mailing list > linux-arm-kernel@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel 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=DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_PASS 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 A4013C43381 for ; Sun, 3 Mar 2019 15:15:00 +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 7176120836 for ; Sun, 3 Mar 2019 15:15:00 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="ltIUTYm/"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="X9RuIhp1" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7176120836 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.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:To:Subject:Message-ID:Date:From: In-Reply-To:References:MIME-Version:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=qjU197NYodumOSLIRbZKq/0qvAUHKvOZoAYX3T6y2cE=; b=ltIUTYm/kbgOxL DT40cH2rCA88ZEtw++nFBzh13MvUMqZEJGz/Xu3xDgszLNtQMNl8pNXMz++r8fPt1SMIhH5Rp5nKL DVVebA9DwiSxpF4OrG2/DF1CznBaj5/2bP1VNcn74dg3c4wBNZlDc/bT3Kjn25NM668xBMyxfOK2d xUFq/68miwp7IpIXr8/78s/y/mpiE0STiGDBmD8KqDxnmgubzmUzh7FKDpv488eWu3Be7ZxfxxYf+ Phh1cfNVtYpmIw8H69XBaZHI1+8d5lBaz63nrH0OWnGWGumESwx8Gzbs9hAHOP6NUmo+AOk3w8m0f fOXnw1RFCxSKw3rNaCEw==; 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 1h0SpL-0007mi-0u; Sun, 03 Mar 2019 15:14:55 +0000 Received: from mail-wm1-x344.google.com ([2a00:1450:4864:20::344]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1h0SpH-0007mG-V6 for linux-arm-kernel@lists.infradead.org; Sun, 03 Mar 2019 15:14:53 +0000 Received: by mail-wm1-x344.google.com with SMTP id x10so2314970wmg.2 for ; Sun, 03 Mar 2019 07:14:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=4VrZ5zk/YsYTYEWhFr1yM4k1yqQj7V8lxdL/Jl3sZTI=; b=X9RuIhp1Lpa/MWGDdF2c1BjTj3uF3XOdSTluji5fLpXFbU0IKG7yxrLsV5jE/RwE4t ddmSNyHxpxmnaS41/5ovjYAxx5ImPiXep3Lb77uyJwSkeskXEdDfmEnsRAKsQyD0CLUC hJMdOW1PofMRehlAsVka8Wb2lMcnx+rI+WtMsHPDHgTbTxGjIoN0w0sddaMWeY6HT844 pBXWE7dyUZi/j+e/oAKwk+3X5MIn9NImnuJcE/HCyZzp1LT/evULH+/OKojbo55m8y+Y sTVkgDrIhVS22EiEwer8GKMULE5zYV12F4J7BWz4s4PKptkDHLajJNXXMhu0WY8UwaFU FjIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=4VrZ5zk/YsYTYEWhFr1yM4k1yqQj7V8lxdL/Jl3sZTI=; b=f31eJ5gaLIBU6snk+qrvautVpiNB5Vjahnuf2g4Z7xxue6yiSaFKjMsEcq2qlzrHcY uJoGhEqHHIh4PupkWQ80dXX188q/qt2ja39KLTgjP8b9QCAVspI9yBGwbDvkv8ej808E m9ljcZ5SGW6r76q348wfLugWu8VfXTVl0EA0ZercYB72NwzAGbzTXTJaMECPxuHz9fCh tWBqmtE1O6Mm565ISdkQd4e/dunI15mKOQh8NLRWlmjRUwwTquMZwlrb40asVDf9TwYj FulFKYZ/VH7+jnv/Mjod0/bIp46hBUT0GROEf46hme6FizKi8mlZZh+4tBhBZUQ1ptuC IkHA== X-Gm-Message-State: AHQUAuaDc6CBwqnDGx0erXlBg55rU+mQZTPvsKI1r8WoPKCJ0/rMk0iA 69wDQE0ucK67NgnvZBWDu7fm2nyOgbYa7jQ5G0U= X-Google-Smtp-Source: APXvYqw6ZWrfRjVcSAnKzX6N6sExROh917opCEwHRhj/Gbu2c42Tg1prI0LZvI8BHB1mZwDFEQaBGGw+H0bTXB/13UI= X-Received: by 2002:a1c:2348:: with SMTP id j69mr8332833wmj.100.1551626089592; Sun, 03 Mar 2019 07:14:49 -0800 (PST) MIME-Version: 1.0 References: <1551497728-12576-1-git-send-email-yuzenghui@huawei.com> In-Reply-To: <1551497728-12576-1-git-send-email-yuzenghui@huawei.com> From: Zenghui Yu Date: Sun, 3 Mar 2019 23:14:38 +0800 Message-ID: Subject: Re: [RFC PATCH] KVM: arm64: Force a PTE mapping when logging is enabled To: christoffer.dall@arm.com, marc.zyngier@arm.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190303_071452_004270_ED8CA49B X-CRM114-Status: GOOD ( 21.02 ) 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: julien.thierry@arm.com, Punit Agrawal , LKML , james.morse@arm.com, linux-arm-kernel@lists.infradead.org, Zenghui Yu , wanghaibin.wang@huawei.com, kvmarm@lists.cs.columbia.edu, suzuki.poulose@arm.com 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 I think there're still some problems in this patch... Details below. On Sat, Mar 2, 2019 at 11:39 AM Zenghui Yu wrote: > > The idea behind this is: we don't want to keep tracking of huge pages when > logging_active is true, which will result in performance degradation. We > still need to set vma_pagesize to PAGE_SIZE, so that we can make use of it > to force a PTE mapping. > > Cc: Suzuki K Poulose > Cc: Punit Agrawal > Signed-off-by: Zenghui Yu > > --- > Atfer looking into https://patchwork.codeaurora.org/patch/647985/ , the > "vma_pagesize = PAGE_SIZE" logic was not intended to be deleted. As far > as I can tell, we used to have "hugetlb" to force the PTE mapping, but > we have "vma_pagesize" currently instead. We should set it properly for > performance reasons (e.g, in VM migration). Did I miss something important? > > --- > virt/kvm/arm/mmu.c | 7 +++++++ > 1 file changed, 7 insertions(+) > > diff --git a/virt/kvm/arm/mmu.c b/virt/kvm/arm/mmu.c > index 30251e2..7d41b16 100644 > --- a/virt/kvm/arm/mmu.c > +++ b/virt/kvm/arm/mmu.c > @@ -1705,6 +1705,13 @@ static int user_mem_abort(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa, > (vma_pagesize == PUD_SIZE && kvm_stage2_has_pmd(kvm))) && > !force_pte) { > gfn = (fault_ipa & huge_page_mask(hstate_vma(vma))) >> PAGE_SHIFT; > + } else { > + /* > + * Fallback to PTE if it's not one of the stage2 > + * supported hugepage sizes or the corresponding level > + * doesn't exist, or logging is enabled. First, Instead of "logging is enabled", it should be "force_pte is true", since "force_pte" will be true when: 1) fault_supports_stage2_pmd_mappings() return false; or 2) "logging is enabled" (e.g, in VM migration). Second, fallback some unsupported hugepage sizes (e.g, 64K hugepage with 4K pages) to PTE is somewhat strange. And it will then _unexpectedly_ reach transparent_hugepage_adjust(), though no real adjustment will happen since commit fd2ef358282c ("KVM: arm/arm64: Ensure only THP is candidate for adjustment"). Keeping "vma_pagesize" there as it is will be better, right? So I'd just simplify the logic like: } else if (force_pte) { vma_pagesize = PAGE_SIZE; } Will send a V2 later and waiting for your comments :) thanks, zenghui > + */ > + vma_pagesize = PAGE_SIZE; > } > up_read(¤t->mm->mmap_sem); > > -- > 1.8.3.1 > > > > _______________________________________________ > linux-arm-kernel mailing list > linux-arm-kernel@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel