Skip to contentSkip to conversation

RDMA/nldev: Add copy-on-fork attribute to get sys command

PATCH Superseded Gal Pressman 3 participants 13 messages Apr 5, 2021 – Apr 7, 2021 InfiniBand

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 RDMA/nldev: Add copy-on-fork attribute to get sys command

The new attribute indicates that the kernel copies DMA pages on fork, hence libibverbs' fork support through madvise and MADV_DONTFORK is not needed.

The introduced attribute is always reported as supported since the kernel has the patch that added the copy-on-fork behavior. This allows the userspace library to identify older vs newer kernel versions. Extra care should be taken when backporting this patch as it relies on the fact that the copy-on-fork patch is merged, hence no check for support is added.

Copy-on-fork attribute is read-only, trying to change it through the set sys command will result in an error.

---
PR was sent:
https://github.com/linux-rdma/rdma-core/pull/975

---
 drivers/infiniband/core/nldev.c  | 19 ++++++++++++++-----
 include/uapi/rdma/rdma_netlink.h |  2 ++
 2 files changed, 16 insertions(+), 5 deletions(-)
drivers/infiniband/core/nldev.c +14 -5
index b8dc002a2478..87c68301c25b 100644
@@ -146,6 +146,7 @@ static const struct nla_policy nldev_policy[RDMA_NLDEV_ATTR_MAX] = {
 	[RDMA_NLDEV_ATTR_UVERBS_DRIVER_ID]	= { .type = NLA_U32 },
 	[RDMA_NLDEV_NET_NS_FD]			= { .type = NLA_U32 },
 	[RDMA_NLDEV_SYS_ATTR_NETNS_MODE]	= { .type = NLA_U8 },
+	[RDMA_NLDEV_SYS_ATTR_COPY_ON_FORK]	= { .type = NLA_U8 },
 };
 
 static int put_driver_name_print_type(struct sk_buff *msg, const char *name,
@@ -1693,12 +1694,19 @@ static int nldev_sys_get_doit(struct sk_buff *skb, struct nlmsghdr *nlh,
 
 	err = nla_put_u8(msg, RDMA_NLDEV_SYS_ATTR_NETNS_MODE,
 			 (u8)ib_devices_shared_netns);
-	if (err) {
-		nlmsg_free(msg);
-		return err;
-	}
+	if (err)
+		goto err_nlmsg_free;
+
+	err = nla_put_u8(msg, RDMA_NLDEV_SYS_ATTR_COPY_ON_FORK, 1);
+	if (err)
+		goto err_nlmsg_free;
+
 	nlmsg_end(msg, nlh);
 	return rdma_nl_unicast(sock_net(skb->sk), msg, NETLINK_CB(skb).portid);
+
+err_nlmsg_free:
+	nlmsg_free(msg);
+	return err;
 }
 
 static int nldev_set_sys_set_doit(struct sk_buff *skb, struct nlmsghdr *nlh,
@@ -1710,7 +1718,8 @@ static int nldev_set_sys_set_doit(struct sk_buff *skb, struct nlmsghdr *nlh,
 
 	err = nlmsg_parse(nlh, 0, tb, RDMA_NLDEV_ATTR_MAX - 1,
 			  nldev_policy, extack);
-	if (err || !tb[RDMA_NLDEV_SYS_ATTR_NETNS_MODE])
+	if (err || !tb[RDMA_NLDEV_SYS_ATTR_NETNS_MODE] ||
+	    tb[RDMA_NLDEV_SYS_ATTR_COPY_ON_FORK])
 		return -EINVAL;
 
 	enable = nla_get_u8(tb[RDMA_NLDEV_SYS_ATTR_NETNS_MODE]);
include/uapi/rdma/rdma_netlink.h +2 -0
index d2f5b8396243..342c9db5b3c1 100644
@@ -533,6 +533,8 @@ enum rdma_nldev_attr {
 
 	RDMA_NLDEV_ATTR_RES_RAW,	/* binary */
 
+	RDMA_NLDEV_SYS_ATTR_COPY_ON_FORK,	/* u8 */
+
 	/*
 	 * Always the end
 	 */

base-commit: adb76a520d068a54ee5ca82e756cf8e5a47363a4

Signature · 1 line
2.31.1
#1 lore raw
Quoted 10 lines · Gal Pressman

The new attribute indicates that the kernel copies DMA pages on fork, hence libibverbs' fork support through madvise and MADV_DONTFORK is not needed.

The introduced attribute is always reported as supported since the kernel has the patch that added the copy-on-fork behavior. This allows the userspace library to identify older vs newer kernel versions. Extra care should be taken when backporting this patch as it relies on the fact that the copy-on-fork patch is merged, hence no check for support is added.

Please be more specific, add SHA-1 of that patch and wrote the same comment near "err = nla_put_u8(msg, RDMA_NLDEV_SYS_ATTR_COPY_ON_FORK, 1);" line.

Thanks

Quoted 29 lines

Copy-on-fork attribute is read-only, trying to change it through the set sys command will result in an error.

---
PR was sent:
https://github.com/linux-rdma/rdma-core/pull/975

---
 drivers/infiniband/core/nldev.c  | 19 ++++++++++++++-----
 include/uapi/rdma/rdma_netlink.h |  2 ++
 2 files changed, 16 insertions(+), 5 deletions(-)
drivers/infiniband/core/nldev.c +1 -0
index b8dc002a2478..87c68301c25b 100644
@@ -146,6 +146,7 @@ static const struct nla_policy nldev_policy[RDMA_NLDEV_ATTR_MAX] = {
 	[RDMA_NLDEV_ATTR_UVERBS_DRIVER_ID]	= { .type = NLA_U32 },
 	[RDMA_NLDEV_NET_NS_FD]			= { .type = NLA_U32 },
 	[RDMA_NLDEV_SYS_ATTR_NETNS_MODE]	= { .type = NLA_U8 },
+	[RDMA_NLDEV_SYS_ATTR_COPY_ON_FORK]	= { .type = NLA_U8 },
 };
 
 static int put_driver_name_print_type(struct sk_buff *msg, const char *name,
@@ -1693,12 +1694,19 @@ static int nldev_sys_get_doit(struct sk_buff *skb, struct nlmsghdr *nlh,
 
 	err = nla_put_u8(msg, RDMA_NLDEV_SYS_ATTR_NETNS_MODE,
 			 (u8)ib_devices_shared_netns);

drivers/infiniband/core/nldev.c static int nldev_sys_get_doit(struct sk_buff *skb, struct nlmsghdr *nlh, · line 1702

Quoted 10 lines
drivers/infiniband/core/nldev.c +6 -4
-	if (err) {
-		nlmsg_free(msg);
-		return err;
-	}
+	if (err)
+		goto err_nlmsg_free;
+
+	err = nla_put_u8(msg, RDMA_NLDEV_SYS_ATTR_COPY_ON_FORK, 1);
+	if (err)
+		goto err_nlmsg_free;

Is it important to have an ability to fail here? Can we simply ignore failure?

Quoted 38 lines
drivers/infiniband/core/nldev.c +7 -1
+
 	nlmsg_end(msg, nlh);
 	return rdma_nl_unicast(sock_net(skb->sk), msg, NETLINK_CB(skb).portid);
+
+err_nlmsg_free:
+	nlmsg_free(msg);
+	return err;
 }
 
 static int nldev_set_sys_set_doit(struct sk_buff *skb, struct nlmsghdr *nlh,
@@ -1710,7 +1718,8 @@ static int nldev_set_sys_set_doit(struct sk_buff *skb, struct nlmsghdr *nlh,
 
 	err = nlmsg_parse(nlh, 0, tb, RDMA_NLDEV_ATTR_MAX - 1,
 			  nldev_policy, extack);
-	if (err || !tb[RDMA_NLDEV_SYS_ATTR_NETNS_MODE])
+	if (err || !tb[RDMA_NLDEV_SYS_ATTR_NETNS_MODE] ||
+	    tb[RDMA_NLDEV_SYS_ATTR_COPY_ON_FORK])
 		return -EINVAL;
 
 	enable = nla_get_u8(tb[RDMA_NLDEV_SYS_ATTR_NETNS_MODE]);
include/uapi/rdma/rdma_netlink.h +2 -0
index d2f5b8396243..342c9db5b3c1 100644
@@ -533,6 +533,8 @@ enum rdma_nldev_attr {
 
 	RDMA_NLDEV_ATTR_RES_RAW,	/* binary */
 
+	RDMA_NLDEV_SYS_ATTR_COPY_ON_FORK,	/* u8 */
+
 	/*
 	 * Always the end
 	 */

base-commit: adb76a520d068a54ee5ca82e756cf8e5a47363a4

Signature · 1 line
2.31.1
#2 lore raw
Quoted 12 lines · Leon Romanovsky
Quoted 10 lines · Gal Pressman

The new attribute indicates that the kernel copies DMA pages on fork, hence libibverbs' fork support through madvise and MADV_DONTFORK is not needed.

The introduced attribute is always reported as supported since the kernel has the patch that added the copy-on-fork behavior. This allows the userspace library to identify older vs newer kernel versions. Extra care should be taken when backporting this patch as it relies on the fact that the copy-on-fork patch is merged, hence no check for support is added.

Quoted 3 lines

Please be more specific, add SHA-1 of that patch and wrote the same comment near "err = nla_put_u8(msg, RDMA_NLDEV_SYS_ATTR_COPY_ON_FORK, 1);" line.

And rdmatool should be updated too.

Thanks

#3 lore raw
Quoted 13 lines · Leon Romanovsky
Quoted 12 lines · Leon Romanovsky
Quoted 10 lines · Gal Pressman

The new attribute indicates that the kernel copies DMA pages on fork, hence libibverbs' fork support through madvise and MADV_DONTFORK is not needed.

The introduced attribute is always reported as supported since the kernel has the patch that added the copy-on-fork behavior. This allows the userspace library to identify older vs newer kernel versions. Extra care should be taken when backporting this patch as it relies on the fact that the copy-on-fork patch is merged, hence no check for support is added.

Quoted 5 lines
Quoted 3 lines

Please be more specific, add SHA-1 of that patch and wrote the same comment near "err = nla_put_u8(msg, RDMA_NLDEV_SYS_ATTR_COPY_ON_FORK, 1);" line.

And rdmatool should be updated too.

Sure.

#4 lore raw
In reply to Leon Romanovsky
Quoted 12 lines · Leon Romanovsky
Quoted 10 lines · Gal Pressman

The new attribute indicates that the kernel copies DMA pages on fork, hence libibverbs' fork support through madvise and MADV_DONTFORK is not needed.

The introduced attribute is always reported as supported since the kernel has the patch that added the copy-on-fork behavior. This allows the userspace library to identify older vs newer kernel versions. Extra care should be taken when backporting this patch as it relies on the fact that the copy-on-fork patch is merged, hence no check for support is added.

Quoted 5 lines

Please be more specific, add SHA-1 of that patch and wrote the same comment near "err = nla_put_u8(msg, RDMA_NLDEV_SYS_ATTR_COPY_ON_FORK, 1);" line.

Thanks

Should I put the original commit here? There were quite a lot of bug fixes and followups that are required.

Quoted 27 lines
Quoted 27 lines

Copy-on-fork attribute is read-only, trying to change it through the set sys command will result in an error.

---
PR was sent:
https://github.com/linux-rdma/rdma-core/pull/975

---
 drivers/infiniband/core/nldev.c  | 19 ++++++++++++++-----
 include/uapi/rdma/rdma_netlink.h |  2 ++
 2 files changed, 16 insertions(+), 5 deletions(-)
drivers/infiniband/core/nldev.c +1 -0
index b8dc002a2478..87c68301c25b 100644
@@ -146,6 +146,7 @@ static const struct nla_policy nldev_policy[RDMA_NLDEV_ATTR_MAX] = {
      [RDMA_NLDEV_ATTR_UVERBS_DRIVER_ID]      = { .type = NLA_U32 },
      [RDMA_NLDEV_NET_NS_FD]                  = { .type = NLA_U32 },
      [RDMA_NLDEV_SYS_ATTR_NETNS_MODE]        = { .type = NLA_U8 },
+     [RDMA_NLDEV_SYS_ATTR_COPY_ON_FORK]      = { .type = NLA_U8 },
 };
 
 static int put_driver_name_print_type(struct sk_buff *msg, const char *name,
@@ -1693,12 +1694,19 @@ static int nldev_sys_get_doit(struct sk_buff *skb, struct nlmsghdr *nlh,
 
Quoted 15 lines

drivers/infiniband/core/nldev.c static int nldev_sys_get_doit(struct sk_buff *skb, struct nlmsghdr *nlh, · line 1702

Quoted 12 lines
drivers/infiniband/core/nldev.c +6 -4
      err = nla_put_u8(msg, RDMA_NLDEV_SYS_ATTR_NETNS_MODE,
                       (u8)ib_devices_shared_netns);
-     if (err) {
-             nlmsg_free(msg);
-             return err;
-     }
+     if (err)
+             goto err_nlmsg_free;
+
+     err = nla_put_u8(msg, RDMA_NLDEV_SYS_ATTR_COPY_ON_FORK, 1);
+     if (err)
+             goto err_nlmsg_free;

Is it important to have an ability to fail here? Can we simply ignore failure?

Should be fine.

Thanks

#5 lore raw
Quoted 13 lines · Gal Pressman
Quoted 12 lines · Leon Romanovsky
Quoted 10 lines · Gal Pressman

The new attribute indicates that the kernel copies DMA pages on fork, hence libibverbs' fork support through madvise and MADV_DONTFORK is not needed.

The introduced attribute is always reported as supported since the kernel has the patch that added the copy-on-fork behavior. This allows the userspace library to identify older vs newer kernel versions. Extra care should be taken when backporting this patch as it relies on the fact that the copy-on-fork patch is merged, hence no check for support is added.

Quoted 8 lines
Quoted 5 lines

Please be more specific, add SHA-1 of that patch and wrote the same comment near "err = nla_put_u8(msg, RDMA_NLDEV_SYS_ATTR_COPY_ON_FORK, 1);" line.

Thanks

Should I put the original commit here? There were quite a lot of bug fixes and followups that are required.

IMHO, the last commit SHA will be enough, the one that has working functionality from your POV.

Thanks

Quoted 47 lines
Quoted 28 lines
Quoted 28 lines

Copy-on-fork attribute is read-only, trying to change it through the set sys command will result in an error.

---
PR was sent:
https://github.com/linux-rdma/rdma-core/pull/975

---
 drivers/infiniband/core/nldev.c  | 19 ++++++++++++++-----
 include/uapi/rdma/rdma_netlink.h |  2 ++
 2 files changed, 16 insertions(+), 5 deletions(-)
drivers/infiniband/core/nldev.c +1 -0
index b8dc002a2478..87c68301c25b 100644
@@ -146,6 +146,7 @@ static const struct nla_policy nldev_policy[RDMA_NLDEV_ATTR_MAX] = {
      [RDMA_NLDEV_ATTR_UVERBS_DRIVER_ID]      = { .type = NLA_U32 },
      [RDMA_NLDEV_NET_NS_FD]                  = { .type = NLA_U32 },
      [RDMA_NLDEV_SYS_ATTR_NETNS_MODE]        = { .type = NLA_U8 },
+     [RDMA_NLDEV_SYS_ATTR_COPY_ON_FORK]      = { .type = NLA_U8 },
 };
 
 static int put_driver_name_print_type(struct sk_buff *msg, const char *name,
@@ -1693,12 +1694,19 @@ static int nldev_sys_get_doit(struct sk_buff *skb, struct nlmsghdr *nlh,
 
Quoted 15 lines

drivers/infiniband/core/nldev.c static int nldev_sys_get_doit(struct sk_buff *skb, struct nlmsghdr *nlh, · line 1702

Quoted 12 lines
drivers/infiniband/core/nldev.c +6 -4
      err = nla_put_u8(msg, RDMA_NLDEV_SYS_ATTR_NETNS_MODE,
                       (u8)ib_devices_shared_netns);
-     if (err) {
-             nlmsg_free(msg);
-             return err;
-     }
+     if (err)
+             goto err_nlmsg_free;
+
+     err = nla_put_u8(msg, RDMA_NLDEV_SYS_ATTR_COPY_ON_FORK, 1);
+     if (err)
+             goto err_nlmsg_free;

Is it important to have an ability to fail here? Can we simply ignore failure?

Should be fine.

Thanks

#6 lore raw
Quoted 18 lines · Leon Romanovsky
Quoted 17 lines · Gal Pressman
Quoted 16 lines · Leon Romanovsky
Quoted 10 lines · Gal Pressman

The new attribute indicates that the kernel copies DMA pages on fork, hence libibverbs' fork support through madvise and MADV_DONTFORK is not needed.

The introduced attribute is always reported as supported since the kernel has the patch that added the copy-on-fork behavior. This allows the userspace library to identify older vs newer kernel versions. Extra care should be taken when backporting this patch as it relies on the fact that the copy-on-fork patch is merged, hence no check for support is added.

Please be more specific, add SHA-1 of that patch and wrote the same comment near "err = nla_put_u8(msg, RDMA_NLDEV_SYS_ATTR_COPY_ON_FORK, 1);" line.

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

Thanks

Should I put the original commit here? There were quite a lot of bug fixes and followups that are required.

IMHO, the last commit SHA will be enough, the one that has working functionality from your POV.

OK, so that would be:
4eae4efa2c29 ("hugetlb: do early cow when page pinned on src mm")

Which I now realize for-next isn't rebased on top of it yet, so these patches should be applied after rebasing to v5.12-rc5.

#7 lore raw
Quoted 21 lines · Gal Pressman
Quoted 20 lines · Leon Romanovsky
Quoted 19 lines · Gal Pressman
Quoted 17 lines · Leon Romanovsky
Quoted 10 lines · Gal Pressman

The new attribute indicates that the kernel copies DMA pages on fork, hence libibverbs' fork support through madvise and MADV_DONTFORK is not needed.

The introduced attribute is always reported as supported since the kernel has the patch that added the copy-on-fork behavior. This allows the userspace library to identify older vs newer kernel versions. Extra care should be taken when backporting this patch as it relies on the fact that the copy-on-fork patch is merged, hence no check for support is added.

Please be more specific, add SHA-1 of that patch and wrote the same comment near "err = nla_put_u8(msg, RDMA_NLDEV_SYS_ATTR_COPY_ON_FORK, 1);" line.

Thanks

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

Should I put the original commit here? There were quite a lot of bug fixes and followups that are required.

IMHO, the last commit SHA will be enough, the one that has working functionality from your POV.

OK, so that would be:
4eae4efa2c29 ("hugetlb: do early cow when page pinned on src mm")

No, lets put them all

And I'd mark them with a Fixes: and a huge comment saying not to backport this and that the Fixes lines exist to *prevent* tooling from wrongly backporting to kernels that cannot support this.

And email Sasha to see if there is a magic text we can add to prevent auto backporting

Quoted 2 lines

Which I now realize for-next isn't rebased on top of it yet, so these patches should be applied after rebasing to v5.12-rc5.

I will sort it out

Jason

#8 lore raw
Quoted 25 lines · Jason Gunthorpe
Quoted 24 lines · Gal Pressman
Quoted 23 lines · Leon Romanovsky
Quoted 21 lines · Gal Pressman
Quoted 12 lines · Leon Romanovsky
Quoted 10 lines · Gal Pressman

The new attribute indicates that the kernel copies DMA pages on fork, hence libibverbs' fork support through madvise and MADV_DONTFORK is not needed.

The introduced attribute is always reported as supported since the kernel has the patch that added the copy-on-fork behavior. This allows the userspace library to identify older vs newer kernel versions. Extra care should be taken when backporting this patch as it relies on the fact that the copy-on-fork patch is merged, hence no check for support is added.

Quoted 5 lines

Please be more specific, add SHA-1 of that patch and wrote the same comment near "err = nla_put_u8(msg, RDMA_NLDEV_SYS_ATTR_COPY_ON_FORK, 1);" line.

Thanks

Should I put the original commit here? There were quite a lot of bug fixes and followups that are required.

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

IMHO, the last commit SHA will be enough, the one that has working functionality from your POV.

OK, so that would be:
4eae4efa2c29 ("hugetlb: do early cow when page pinned on src mm")

No, lets put them all

The more data the better chance that it will be missed. It is much saner to add last commit.

Quoted 7 lines

And I'd mark them with a Fixes: and a huge comment saying not to backport this and that the Fixes lines exist to *prevent* tooling from wrongly backporting to kernels that cannot support this.

And email Sasha to see if there is a magic text we can add to prevent auto backporting

Don't add Fixes, maybe?

Quoted 7 lines
Quoted 3 lines

Which I now realize for-next isn't rebased on top of it yet, so these patches should be applied after rebasing to v5.12-rc5.

I will sort it out

Jason

#9 lore raw
Quoted 29 lines · Leon Romanovsky
Quoted 28 lines · Jason Gunthorpe
Quoted 27 lines · Gal Pressman
Quoted 25 lines · Leon Romanovsky
Quoted 13 lines · Gal Pressman
Quoted 12 lines · Leon Romanovsky
Quoted 10 lines · Gal Pressman

The new attribute indicates that the kernel copies DMA pages on fork, hence libibverbs' fork support through madvise and MADV_DONTFORK is not needed.

The introduced attribute is always reported as supported since the kernel has the patch that added the copy-on-fork behavior. This allows the userspace library to identify older vs newer kernel versions. Extra care should be taken when backporting this patch as it relies on the fact that the copy-on-fork patch is merged, hence no check for support is added.

Quoted 8 lines
Quoted 5 lines

Please be more specific, add SHA-1 of that patch and wrote the same comment near "err = nla_put_u8(msg, RDMA_NLDEV_SYS_ATTR_COPY_ON_FORK, 1);" line.

Thanks

Should I put the original commit here? There were quite a lot of bug fixes and followups that are required.

IMHO, the last commit SHA will be enough, the one that has working functionality from your POV.

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

OK, so that would be:
4eae4efa2c29 ("hugetlb: do early cow when page pinned on src mm")

No, lets put them all

The more data the better chance that it will be missed. It is much saner to add last commit.

I can gather a list of commits, but I'm not sure I'm aware of every single commit that's needed to make this work properly, there's a chance some will be missed.

#10 lore raw
Quoted 33 lines · Gal Pressman
Quoted 32 lines · Leon Romanovsky
Quoted 31 lines · Jason Gunthorpe
Quoted 29 lines · Gal Pressman
Quoted 18 lines · Leon Romanovsky
Quoted 17 lines · Gal Pressman
Quoted 16 lines · Leon Romanovsky
Quoted 10 lines · Gal Pressman

The new attribute indicates that the kernel copies DMA pages on fork, hence libibverbs' fork support through madvise and MADV_DONTFORK is not needed.

The introduced attribute is always reported as supported since the kernel has the patch that added the copy-on-fork behavior. This allows the userspace library to identify older vs newer kernel versions. Extra care should be taken when backporting this patch as it relies on the fact that the copy-on-fork patch is merged, hence no check for support is added.

Please be more specific, add SHA-1 of that patch and wrote the same comment near "err = nla_put_u8(msg, RDMA_NLDEV_SYS_ATTR_COPY_ON_FORK, 1);" line.

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

Thanks

Should I put the original commit here? There were quite a lot of bug fixes and followups that are required.

IMHO, the last commit SHA will be enough, the one that has working functionality from your POV.

OK, so that would be:
4eae4efa2c29 ("hugetlb: do early cow when page pinned on src mm")

Quoted 8 lines
Quoted 4 lines
Quoted 1 line

No, lets put them all

The more data the better chance that it will be missed. It is much saner to add last commit.

I can gather a list of commits, but I'm not sure I'm aware of every single commit that's needed to make this work properly, there's a chance some will be missed.

I think it is just the two groups from Peter Xu

Jason

#11 lore raw
Quoted 36 lines · Jason Gunthorpe
Quoted 35 lines · Gal Pressman
Quoted 34 lines · Leon Romanovsky
Quoted 32 lines · Jason Gunthorpe
Quoted 21 lines · Gal Pressman
Quoted 20 lines · Leon Romanovsky
Quoted 19 lines · Gal Pressman
Quoted 17 lines · Leon Romanovsky
Quoted 10 lines · Gal Pressman

The new attribute indicates that the kernel copies DMA pages on fork, hence libibverbs' fork support through madvise and MADV_DONTFORK is not needed.

The introduced attribute is always reported as supported since the kernel has the patch that added the copy-on-fork behavior. This allows the userspace library to identify older vs newer kernel versions. Extra care should be taken when backporting this patch as it relies on the fact that the copy-on-fork patch is merged, hence no check for support is added.

Please be more specific, add SHA-1 of that patch and wrote the same comment near "err = nla_put_u8(msg, RDMA_NLDEV_SYS_ATTR_COPY_ON_FORK, 1);" line.

Thanks

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

Should I put the original commit here? There were quite a lot of bug fixes and followups that are required.

IMHO, the last commit SHA will be enough, the one that has working functionality from your POV.

OK, so that would be:
4eae4efa2c29 ("hugetlb: do early cow when page pinned on src mm")

No, lets put them all

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

The more data the better chance that it will be missed. It is much saner to add last commit.

I can gather a list of commits, but I'm not sure I'm aware of every single commit that's needed to make this work properly, there's a chance some will be missed.

I think it is just the two groups from Peter Xu

Will do.

#12 lore raw
In reply to Leon Romanovsky
Quoted 29 lines · Leon Romanovsky
Quoted 28 lines · Jason Gunthorpe
Quoted 27 lines · Gal Pressman
Quoted 25 lines · Leon Romanovsky
Quoted 13 lines · Gal Pressman
Quoted 12 lines · Leon Romanovsky
Quoted 10 lines · Gal Pressman

The new attribute indicates that the kernel copies DMA pages on fork, hence libibverbs' fork support through madvise and MADV_DONTFORK is not needed.

The introduced attribute is always reported as supported since the kernel has the patch that added the copy-on-fork behavior. This allows the userspace library to identify older vs newer kernel versions. Extra care should be taken when backporting this patch as it relies on the fact that the copy-on-fork patch is merged, hence no check for support is added.

Quoted 8 lines
Quoted 5 lines

Please be more specific, add SHA-1 of that patch and wrote the same comment near "err = nla_put_u8(msg, RDMA_NLDEV_SYS_ATTR_COPY_ON_FORK, 1);" line.

Thanks

Should I put the original commit here? There were quite a lot of bug fixes and followups that are required.

IMHO, the last commit SHA will be enough, the one that has working functionality from your POV.

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

OK, so that would be:
4eae4efa2c29 ("hugetlb: do early cow when page pinned on src mm")

No, lets put them all

The more data the better chance that it will be missed. It is much saner to add last commit.

I don't know, there is alot of automation here we need to ensure that none of it triggers unless all the required commits are present. I would list all the tops of all the 'fixes' chains.

Quoted 4 lines
Quoted 2 lines

And email Sasha to see if there is a magic text we can add to prevent auto backporting

Don't add Fixes, maybe?

Then it randomly AI matches on the commit text and we loose even the protection of the fixes lines

Jason