Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp867196ybp; Fri, 4 Oct 2019 06:16:09 -0700 (PDT) X-Google-Smtp-Source: APXvYqx/ylsjHAMsF51/a/j0IhxdcDRxIzpGQ/RD1c1/zfJAWFZwFJNlrUxSRaD2GGXaX+16m5Wb X-Received: by 2002:a50:aa96:: with SMTP id q22mr15078447edc.179.1570194969570; Fri, 04 Oct 2019 06:16:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570194969; cv=none; d=google.com; s=arc-20160816; b=IwB3ITdP+BNhIPEwWl9VP81X0pEfWYsp1nWtCaiLhpamdnv+IoYRSw884kvX8c7I4p +0YrgPZKFRapZ5N+mF6zHaTkcaWNTbseAcDlpNNJg11B1IN9SrFZDjk2YwtehWTUdj4O g3PFUzDAPynG34KeV8om6V/UJA6q4+X/tH/UdqieM++AkTcHVwEcozk0BT8ugt6BTDJH AmTHFiSROz1cyPLhzIntd+WSeFmcA92pxSIi1YZHFGD7IcM+fWZljZgE5SqsowywYFZm c+KbSQsgGyLAdLJimJCM19eNcylL/DF5ZLVQMw+5hLunnyUJzyNbCDag6DsZS1tL6ver WzJg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=/UcVhX9GaoSfCR5Nzgmo8T8FLFMJ0xd65q4Shx2Kmts=; b=k8e9rdiV4cYY2kkJFoeAaf61y/z+NTksPWV08xyolpXG47cLpOiV7E+fF3gZ0meDOH 6E7YKIqKEBTBuwNntSxXDF1fnRruFG6mnx1p2gVON3NoInHasutnzKCUYb18PcHNjGYK 7BVWtv2HB7aTwEarrAVY0i8vpCM1VAmVdcBEdsJBxonNcujY2nNcDy9ZrqiC9EG5c1ur X6uCZHs+OPss37e9fJ46bVm9WV0rbvxhP0QEGBF0u2CZuNdV1GkcHFdRxGJ5Hmx/pgzH V5Yc96xIGrj+91bLpb3QSvsNyYwdtzwVojDSSJntSRGmdBEJq7vdwKzTxFoTzWeV/EL1 uXKQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=aVs4zyKI; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u12si3083178ejt.21.2019.10.04.06.15.45; Fri, 04 Oct 2019 06:16:09 -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=@google.com header.s=20161025 header.b=aVs4zyKI; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388313AbfJDNP2 (ORCPT + 99 others); Fri, 4 Oct 2019 09:15:28 -0400 Received: from mail-yb1-f179.google.com ([209.85.219.179]:40105 "EHLO mail-yb1-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387952AbfJDNP1 (ORCPT ); Fri, 4 Oct 2019 09:15:27 -0400 Received: by mail-yb1-f179.google.com with SMTP id g9so2086312ybi.7 for ; Fri, 04 Oct 2019 06:15:27 -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=/UcVhX9GaoSfCR5Nzgmo8T8FLFMJ0xd65q4Shx2Kmts=; b=aVs4zyKIMELcbbp0OrZDIIRM6M9FqgqBWOj7D/V0OOVxjk/TCK1tb1H33aayEVT9Fq NOF79kJ75vl2d2aHQWCNVE3mdS8xv2agwN5v/GWtJcU0doJRauKDjzYg6Q6Aok4YYi3b mqNPN9hT3Q49dLWzDmTUjRAHeblmpVkFSji5wQrOx6/uMD4mWAJGCY15WvCoWVOEjYTY zLXisVJYNrNI9DPaiv0kVngz338cFFvM+h3OzJgZEFf8gZFZm7Iiy5tpDfP2d3CkVb0j V4Ux/4E3Ys8h0MioMBqFvf8jY+vH9oklDJ5qpoyn4dUJxko+npNTfqsfS9FFgD1YpKeU TCXA== 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=/UcVhX9GaoSfCR5Nzgmo8T8FLFMJ0xd65q4Shx2Kmts=; b=nLnavJQRwEMTfAv3mvAYHBbmZqCI2jUpQ01QoMbmuapu/Myu4xyzza7lQCZRFVZ5T8 oUXUiqK3bQLlUmcwZvGa8J68dkc5Oj2NSprSo6hshRFB9OFxTRTpP2R1bPM8pQHqaoi/ oA3VwJogeGdA20fD/7ushiK9YMdiDTIzYqa5BXGb0BMuNpwunHQUmn8ZCklK5cj6Xgt/ 0lgFFkdIm0MI+nwlwRoIu2r3T4kGcJsAydy01mbhX/+KiGaTxZWe4ywIek4or0CdNnhg Xq0pylluo8w64SqRWh36oPnCS2BY2OXsZQjoN0YJRBNklFwOMlhtk3awkL1wP5chEAuO xsJg== X-Gm-Message-State: APjAAAUvtuzIgSgQCgFbYC6blZybhCU7huooY4/cFoF7gofssDFWOluN 8GyYAZcnpzAwBpmse6EeRPKnVKekpt6fSAHrQOcNa8ma7AN1zQ== X-Received: by 2002:a25:8149:: with SMTP id j9mr1749501ybm.132.1570194926383; Fri, 04 Oct 2019 06:15:26 -0700 (PDT) MIME-Version: 1.0 References: <20191003201858.11666-1-dave@stgolabs.net> <20191004002609.GB1492@ziepe.ca> In-Reply-To: <20191004002609.GB1492@ziepe.ca> From: Michel Lespinasse Date: Fri, 4 Oct 2019 06:15:11 -0700 Message-ID: Subject: Re: [PATCH -next 00/11] lib/interval-tree: move to half closed intervals To: Jason Gunthorpe Cc: Davidlohr Bueso , Andrew Morton , Peter Zijlstra , LKML , linux-mm , dri-devel@lists.freedesktop.org, linux-rdma@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 ?) 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) - closed vs half-open interval definitions It looks like you have been looking mostly at the first issue, which I expect could simplify several interval tree users considerably, while Davidlohr is addressing the second issue here. > radeon_mn actually wants overlapping but seems to mis-understand the > interval_tree API and actively tries hard to prevent overlapping at > great cost and complexity. I have a patch to delete all of this and > just be overlapping. > > amdgpu_mn copied the wrongness from radeon_mn > > All the DRM drivers are basically the same here, tracking userspace > controlled VAs, so overlapping is essential > > 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. > vhost probably doesn't overlap in the normal case, but again userspace > could trigger overlap in some pathalogical case. > > The [start,last] allows the interval to cover up to ULONG_MAX. I don't > know if this is needed however. Many users are using userspace VAs > here. Is there any kernel configuration where ULONG_MAX is a valid > userspace pointer? Ie 32 bit 4G userspace? I don't know. > > Many users seemed to have bugs where they were taking a userspace > controlled start + length and converting them into a start/end for > interval tree without overflow protection (woops) > > Also I have a series already cooking to delete several of these > interval tree users, which will terribly conflict with this :\ > > Is it really necessary to make such churn for such a tiny API change? My take is that this (Davidlohr's) patch series does not necessarily need to be applied all at once - we could get the first change in (adding the interval_tree_gen.h header), and convert the first few users, without getting them all at once, as long as we have a plan for finishing the work. So, if you have cleanups in progress in some of the files, just tell us which ones and we can leave them out from the first pass. Thanks, -- Michel "Walken" Lespinasse A program is never fully debugged until the last user dies.