Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=192.198.163.17 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796314730; b=GAcIVdmoa0e67RX+HtglZAHMun3YZ9EXqpNUudkIWGeZrNTu+cnlZOEtJlGzDxrzsB4E aSrSe+gQBUlH1Ofy6FGrgzz6g6pKSsaqqaP1d24Z0N2MOg1K8uWw02WEggZMc32DjdHy9 5U1wTsl8PX3SwA5a5Xp+frIBEwOK1vZvlePcLMwFV6OV7a8A7Xh85tUrv1x1jxQv0au05 yUQf6hSJfVnpxpbi95qOGLLGF4Sg7A6tmJLxjPzhW6Lk37ldPKPmd8jVF4fNO5aIcH+n/ NJDW8x866uc66cCEqD3kNkoMeS24ZIiSobHao2E8HsxGRRseuTiiq/Ohu0NrRuypglQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796314730; 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=z3LAi4A1AmUpMoWz0iADYGASZsEfFhk8/z0rdVXqoy4=; b=NXFEmgPyDtNYd2KGZtwlL9hp7qS7XcNytOHmph6NEk0ozNVTaQ6UcBsbQBXW3eIJddO3 DN8gMzUBXeGJpzde8uw20xoWN9pwWLfTYtlpVD1lidBPh+HEhmMkthbHarHTpfHLjdEBZ Oo3L/7KvvgklCGMhhtDOvKQ+UdAmWntOpfOKY5vycdjCyAgM4mC+jMXjpN6m/25Brhm4o AurhJtZQCWziTUhWOaLJzL6h8IfTooIir/WSQYJ3ZBflvyn4GMp3AfdhI6be9d7jfwh/R ed6Y4gPtVvtegSpbDvZXTLJC7TQi+5mouTPvA2ELbvzr5BaOPg86/7RjvdThEvSwKXQ== 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=bisqTg4C; arc=none smtp.remote-ip=192.198.163.17 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.17]) (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 3A4F5606A32C for ; Thu, 3 Dec 2026 16:18:49 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 3A4F5606A32C 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, unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=bisqTg4C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1796314730; x=1827850730; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=z3LAi4A1AmUpMoWz0iADYGASZsEfFhk8/z0rdVXqoy4=; b=bisqTg4CiJoPSEGZcT5jsKPSPmhdwUD0kR1Pwup5EcJuXMya4Jq/deaW UZCn4IibPE0lEnhuT+Rvx8/BzWFmxxMyZxYlE49XeT+LCTvA7BZvtsacZ cMZAPjPbZPsPsqyrmAQgqrtKtSaaaouSNFpLU5r+BkPxmSZjXvLYKLvuX x29DMQh3i5Mr99oOQo2+J+USWtKzauvm7+fwk7T30B9J/S3TBhadrbN+t +MjKpKHRp6IQPO1SuruTBisFIIvggPuXKTr8JSznkp0Fxccbi5zZXFE9h v81IzuQezFi/T7kpRdRA3Ucx3mhNAoBpqazsR1h+2xbwR2nBADYGf8hWN Q==; X-CSE-ConnectionGUID: uP/up4KwTNKb5TGTmIg0oQ== X-CSE-MsgGUID: 2JdOEJwxSjaqOW/54VsbpA== X-IronPort-AV: E=McAfee;i="6800,10657,11985"; a="5291300" X-IronPort-AV: E=Sophos;i="6.29,248,1794902400"; d="scan'208";a="5291300" Received: from orviesa007.jf.intel.com ([10.64.159.147]) by fmvoesa111.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Dec 2026 08:18:49 -0800 X-CSE-ConnectionGUID: j6Y9GJQ3SQyLC0BPmapzJA== X-CSE-MsgGUID: yQeIRAuQTumw4dUDZr9O0g== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.29,248,1794902400"; d="scan'208";a="13884278" Received: from alekseim-mobl.ger.corp.intel.com (HELO [10.245.244.94]) ([10.245.244.94]) by smtpauth.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Dec 2026 08:18:48 -0800 Message-ID: <0dcdb524-1e3f-4119-a825-e58abd46cc28@intel.com> Date: Thu, 3 Dec 2026 16:18:45 +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 v5 28/36] drm/xe: Lock the bo in xe_bo_dma_unmap_pinned() 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: <20261202233323.3743190-1-matthew.brost@intel.com> <20261202233323.3743190-29-matthew.brost@intel.com> Content-Language: en-GB From: Matthew Auld In-Reply-To: <20261202233323.3743190-29-matthew.brost@intel.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 02/12/2026 23:33, Matthew Brost wrote: > xe_bo_apply_to_pinned() drops xe->pinned.lock before invoking the > callback with only a bo reference held. Unlike the other pinned > callbacks, xe_bo_dma_unmap_pinned() does not take the bo's dma-resv lock, > so on device removal it can race with an importer unpinning an exported > bo (xe_bo_unpin_external()) followed by an eviction that unmaps the same > tt, resulting in a double DMA unmap and sg table free. The imported-bo > branch also calls dma_buf_unmap_sgt(), which asserts that the dma-resv > lock is held. > > Take the bo lock around the unmap. > > 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