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=-7.0 required=3.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,T_DKIMWL_WL_HIGH, URIBL_BLOCKED autolearn=unavailable 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 4C835C282CE for ; Tue, 4 Jun 2019 12:45:51 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 20C4E24C11 for ; Tue, 4 Jun 2019 12:45:51 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="KY9/BBQ6"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=google.com header.i=@google.com header.b="E/mvMDTE" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 20C4E24C11 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:To:Subject:Message-ID:Date:From: In-Reply-To:References:MIME-Version:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=9XXTAoTCk3kZkLnABhz6xvHk9q/kd8bqSE1bvi5xBZM=; b=KY9/BBQ6HYaXt4 nXUi2jxkfgYS08sP7YZyb9Q9Z7vxRuLLiXlx/A2+p2VNMC5d1D9BpIGs6vOS2YmTfr0Ltsb8+4Nta xZl8MB9pKoA7QG5lymAxwIFsjOH39oN/AtwLssarmQejMKxxyP98eHD53WV3rfbdhnSzIP/C8YYpm LOLYsr9Ia3tKF8uDslUTLdh/1SrQcq42ge9zZ623CE4y3oxrgQOJUWe+0Y7h7XIMm+mqxvVBwR1n2 Jn3AveS+vrBOB4fQw9LolEA3/cKse+o46gp3moQZ+eD6FNqEOjDJYTRi/komSg7PAXinQvoNcfGPd G+cvEb+9J5vgFis3W2Rg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hY8p2-0006qy-8d; Tue, 04 Jun 2019 12:45:48 +0000 Received: from mail-pf1-x441.google.com ([2607:f8b0:4864:20::441]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hY8oz-0006q4-8y for linux-arm-kernel@lists.infradead.org; Tue, 04 Jun 2019 12:45:46 +0000 Received: by mail-pf1-x441.google.com with SMTP id u22so12629484pfm.3 for ; Tue, 04 Jun 2019 05:45:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=SX1wXsAGfUFN70h44peTZcKIMqGr5ZE+ZDyQc1zQL5o=; b=E/mvMDTExggwag20QOMbkhKP75T7Pk+0ZF0pcXUr5AaTNbmr23JwDn0UqrTqxdl5Je krdUOdiGs3h2/gebELEz8jqrOUeDCDUC2JEOV4V8ITgtQF1Ax7woXAnTfQ5gsE1sKCk5 73PDFS4epP+6c23bo89e7xnteUzAo/q7k0cXafuB0juxjfStepuJz67jDdEHof0O7Ctq rV/upWmgoM7X7JZZHSCmqQbuzKuvYpbwxz+61v3PWpNyw0Pr5WN0hOaTsMwrna556VUE CzT1IMUxqM0c1X/8hXFuS/fU+Fq0VdvtOqB87v2sTCjXWa4vVxnoJGfUoTWZKlqF7TqV Xbpw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=SX1wXsAGfUFN70h44peTZcKIMqGr5ZE+ZDyQc1zQL5o=; b=alEDWjRt1Z3yyW1rAFbCCAy4o9wFde1kRSauhVZ54s6M19ySRJKAgKQHCDcD6l8wB1 30iZ5NI62W08YlptQawD+WcQiwRx9jLu4dlRhCNQmg2v8Lyem2uVToFwStLLh9dqAKOz 1t36R8OLxRVQSDi+R+7087r7QckZEZ6v0QMipiAADFh4TAcSsPobgMZdVaeRDzCZ+ICw Gn/zY3COwLi+Ld79ky4DGu9J/c83W5jC+uLJ1/BgP6+xc5kPfkwd2p7xSKVH8K+l9s/u UlDKyyf2PLv0eG3aQqlCVF3ArJIhP3rK4Wuz0ZRSedL0DYJnCBlMrFFzC5jAu9eprI10 NM8g== X-Gm-Message-State: APjAAAXrEAWtdTGMKccTHuYHAjR14Jh3FnUj35m/IIzJ1xnSx+o6DcSO eSoaRUHh9g1zLupRNR320zXixNW+BojIgcjbuhC7iA== X-Google-Smtp-Source: APXvYqzZt2kMUXJ9WHlwmRLt2vrbUVohOpQLy3RY96eqdlAIdJcx5KC4nxWy0iNPEMefwexAGDMOHmuMZCiVo+DqZfo= X-Received: by 2002:a17:90a:2488:: with SMTP id i8mr28955959pje.123.1559652343964; Tue, 04 Jun 2019 05:45:43 -0700 (PDT) MIME-Version: 1.0 References: <20190603174619.GC11474@ziepe.ca> <20190604122714.GA15385@ziepe.ca> In-Reply-To: <20190604122714.GA15385@ziepe.ca> From: Andrey Konovalov Date: Tue, 4 Jun 2019 14:45:32 +0200 Message-ID: Subject: Re: [PATCH v16 12/16] IB, arm64: untag user pointers in ib_uverbs_(re)reg_mr() To: Jason Gunthorpe X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190604_054545_334725_1E7397E7 X-CRM114-Status: GOOD ( 27.33 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , kvm@vger.kernel.org, Szabolcs Nagy , Catalin Marinas , Will Deacon , dri-devel@lists.freedesktop.org, Linux Memory Management List , Khalid Aziz , "open list:KERNEL SELFTEST FRAMEWORK" , Felix Kuehling , Vincenzo Frascino , Jacob Bramley , Leon Romanovsky , linux-rdma@vger.kernel.org, amd-gfx@lists.freedesktop.org, Christoph Hellwig , Dmitry Vyukov , Dave Martin , Evgeniy Stepanov , linux-media@vger.kernel.org, Kevin Brodsky , Kees Cook , Ruben Ayrapetyan , Ramana Radhakrishnan , Alex Williamson , Mauro Carvalho Chehab , Linux ARM , Kostya Serebryany , Greg Kroah-Hartman , Yishai Hadas , LKML , Jens Wiklander , Lee Smith , Alexander Deucher , Andrew Morton , enh , Robin Murphy , Christian Koenig , Luc Van Oostenryck Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, Jun 4, 2019 at 2:27 PM Jason Gunthorpe wrote: > > On Tue, Jun 04, 2019 at 02:18:19PM +0200, Andrey Konovalov wrote: > > On Mon, Jun 3, 2019 at 7:46 PM Jason Gunthorpe wrote: > > > > > > On Mon, Jun 03, 2019 at 06:55:14PM +0200, Andrey Konovalov wrote: > > > > This patch is a part of a series that extends arm64 kernel ABI to allow to > > > > pass tagged user pointers (with the top byte set to something else other > > > > than 0x00) as syscall arguments. > > > > > > > > ib_uverbs_(re)reg_mr() use provided user pointers for vma lookups (through > > > > e.g. mlx4_get_umem_mr()), which can only by done with untagged pointers. > > > > > > > > Untag user pointers in these functions. > > > > > > > > Signed-off-by: Andrey Konovalov > > > > drivers/infiniband/core/uverbs_cmd.c | 4 ++++ > > > > 1 file changed, 4 insertions(+) > > > > > > > > diff --git a/drivers/infiniband/core/uverbs_cmd.c b/drivers/infiniband/core/uverbs_cmd.c > > > > index 5a3a1780ceea..f88ee733e617 100644 > > > > +++ b/drivers/infiniband/core/uverbs_cmd.c > > > > @@ -709,6 +709,8 @@ static int ib_uverbs_reg_mr(struct uverbs_attr_bundle *attrs) > > > > if (ret) > > > > return ret; > > > > > > > > + cmd.start = untagged_addr(cmd.start); > > > > + > > > > if ((cmd.start & ~PAGE_MASK) != (cmd.hca_va & ~PAGE_MASK)) > > > > return -EINVAL; > > > > > > I feel like we shouldn't thave to do this here, surely the cmd.start > > > should flow unmodified to get_user_pages, and gup should untag it? > > > > > > ie, this sort of direction for the IB code (this would be a giant > > > patch, so I didn't have time to write it all, but I think it is much > > > saner): > > > > Hi Jason, > > > > ib_uverbs_reg_mr() passes cmd.start to mlx4_get_umem_mr(), which calls > > find_vma(), which only accepts untagged addresses. Could you explain > > how your patch helps? > > That mlx4 is just a 'weird duck', it is not the normal flow, and I > don't think the core code should be making special consideration for > it. How do you think we should do untagging (or something else) to deal with this 'weird duck' case? > > Jason _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel