Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4196306pxj; Tue, 25 May 2021 02:30:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyJwamBmhNAySNEXYfZ9+t5HSfKrpH5SIQ16nhuKu4p7r9ynhREr007/OOLXFiGfTXtYCK2 X-Received: by 2002:a17:906:ff01:: with SMTP id zn1mr12410332ejb.119.1621935048347; Tue, 25 May 2021 02:30:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621935048; cv=none; d=google.com; s=arc-20160816; b=WYhvenkqTOtDuVx7MlDEuTwTvDjs33TDK3sm2htIZ9kzPyMLc9WrfJMw7hTBXlN+VV zD9MnFbCU21GTzdtDrt0C40ibX2p1Y6YbWlgSrum9MN9C+OJoW1VFybNIthjsd/ALL17 3m47pfZUsYRKZocVJ23iRgOtXsmlNCJhHoMZfoxTZr+cqgipjac1XLzwplyg0/U7b4ig BDSuDZOv5OCahLU/zdVuQ0iQtiJYik8mgFK3NxlloNQn4yk6Hh6N5l70PJKfdV0f4O3L /MPhLfGOMW8ZX3zrL676L3pdxt1d2MOhe/iuNQqmkAOwqTDmJDv50MIvMolFF/+1Fyql zeFg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=2nxueqC1X2hGmdoQp4TppAn8TVA6NZaGWiWSs7Veagc=; b=0XToJhZmQ0ai9Ru5rOkNNgvVB6D9dLTPcrx3/kYkhyzAsVkdLHZzwOOMIJ3vnpzFdQ J8GagUINiYd6cSe7obC416kHt1y/3a2QbbB9rpcNEvKM+6uFzh9UlG6jrpySRood2r6E U52V6MxT9O5a7wapgiABV4TS/0RORXqad75x6Fk44rFG6JhkhVhevjNGkLovC9q8vQj4 KmMhAEWfAVM1mTgKYOH6ng41QgZUiQ/T3Bu0NlK1yeE29qeK2md+L0rCq1EM+MYX30aL Y5XWdQxPS9SPFgdqOEz0aiNLgnLVca8r1+oWF0lFP0NBRgu0ZVBsYgVMYCVyuoGDzFy8 kcGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=k+XkKzp8; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f8si15670098ejw.475.2021.05.25.02.30.25; Tue, 25 May 2021 02:30:48 -0700 (PDT) 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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=k+XkKzp8; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232452AbhEYJaE (ORCPT + 99 others); Tue, 25 May 2021 05:30:04 -0400 Received: from mail.kernel.org ([198.145.29.99]:52878 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232341AbhEYJaD (ORCPT ); Tue, 25 May 2021 05:30:03 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 5A4F66141B; Tue, 25 May 2021 09:28:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1621934914; bh=NW/6KeimjMY0HcsoXBOHeEH9IbSnm0X7Mg03MgNiLQI=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=k+XkKzp8W7RYdepnY+CdUapRNWYS46HCEdTPQBAHtzakaTPmtWxRr88Gxjg5q1XN+ KWAOlgbOehz4JrvYaKkB8ZBUun5SXeMB7eLlFnRyV7zqzJVElsEMMu5WjjOXLe0SGH 8/a9OKFlxdbBXV2BH1Ljb+M5fqNdYprDBrJbSCNH1wUt3c14FaVYYLm3PlP1j4fRjM CEYWr4F52AVqBvgHhEVxrElNarmB7EZTegX8Eyn8H2YC3ai9S/Ib3XE74bPkFEakKW 9xkU2xGRhgdMtR5gHWpji6aPKkf5NxD/X7jCSaEPF4qf8Yyun3qtP+c6l4q0FWM6QV Q3MC7G/MHQG0g== Received: by mail-lj1-f174.google.com with SMTP id p20so37228587ljj.8; Tue, 25 May 2021 02:28:34 -0700 (PDT) X-Gm-Message-State: AOAM532UWZMemXomli4VDYjwfJ/MTj2RXmqwr1JjSzY9IvddyH+Zp2bt ljfZuP4qhP+NL0bha70O8B1fTc0nvPCmjrKiu6k= X-Received: by 2002:a2e:501b:: with SMTP id e27mr19934531ljb.508.1621934912683; Tue, 25 May 2021 02:28:32 -0700 (PDT) MIME-Version: 1.0 References: <1621839068-31738-1-git-send-email-guoren@kernel.org> <1621839068-31738-2-git-send-email-guoren@kernel.org> In-Reply-To: From: Guo Ren Date: Tue, 25 May 2021 17:28:21 +0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 2/3] riscv: Fixup PAGE_UP in asm/page.h To: Christoph Hellwig Cc: Anup Patel , Palmer Dabbelt , Arnd Bergmann , linux-riscv , Linux Kernel Mailing List , linux-arch , linux-sunxi@lists.linux.dev, Guo Ren Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, May 25, 2021 at 2:34 PM Christoph Hellwig wrote: > > On Mon, May 24, 2021 at 06:51:07AM +0000, guoren@kernel.org wrote: > > From: Guo Ren > > > > Current PAGE_UP implementation is wrong. PAGE_UP(0) should be > > 0x1000, but current implementation will give out 0. > > > > Although the current PAGE_UP isn't used, it will soon be used in > > tlb_flush optimization. > > Nak. Please just remove the PAGE_UP/PAGE_DOWN macros just like they > have been removed from other architectures long ago and use the > generic DIV_ROUND_UP macro for your new code like everyone else. This patch has been dropped because it's wrong, ref Anup's reply. Remove PAGE_UP/DOWN is okay for me. How about: static inline void local_flush_tlb_range_asid(unsigned long start, unsigned long size, unsigned long asid) { - unsigned long page_add = PAGE_DOWN(start); - unsigned long page_end = PAGE_UP(start + size); + unsigned long page_add = _ALIGN_DOWN(start, PAGE_SIZE); + unsigned long page_end = _ALIGN_UP(start + size, PAGE_SIZE); _ALIGN_XXX are also defined in arch/riscv/include/asm/page.h. -- Best Regards Guo Ren ML: https://lore.kernel.org/linux-csky/