From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id AF0D5A0351; Mon, 17 Aug 2020 12:30:56 +0200 (CEST) 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