# Re: rsockets and fork

- From: Roland Dreier \<hidden\>
- Date: 2012-08-24 18:22:04 
- List: linux-rdma
- Page: https://ratatoskr.run/linux-rdma/2012/08/15419045
- Thread: https://ratatoskr.run/linux-rdma/2012/08/15419045/t.md

```text
On Wed, Aug 22, 2012 at 4:35 PM, Hefty, Sean [ref] 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.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
```
