All of lore.kernel.org
 help / color / mirror / Atom feed
From: SeongJae Park <sj@kernel.org>
To: akpm@linux-foundation.org
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	SeongJae Park <sj@kernel.org>,
	apopple@nvidia.com
Subject: [PATCH for-mm 2/2] mm/gup: Make migrate_device_page() fails always if !CONFIG_DEVICE_PRIVATE
Date: Wed,  9 Feb 2022 09:41:58 +0000	[thread overview]
Message-ID: <20220209094158.21941-3-sj@kernel.org> (raw)
In-Reply-To: <20220209094158.21941-1-sj@kernel.org>

Commit 7059ac82be44 ("mm/gup.c: migrate device coherent pages when
pinning instead of failing") in -mm tree[1] introduces
'migrate_device_page()', which uses several functions that defined under
CONFIG_DEVICE_RIVATE.  As a result, build under 'CONFIG_MIGRATION &&
!CONFIG_DEVICE_PRIVATE' fails as below.

      LD      .tmp_vmlinux.kallsyms1
    mm/gup.o: In function `migrate_device_page':
    /linux/mm/gup.c:1856: undefined reference to `migrate_vma_setup'
    /linux/mm/gup.c:1876: undefined reference to `migrate_vma_pages'
    /linux/mm/gup.c:1879: undefined reference to `migrate_vma_finalize'
    /linux/Makefile:1222: recipe for target 'vmlinux' failed
    make[1]: *** [vmlinux] Error 1

This commit fixes it by implementing an always-failing version of the
function for !CONFIG_DEVICE_PRIVATE'.

[1] https://www.ozlabs.org/~akpm/mmotm/broken-out/mm-gupc-migrate-device-coherent-pages-when-pinning-instead-of-failing.patch

Signed-off-by: SeongJae Park <sj@kernel.org>
---
 mm/gup.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/mm/gup.c b/mm/gup.c
index 1df99a5e90cf..0cf59858114d 100644
--- a/mm/gup.c
+++ b/mm/gup.c
@@ -1834,6 +1834,7 @@ struct page *get_dump_page(unsigned long addr)
 #endif /* CONFIG_ELF_CORE */
 
 #ifdef CONFIG_MIGRATION
+#ifdef CONFIG_DEVICE_PRIVATE
 /*
  * Migrates a device coherent page back to normal memory. Caller should have a
  * reference on page which will be copied to the new page if migration is
@@ -1887,6 +1888,14 @@ static struct page *migrate_device_page(struct page *page,
 
 	return dpage;
 }
+#else
+static inline struct page *migrate_device_page(struct page *page,
+					unsigned int gup_flags)
+{
+	return NULL;
+}
+#endif /* CONFIG_DEVICE_PRIVATE */
+
 
 /*
  * Check whether all pages are pinnable, if so return number of pages.  If some
-- 
2.17.1



      parent reply	other threads:[~2022-02-09  9:42 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-09  9:41 [PATCH for-mm 0/2] Fix trivial build errors on -mm tree SeongJae Park
2022-02-09  9:41 ` [PATCH for-mm 1/2] mm/internal: Implement no-op mlock_page_drain() for !CONFIG_MMU SeongJae Park
2022-02-09 15:37   ` Hugh Dickins
2022-02-09 16:19     ` Geert Uytterhoeven
2022-02-10  4:37       ` Hugh Dickins
2022-02-10  4:44       ` [PATCH for-mm 1/2 v2] " Hugh Dickins
2022-02-10  7:58         ` SeongJae Park
2022-02-11  3:58         ` Stephen Rothwell
2022-02-09  9:41 ` SeongJae Park [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220209094158.21941-3-sj@kernel.org \
    --to=sj@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=apopple@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.