Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1648789pxb; Sun, 17 Jan 2021 17:21:20 -0800 (PST) X-Google-Smtp-Source: ABdhPJx5w1Om8jXZbRblTU888Mpu6hbtY83lBH8jcotmMWB03BKokemuznn30BcFU0PnlO+jriJG X-Received: by 2002:a17:907:389:: with SMTP id ss9mr16341532ejb.158.1610932879890; Sun, 17 Jan 2021 17:21:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610932879; cv=none; d=google.com; s=arc-20160816; b=lHbSun8IECCk0z+1Wg+QiHpimpNtOhF1YfCBevY1EqLvOfKCzus9a10+T1KlBXkMyB zd2Lh2E0larScuQh3JRNvA0uJjFxDJ3VuFxVUgfmECpfMtdoJt7qN4RL9GP7n0meNqgU XKfjgfOSpwYCsHJeVHJxad43Ed1IqcbwcyPusbp4utUP7wwp6tPhBPo+p7caavFEL/nX SKd5I0tpkFF1mhKVF8TKCkF6od+03Bin4lkc/YehqyfmBQi0cr0FUo3wZcCDuyx4rHLc 01gEsdWos/aCpIU/AeO53gZ4cr/iWO7u3RyQ/M8JULhHPXu3uH2tikX1aJRAHeguerx6 s/lQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:cc:references:to :subject; bh=Jst5+Ycf+iLEFfNDf/ifuyIPyQtmZZA4pwLcfHCHM/M=; b=Tk+QqZp2gcf/Q9gbng++kVrShSov0AXMmS5JDh1CG/y02wi41rX/nSgwK/ym9ZO2nJ N2/pBntjvWZoMfF+rC+MIbPr3tGLy4/8J8mJm5y5kxDlPjOtwTW55k+HLKUk4mTOQ46s xJLUuiqiQVu/67h8nXLwtq5uTDpvl0yqMDvsvldoV2yO94g0qWVUIqVKKFJD6J4xL0sx Ymzbx2RW42Wke8N6dbipFzQSrTjYH2aUAlqncB3ZqmXWh7yqi7NeSoTMpBF6H7uHPxjn pCug/kpLsNzviRhmKYuBd+aQwj3VpxATEVaW/SueLDhwx+ICB11WElmCLSFJixTBrDNr yiGA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y4si6268398ejf.479.2021.01.17.17.20.57; Sun, 17 Jan 2021 17:21:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730778AbhARBTq (ORCPT + 99 others); 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: linux-kernel@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