From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 764A1606A32F for ; Thu, 3 Dec 2026 16:19:03 +0000 (UTC) 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=AE+CqrKB Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3EA1A10E781; Thu, 3 Dec 2026 16:18:58 +0000 (UTC) Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.17]) by gabe.freedesktop.org (Postfix) with ESMTPS id DDEEF10E781; Thu, 3 Dec 2026 16:18:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1796314732; x=1827850732; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=z3LAi4A1AmUpMoWz0iADYGASZsEfFhk8/z0rdVXqoy4=; b=AE+CqrKB3w1JiXDqgGZtPCJoPFf7c2Q3AAhoo8T7IQqk/jhy0qu58/I2 6/sn81vsz2/YYpDp47wMYlI9FPHUB7+dTvMprLhMfBiLcgMmUYTKfL2M8 9Ht2Mul83me8reYGGPAfzO9aNWZk8WjqhMShunkdAE9s74tugFbOYpg4H UrbyAmsU03s/SeICLHL5GXmSjQjaFw6l0A6logtXHAH2Z5Sdy5bvlbMT/ W4ihSlpkgizaXx8PZyZZ/CQQrrh+pzRV1J99wEkZ9Gyk7w3+HaTRnQSuo +OQpm9PMMv2FsAwakyr3qrdcRDfg01et22qgdlmNLhF5uFtr0TfYAUg// A==; X-CSE-ConnectionGUID: yCrRCsStSXa5fG0JO6Qtjg== X-CSE-MsgGUID: JcjV6kM0SZWUvRr9QofH4w== X-IronPort-AV: E=McAfee;i="6800,10657,11985"; a="5291301" X-IronPort-AV: E=Sophos;i="6.29,248,1794902400"; d="scan'208";a="5291301" 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-Archived-By: 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 X-BeenThere: intel-xe@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel Xe graphics driver List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Intel-xe" X-Spam-Status: No, score=-12.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 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