Re: rsockets and fork

Roland Dreier
2012-08-24T18:22:04Z

On Wed, Aug 22, 2012 at 4:35 PM, Hefty, Sean <sean.hefty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> wrote:
> I'm haven't identified the specific problem with fork support, but I did see this in libmlx4:
>
> mlx4_alloc_context()
> {
> ...
> context->uar = mmap(NULL, to_mdev(ibdev)->page_size, PROT_WRITE,
> MAP_SHARED, cmd_fd, 0);
> if (context->uar == MAP_FAILED)
> goto err_free;
>
> if (resp.bf_reg_size) {
> context->bf_page = mmap(NULL, to_mdev(ibdev)->page_size,
> PROT_WRITE, MAP_SHARED, cmd_fd,
> to_mdev(ibdev)->page_size);
> ...
> }
>
> I don't know for certain that these mmap() calls cause an issue, but the preload library socket() function calls rsocket(), which loads and initializes libibverbs. This calls mlx4_alloc_context() before fork() has been called.

I don't think those mmap()s should be an issue with fork.... they are
mapping adapter PCI space into userspace, but it should work across
fork.

- R.