From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.11]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9386086334 for ; Mon, 13 Jul 2026 11:32:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.11 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783942376; cv=none; b=Z8FwYHYuSgNevZ2knU2J2j7LX55WhWI+D+NXON0rx5Al1Ls0p6xJG4NQYsEpfAVTyUo45LseVr0CG0sJDRr2H+yYp3dGG2X0PdPa154gHdiIAqLmG9wOlgPUI3vfFb79zEcdcj7QXukJJ1PCH4wHUa3WQhKwl+Cb+cfQhMRCDgw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783942376; c=relaxed/simple; bh=db9eSoCMqiyiPL1Dl/5RAF99+DSiTdsNrZQEK+Xtow4=; h=Message-ID:Subject:From:To:Date:In-Reply-To:References: Content-Type:MIME-Version; b=jMLaJVD91Fnnc2s5KL0cQvvGodtA4TOvo8p5s0rC2wzfJS1CRORB3lw6ra/dNxAKEXF6ntm+H6ldF+cPQrZm0s4nC4pAdX87iRYAcdds8jbxkdP3QSzvyED2ObEsHQ6D21EC0YWgLzp8YIeKQMKT9tk1ziMQUZmh/yBmWO/WDQA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=pass smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=IGLzlfl/; arc=none smtp.client-ip=198.175.65.11 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="IGLzlfl/" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1783942374; x=1815478374; h=message-id:subject:from:to:date:in-reply-to:references: content-transfer-encoding:mime-version; bh=db9eSoCMqiyiPL1Dl/5RAF99+DSiTdsNrZQEK+Xtow4=; b=IGLzlfl/PyTO9DdmIbT7L6B3ut87KaSPabi+2qbQYa3T4EqHHI+//z3z mTo6KkU7ln2Q4atfc1c7FMfw90CyFBuCyMzpLEhzuKZLI26ClwS/YWF3Q RgL5/7yxg0GW8IeAxJkYRtVIGW5dHFaYUW8064y9uCtopQo2data0vPNg r4f/L6ppsjE3KDatOUvjTegirnjs2YMJlMH2AScGOFUDyTxSEwVnH/WbI IcksfCPAMTLmVLjO1i6VY4HteZm6Tm5we6Lvfr4P1DxUJkoPDv6a68Hgi BaFp1QTF3bZDGio/0bhLcU5bDumR/24b3wWBiV4dExNP0Hz67BWGffDjG w==; X-CSE-ConnectionGUID: EMnvgdLNT0675RVVxXrSEg== X-CSE-MsgGUID: ba+tcV3+RP2A8WK4wm60RQ== X-IronPort-AV: E=McAfee;i="6800,10657,11841"; a="94899546" X-IronPort-AV: E=Sophos;i="6.25,154,1779174000"; d="scan'208";a="94899546" Received: from fmviesa006.fm.intel.com ([10.60.135.146]) by orvoesa103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Jul 2026 04:32:54 -0700 X-CSE-ConnectionGUID: iec/IZY9Tk20QDiTheYBsA== X-CSE-MsgGUID: 0BwvW1IXQdK1LgG/q/5QaA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.25,154,1779174000"; d="scan'208";a="251105714" Received: from mkosciow-mobl1.ger.corp.intel.com (HELO [10.245.245.123]) ([10.245.245.123]) by fmviesa006-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Jul 2026 04:32:51 -0700 Message-ID: Subject: Re: Refcounting dma_resv and using that for drm_exec support in TTM From: Thomas =?ISO-8859-1?Q?Hellstr=F6m?= To: Christian =?ISO-8859-1?Q?K=F6nig?= , dakr@kernel.org, ecourtney@nvidia.com, simona@ffwll.ch, matthew.brost@intel.com, nat@pixelcluster.dev, airlied@gmail.com, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org, amd-gfx@lists.freedesktop.org Date: Mon, 13 Jul 2026 13:32:48 +0200 In-Reply-To: <20260710190752.2355-1-christian.koenig@amd.com> References: <20260710190752.2355-1-christian.koenig@amd.com> Organization: Intel Sweden AB, Registration Number: 556189-6027 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.58.3 (3.58.3-1.fc43) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Hi, Christian, On Fri, 2026-07-10 at 20:52 +0200, Christian K=C3=B6nig wrote: > Hi everybody, >=20 > The idea of ref-counting dma_resv or ww_mutex came up multiple times > from > different people, but so far at least I have abandoned that as to > complicated to implement considering how widely used that object is. >=20 > Thanks to AI I gave the task to refcount dma_resv to Claude Sonet 4 > just > to check how horrible it would look like. >=20 > Well turns out that this is actually a cleanup we should most likely > aim > for and I'm really wondering why we haven't done it like this in the > first place. >=20 > Not only resolves it a bunch of issues with dma_resv instances shared > by > multiple GEM objects (we just recently had a bunch of patches for > that on > the mailing list), but also allows TTM to implement it's delayed > delete > handling without any zombie resurrection or similar hacks. >=20 > The patch set is totally work in progress and only survives a smoke > test > with amdgpu, but I still wanted to check if the idea is valuable and > should be looked in further. >=20 > Please comment and/or tear apart :) Before starting to look at this, in the spirit of trying to aligning on a "final" solution for ww transactions used in TTM, could we agree on how we are supposed to pass the importer's ww transaction context to the exporter's dma_map_attachment() operation to handle exporter evictions while mapping, because that decides what abstaction we should use for WW transations within TTM. drm_exec_init() xe_bo_validate() // IMporter dma_buf_map() // importer; map_attachment() // callback in exporter xe_bo_validate() // exporter tries to move exportert bo to VRAM but runs out of memory. ttm_bo_evict() // exporter's evict needs importer's drm_exec As mentioned a couple of times before, we can't pass a drm_exec to the exporter because that would make dma-buf depend on drm. So with this series it would be sufficient to move drm_exec to the dma- buf layer and rename it, but I still think we should have a plan. Thanks, Thomas >=20 > Cheers, > Christian.