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=-2.4 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 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 7B3CFC4360C for ; Fri, 4 Oct 2019 17:45:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 56B8220862 for ; Fri, 4 Oct 2019 17:45:20 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=ziepe.ca header.i=@ziepe.ca header.b="aD6KFFs6" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387928AbfJDRpT (ORCPT ); Fri, 4 Oct 2019 13:45:19 -0400 Received: from mail-qt1-f180.google.com ([209.85.160.180]:34121 "EHLO mail-qt1-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729923AbfJDRpT (ORCPT ); Fri, 4 Oct 2019 13:45:19 -0400 Received: by mail-qt1-f180.google.com with SMTP id 3so9706159qta.1 for ; Fri, 04 Oct 2019 10:45:17 -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:user-agent; bh=Bi0XR3hupm8FaWsiionOtqXr2yCT1RATJYfj2jN7Nko=; b=aD6KFFs6/n0WLfple7V8WOE5Wn8rrv+FMdylWq2mm0aAyC8nDUHgeMNxYOvFQpPDHE EbC8IsDUCdrmV7vWoxKmhQpGS/8czZbFy59AVPIEeqEyYkXoLFvGTkdsvDw4noRhceu7 cuvQJIke4a2mmXF2MVv0/53BkYBEirAH/R6RqJxS0c+06M6IHXTcr/28HdpFnzQsA/Yc yEnAKlUc/heMZY9R6Br1zY9lNHZvfV37Q+suHlj7ql1pLrTAUa27zqw+EBt7uV2GbcC7 m4R/GvDj9KGcLmIEea1kW5EDLlgb4uyV11CGwAzVicslYxkATIF57uJagDlwU2e2Yoci kcDQ== 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:user-agent; bh=Bi0XR3hupm8FaWsiionOtqXr2yCT1RATJYfj2jN7Nko=; b=sWKMM6Ui6hCj9zof7KKX8or4fdWQc/DJFA05SJpnoD6P4+rvP/Bq6PRxn5lekRAjKc US1ZvYt7WwUbYWsZuZhpIdX3YtYPPfNGEUCrXSZaMWjuyVgF4KU0XQOLAxVeA6MWrROv jGMebpFHTTk5sSFRN5yGzxgyadfX+5BAiiSpG6obSAhG0Uw3aJGXcAewQZeKOKfmZX/2 JEoVt9CDsY5ESNlyG1q/NCf+b7+KmCgEwsak/wxR25PYZOSn8gbuJyDCbBHrdaDiMXjN +gVp5+MBgTqbOcLH6RHs/5ot2npzofkg3nYS/ZdqwMuBR0lGWEymI138TAMF0Kx9xr/D gcYw== X-Gm-Message-State: APjAAAVQXI6USFYuOjh0Rn1rMCOBkxDC5J1Y1T2FpS6kEj7bzryFxOrw KeZWOQ6Fhf1WNGFUL8A4FtTUQg== X-Google-Smtp-Source: APXvYqyPAWyb3vaf4qK5ug4xP+qdVBPW0ywm32J6kQwwYKPon44JN0O7N/RjTxu6idcF4CccyzhWjA== X-Received: by 2002:ac8:1302:: with SMTP id e2mr16882073qtj.326.1570211116678; Fri, 04 Oct 2019 10:45:16 -0700 (PDT) Received: from ziepe.ca (hlfxns017vw-142-162-113-180.dhcp-dynamic.fibreop.ns.bellaliant.net. [142.162.113.180]) by smtp.gmail.com with ESMTPSA id s16sm2817091qkg.40.2019.10.04.10.45.16 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 04 Oct 2019 10:45:16 -0700 (PDT) Received: from jgg by mlx.ziepe.ca with local (Exim 4.90_1) (envelope-from ) id 1iGRdj-0005rL-Np; Fri, 04 Oct 2019 14:45:15 -0300 Date: Fri, 4 Oct 2019 14:45:15 -0300 From: Jason Gunthorpe To: Michel Lespinasse Cc: Davidlohr Bueso , Andrew Morton , Peter Zijlstra , LKML , linux-mm , dri-devel@lists.freedesktop.org, linux-rdma@vger.kernel.org Subject: Re: [PATCH -next 00/11] lib/interval-tree: move to half closed intervals Message-ID: <20191004174515.GE13988@ziepe.ca> References: <20191003201858.11666-1-dave@stgolabs.net> <20191004002609.GB1492@ziepe.ca> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org On Fri, Oct 04, 2019 at 06:15:11AM -0700, Michel Lespinasse wrote: > Hi Jason, > > On Thu, Oct 3, 2019 at 5:26 PM Jason Gunthorpe wrote: > > Hurm, this is not entirely accurate. Most users do actually want > > overlapping and multiple ranges. I just studied this extensively: > > (Just curious, are you the person we discussed this with after the > Maple Tree talk at LPC 2019 ?) Possibly! > I think we have two separate API problems there: > - overlapping vs non-overlapping intervals (the interval tree API > supports overlapping intervals, but some users are confused about > this) I think we just have a bunch of confused drivers, ie the two drm drivers sure look confused to me. > - closed vs half-open interval definitions I'm not sure why this is a big problem.. We may actually just have bugs in handling the '-1' as it is supposed to be written as start + (size-1) so that start + size == ULONG_MAX+1 works properly. > > hfi1/mmu_rb definitely needs overlapping as it is dealing with > > userspace VA ranges under control of userspace. As do the other > > infiniband users. > > Do you have a handle on what usnic is doing with its intervals ? > usnic_uiom_insert_interval() has some complicated logic to avoid > having overlapping intervals, which is very confusing to me. I don't know why it is so complicated, but I can say that it is storing userspace VA's in that tree. I have some feeling this driver is trying to use the IOMMU to create a mirror of the userspace VA Userspace can request the HW be able to access any set of overlapping regions and so the driver must intersect all the ranges and compute a list of VA pages to IOMMU map. Just guessing. Jason