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=-5.5 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_PASS,URIBL_BLOCKED,USER_AGENT_MUTT 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 11FDDC43441 for ; Mon, 26 Nov 2018 19:00:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C9F0820865 for ; Mon, 26 Nov 2018 19:00:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C9F0820865 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726627AbeK0FzM (ORCPT ); Tue, 27 Nov 2018 00:55:12 -0500 Received: from mga03.intel.com ([134.134.136.65]:27038 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726140AbeK0FzM (ORCPT ); Tue, 27 Nov 2018 00:55:12 -0500 X-Amp-Result: UNSCANNABLE X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 26 Nov 2018 11:00:10 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,283,1539673200"; d="scan'208";a="112406539" Received: from sjchrist-coffee.jf.intel.com (HELO linux.intel.com) ([10.54.74.154]) by fmsmga001.fm.intel.com with ESMTP; 26 Nov 2018 11:00:10 -0800 Date: Mon, 26 Nov 2018 11:00:10 -0800 From: Sean Christopherson To: Will Deacon Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, cpandya@codeaurora.org, toshi.kani@hpe.com, tglx@linutronix.de, mhocko@suse.com, akpm@linux-foundation.org Subject: Re: [PATCH v4 4/5] lib/ioremap: Ensure phys_addr actually corresponds to a physical address Message-ID: <20181126190009.GG25719@linux.intel.com> References: <1543252067-30831-1-git-send-email-will.deacon@arm.com> <1543252067-30831-5-git-send-email-will.deacon@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1543252067-30831-5-git-send-email-will.deacon@arm.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Nov 26, 2018 at 05:07:46PM +0000, Will Deacon wrote: > The current ioremap() code uses a phys_addr variable at each level of > page table, which is confusingly offset by subtracting the base virtual > address being mapped so that adding the current virtual address back on > when iterating through the page table entries gives back the corresponding > physical address. > > This is fairly confusing and results in all users of phys_addr having to > add the current virtual address back on. Instead, this patch just updates > phys_addr when iterating over the page table entries, ensuring that it's > always up-to-date and doesn't require explicit offsetting. > > Cc: Chintan Pandya > Cc: Toshi Kani > Cc: Thomas Gleixner > Cc: Michal Hocko > Cc: Andrew Morton > Cc: Sean Christopherson > Signed-off-by: Will Deacon Tested-by: Sean Christopherson Reviewed-by: Sean Christopherson