From patchwork Mon Aug 3 15:39:32 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 6930861 Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id C70849F38B for ; Mon, 3 Aug 2015 15:39:38 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0771D205FE for ; Mon, 3 Aug 2015 15:39:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1CC4A205E1 for ; Mon, 3 Aug 2015 15:39:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753524AbbHCPjf (ORCPT ); Mon, 3 Aug 2015 11:39:35 -0400 Received: from bombadil.infradead.org ([198.137.202.9]:51072 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752941AbbHCPje (ORCPT ); Mon, 3 Aug 2015 11:39:34 -0400 Received: from hch by bombadil.infradead.org with local (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZMHps-0003D4-MJ; Mon, 03 Aug 2015 15:39:32 +0000 Date: Mon, 3 Aug 2015 08:39:32 -0700 From: Christoph Hellwig To: Jason Gunthorpe Cc: Doug Ledford , linux-rdma@vger.kernel.org, Amir Vadai , Bart Van Assche , Chien Yen , Christoph Hellwig , Dominique Martinet , Eli Cohen , Eric Van Hensbergen , Ido Shamay , Latchesar Ionkov , Or Gerlitz , Roi Dayan , Ron Minnich , Sagi Grimberg , Simon Derr , Tom Tucker , rds-devel@oss.oracle.com, target-devel@vger.kernel.org, v9fs-developer@lists.sourceforge.net Subject: Re: [PATCH v2 09/12] IB/srp: Do not create an all physical insecure rkey by default Message-ID: <20150803153932.GA10054@infradead.org> References: <1438298547-21404-1-git-send-email-jgunthorpe@obsidianresearch.com> <1438298547-21404-10-git-send-email-jgunthorpe@obsidianresearch.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1438298547-21404-10-git-send-email-jgunthorpe@obsidianresearch.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org See http://www.infradead.org/rpr.html Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP In addition to the comments on the cover letter I think your changes to srp_add_one could use this incremental cleanup: --- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c index a546256..5e2cb53 100644 --- a/drivers/infiniband/ulp/srp/ib_srp.c +++ b/drivers/infiniband/ulp/srp/ib_srp.c @@ -3381,7 +3381,7 @@ static void srp_add_one(struct ib_device *device) struct srp_host *host; int mr_page_shift, p; u64 max_pages_per_mr; - unsigned int mr_flags = 0; + bool need_phys_rkey = false; dev_attr = kmalloc(sizeof *dev_attr, GFP_KERNEL); if (!dev_attr) @@ -3403,7 +3403,7 @@ static void srp_add_one(struct ib_device *device) if (!srp_dev->has_fmr && !srp_dev->has_fr) { dev_warn(&device->dev, "neither FMR nor FR is supported\n"); /* Fall back to using an insecure all physical rkey */ - mr_flags |= IB_ACCESS_REMOTE_READ | IB_ACCESS_REMOTE_WRITE; + need_phys_rkey = true; } srp_dev->use_fast_reg = (srp_dev->has_fr && @@ -3441,11 +3441,13 @@ static void srp_add_one(struct ib_device *device) goto free_dev; if (!register_always) - mr_flags |= IB_ACCESS_REMOTE_READ | IB_ACCESS_REMOTE_WRITE; + need_phys_rkey = true; - if (mr_flags) { + if (need_phys_rkey) { srp_dev->rkey_mr = ib_get_dma_mr( - srp_dev->pd, IB_ACCESS_LOCAL_WRITE | mr_flags); + srp_dev->pd, IB_ACCESS_LOCAL_WRITE | + IB_ACCESS_REMOTE_READ | + IB_ACCESS_REMOTE_WRITE); if (IS_ERR(srp_dev->rkey_mr)) goto err_pd; } else