From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=192.198.163.11 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796388461; b=JgpzpVzka7posvuaalozLPznxeaWMA5ebC0U0dPG6BXKb/9lHM2hQSo7bsfJbBigRGyX /cWEhfh0Iy3p9lJcQHNi4vh1/wuJx7YxsncAfTwWW+F/suE9CEKlhnXt56jr9idZ2tdxn MiTgAnOhXSjNi/Qx/vkLjLVgiaA3PWiDz6ThxZT1tLfQGV49+ArvMGAbgt/3luNnXRbK8 2CVkMhn0CbbIDn8ZlCUkLP5Wx91ugPiEseuB5ku7yU45YVOsMjfdF6o6D2zlPrtOPYfdA Z716O3MeyZdnWyspqD5S//9OeKPQqPycKMwfdK3SVEZL/pyVqoe7ZsQkxoRVvk3sLqQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796388461; h=DMARC-Filter:DKIM-Signature:X-CSE-ConnectionGUID:X-CSE-MsgGUID: X-IronPort-AV:X-IronPort-AV:Received:X-CSE-ConnectionGUID: X-CSE-MsgGUID:X-ExtLoop1:X-IronPort-AV:Received:Message-ID:Date: MIME-Version:User-Agent:Subject:To:Cc:References:Content-Language: From:In-Reply-To:Content-Type:Content-Transfer-Encoding; bh=xdDkQZBzldqtMRx3we/7guVXVnlxhrQY0jTx9MYFmYA=; b=n0PPPMv+nGcE7RU/YNKzNsxFn624QV4zjHqjCfWaG9mdvZiEdQBIv2aOyEIpPi41Fqru oml0zkK5pUtuR0EGt0nn3x/l2GC0r2ZhosfeW5ueFhvIkFVdyWWSS/2JpuWYWskZ/h+l7 pDwvnpd5AdcDV7asY80HtWJAGyHrDX6PGXnptLzcq6hVFZOlyYviAtm2QLr3g55UBMQRH M4jFIS/2FzAETHVmqkqGZEsWvA4cKwaGnyBITvMX70jVprLZtvHJPeky3TobtqHbJqeQI esR8kCv56Oh0Hu1qQL7r2SGtO30qrxw56UB6sxnGwGbTLdUNZMoGItw7k+o0PenRKew== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=iSSjTDNk; arc=none smtp.remote-ip=192.198.163.11 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.11]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 430E2606A337 for ; Fri, 4 Dec 2026 12:47:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 430E2606A337 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=iSSjTDNk DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1796388461; x=1827924461; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=xdDkQZBzldqtMRx3we/7guVXVnlxhrQY0jTx9MYFmYA=; b=iSSjTDNk+0z1ZShcNuskIXgzccgaDk3ofSJcI9Lmjkxc+3+bEoPPmsD8 VehTxDo073Cds/19YmBP7aG9qwYSqWJa+XshA8VX/jbzAvd/LXET6RVZW AMIbHXu3RHFMU2vrnm1xLwzRpZmvnSruo0mvv6Lr/nV3vn5ZjLzaoyxcp tV0onj7ScrmORIocqcChjD6ErH4x6qM35HDfdxZvmsNHBFPjJOqen7HtT Xyb8sFxPIXTBYwGCvtygcxJgk38wt6Gx07sY9BDngrGTvfk7l4PgDnW/D ZvalHtNZP5Uukk9vYTVcE4ygQarxDj9r/Vz/ZbBsbFgzvZ9Zn+DkBgayO Q==; X-CSE-ConnectionGUID: t9qzDV+tRnSd/r95SDz4GA== X-CSE-MsgGUID: CP+SqA9KTQqTdMyH/i7xzQ== X-IronPort-AV: E=McAfee;i="6800,10657,11986"; a="5272914" X-IronPort-AV: E=Sophos;i="6.29,78,1794902400"; d="scan'208";a="5272914" Received: from fmviesa009.fm.intel.com ([10.60.135.149]) by fmvoesa105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Dec 2026 04:21:20 -0800 X-CSE-ConnectionGUID: wUuhSuOATdGa9wcMdny+sw== X-CSE-MsgGUID: xwjs2ES6TK2Liw1MB9++NQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.29,78,1794902400"; d="scan'208";a="14231534" Received: from conormcd-mobl2.ger.corp.intel.com (HELO [10.245.245.12]) ([10.245.245.12]) by smtpauth.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Dec 2026 04:21:18 -0800 Message-ID: Date: Fri, 4 Dec 2026 12:21:16 +0000 X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v6 26/35] drm/xe: Don't DMA map tt pages after device unplug To: Matthew Brost , intel-xe@lists.freedesktop.org, dri-devel@lists.freedesktop.org Cc: =?UTF-8?Q?Thomas_Hellstr=C3=B6m?= , stable@vger.kernel.org References: <20261203202352.4153159-1-matthew.brost@intel.com> <20261203202352.4153159-27-matthew.brost@intel.com> Content-Language: en-GB From: Matthew Auld In-Reply-To: <20261203202352.4153159-27-matthew.brost@intel.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 03/12/2026 20:23, Matthew Brost wrote: > xe_bo_pci_dev_remove_all() drops all DMA mappings on device removal: > non-exported bos are purged and exported dma-bufs are moved out to > system. However, nothing prevents an exported dma-buf from being moved > back to TT afterwards, e.g. via DMA_BUF_IOCTL_SYNC -> > xe_dma_buf_begin_cpu_access() -> xe_bo_migrate(bo, XE_PL_TT), which > re-establishes a DMA mapping for a device that is going away. Once the > pci device has been removed from its IOMMU group, unmapping that tt on > dma-buf release dereferences a NULL iommu group. > > Refuse non-eviction moves to TT once the device is unplugged. > drm_dev_unplug() completes before xe_bo_pci_dev_remove_all() evicts bos > under their dma-resv lock and the move runs under the same lock, so a > mapping created before the unplug is evicted, and any later move to TT > sees the unplugged device. Evictions stay allowed: > xe_bo_pci_dev_remove_all() itself moves exported dma-bufs VRAM -> TT -> > SYSTEM, where the copy out of VRAM needs the TT mapping and the final > TT -> SYSTEM pass drops it. begin_cpu_access() already ignores > migration failures, leaving CPU access in the system placement. > > v6: > - Allow eviction moves to TT after unplug, xe_bo_pci_dev_remove_all() > needs them to move exported dma-bufs out of VRAM (Sashiko) > > Fixes: 3cbb651117ff ("drm/xe/bo: Add a bo remove callback") > Cc: Thomas Hellström > Cc: Matthew Auld > Cc: stable@vger.kernel.org # v6.16+ > Signed-off-by: Matthew Brost Reviewed-by: Matthew Auld