Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp1814403pxb; Wed, 9 Feb 2022 05:11:49 -0800 (PST) X-Google-Smtp-Source: ABdhPJxbcXR/0aH4cEvi1hFCUBGzFj13nwxOUwBSk4eTrtNKpoi7gJmGwzwpKUObSyCIjlgIJU4Y X-Received: by 2002:a05:6a00:1143:: with SMTP id b3mr2322320pfm.11.1644412309749; Wed, 09 Feb 2022 05:11:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644412309; cv=none; d=google.com; s=arc-20160816; b=vqkFGWzt3Q4y14fW2UekgBL8Yj3IZr4EDOsg4vracc3wx+aSPeehkzN0V81SUSBpAb fHYOxnqykKz7kkfwEFTpQ8GBGv+e2/XxcW9Nhi+18jDU2sxkJZxvlyaIKggxOPZdu5ix oNy1pqTmTnVmLpu1qJnTwV490lHEGub2ylhfUmbZPTs8ePt68ms0SiZtWGAU1TjpLx8e A3EjNaHp0sc6jGyDOyNXij4NpshfpAn8DjL9jNpNSuR++q1xreJ24XDb7UP+O/q1oHWv wTaSBrrLeFnc+uU6TtkhiP7ijObkFoGRuBAurpKQOwanTsmzGB3aYJsj/73Awbcf6JN5 Sjdw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from:dkim-signature; bh=R24wpQTRuh9B6sAw9vYrF/8zlsIZ+QX+pBvsyB1XjHA=; b=rp9SXfkgrEOonm5NGXzrBOjV0hP9EtXFDHWiKve7yndH5IQ5mSYSZas6QaN+SsnvOa n3eZOQeXpuqhwaAzvo+MS3g/9E9EOh5eo1gaxY8yd+lgh5AC8DlccNd8RjRvEnhKw2c7 D3svt+N7UChEzZP5qKVB0RdiQPvkn8oMeN30YBQQky4YS/NtnwcdjCoZxHga4dX8Uj/P /RDMxpP7yimciiXfhOj+ZHoCFsftJRnj4L8nMUj62IxfX0tv+gSDvwIZoH9naiS7VI9Q xHZIkB3rc0CsBGWbi7h/u5nUesVUU/a6sLPjhdqr5pOad2GWIT/pLbEQS2VeuT/j4Ur0 TYiA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=dBIiEUgl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1: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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id l10si17302653pgp.672.2022.02.09.05.11.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Feb 2022 05:11:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=dBIiEUgl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1: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: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id DC55DE17E47C; Wed, 9 Feb 2022 02:37:05 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234800AbiBIJpr (ORCPT + 99 others); Wed, 9 Feb 2022 04:45:47 -0500 Received: from gmail-smtp-in.l.google.com ([23.128.96.19]:39252 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230118AbiBIJpp (ORCPT ); Wed, 9 Feb 2022 04:45:45 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1CDA3E0699AE for ; Wed, 9 Feb 2022 01:45:39 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A7DA4619BA for ; Wed, 9 Feb 2022 09:42:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A61F4C340E7; Wed, 9 Feb 2022 09:42:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1644399739; bh=Hj4guPRHDf34ilQhSL4H2ZHu0uoUXzIKahEM2dGbhc4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dBIiEUglGNaozi8wCk7JEHogC+s6n2oGOegdedQLT58ZmDH4oLBynvio9o6Z9Hke7 H3C1fXPgBPsynjoLfyixntDZb2Zrvj4+mp0US991qnja3Z19YxJyn95o+QD/ZHoCuK OH5ayPgSRzULSPTnUjTnBChmgu03SeV6jIo49U/zRfru8G7UItNu+/Gm/Ozvkb3uX+ TbSMW/+uLI8ryzHRee4iD8ZuZ+3XVhQWV7fHJ/11caNrAopel4SD63Ehw3BSKb2uac ssBzq4/0eax4rwqbOICH8md5mUX/em9RC7gI1DiC+tS3ETTojG0nhulpd5P13nvZwp vTKgxCQSSxpjQ== From: SeongJae Park To: akpm@linux-foundation.org Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, SeongJae Park , 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 Message-Id: <20220209094158.21941-3-sj@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220209094158.21941-1-sj@kernel.org> References: <20220209094158.21941-1-sj@kernel.org> X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.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 --- 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