mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-16 03:11:11 -04:00
CCS save/restore batch buffers are attached during BO allocation and
detached during BO teardown. The shrinker triggers xe_bo_move(), which is
used for both allocation and deletion paths.
When BO allocation and shrinking occur concurrently, a circular locking
dependency involving fs_reclaim and swap_guard can occur, leading to a
deadlock such as:
*===============================================================*
* WARNING: possible circular locking dependency detected *
*---------------------------------------------------------------*
* *
* CPU0 CPU1 *
* ---- ---- *
* lock(fs_reclaim); *
* lock(&sa_manager->swap_guard); *
* lock(fs_reclaim); *
* lock(&sa_manager->swap_guard); *
* *
* *** DEADLOCK *** *
*===============================================================*
To avoid this, the BB pointer and SA are allocated using xe_bb_alloc()
before taking lock and SA is initialized using xe_bb_init() preventing
reclaim from being invoked in this context.
Fixes: 864690cf4d ("drm/xe/vf: Attach and detach CCS copy commands with BO")
Signed-off-by: Satyanarayana K V P <satyanarayana.k.v.p@intel.com>
Cc: Matthew Brost <matthew.brost@intel.com>
Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
Cc: Matthew Auld <matthew.auld@intel.com>
Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Cc: Maarten Lankhorst <dev@lankhorst.se>
Reviewed-by: Matthew Brost <matthew.brost@intel.com>
Signed-off-by: Matthew Brost <matthew.brost@intel.com>
Link: https://patch.msgid.link/20260220055519.2485681-7-satyanarayana.k.v.p@intel.com
29 lines
726 B
C
29 lines
726 B
C
/* SPDX-License-Identifier: MIT */
|
|
/*
|
|
* Copyright © 2022 Intel Corporation
|
|
*/
|
|
|
|
#ifndef _XE_BB_H_
|
|
#define _XE_BB_H_
|
|
|
|
#include "xe_bb_types.h"
|
|
|
|
struct dma_fence;
|
|
|
|
struct xe_gt;
|
|
struct xe_exec_queue;
|
|
struct xe_sa_manager;
|
|
struct xe_sched_job;
|
|
|
|
struct xe_bb *xe_bb_new(struct xe_gt *gt, u32 dwords, bool usm);
|
|
struct xe_bb *xe_bb_alloc(struct xe_gt *gt);
|
|
int xe_bb_init(struct xe_bb *bb, struct xe_sa_manager *bb_pool, u32 dwords);
|
|
struct xe_sched_job *xe_bb_create_job(struct xe_exec_queue *q,
|
|
struct xe_bb *bb);
|
|
struct xe_sched_job *xe_bb_create_migration_job(struct xe_exec_queue *q,
|
|
struct xe_bb *bb, u64 batch_ofs,
|
|
u32 second_idx);
|
|
void xe_bb_free(struct xe_bb *bb, struct dma_fence *fence);
|
|
|
|
#endif
|