Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp1189298ybp; Fri, 4 Oct 2019 10:46:55 -0700 (PDT) X-Google-Smtp-Source: APXvYqwhkbHNGIBWfeqpmNRrRrNss7ffwtJ/obpXv+MdL3oIOaCMCxTAKvuXgstjgDlk3wa2N9RB X-Received: by 2002:aa7:d9d2:: with SMTP id v18mr16615374eds.177.1570211215758; Fri, 04 Oct 2019 10:46:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570211215; cv=none; d=google.com; s=arc-20160816; b=BLmxiOxWuA/rd1ZaCqFaVHgA3bkdWPmqIkJcuplXr9tmOXtoN/dqAn/WbHIWoASadj 2G1hnaWKolWnB0z4LEQLNSOb0O35jsNNlQEt7m8ermE9ZCFPsL6dQStap9Ah/sQFY1jd YajUUCsluprr1h/EYGW1z2j5aiuk7Yp1nU+u7i0OhtpUN8rxOKVHnmEiEfljhHYugyaz J1MOYqt4yQOOG3iUpnImy/gWazpOc/WPIA5zkC2tZ8JAtKvBX0CVMyBxPxWqTyMDk05v FJWUalUKc8FcljrgqOuUwjkQbS+8m0APORyPOLNqzQ5u0bykHVPkU6shbYcKbQPYHhlc SW2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=Bi0XR3hupm8FaWsiionOtqXr2yCT1RATJYfj2jN7Nko=; b=zpel59xz0s78T0LFtB0RVbseKcWpnovIBh2cqZt+cASc4zasOU7/0aNAq4HhjZgMwt tjueIDDJn2m3AwUuEbRCkbF3xuSiK7HwDn9TrJFV+jXvFLB2TIY14O1xGGlLCxTcVDjG 13nppWfdtXYl7Bq0/8Owaz+Ztxmr7es9IlDacOu0N3EgIKSU4zmEL9br/cCfUhLybe1G OHK5oZgsEUGTn64gCeqrG1NuDZjEj17NmAyWMJWxQ2x4JaNPmyHNxsomcLHvR/VmnW3/ 35s3OndpLbB+Xw+7VTqDRorA3yeVfXBlI83WlB9ek51o1yV1s/ofvKE64nxe5rVfEIEz fzEg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ziepe.ca header.s=google header.b=aD6KFFs6; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id qp4si3560249ejb.171.2019.10.04.10.46.31; Fri, 04 Oct 2019 10:46:55 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@ziepe.ca header.s=google header.b=aD6KFFs6; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388004AbfJDRpT (ORCPT + 99 others); Fri, 4 Oct 2019 13:45:19 -0400 Received: from mail-qt1-f180.google.com ([209.85.160.180]:45203 "EHLO mail-qt1-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725932AbfJDRpT (ORCPT ); Fri, 4 Oct 2019 13:45:19 -0400 Received: by mail-qt1-f180.google.com with SMTP id c21so9607824qtj.12 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=kZpniwhETJpOnDb1P712BQ15kCJDEXj3KQwTw+dwL1YeoeCkpIVvdp562UxuvbzN7y RK8Ak9l4N/wUwiwf3q/7oLrVdhTX0KN5apqKEL8fTGzCbvYwhQcNugqNY0NWQzGe8dlQ UAb2VBeX3pRsq1Rj5lN6cWN1EjYcUIKLqyRiOidVLT7P6QAfT+4JN+ayAQRizOR9pAdV LJ4FvpU13eYO+6J9OVBimfCdpRgz0uKLcnY9ZcEhxLWStxYi6JjloBKQW4C7R9idhfEc V3RYLiJZpx/QfYD5iOzT+iockYDgO0anEQi+mPjGdBwEU+wZpp9vET49IeRZJdnSTRTS RCSw== X-Gm-Message-State: APjAAAWS5SPsqIah/K69pDx/tnsTACkLJW0jaEKgN+oqLgcH9ZkErNXP c+9VLmLWl1KnHf4f3/2Gsv9icQ== 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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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