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=-15.5 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 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 6DE7AC433E0 for ; Mon, 18 Jan 2021 01:20:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3E906207AE for ; Mon, 18 Jan 2021 01:20:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730776AbhARBTq (ORCPT ); Sun, 17 Jan 2021 20:19:46 -0500 Received: from szxga05-in.huawei.com ([45.249.212.191]:11032 "EHLO szxga05-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729570AbhARBTo (ORCPT ); Sun, 17 Jan 2021 20:19:44 -0500 Received: from DGGEMS405-HUB.china.huawei.com (unknown [172.30.72.59]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4DJv6X6JWVzj3w7; Mon, 18 Jan 2021 09:17:56 +0800 (CST) Received: from [10.174.184.42] (10.174.184.42) by DGGEMS405-HUB.china.huawei.com (10.3.19.205) with Microsoft SMTP Server id 14.3.498.0; Mon, 18 Jan 2021 09:18:52 +0800 Subject: Re: [PATCH] kvm: arm64: Properly align the end address of table walk To: Will Deacon References: <20210115095307.12912-1-zhukeqian1@huawei.com> <20210115102334.GA14167@willie-the-truck> CC: , , , , Marc Zyngier , Catalin Marinas , Mark Rutland , James Morse , Robin Murphy , Joerg Roedel , Daniel Lezcano , Thomas Gleixner , "Suzuki K Poulose" , Julien Thierry , Andrew Morton , Alexios Zavras , , From: Keqian Zhu Message-ID: Date: Mon, 18 Jan 2021 09:18:51 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.7.1 MIME-Version: 1.0 In-Reply-To: <20210115102334.GA14167@willie-the-truck> Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.174.184.42] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org On 2021/1/15 18:23, Will Deacon wrote: > On Fri, Jan 15, 2021 at 05:53:07PM +0800, Keqian Zhu wrote: >> When align the end address, ought to use its original value. >> >> Fixes: b1e57de62cfb ("KVM: arm64: Add stand-alone page-table walker infrastructure") >> Signed-off-by: Keqian Zhu >> --- >> arch/arm64/kvm/hyp/pgtable.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/arch/arm64/kvm/hyp/pgtable.c b/arch/arm64/kvm/hyp/pgtable.c >> index bdf8e55ed308..670b0ef12440 100644 >> --- a/arch/arm64/kvm/hyp/pgtable.c >> +++ b/arch/arm64/kvm/hyp/pgtable.c >> @@ -296,7 +296,7 @@ int kvm_pgtable_walk(struct kvm_pgtable *pgt, u64 addr, u64 size, >> struct kvm_pgtable_walk_data walk_data = { >> .pgt = pgt, >> .addr = ALIGN_DOWN(addr, PAGE_SIZE), >> - .end = PAGE_ALIGN(walk_data.addr + size), >> + .end = PAGE_ALIGN(addr + size), >> .walker = walker, > > Hmm, this is a change in behaviour, no (consider the case where both 'addr' > and 'size' are misaligned)? The current code is consistent with the > kerneldoc in asm/kvm_pgtable.h, so I don't see the motivation to change it. > > Did you hit a bug somewhere? > > Will > . > Not hit a bug, I just read the code to implement a new idea of stage2 DBM support [1]. Yes, according to doc, this is not an issue ("The offset of @addr within a page is ignored."). Sorry to disturb ;-). [1] https://lore.kernel.org/kvmarm/fd26654b-8258-061c-2a69-90b961c1c71b@huawei.com/ Thanks, Keqian