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=-9.9 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,UNWANTED_LANGUAGE_BODY,USER_AGENT_GIT 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 539CFC433E1 for ; Mon, 17 Aug 2020 10:30:57 +0000 (UTC) Received: from dpdk.org (dpdk.org [92.243.14.124]) by mail.kernel.org (Postfix) with ESMTP id 1497E206FA for ; Mon, 17 Aug 2020 10:30:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1497E206FA Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=dev-bounces@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 2A3811C0D9; Mon, 17 Aug 2020 12:30:56 +0200 (CEST) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by dpdk.org (Postfix) with ESMTP id 5599E1C0BC for ; Mon, 17 Aug 2020 12:30:55 +0200 (CEST) IronPort-SDR: tMdUjkFUbHx4XL7jAISHuvUNXuIFI2oeUYL03A4Dij1laaZp32ZCdMU46fI6XQ12yj521gvlBd m2Pg36uXAVRw== X-IronPort-AV: E=McAfee;i="6000,8403,9715"; a="134189102" X-IronPort-AV: E=Sophos;i="5.76,322,1592895600"; d="scan'208";a="134189102" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Aug 2020 03:30:54 -0700 IronPort-SDR: 7uQ3pgL59FHy9Y4mEkphNcx/lBjrP63Q9z45Q65T15cLt2qaACt+Py06jng9ZGMYbnIJuujUG7 rN47jJ61QyqQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.76,322,1592895600"; d="scan'208";a="496966346" Received: from silpixa00399752.ir.intel.com (HELO silpixa00399752.ger.corp.intel.com) ([10.237.222.180]) by fmsmga005.fm.intel.com with ESMTP; 17 Aug 2020 03:30:53 -0700 From: Ferruh Yigit To: dev@dpdk.org Cc: Ferruh Yigit Date: Mon, 17 Aug 2020 11:30:51 +0100 Message-Id: <20200817103051.1552870-1-ferruh.yigit@intel.com> X-Mailer: git-send-email 2.25.4 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH] kni: fix build with Linux 5.9 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Starting from Linux 5.9 'get_user_pages_remote()' API doesn't get 'struct task_struct' parameter: commit 64019a2e467a ("mm/gup: remove task_struct pointer for all gup code") The change reflected to the KNI with version check. Signed-off-by: Ferruh Yigit --- kernel/linux/kni/compat.h | 4 ++++ kernel/linux/kni/kni_dev.h | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/kernel/linux/kni/compat.h b/kernel/linux/kni/compat.h index 9ee45dbf6f..d515b27669 100644 --- a/kernel/linux/kni/compat.h +++ b/kernel/linux/kni/compat.h @@ -134,3 +134,7 @@ #if KERNEL_VERSION(5, 6, 0) <= LINUX_VERSION_CODE #define HAVE_TX_TIMEOUT_TXQUEUE #endif + +#if KERNEL_VERSION(5, 9, 0) > LINUX_VERSION_CODE +#define HAVE_TSK_IN_GUP +#endif diff --git a/kernel/linux/kni/kni_dev.h b/kernel/linux/kni/kni_dev.h index ca5f92a47b..c15da311ba 100644 --- a/kernel/linux/kni/kni_dev.h +++ b/kernel/linux/kni/kni_dev.h @@ -101,8 +101,13 @@ static inline phys_addr_t iova_to_phys(struct task_struct *tsk, offset = iova & (PAGE_SIZE - 1); /* Read one page struct info */ +#ifdef HAVE_TSK_IN_GUP ret = get_user_pages_remote(tsk, tsk->mm, iova, 1, FOLL_TOUCH, &page, NULL, NULL); +#else + ret = get_user_pages_remote(tsk->mm, iova, 1, + FOLL_TOUCH, &page, NULL, NULL); +#endif if (ret < 0) return 0; -- 2.25.4