From patchwork Wed Oct 31 17:08:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robin Murphy X-Patchwork-Id: 10662995 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4DAAB17DF for ; Wed, 31 Oct 2018 17:08:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3B62E2AF04 for ; Wed, 31 Oct 2018 17:08:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2F3572AF0F; Wed, 31 Oct 2018 17:08:30 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3FA162AF04 for ; Wed, 31 Oct 2018 17:08:29 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4A04B6B0003; Wed, 31 Oct 2018 13:08:28 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 427166B0006; Wed, 31 Oct 2018 13:08:28 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2F1886B0008; Wed, 31 Oct 2018 13:08:28 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-ot1-f71.google.com (mail-ot1-f71.google.com [209.85.210.71]) by kanga.kvack.org (Postfix) with ESMTP id 009A26B0003 for ; Wed, 31 Oct 2018 13:08:27 -0400 (EDT) Received: by mail-ot1-f71.google.com with SMTP id m91so11558209otc.17 for ; Wed, 31 Oct 2018 10:08:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:to:cc:from :subject:message-id:date:user-agent:mime-version:content-language :content-transfer-encoding; bh=NCdXDbMmK/zYxFseTROc06nmTFicpBUkyxXQIPGGlMw=; b=ZGSbYgDgKRrge9gPBey8jWaurlKvKoPykLLFVUwTOpXZR13oXdSO0cAP3H+6QHSLAO 8EfJuDG+xuSaH2DV2q+QIt7+Urk79j0hRdnSOXg96N7g3fb2z3TYwgd7n5uvNgtGcpSR 56HHO5Z+oM3lqdl0JDYDpoUjm6n5mEGOdwpbC5UZbF3i3VlY6ar5n7PVIZ9qsJAzYZC/ rLqviT8H0koWyFLFdQB0AbTT7UCq4y0cLua6UrKHy6IBrHF+PLJm0fXYRKx6lWSW0j3W ctrvT2ZE2K96mWqQ5N+HHx578Z1jTFnquXEPCAeVPqB49T/DCQh8Ljdz/HZDWWHYegAA jn3A== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of robin.murphy@arm.com designates 217.140.101.70 as permitted sender) smtp.mailfrom=robin.murphy@arm.com X-Gm-Message-State: AGRZ1gJKYBm+c5qJRCrImrhxMzYgtCm1m1NlNfM5yqF000LTNi5gIlK6 slKUdcvAKSknQkkE2bp83Zt5YqjODOE5ojLCDSIsHLOZ74XzGSKbhaHSBOIrtgkAzu+iN1a05Z3 ge3ORkXVmgAYxVVg87JIkAuSnjRTHvjEJ5sr4cURjqgjDy4FjSrXBMoGOWh/w4oNr7w== X-Received: by 2002:aca:3f43:: with SMTP id m64-v6mr2409409oia.46.1541005707743; Wed, 31 Oct 2018 10:08:27 -0700 (PDT) X-Google-Smtp-Source: AJdET5ct62w0EoIpCKsobeV0qXaMT9D4jjtwBQ8LQvTFLBWoYVCnFQQ1a5P94Ug8CDpKgan8cM1/ X-Received: by 2002:aca:3f43:: with SMTP id m64-v6mr2409365oia.46.1541005706970; Wed, 31 Oct 2018 10:08:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1541005706; cv=none; d=google.com; s=arc-20160816; b=Sxkl+Uugc4rZElOAyeCDVoft6Xo867xbQzSnUDrIz+VPZSnDFvdDTBN288roUZYt7K RzNBut8NadcGnG4AXbmxiqW4EVQFg39LmoD6qnTnH+GPa7p/0abuer8GFGLF8B+WYWtY 6XICLbISf2UVFNQ4S+U7QQlImMRDaftFYTYzqkTYAqZNssUlzX3kMSItqJMMWByVs8R+ ehRH5HEgZxmnVtDBOyS78zzv8hN0uyIVO8SP7IrIA2cliXaN+0k+x7PxC+VDO6mWFw8E hdQw1LoCDLjISCrFY0LIxm00emTrP6kvEIvt3ynaFGtFBM2BFomEc7MfZ0XdbM5M4dkA bFpw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:content-language:mime-version:user-agent :date:message-id:subject:from:cc:to; bh=NCdXDbMmK/zYxFseTROc06nmTFicpBUkyxXQIPGGlMw=; b=VDy9buL+cxlN/a2NiyQkYDcPHfAdNSpOIp6QhE7YbsXgEr8Lp70DvAGsZaBEaLHgzD PNzx+yYZQEchy30yvY97lREgZGrhMaORx1qo3Efo4B2Va87HuGHTXCDdYS37aXIlUDuU kJnXYLgOvbqxIiDUw8SLGyHAd9mfkepIX1oprcQPzkeQENZr8F1efhIIqaxpyLhtBbAz 3hCC5ID3BCo62ZsCA81nJiGC3rdy2YGP9Og1zlIcxfpIwShM7tDHm5Zumzk59Ky7nUVS FT6huI2z7nra3lDi8qe/rPIIuqTLyi7FIt/3zGDnhda1AzPKNtvmcYK5z5zHB99FuQgh DtZw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of robin.murphy@arm.com designates 217.140.101.70 as permitted sender) smtp.mailfrom=robin.murphy@arm.com Received: from foss.arm.com (foss.arm.com. [217.140.101.70]) by mx.google.com with ESMTP id r5si2016805ote.302.2018.10.31.10.08.26 for ; Wed, 31 Oct 2018 10:08:26 -0700 (PDT) Received-SPF: pass (google.com: domain of robin.murphy@arm.com designates 217.140.101.70 as permitted sender) client-ip=217.140.101.70; Authentication-Results: mx.google.com; spf=pass (google.com: domain of robin.murphy@arm.com designates 217.140.101.70 as permitted sender) smtp.mailfrom=robin.murphy@arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id EF7D480D; Wed, 31 Oct 2018 10:08:25 -0700 (PDT) Received: from [10.1.196.75] (e110467-lin.cambridge.arm.com [10.1.196.75]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 55BF93F71D; Wed, 31 Oct 2018 10:08:25 -0700 (PDT) To: linux-mm@kvack.org Cc: dan.j.williams@intel.com, jglisse@redhat.com From: Robin Murphy Subject: __HAVE_ARCH_PTE_DEVMAP - bug or intended behaviour? Message-ID: <9cf5c075-c83f-0915-99ef-b2aa59eca685@arm.com> Date: Wed, 31 Oct 2018 17:08:23 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 Content-Language: en-GB X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP Hi mm folks, I'm looking at ZONE_DEVICE support for arm64, and trying to make sense of a build failure has led me down the rabbit hole of pfn_t.h, and specifically __HAVE_ARCH_PTE_DEVMAP in this first instance. The failure itself is a link error in remove_migration_pte() due to a missing definition of pte_mkdevmap(), but I'm a little confused at the fact that it's explicitly declared without a definition, as if that breakage is deliberate. So, is the !__HAVE_ARCH_PTE_DEVMAP case actually expected to work? If not, then it seems to me that the relevant code could just be gated by CONFIG_ZONE_DEVICE directly to remove the confusion. If it is, though, then what should the generic definitions of p??_mkdevmap() be? I guess either way I still need to figure out the implications of _PAGE_DEVMAP at the arch end and whether/how arm64 should implement it, but given this initial hurdle it's not clear exactly where to go next. Tangentially, is it also right that is_device_{public,private}_page() can still get non-stub definitions even with CONFIG_DEVICE_{PUBLIC,PRIVATE} disabled? As it happens, the patch below is enough to dodge the build failure for my configuration (i.e. CONFIG_FS_DAX && !CONFIG_HMM) by optimising the offending call away, however I'm not sure I'd want to rely on that; conceptually, though, it does still seem like it might be appropriate. Thanks, Robin. ----->8----- From: Robin Murphy Date: Wed, 31 Oct 2018 15:57:17 +0000 Subject: [PATCH] mm: Clean up is_device_*_page() definitions Refactor is_device_{public,private}_page() with is_pci_p2pdma_page() to make them all consistent in depending on their respective config options even when CONFIG_DEV_PAGEMAP_OPS is enabled for other reasons. This allows a little more compile-time optimisation as well as the conceptual and cosmetic cleanup. Signed-off-by: Robin Murphy --- include/linux/mm.h | 52 ++++++++++++++++++++++------------------------ 1 file changed, 25 insertions(+), 27 deletions(-) { @@ -918,22 +892,46 @@ static inline bool put_devmap_managed_page(struct page *page) { return false; } +#endif /* CONFIG_DEV_PAGEMAP_OPS */ +#if defined(CONFIG_DEV_PAGEMAP_OPS) && defined(CONFIG_DEVICE_PRIVATE) +static inline bool is_device_private_page(const struct page *page) +{ + return is_zone_device_page(page) && + page->pgmap->type == MEMORY_DEVICE_PRIVATE; +} +#else static inline bool is_device_private_page(const struct page *page) { return false; } +#endif +#if defined(CONFIG_DEV_PAGEMAP_OPS) && defined(CONFIG_DEVICE_PUBLIC) +static inline bool is_device_public_page(const struct page *page) +{ + return is_zone_device_page(page) && + page->pgmap->type == MEMORY_DEVICE_PUBLIC; +} +#else static inline bool is_device_public_page(const struct page *page) { return false; } +#endif +#if defined(CONFIG_DEV_PAGEMAP_OPS) && defined(CONFIG_PCI_P2PDMA) +static inline bool is_pci_p2pdma_page(const struct page *page) +{ + return is_zone_device_page(page) && + page->pgmap->type == MEMORY_DEVICE_PCI_P2PDMA; +} +#else static inline bool is_pci_p2pdma_page(const struct page *page) { return false; } -#endif /* CONFIG_DEV_PAGEMAP_OPS */ +#endif static inline void get_page(struct page *page) { diff --git a/include/linux/mm.h b/include/linux/mm.h index 1e52b8fd1685..15a49ed5436c 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -879,32 +879,6 @@ static inline bool put_devmap_managed_page(struct page *page) } return false; } - -static inline bool is_device_private_page(const struct page *page) -{ - return is_zone_device_page(page) && - page->pgmap->type == MEMORY_DEVICE_PRIVATE; -} - -static inline bool is_device_public_page(const struct page *page) -{ - return is_zone_device_page(page) && - page->pgmap->type == MEMORY_DEVICE_PUBLIC; -} - -#ifdef CONFIG_PCI_P2PDMA -static inline bool is_pci_p2pdma_page(const struct page *page) -{ - return is_zone_device_page(page) && - page->pgmap->type == MEMORY_DEVICE_PCI_P2PDMA; -} -#else /* CONFIG_PCI_P2PDMA */ -static inline bool is_pci_p2pdma_page(const struct page *page) -{ - return false; -} -#endif /* CONFIG_PCI_P2PDMA */ - #else /* CONFIG_DEV_PAGEMAP_OPS */ static inline void dev_pagemap_get_ops(void)