DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] kni: fix build with Linux 5.9
@ 2020-09-09 11:59 Min Hu (Connor)
  2020-09-09 12:53 ` Ferruh Yigit
  0 siblings, 1 reply; 3+ messages in thread
From: Min Hu (Connor) @ 2020-09-09 11:59 UTC (permalink / raw)
  To: dev; +Cc: thomas, arybchenko, ferruh.yigit, linuxarm, vattunuru

Build error seen with Linux kernel 5.9.

Build error:
kernel/linux/kni/kni_dev.h:104:30:
	error: passing argument 1 of ‘get_user_pages_remote’ from
	incompatible pointer type [-Werror=incompatible-pointer-types]
	ret = get_user_pages_remote(tsk, tsk->mm, iova, 1,

get_user_pages_remote() is changed in Linux kernel version 5.9 and
remove a parameter, struct task_struct *tsk:
Linux Commit 64019a2e467a ("mm/gup: remove task_struct pointer
for all gup code")

get_user_pages_remote() parameter updated with compile time Linux
kernel version check.

Cc: stable@dpdk.org

Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
Reviewed-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
---
 kernel/linux/kni/kni_dev.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/kernel/linux/kni/kni_dev.h b/kernel/linux/kni/kni_dev.h
index ca5f92a..192c3d9 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 */
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 9, 0)
+	ret = get_user_pages_remote(tsk->mm, iova, 1,
+				    FOLL_TOUCH, &page, NULL, NULL);
+#else
 	ret = get_user_pages_remote(tsk, tsk->mm, iova, 1,
 				    FOLL_TOUCH, &page, NULL, NULL);
+#endif /* >= 5.9.0 */
 	if (ret < 0)
 		return 0;
 
-- 
2.7.4


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-dev] [PATCH] kni: fix build with Linux 5.9
  2020-09-09 11:59 [dpdk-dev] [PATCH] kni: fix build with Linux 5.9 Min Hu (Connor)
@ 2020-09-09 12:53 ` Ferruh Yigit
  0 siblings, 0 replies; 3+ messages in thread
From: Ferruh Yigit @ 2020-09-09 12:53 UTC (permalink / raw)
  To: Min Hu (Connor), dev; +Cc: thomas, arybchenko, linuxarm, vattunuru

On 9/9/2020 12:59 PM, Min Hu (Connor) wrote:
> Build error seen with Linux kernel 5.9.
> 
> Build error:
> kernel/linux/kni/kni_dev.h:104:30:
> 	error: passing argument 1 of ‘get_user_pages_remote’ from
> 	incompatible pointer type [-Werror=incompatible-pointer-types]
> 	ret = get_user_pages_remote(tsk, tsk->mm, iova, 1,
> 
> get_user_pages_remote() is changed in Linux kernel version 5.9 and
> remove a parameter, struct task_struct *tsk:
> Linux Commit 64019a2e467a ("mm/gup: remove task_struct pointer
> for all gup code")
> 
> get_user_pages_remote() parameter updated with compile time Linux
> kernel version check.
> 
> Cc: stable@dpdk.org
> 
> Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
> Reviewed-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
> ---
>  kernel/linux/kni/kni_dev.h | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/kernel/linux/kni/kni_dev.h b/kernel/linux/kni/kni_dev.h
> index ca5f92a..192c3d9 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 */
> +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 9, 0)
> +	ret = get_user_pages_remote(tsk->mm, iova, 1,
> +				    FOLL_TOUCH, &page, NULL, NULL);
> +#else
>  	ret = get_user_pages_remote(tsk, tsk->mm, iova, 1,
>  				    FOLL_TOUCH, &page, NULL, NULL);
> +#endif /* >= 5.9.0 */
>  	if (ret < 0)
>  		return 0;
>  
> 

The patch is already out, please check: https://patches.dpdk.org/patch/75577/

If you are already on it, an ack or review tag would be good. Thanks.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [dpdk-dev] [PATCH] kni: fix build with Linux 5.9
@ 2020-08-17 10:30 Ferruh Yigit
  0 siblings, 0 replies; 3+ messages in thread
From: Ferruh Yigit @ 2020-08-17 10:30 UTC (permalink / raw)
  To: dev; +Cc: Ferruh Yigit

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 <ferruh.yigit@intel.com>
---
 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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-09-09 12:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-09 11:59 [dpdk-dev] [PATCH] kni: fix build with Linux 5.9 Min Hu (Connor)
2020-09-09 12:53 ` Ferruh Yigit
  -- strict thread matches above, loose matches on Subject: below --
2020-08-17 10:30 Ferruh Yigit

DPDK patches and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/dev/0 dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dev dev/ https://inbox.dpdk.org/dev \
		dev@dpdk.org
	public-inbox-index dev

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git