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,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, 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 A1AFEC433E0 for ; Thu, 4 Mar 2021 09:25:20 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (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 30CFD64F02 for ; Thu, 4 Mar 2021 09:25:20 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 30CFD64F02 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+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=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=zhJ2cAwqvUNbxHsT24Z8KPmTWNC2Ce5KT327nDZOaqc=; b=k0dCY8CMQsl5sLDzvt9A3gtmf +Kxf4lPvfFbNyQC7+pPOCtqzYHImUNtz1b/4/H7LQ9kOzoGiWB4bxbB8SWcUb1iH8OsWzwuVHWA9A xC6Myv9RozZimNMCGWvbJ4rq0pmebojrVJn85VAUmoNy7yqvhu3QD4L/HWU/r8xrII6Kp/4tC2ukh it4ZV4zU/mWFHAqo6UyXsh/cMEiaxHF8Q53d+d1oUaxFsB1LT3UYZtEVkAz+WOJS0TxyXHM9SJbDF IhI/3jCE5sghNHrZqfqGpTzJPOW9RJ5/jdPSZaIpsRHh6r5Zu27vfmHA/xCSvrDJF3EBfo4T6nGvd Wl8DZZFWg==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lHkC9-008H6t-UF; Thu, 04 Mar 2021 09:22:59 +0000 Received: from mail.kernel.org ([198.145.29.99]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lHkBh-008H5u-Cd for linux-arm-kernel@lists.infradead.org; Thu, 04 Mar 2021 09:22:50 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 05D2A64F02; Thu, 4 Mar 2021 09:22:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1614849748; bh=avry0IOR9EUhJ4b3KzhzYcucO6mG947RxdRJZ7zr5kk=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=YDvy8nkwPefjbYpb/xgtzMqWmoJHtdpuQvK2ZiPE1QuSssOdZ+atKE9MOEniu52pr E0sik1L95uCb0gjCmJ/FmAzDzZ48PE2l790hhio+TUCbCSmA0DMJn7HfDqHGT0Ydj4 q1W75z4jGf5PLBwwiO12BY+d4syKAW2jBttFk9P0kQjwPCPNY2n+KEHJSaM9Ii4nEc Ez03U+uTZDQdFtBMQHPwyXrjhYOb16tmFsrVFAsM4Xl6e/PzkK1twB16pi2QKxEKjR QwDDnwAMeoxk8P7Crh4xF0XjgwWWnJO4z3mI2bnk34Ins4SFSVA3IJqwBk9FmXZhoN bNwESzX+gVbBg== Date: Thu, 4 Mar 2021 09:22:22 +0000 From: Will Deacon To: Marc Zyngier Cc: Justin He , kvmarm@lists.cs.columbia.edu, James Morse , Julien Thierry , Suzuki Poulose , Catalin Marinas , Gavin Shan , Yanan Wang , Quentin Perret , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] KVM: arm64: Fix unaligned addr case in mmu walking Message-ID: <20210304092222.GA20662@willie-the-truck> References: <20210303024225.2591-1-justin.he@arm.com> <20210303112934.GA18452@willie-the-truck> <87mtvkys1y.wl-maz@kernel.org> <20210303211325.GA20055@willie-the-truck> <5bd4fa0b0590e548288b8f6dc3659ea5@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <5bd4fa0b0590e548288b8f6dc3659ea5@kernel.org> User-Agent: Mutt/1.10.1 (2018-07-13) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, Mar 04, 2021 at 09:16:25AM +0000, Marc Zyngier wrote: > On 2021-03-04 00:46, Justin He wrote: > > > On Wed, Mar 03, 2021 at 07:07:37PM +0000, Marc Zyngier wrote: > > > > From e0524b41a71e0f17d6dc8f197e421e677d584e72 Mon Sep 17 00:00:00 2001 > > > > From: Jia He > > > > Date: Wed, 3 Mar 2021 10:42:25 +0800 > > > > Subject: [PATCH] KVM: arm64: Fix range alignment when walking page tables > > > > > > > > When walking the page tables at a given level, and if the start > > > > address for the range isn't aligned for that level, we propagate > > > > the misalignment on each iteration at that level. > > > > > > > > This results in the walker ignoring a number of entries (depending > > > > on the original misalignment) on each subsequent iteration. > > > > > > > > Properly aligning the address at the before the next iteration > > > > > > "at the before the next" ??? > > > > > > > addresses the issue. > > > > > > > > Cc: stable@vger.kernel.org > > > > Reported-by: Howard Zhang > > > > Signed-off-by: Jia He > > > > Fixes: b1e57de62cfb ("KVM: arm64: Add stand-alone page-table walker > > > infrastructure") > > > > [maz: rewrite commit message] > > > > Signed-off-by: Marc Zyngier > > > > Link: https://lore.kernel.org/r/20210303024225.2591-1-justin.he@arm.com > > > > --- > > > > 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 4d177ce1d536..124cd2f93020 100644 > > > > --- a/arch/arm64/kvm/hyp/pgtable.c > > > > +++ b/arch/arm64/kvm/hyp/pgtable.c > > > > @@ -223,7 +223,7 @@ static inline int __kvm_pgtable_visit(struct > > > kvm_pgtable_walk_data *data, > > > > goto out; > > > > > > > > if (!table) { > > > > - data->addr += kvm_granule_size(level); > > > > + data->addr = ALIGN(data->addr, kvm_granule_size(level)); > > > > What if previous data->addr is already aligned with > > kvm_granule_size(level)? > > Hence a deadloop? Am I missing anything else? > > Indeed, well spotted. I'll revert to your original suggestion > if everybody agrees... Heh, yeah, at least one of us is awake. For the original patch, with the updated (including typo fix) commit message: Acked-by: Will Deacon If that still counts for anything! Will _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel