Received: by 10.213.65.68 with SMTP id h4csp2726602imn; Mon, 2 Apr 2018 12:51:23 -0700 (PDT) X-Google-Smtp-Source: AIpwx49/VCfSPyUtCSWUDh6fp31Z4FpJzbRB3xgPCzBTH/VpkjXn0s84K7Oun0heGlT2QdyMhpBc X-Received: by 10.101.97.88 with SMTP id o24mr7011046pgv.270.1522698683567; Mon, 02 Apr 2018 12:51:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522698683; cv=none; d=google.com; s=arc-20160816; b=hkytqZxH7bZ2FoSQlipxakPbHM+bhgaNieXefbsJRoOAvwsSFCDXfaUklLe/xz+tHp ZS8yCdUNFV07Pb0VLMLCEQEWwmsl6d6q0nWB6KzFMTVsL8bBqa4dbP0jIuopO3ZpuTr5 Ns9FKLCJQVSW7hxfGsxQS9hQTjiT1N9kUC15RDeGGaq3EbX43GPhr28qCGjXWbc6K8EH iIpeEZ1EPEXUuFqVpyHlsuYawWaOCSmPDmB5uLOi4P8D3hN1wy9nCm6wtNigVcEST2af dVwjeT6tMK3bw7SLlqt7CqM4A+J5r0J7kkVk9cURNgc2x8g6DTCPG0osFtaQXLx51m+v XI2g== 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-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date :arc-authentication-results; bh=YcP1iSpIiMiMXo9Ra1njCgkQExSzuBHOoVOPofoxiEE=; b=m3tsCfZX503Ysw+us2my+etjyrbikBbKfAO8gwh1Er6nf10EhvOR4HdtUibrTVqYgI CPMqoVbfVibpbseBZiND5YPYESKtq3zrey/k24VGPKNbY2Cx0uFNuOy7frI+cgJvW9W8 4v8wQ+2LRR4b30JfZz6/0sODnPXKS8Dc7ypJ0F1QQpRcvZ3SjiH6dw03tgQsboRBZkmi aCJmwP1oUJNfhtFjV4QYar+V1mjqASL92jxL7RcVsVzr27c2SOJHMiDLLtKhAjQRmh7e TxrEiIpiGtaKevMij8w1Gv74pRbuiEo7qqZmrBGuYsRO+R+AZH8rKieuS6IxuiJxXNZV kwQA== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m12-v6si996041pln.302.2018.04.02.12.51.08; Mon, 02 Apr 2018 12:51:23 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756939AbeDBTp6 (ORCPT + 99 others); Mon, 2 Apr 2018 15:45:58 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:43180 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752321AbeDBTp4 (ORCPT ); Mon, 2 Apr 2018 15:45:56 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3CE88BD95; Mon, 2 Apr 2018 19:45:56 +0000 (UTC) Received: from redhat.com (ovpn-122-207.rdu2.redhat.com [10.10.122.207]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4194ED7E19; Mon, 2 Apr 2018 19:45:55 +0000 (UTC) Date: Mon, 2 Apr 2018 15:45:53 -0400 From: Jerome Glisse To: Logan Gunthorpe Cc: Christian =?iso-8859-1?Q?K=F6nig?= , Christoph Hellwig , Will Davis , Joerg Roedel , linaro-mm-sig@lists.linaro.org, amd-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-media@vger.kernel.org, Bjorn Helgaas Subject: Re: [PATCH 2/8] PCI: Add pci_find_common_upstream_dev() Message-ID: <20180402194553.GC18231@redhat.com> References: <8d050848-8970-b8c4-a657-429fefd31769@amd.com> <20180330015854.GA3572@redhat.com> <0234bc5e-495e-0f68-fb0a-debb17a35761@deltatee.com> <20180330194519.GC3198@redhat.com> <31266710-f6bb-99ee-c73d-6e58afe5c38c@deltatee.com> <20180402172027.GA18231@redhat.com> <6f796779-0ba3-d056-de33-341ee55d6b38@deltatee.com> <20180402191649.GB18231@redhat.com> <4c672c71-6202-0775-7825-37f8077d1d35@deltatee.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <4c672c71-6202-0775-7825-37f8077d1d35@deltatee.com> User-Agent: Mutt/1.9.2 (2017-12-15) X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Mon, 02 Apr 2018 19:45:56 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Mon, 02 Apr 2018 19:45:56 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'jglisse@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Apr 02, 2018 at 01:32:37PM -0600, Logan Gunthorpe wrote: > > > On 02/04/18 01:16 PM, Jerome Glisse wrote: > > There isn't good API at the moment AFAIK, closest thing would either be > > lookup_resource() or region_intersects(), but a more appropriate one can > > easily be added, code to walk down the tree is readily available. More- > > over this can be optimize like vma lookup are, even more as resource are > > seldomly added so read side (finding a resource) can be heavily favor > > over write side (adding|registering a new resource). > > So someone needs to create a highly optimized tree that registers all > physical address on the system and maps them to devices? That seems a > long way from being realized. I'd hardly characterize that as "easily". > If we can pass both devices to the API I'd suspect it would be preferred > over the complicated tree. This, of course, depends on what users of the > API need. This tree already exist, it is all there upstream see kernel/resource.c What is missing is something that take a single address and return the device struct. There is function that take a range region_intersects() or one that take the start address lookup_resource(). It isn't hard to think that using roughly same code as region_intersects() an helper that return the device for a resource can be added. And yes currently this does not have a pointer back to the device that own the resource but this can be added. It wasn't needed until now. It can latter be optimize if device lookup shows as a bottleneck in perf profile. > > > cache coherency protocol (bit further than PCIE snoop). But also the > > other direction the CPU access to device memory can also be cache coherent, > > which is not the case in PCIE. > > I was not aware that CAPI allows PCI device memory to be cache coherent. > That sounds like it would be very tricky... And yet CAPI, CCIX, Gen-Z, NVLink, ... are all inter-connect that aim at achieving this cache coherency between multiple devices and CPUs. J?r?me