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 4B163C47404 for ; Fri, 4 Oct 2019 17:45:19 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 0F8B820862 for ; Fri, 4 Oct 2019 17:45:18 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=ziepe.ca header.i=@ziepe.ca header.b="aD6KFFs6" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0F8B820862 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ziepe.ca Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 8E93E6B0003; Fri, 4 Oct 2019 13:45:18 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 89B0E6B0005; Fri, 4 Oct 2019 13:45:18 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7627A6B0006; Fri, 4 Oct 2019 13:45:18 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0211.hostedemail.com [216.40.44.211]) by kanga.kvack.org (Postfix) with ESMTP id 555A26B0003 for ; Fri, 4 Oct 2019 13:45:18 -0400 (EDT) Received: from smtpin19.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with SMTP id EA0608243768 for ; Fri, 4 Oct 2019 17:45:17 +0000 (UTC) X-FDA: 76006828674.19.field40_1118aba7bcb08 X-HE-Tag: field40_1118aba7bcb08 X-Filterd-Recvd-Size: 5205 Received: from mail-qt1-f173.google.com (mail-qt1-f173.google.com [209.85.160.173]) by imf11.hostedemail.com (Postfix) with ESMTP for ; Fri, 4 Oct 2019 17:45:17 +0000 (UTC) Received: by mail-qt1-f173.google.com with SMTP id j31so9674980qta.5 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=UEPwJ0hIK7ul/guoGP4sblvvJ0DP6HU3CN2w2Zkqair6dyg1bMZMCltVOfEpvZhHCS XEV69zG2Gi5JBWC+5h35DoWAXYIO9zZ1WINd5dy9wv2btA39cRTVW+6xmtJxpweTfH8M u+b+dAnFL841MEVUPMxNW06cxohB0j1RTjz+wFBVS1tV19sn67MY+xLcINr2ldegJSN5 tJC6FChMi63MDwRIhQthdoECOkcjEKtEw9YQXAvo9VWdMl3cS8cXLN4n61ykM50zBomO JlhacSjsaptKqj8w5CGV5jtmvu7eqUWIA7mJXxpJZwvxUksbm6ABUDQwpF097thVugWm xvRg== X-Gm-Message-State: APjAAAWK8ubSGE7pxPLMC5/j6+bYgh2sVVTel8uFTgtGQbeX2ZikaXEF JL99/ry/wgjCluAyvuzhflNW/A== 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) X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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