From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6E8E7C433E7 for ; Fri, 9 Oct 2020 14:57:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2C65622260 for ; Fri, 9 Oct 2020 14:57:11 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=ziepe.ca header.i=@ziepe.ca header.b="JNnpNyXP" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388901AbgJIO5K (ORCPT ); Fri, 9 Oct 2020 10:57:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57644 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388811AbgJIO5K (ORCPT ); Fri, 9 Oct 2020 10:57:10 -0400 Received: from mail-qv1-xf44.google.com (mail-qv1-xf44.google.com [IPv6:2607:f8b0:4864:20::f44]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A9DCDC0613D2 for ; Fri, 9 Oct 2020 07:57:08 -0700 (PDT) Received: by mail-qv1-xf44.google.com with SMTP id bl9so4871060qvb.10 for ; Fri, 09 Oct 2020 07:57:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=6GE5XtwpF4aEcJm96nnfrrNLk+nAU1CpOxYGlBo79f4=; b=JNnpNyXPU89PrAi0h1W8lShWlJyqeROd1J4gtT8tVkuM9u75aeXNOq04Mhm67sOzsB wS3gQ0as8zUnx06pJgs7LdNYn53DQmLtlmUHUVjQl93gTEUgjGPBoEX2xICoTeCkpT+W +4On0CWSmlinhlB+SrZcIyEyVAhaMJ77LfmAC4prXXQwttKTcQlbnXHQLgtvYbOoiO/1 PUFoz7ZPqdqe+QL+kDJkcDuEuWJiVuEuImpTCEr4ylum0K3XVs36shFrFZsHUEU/+El9 osLzo9jzfAjtPNWE/mBi/abvJKvN9MXETmuGA7Kwv84NVVisHm+VtVgxU57soO9KnpCo Ii/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=6GE5XtwpF4aEcJm96nnfrrNLk+nAU1CpOxYGlBo79f4=; b=khn4oSat+dFYgexHjaB9EQrDMWZ+5CNRnNaWtCZqvF+L8ecW2tTlGvwZqMu86Eq1kB QN9RlwOT1nok/caKQRZ/U/UsnHt0XFUezGGaNWdXtja3n0PmQ/h7UVJZ96d1IF5jGyEz JDvCtA5vi4jSqFEzQMEqrTr/n+5esjolUZc67CPe6SKOeVYhLIf9kBMPk7Y1kCFhsSrr UjHoHRPACnVr7LEO+MKWuS0CMOmqocnqT3tX8S4Jq8rEFZokt3i8uqvy8rZ6py9Xu82W JeuUgAc3udFf9pqoe382x4FNH+ZiXE5yH4//p7e44Q8D3eKUKzJkJlGdsDIljYZ84Eik EJ8A== X-Gm-Message-State: AOAM533sszx6+/2cckHNSd7D+OuCBw/tvuk8VdvktwpRirygV7Pjn8gb ghPULtfoU3KErtpFhE60hJD3+O9Ojmd+HDJF X-Google-Smtp-Source: ABdhPJykgDEkgOPwxiB0oPqInEL46MRKQ5Aes8NbaNEYw43vyv99/rUeoNncCVkhGJCZw7IJHuubVw== X-Received: by 2002:a0c:c709:: with SMTP id w9mr13060827qvi.26.1602255427930; Fri, 09 Oct 2020 07:57:07 -0700 (PDT) Received: from ziepe.ca (hlfxns017vw-156-34-48-30.dhcp-dynamic.fibreop.ns.bellaliant.net. [156.34.48.30]) by smtp.gmail.com with ESMTPSA id k126sm6061448qke.135.2020.10.09.07.57.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Oct 2020 07:57:07 -0700 (PDT) Received: from jgg by mlx with local (Exim 4.94) (envelope-from ) id 1kQtpS-0020EZ-MX; Fri, 09 Oct 2020 11:57:06 -0300 Date: Fri, 9 Oct 2020 11:57:06 -0300 From: Jason Gunthorpe To: Chuck Lever Cc: Ka-Cheong Poon , Leon Romanovsky , linux-rdma@vger.kernel.org Subject: Re: RDMA subsystem namespace related questions (was Re: Finding the namespace of a struct ib_device) Message-ID: <20201009145706.GU5177@ziepe.ca> References: <20201006124627.GH5177@ziepe.ca> <20201007111636.GD3678159@unreal> <4d29915c-3ed7-0253-211b-1b97f5f8cfdf@oracle.com> <20201008103641.GM13580@unreal> <20201008160814.GF5177@ziepe.ca> <727de097-4338-c1d8-73a0-1fce0854f8af@oracle.com> <20201009143940.GT5177@ziepe.ca> <0E82FB51-244C-4134-8F74-8C365259DCD5@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <0E82FB51-244C-4134-8F74-8C365259DCD5@gmail.com> Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org On Fri, Oct 09, 2020 at 10:48:55AM -0400, Chuck Lever wrote: > Hi Jason- > > > On Oct 9, 2020, at 10:39 AM, Jason Gunthorpe wrote: > > > > On Fri, Oct 09, 2020 at 12:49:30PM +0800, Ka-Cheong Poon wrote: > >> As I mentioned before, this is a very serious restriction on how > >> the RDMA subsystem can be used in a namespace environment by kernel > >> module. The reason given for this restriction is that any kernel > >> socket without a corresponding user space file descriptor is "rogue". > >> All Internet protocol code create a kernel socket without user > >> interaction. Are they all "rogue"? > > > > You should work with Chuck to make NFS use namespaces properly and > > then you can propose what changes might be needed with a proper > > justification. > > The NFS server code already uses namespaces for creating listener > endpoints, already has a user space component that drives the > creation of listeners, and already passes an appropriate struct > net to rdma_create_id. As far as I am aware, it is namespace-aware > and -friendly all the way down to rdma_create_id(). > > What more needs to be done? I have no idea, if you are able to pass a namespace all the way down to the listening cm_id and everything works right (I'm skeptical) then there is nothing more to worry about - why are we having this thread? > > The rules for lifetime on IB clients are tricky, and the interaction > > with namespaces makes it all a lot more murky. > > I think what Ka-cheong is asking is for a detailed explanation of > these lifetime rules so we can understand why rdma_create_id bumps > the namespace reference count. It is because the CM has no code to revoke a CM ID before the namespace goes away and the pointer becomes invalid. Jason