* [PATCH iproute2-next 0/2] Add copy-on-fork to get sys command @ 2021-04-28 11:42 Gal Pressman 2021-04-28 11:42 ` [PATCH iproute2-next 1/2] rdma: update uapi headers Gal Pressman 2021-04-28 11:42 ` [PATCH iproute2-next 2/2] rdma: Add copy-on-fork to get sys command Gal Pressman 0 siblings, 2 replies; 5+ messages in thread From: Gal Pressman @ 2021-04-28 11:42 UTC (permalink / raw) To: David Ahern Cc: linux-rdma, netdev, Yossi Leybovich, Alexander Matushevsky, Leon Romanovsky, Jason Gunthorpe, Gal Pressman This is the userspace part for the new copy-on-fork attribute added to the get sys netlink command. The new attribute indicates that the kernel copies DMA pages on fork, hence fork support through madvise and MADV_DONTFORK is not needed. Kernel series was merged: https://lore.kernel.org/linux-rdma/20210418121025.66849-1-galpress@amazon.com/ Thanks Gal Pressman (2): rdma: update uapi headers rdma: Add copy-on-fork to get sys command rdma/include/uapi/rdma/rdma_netlink.h | 16 ++++++++++++++++ rdma/sys.c | 9 +++++++++ 2 files changed, 25 insertions(+) -- 2.31.1 ^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH iproute2-next 1/2] rdma: update uapi headers 2021-04-28 11:42 [PATCH iproute2-next 0/2] Add copy-on-fork to get sys command Gal Pressman @ 2021-04-28 11:42 ` Gal Pressman 2021-04-28 11:42 ` [PATCH iproute2-next 2/2] rdma: Add copy-on-fork to get sys command Gal Pressman 1 sibling, 0 replies; 5+ messages in thread From: Gal Pressman @ 2021-04-28 11:42 UTC (permalink / raw) To: David Ahern Cc: linux-rdma, netdev, Yossi Leybovich, Alexander Matushevsky, Leon Romanovsky, Jason Gunthorpe, Gal Pressman Update rdma_netlink.h file upto kernel commit 6cc9e215eb27 ("RDMA/nldev: Add copy-on-fork attribute to get sys command") Signed-off-by: Gal Pressman <galpress@amazon.com> --- rdma/include/uapi/rdma/rdma_netlink.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/rdma/include/uapi/rdma/rdma_netlink.h b/rdma/include/uapi/rdma/rdma_netlink.h index 4aef76ae317b..37f583ee58fc 100644 --- a/rdma/include/uapi/rdma/rdma_netlink.h +++ b/rdma/include/uapi/rdma/rdma_netlink.h @@ -293,6 +293,10 @@ enum rdma_nldev_command { RDMA_NLDEV_CMD_RES_MR_GET_RAW, + RDMA_NLDEV_CMD_RES_CTX_GET, /* can dump */ + + RDMA_NLDEV_CMD_RES_SRQ_GET, /* can dump */ + RDMA_NLDEV_NUM_OPS }; @@ -533,6 +537,18 @@ enum rdma_nldev_attr { RDMA_NLDEV_ATTR_RES_RAW, /* binary */ + RDMA_NLDEV_ATTR_RES_CTX, /* nested table */ + RDMA_NLDEV_ATTR_RES_CTX_ENTRY, /* nested table */ + + RDMA_NLDEV_ATTR_RES_SRQ, /* nested table */ + RDMA_NLDEV_ATTR_RES_SRQ_ENTRY, /* nested table */ + RDMA_NLDEV_ATTR_RES_SRQN, /* u32 */ + + RDMA_NLDEV_ATTR_MIN_RANGE, /* u32 */ + RDMA_NLDEV_ATTR_MAX_RANGE, /* u32 */ + + RDMA_NLDEV_SYS_ATTR_COPY_ON_FORK, /* u8 */ + /* * Always the end */ -- 2.31.1 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH iproute2-next 2/2] rdma: Add copy-on-fork to get sys command 2021-04-28 11:42 [PATCH iproute2-next 0/2] Add copy-on-fork to get sys command Gal Pressman 2021-04-28 11:42 ` [PATCH iproute2-next 1/2] rdma: update uapi headers Gal Pressman @ 2021-04-28 11:42 ` Gal Pressman 2021-04-28 12:00 ` Leon Romanovsky 1 sibling, 1 reply; 5+ messages in thread From: Gal Pressman @ 2021-04-28 11:42 UTC (permalink / raw) To: David Ahern Cc: linux-rdma, netdev, Yossi Leybovich, Alexander Matushevsky, Leon Romanovsky, Jason Gunthorpe, Gal Pressman The new attribute indicates that the kernel copies DMA pages on fork, hence fork support through madvise and MADV_DONTFORK is not needed. If the attribute is not reported (expected on older kernels), copy-on-fork is disabled. Example: $ rdma sys netns shared copy-on-fork on Signed-off-by: Gal Pressman <galpress@amazon.com> --- rdma/sys.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/rdma/sys.c b/rdma/sys.c index 8fb565d70598..dd9c6da33e2a 100644 --- a/rdma/sys.c +++ b/rdma/sys.c @@ -38,6 +38,15 @@ static int sys_show_parse_cb(const struct nlmsghdr *nlh, void *data) print_color_string(PRINT_ANY, COLOR_NONE, "netns", "netns %s\n", mode_str); } + + if (tb[RDMA_NLDEV_SYS_ATTR_COPY_ON_FORK]) + print_color_on_off(PRINT_ANY, COLOR_NONE, "copy-on-fork", + "copy-on-fork %s\n", + mnl_attr_get_u8(tb[RDMA_NLDEV_SYS_ATTR_COPY_ON_FORK])); + else + print_color_on_off(PRINT_ANY, COLOR_NONE, "copy-on-fork", + "copy-on-fork %s\n", false); + return MNL_CB_OK; } -- 2.31.1 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH iproute2-next 2/2] rdma: Add copy-on-fork to get sys command 2021-04-28 11:42 ` [PATCH iproute2-next 2/2] rdma: Add copy-on-fork to get sys command Gal Pressman @ 2021-04-28 12:00 ` Leon Romanovsky 2021-04-29 6:40 ` Gal Pressman 0 siblings, 1 reply; 5+ messages in thread From: Leon Romanovsky @ 2021-04-28 12:00 UTC (permalink / raw) To: Gal Pressman Cc: David Ahern, linux-rdma, netdev, Yossi Leybovich, Alexander Matushevsky, Jason Gunthorpe On Wed, Apr 28, 2021 at 02:42:31PM +0300, Gal Pressman wrote: > The new attribute indicates that the kernel copies DMA pages on fork, > hence fork support through madvise and MADV_DONTFORK is not needed. > > If the attribute is not reported (expected on older kernels), > copy-on-fork is disabled. > > Example: > $ rdma sys > netns shared > copy-on-fork on I don't think that we need to print them on separate lines. $ rdma sys netns shared copy-on-fork on > > Signed-off-by: Gal Pressman <galpress@amazon.com> > --- > rdma/sys.c | 9 +++++++++ > 1 file changed, 9 insertions(+) > > diff --git a/rdma/sys.c b/rdma/sys.c > index 8fb565d70598..dd9c6da33e2a 100644 > --- a/rdma/sys.c > +++ b/rdma/sys.c > @@ -38,6 +38,15 @@ static int sys_show_parse_cb(const struct nlmsghdr *nlh, void *data) > print_color_string(PRINT_ANY, COLOR_NONE, "netns", "netns %s\n", > mode_str); > } > + > + if (tb[RDMA_NLDEV_SYS_ATTR_COPY_ON_FORK]) > + print_color_on_off(PRINT_ANY, COLOR_NONE, "copy-on-fork", > + "copy-on-fork %s\n", > + mnl_attr_get_u8(tb[RDMA_NLDEV_SYS_ATTR_COPY_ON_FORK])); > + else > + print_color_on_off(PRINT_ANY, COLOR_NONE, "copy-on-fork", > + "copy-on-fork %s\n", false); Let's simplify it bool cow = false; + if (tb[RDMA_NLDEV_SYS_ATTR_COPY_ON_FORK]) + cow = mnl_attr_get_u8(tb[RDMA_NLDEV_SYS_ATTR_COPY_ON_FORK]); + + print_color_on_off(PRINT_ANY, COLOR_NONE, "copy-on-fork", "copy-on-fork %s", cow); > + > return MNL_CB_OK; > } > > -- > 2.31.1 > ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH iproute2-next 2/2] rdma: Add copy-on-fork to get sys command 2021-04-28 12:00 ` Leon Romanovsky @ 2021-04-29 6:40 ` Gal Pressman 0 siblings, 0 replies; 5+ messages in thread From: Gal Pressman @ 2021-04-29 6:40 UTC (permalink / raw) To: Leon Romanovsky Cc: David Ahern, linux-rdma, netdev, Yossi Leybovich, Alexander Matushevsky, Jason Gunthorpe On 28/04/2021 15:00, Leon Romanovsky wrote: > On Wed, Apr 28, 2021 at 02:42:31PM +0300, Gal Pressman wrote: >> The new attribute indicates that the kernel copies DMA pages on fork, >> hence fork support through madvise and MADV_DONTFORK is not needed. >> >> If the attribute is not reported (expected on older kernels), >> copy-on-fork is disabled. >> >> Example: >> $ rdma sys >> netns shared >> copy-on-fork on > > I don't think that we need to print them on separate lines. > $ rdma sys > netns shared copy-on-fork on Ack. >> Signed-off-by: Gal Pressman <galpress@amazon.com> >> --- >> rdma/sys.c | 9 +++++++++ >> 1 file changed, 9 insertions(+) >> >> diff --git a/rdma/sys.c b/rdma/sys.c >> index 8fb565d70598..dd9c6da33e2a 100644 >> --- a/rdma/sys.c >> +++ b/rdma/sys.c >> @@ -38,6 +38,15 @@ static int sys_show_parse_cb(const struct nlmsghdr *nlh, void *data) >> print_color_string(PRINT_ANY, COLOR_NONE, "netns", "netns %s\n", >> mode_str); >> } >> + >> + if (tb[RDMA_NLDEV_SYS_ATTR_COPY_ON_FORK]) >> + print_color_on_off(PRINT_ANY, COLOR_NONE, "copy-on-fork", >> + "copy-on-fork %s\n", >> + mnl_attr_get_u8(tb[RDMA_NLDEV_SYS_ATTR_COPY_ON_FORK])); >> + else >> + print_color_on_off(PRINT_ANY, COLOR_NONE, "copy-on-fork", >> + "copy-on-fork %s\n", false); > > Let's simplify it > bool cow = false; > > + if (tb[RDMA_NLDEV_SYS_ATTR_COPY_ON_FORK]) > + cow = mnl_attr_get_u8(tb[RDMA_NLDEV_SYS_ATTR_COPY_ON_FORK]); > + > + print_color_on_off(PRINT_ANY, COLOR_NONE, "copy-on-fork", "copy-on-fork %s", cow); Ack (changed cow -> cof). Thanks ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2021-04-29 6:40 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2021-04-28 11:42 [PATCH iproute2-next 0/2] Add copy-on-fork to get sys command Gal Pressman 2021-04-28 11:42 ` [PATCH iproute2-next 1/2] rdma: update uapi headers Gal Pressman 2021-04-28 11:42 ` [PATCH iproute2-next 2/2] rdma: Add copy-on-fork to get sys command Gal Pressman 2021-04-28 12:00 ` Leon Romanovsky 2021-04-29 6:40 ` Gal Pressman
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.