From patchwork Thu Sep 27 10:10:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 10617779 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 365643CF1 for ; Thu, 27 Sep 2018 10:10:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2619D2B049 for ; Thu, 27 Sep 2018 10:10:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1A31F2B058; Thu, 27 Sep 2018 10:10:40 +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=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AA30C2B040 for ; Thu, 27 Sep 2018 10:10:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727112AbeI0Q2J (ORCPT ); Thu, 27 Sep 2018 12:28:09 -0400 Received: from mout.kundenserver.de ([217.72.192.74]:42833 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727187AbeI0Q2J (ORCPT ); Thu, 27 Sep 2018 12:28:09 -0400 Received: from wuerfel.lan ([109.193.40.16]) by mrelayeu.kundenserver.de (mreue109 [212.227.15.145]) with ESMTPA (Nemesis) id 1MirfG-1fZRp10R0e-00ey8H; Thu, 27 Sep 2018 12:10:19 +0200 Received: from wuerfel.lan ([109.193.40.16]) by mrelayeu.kundenserver.de (mreue109 [212.227.15.145]) with ESMTPA (Nemesis) id 1MirfG-1fZRp10R0e-00ey8H; Thu, 27 Sep 2018 12:10:19 +0200 From: Arnd Bergmann To: Jason Gunthorpe Cc: Arnd Bergmann , Doug Ledford , Leon Romanovsky , Matan Barak , Parav Pandit , "Wei Hu(Xavier)" , Huy Nguyen , linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] RDMA/ucontext: fix building with CONFIG_MMU=n Date: Thu, 27 Sep 2018 12:10:03 +0200 Message-Id: <20180927101017.990471-1-arnd@arndb.de> X-Mailer: git-send-email 2.18.0 X-Provags-ID: V03:K1:3BtBNrFcgwoEjYfk6eNDJwm3+KhEaGLVUDVgNMa9+XQ6NIwC2St QCAIqGeIzNE+ZiXAtigG/qgXfkNKAGWELR9NfVI5u/Td2Zwommt5zazWLc0kGNzCxtdyEXH HvqDsUrlTaEujgIT95fGcKuy8boAIPcV4MFs57pMEM1IaB7VGgG0UXFhSiq7U+9AWxtf4I8 87IXwlyaOB21ZN/3VO8sA== X-UI-Out-Filterresults: notjunk:1;V01:K0:scaJkVlG0II=:+Blvh5LMPxhld0/EVUedbI qlITSWWg+PwkxO3vuki7AvQSn0qIGJvScyUrJJO8YknCBWBgeyxUrOHxL4geJYclcQ//xlsJT 4hv4qouYSrW/pWq5sz0mI29VrT/i2LLlZWZaH7F28j8nEBY7tALDantRpM46DCG7GH93m8lcq EeKdSajjdqQfXq8IG9Z0RX7DzsuUJ3S0igQKSTEip7FXkg1XaTtb5d9sF5VcOzutYrwM8iT1l 9sUws0Z3XUox2R98hanzC5oIyL3s3GPfiv71sNJdId2Qpw0BzCGmYuG+6KYs9F+stEzzlFz0Q Cs3FAdATmjjiQcBJ7Hy/3oxwLEcKab7vBlTX6nNFADwp+yKMJHyNu18uYd/TruZ+dy8YyfRcU dcRHR1b0yIiwGL0UIjx4h46GEe7liPAQu24PAsEXIG4mmgk8PW5bahXSqNn2D2En6fctkfsHE LKYb8/fHMwI1NRlnJXBhTPPREFx+19btPBOo81eiqT4Xq0SqFgegZV9IkosTQUBR/+Y2uR55E cs/Ve9eCmzTBTP0m5O55pfIHMDP198sg+vpOUIZ7SdPtIZXCH2471pjIFgOtU/3F+jfN4/KvL gXLS3dp7c/+/JwbRqy4fGtIZttaF98v6L9RU19oNSbzkyJfIo6pcumnxVbGd/DoMWPzCh+Lmy xitK+SJpJbITH6kt9KkYREfQTla5vUKoQ/Vru15K2cspgXnmwV+PHfFOnHeu2Yf0IBtw= Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The zap_vma_ptes() is declared but not defined on NOMMU kernels, causing a link error for the newly added uverbs code: drivers/infiniband/core/uverbs_main.o: In function `uverbs_user_mmap_disassociate': uverbs_main.c:(.text+0x114c): undefined reference to `zap_vma_ptes' drivers/infiniband/core/uverbs_main.o: In function `rdma_umap_open': uverbs_main.c:(.text+0x53c): undefined reference to `zap_vma_ptes' To fix this, we can either make uverbs depend on CONFIG_MMU, or try to build it anyway. Since this is the only compile-time dependency, I decided to allow building it with an extra compile-time check for CONFIG_MMU before calling the one function. Fixes: 5f9794dc94f5 ("RDMA/ucontext: Add a core API for mmaping driver IO memory") Signed-off-by: Arnd Bergmann --- drivers/infiniband/core/uverbs_main.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/infiniband/core/uverbs_main.c b/drivers/infiniband/core/uverbs_main.c index 40dcf3d02a4b..5c1202af0748 100644 --- a/drivers/infiniband/core/uverbs_main.c +++ b/drivers/infiniband/core/uverbs_main.c @@ -884,7 +884,8 @@ static void rdma_umap_open(struct vm_area_struct *vma) * point, so zap it. */ vma->vm_private_data = NULL; - zap_vma_ptes(vma, vma->vm_start, vma->vm_end - vma->vm_start); + if (IS_ENABLED(CONFIG_MMU)) + zap_vma_ptes(vma, vma->vm_start, vma->vm_end - vma->vm_start); } static void rdma_umap_close(struct vm_area_struct *vma) @@ -1023,8 +1024,9 @@ void uverbs_user_mmap_disassociate(struct ib_uverbs_file *ufile) continue; list_del_init(&priv->list); - zap_vma_ptes(vma, vma->vm_start, - vma->vm_end - vma->vm_start); + if (IS_ENABLED(CONFIG_MMU)) + zap_vma_ptes(vma, vma->vm_start, + vma->vm_end - vma->vm_start); vma->vm_flags &= ~(VM_SHARED | VM_MAYSHARE); } mutex_unlock(&ufile->umap_lock);