Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp654335rdg; Wed, 11 Oct 2023 01:22:46 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGO6gY/MZAT1z1/cUcxE/HKGuVTkLCBMaNSiqtacN3g+gLh+dM67g5s0vMgV++VLa6RRTWo X-Received: by 2002:a05:6830:ec1:b0:6b9:9cc0:537f with SMTP id dq1-20020a0568300ec100b006b99cc0537fmr20330462otb.33.1697012566007; Wed, 11 Oct 2023 01:22:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697012565; cv=none; d=google.com; s=arc-20160816; b=HdXjAf0if7qD6t4cWraJSGgfHqboAQD97KF+UyNXYDuQ6UQCDy6mIx5JbRxRhxGpeU ywAZKRd2KzKqTGZgDZfLe5jKDvVNRvBuoNO4IMvWAKYC4daIAgosUcDOZfh8fSPXVD3o abqmxADDU/jF4jxrrDiGQAERaj2pL6EJbCkpk2zH1avPjfQq/Zq8YeoatyhrH2KwGTXB EyPr0tjuOuNgm8+xDR4p7rtxONvHkOz1c1Z5Z1H/bTKnd20QERzCvJ5h4J9/E1hJJfyt Z2BIWmLDhgFzbwuAPjxJCNhNVKGreIWFpXDaODy3oHlzGTO42g2SUSHLmjw5bgBVVjJV 2pAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent :content-transfer-encoding:organization:references:in-reply-to:date :cc:to:from:subject:message-id:dkim-signature; bh=rop2SO3ybzEk4DVuIiU1MtKYn2SMe0Tm8G/1drFuF44=; fh=75rTLOSi/saMCUll5Sx2uQqbkjg6mJznufz+XXL14fo=; b=w3IO4n33kYWNYH/fVPfAzaIuwhkeChZCs9w4PVh8H4BCPtmWugiuX/wuxoWVhMKTiY x+EsZOoxYc1yS14ZAM9tjLtoU8guLJ79T4Pg5YsqEz6fSXV/s9VO6YAl8wYArSh2Lz4e ChfRGGni+iv2bXJXbExMPs8hdMdQquz3yOmYFPwsUO7kipwUIF3jPYMwS/1EoS0waep6 pzEPisnUoPHlSMnAFa9BmI0a88aveeGhH4sYL8YLXYiCOMjP1IHnDpTWYLftft3atsOY kMwd/YEM3W+f7OW7uKd4dvGf9GdfoeoWPfDUqSkCNCVaE7iGtFWFGv0ZLLMcOdH6+nbX l3Fg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=RjwKArkK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id h13-20020a63120d000000b005774978dd75si14232599pgl.175.2023.10.11.01.22.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Oct 2023 01:22:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=RjwKArkK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 5A30F8024618; Wed, 11 Oct 2023 01:22:43 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229879AbjJKIW3 (ORCPT + 99 others); Wed, 11 Oct 2023 04:22:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58264 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229846AbjJKIW2 (ORCPT ); Wed, 11 Oct 2023 04:22:28 -0400 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3818092 for ; Wed, 11 Oct 2023 01:22:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1697012547; x=1728548547; h=message-id:subject:from:to:cc:date:in-reply-to: references:content-transfer-encoding:mime-version; bh=rop2SO3ybzEk4DVuIiU1MtKYn2SMe0Tm8G/1drFuF44=; b=RjwKArkKyoJataX/EgLYTvxKNkeUV1+J/hMRIYPKflfIEtVokXqLfPix eAfaD/SIxUE6z6xk1jfH9RgKaFEQQkMFu/IRsVjwY52PM31H9R8Ms5M9W AwGBeo626AOSUHd1hS18FuBNH4mXNuUPo069nK96OIN4APf6DPayKrkzT 9stAlks8olT47OE3LYn7jQmcUInO2mgfeoTCbpRRsrh4+1gYkRVKnw9EA Yf5L9Iy+NmlDHc0T2AKSw1P4EMldSLEN4c2JBT03qqhwAHjoTAhYPbjtD SsLjxN0YQs6sAleHE4X/slBw02JLXRKEv6/s18WdlUB1nuk2L2U+Ti4mX Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10859"; a="448810097" X-IronPort-AV: E=Sophos;i="6.03,214,1694761200"; d="scan'208";a="448810097" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Oct 2023 01:22:26 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10859"; a="877580799" X-IronPort-AV: E=Sophos;i="6.03,214,1694761200"; d="scan'208";a="877580799" Received: from clanggaa-mobl.ger.corp.intel.com (HELO [10.249.254.169]) ([10.249.254.169]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Oct 2023 01:22:22 -0700 Message-ID: <925e4c2d15161ce8115409b6af97dab9a2996bf7.camel@linux.intel.com> Subject: Re: [PATCH drm-misc-next 2/3] drm/gpuva_mgr: generalize dma_resv/extobj handling and GEM validation From: Thomas =?ISO-8859-1?Q?Hellstr=F6m?= To: Dave Airlie , Thomas =?ISO-8859-1?Q?Hellstr=F6m?= "(Intel)" Cc: Danilo Krummrich , daniel@ffwll.ch, matthew.brost@intel.com, sarah.walker@imgtec.com, donald.robson@imgtec.com, boris.brezillon@collabora.com, christian.koenig@amd.com, faith.ekstrand@collabora.com, bskeggs@redhat.com, Liam.Howlett@oracle.com, nouveau@lists.freedesktop.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org Date: Wed, 11 Oct 2023 10:22:20 +0200 In-Reply-To: References: <20230820215320.4187-1-dakr@redhat.com> <20230820215320.4187-3-dakr@redhat.com> <0c50ff22-0f11-1e27-c32e-694ce2b1e6c5@shipmail.org> <88c45fe6-0942-707c-9ea7-8486c177fcd7@shipmail.org> <736b6b6d-9e04-a27d-7d60-0c45d696b304@shipmail.org> <8a8253ae-0b85-df90-b480-64eeebfafc6d@shipmail.org> Organization: Intel Sweden AB, Registration Number: 556189-6027 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.46.4 (3.46.4-1.fc37) MIME-Version: 1.0 X-Spam-Status: No, score=2.8 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Wed, 11 Oct 2023 01:22:43 -0700 (PDT) X-Spam-Level: ** On Wed, 2023-10-11 at 06:23 +1000, Dave Airlie wrote: > > I think we're then optimizing for different scenarios. Our compute > > driver will use mostly external objects only, and if shared, I > > don't > > forsee them bound to many VMs. What saves us currently here is that > > in > > compute mode we only really traverse the extobj list after a > > preempt > > fence wait, or when a vm is using a new context for the first time. > > So > > vm's extobj list is pretty large. Each bo's vma list will typically > > be > > pretty small. >=20 > Can I ask why we are optimising for this userspace, this seems > incredibly broken. First Judging from the discussion with Christian this is not really uncommon. There *are* ways that we can play tricks in KMD of assorted cleverness to reduce the extobj list size, but doing that in KMD that wouldn't be much different than accepting a large extobj list size and do what we can to reduce overhead of iterating over it. Second the discussion here really was about whether we should be using a lower level lock to allow for async state updates, with a rather complex mechanism with weak reference counting and a requirement to drop the locks within the loop to avoid locking inversion. If that were a simplification with little or no overhead all fine, but IMO it's not a simplification? >=20 > We've has this sort of problem in the past with Intel letting the > tail > wag the horse, does anyone remember optimising relocations for a > userspace that didn't actually need to use relocations? >=20 > We need to ask why this userspace is doing this, can we get some > pointers to it? compute driver should have no reason to use mostly > external objects, the OpenCL and level0 APIs should be good enough to > figure this out. TBH for the compute UMD case, I'd be prepared to drop the *performance* argument of fine-grained locking the extobj list since it's really only traversed on new contexts and preemption. But as Christian mentions there might be other cases. We should perhaps figure those out and document? /Thoams >=20 > Dave.