From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0C162C71155 for ; Mon, 16 Jun 2025 13:04:51 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C1C1D10E37B; Mon, 16 Jun 2025 13:04:50 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=amd.com header.i=@amd.com header.b="WNvX2td6"; dkim-atps=neutral Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2047.outbound.protection.outlook.com [40.107.92.47]) by gabe.freedesktop.org (Postfix) with ESMTPS id 4867010E37B; Mon, 16 Jun 2025 13:04:49 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=l1aycyNiwWOVa1jx9ASOpq/QOhHnWs+f6siOixDQEm1yhvVvviDalokARBVT8ce7xcUE2xrDymWQGc901pWug4/dmX043oBg6LC87Oyt3yVAqSjq6RQUqBJPfubCOqmFUfhWaRBSnrBpKVKMiDo7Rl9p70tYYmQY2U7hGdszA8UpxqA8ysGFMfeWwGfOX5xtH/Bd3SqkPUj4/c2mLmoo29m+PhEOE8+kiPcR83yOh7K40o99c09kxU36pJHdtDMb9MDq/o//ZMzwKdjsHxun2i6sQu/KEb4tIOK5tSNcWdWDzeHcE9Em8Kyf4iKUhBK2xKZg0RlxJqJ21WvlRNBvEQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=1acNXpyh0w7xXgAP5UeD+E3sF5XYBM3FGYys0n/PAUE=; b=akAFL3TpN+LTyV0YbcF2ZghlvQNAuFFfLzlYiCd7hmbltemr2mu3yFSXLIDU9MBrRT60Dpnf2yRqzEkXz9lRsy3u0019zPo3Pmv5TeI1HdCjmhqobBxGtEhOMLBtMfNet2dlU5ufZQhs8IccVHB9IS4fE6lEcjNmY63rcSEM8GAGVPIY4rT1zbRVQsvG7sspakCGe3hudoH9ZUxb0dCrFrCsQ31DyDfclLa9bZvXHZG5n9LuPh2yIgIxxisgNaafBoPRQvCA60W95SV+A1t5vsDk43i8lAzFv2hknO29ONB0qmdgFirivpHMDDqUnQ2Yrw1CokHM/ciPnHYzhyIU2A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=1acNXpyh0w7xXgAP5UeD+E3sF5XYBM3FGYys0n/PAUE=; b=WNvX2td6V5f+YO6nH9cU6SOgy3pYuGfEG3V/Gy9GFAOpdkg3NEdyb1msNzdfsNZDyu/1UlKJ1aKFrzpERSfmhFmF7/VawonDCxRXhAHca8aQyWFdcVuP4XVPFVTWxVj5omczXHt8i1GYFu7nmo5O+IniwCU0dY0kAag6nQ+IiiI= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; Received: from PH7PR12MB5685.namprd12.prod.outlook.com (2603:10b6:510:13c::22) by MW4PR12MB6952.namprd12.prod.outlook.com (2603:10b6:303:207::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8835.26; Mon, 16 Jun 2025 13:04:45 +0000 Received: from PH7PR12MB5685.namprd12.prod.outlook.com ([fe80::46fb:96f2:7667:7ca5]) by PH7PR12MB5685.namprd12.prod.outlook.com ([fe80::46fb:96f2:7667:7ca5%7]) with mapi id 15.20.8722.031; Mon, 16 Jun 2025 13:04:45 +0000 Message-ID: <71a45812-3a56-4a92-a22a-18010a089ea1@amd.com> Date: Mon, 16 Jun 2025 15:04:40 +0200 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 1/3] drm/ttm: Use a struct for the common part of struct ttm_lru_walk and struct ttm_bo_lru_cursor. To: =?UTF-8?Q?Thomas_Hellstr=C3=B6m?= , intel-xe@lists.freedesktop.org Cc: dri-devel@lists.freedesktop.org, airlied@gmail.com, Matthew Brost , Matthew Auld References: <20250613151824.178650-1-thomas.hellstrom@linux.intel.com> <20250613151824.178650-2-thomas.hellstrom@linux.intel.com> Content-Language: en-US From: =?UTF-8?Q?Christian_K=C3=B6nig?= In-Reply-To: <20250613151824.178650-2-thomas.hellstrom@linux.intel.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-ClientProxiedBy: FR2P281CA0096.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:9b::19) To PH7PR12MB5685.namprd12.prod.outlook.com (2603:10b6:510:13c::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH7PR12MB5685:EE_|MW4PR12MB6952:EE_ X-MS-Office365-Filtering-Correlation-Id: 8b215acc-09d2-4faa-88c2-08ddacd65dbb X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|1800799024|376014|7053199007; X-Microsoft-Antispam-Message-Info: =?utf-8?B?Y3BRbHptQUE4NUlQcnoxTjB4Yk1Xdm85SlJWaEdUb0JDUnEzcDBRWFFSQjBT?= =?utf-8?B?dHEyY2NXVWw2dVcwd0dGbURpMTNEN214ZmhTYW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8?B?T3BIaVpLME0xR1IyTVhJeUZkcGlpWVJ0c1BYK29pRWhFRmdTcHF3UjI1NWd6?= =?utf-8?Q?WDNaQDf/qc8=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PH7PR12MB5685.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(366016)(1800799024)(376014)(7053199007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?ck9lQWFuczdpYnlXWUR6RDFsazIxWGdBWXY0Z2UvNUEySm82bEhOaFJzVDQ5?= =?utf-8?B?cjNCUk9GTXhTNS9yWjI4QWY1ZDRkbEFuWkxtb0RrSW12Y2VFQkpJUVhvTHlL?= =?utf-8?B?eXYxK05wcVphOWZjMXM0S21HU1BPQ0g3eExIT1BmTUhBWlRDb21XdEZpalpl?= =?utf-8?B?MU9abjFybk54dHZCRnJGd2ExS0FuVVI1ZGM5YkZ0c2M2bGFaenRIT1pQbGZj?= =?utf-8?B?UjZNZTlDT0tuMzNtWmpBeDhGSHVlYXkxUW5xSENHZHlqQnk4ay9YWTZYbGx2?= =?utf-8?B?VjV2ajMvQnlQSmhIdUdrTmgzd2J4aG5jOEQzZTg4RC9pZkUrNXFEdkRwbFFB?= =?utf-8?B?NEVqU2lCZ05WbWtsU0RkeWdmSWZKZVB2TzZHU29yaW1Uc1NRaFFkd1F0V3JI?= =?utf-8?B?MUMzMzZ1YnpuRXU4SFJleERBeVg4WGRjUUNsNHRucE03eGtVcEs1enhPTTJo?= =?utf-8?B?eXM3YmFXMk1XNnNDZ1EzdmZFeExMR2s4eHhKUTdLTUFXRUI0bGhrSkNrTlhY?= =?utf-8?B?K0dpSEpLS1p5bUhieVZHajZmd040OFk0eC8xbGhoSVp2NEpzV0tPZ21zL1BN?= =?utf-8?B?VjM2MzZ4Y0tyZnFtR0pSYj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?utf-8?B?cjA1YnVIUzIybjNkZmhvN0tGKy82elJQUlV4cWNDbTN5cjhtbEMyOGF0cExv?= =?utf-8?B?NGZ0YVg0ckN5NzF4R0pYcHV1NkJ3dkhzK3laY3hmSmZGSlphcjI5SDdEbG1H?= =?utf-8?B?S3dnbEhsd0VTZ3ZzajBnS3MzdTJodGxtYndlbHF1Zm1sK3ZJaXJuUzJNVUg0?= =?utf-8?B?ZUhhSGpaQmJaTXJVK0o3MGhLUEdlUmpiSUc5aUlzYTZsdnJUblh5VThhSVZj?= =?utf-8?B?NmJjQ2VZeE0wVDFVTnhqelNEODJSS2ZBOFJsVDRZRm43TVRCRDkxUXdOK011?= =?utf-8?B?TTBOaHBQc2haRG5SckJDYldNZjlwVVl1aXFrcHY0ZWRtZjZ3U21mOFVPU2Fh?= =?utf-8?B?NXZMTGhaVW41eWJ4RStTY3pJOWpNWGxKdll4Q05UUlJkUUdLQm5aUlc4QW1k?= =?utf-8?B?bXJyTXB0U2RaRkFtN05ZVi9CSnh5QTlGT1I0Nmo4R2VTK1RsUWhCdjhhMGZ4?= =?utf-8?B?Q2tUV0hDT0pkZTlnNjFaMjZ5YlpNU2YvS0dLQmliZTFrNDI5STl6YlVObXZY?= =?utf-8?B?ZUtkSGpWVWt2K0svSUtZRzRHOS9QblJoeEVBT25MclgxWC9vdGtoMmdFSktG?= =?utf-8?Q?fnoIqAIfhWjSN26eVPVtMJyna?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8b215acc-09d2-4faa-88c2-08ddacd65dbb X-MS-Exchange-CrossTenant-AuthSource: PH7PR12MB5685.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Jun 2025 13:04:45.4618 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: hd4U733aUI1WjWuvfoAXsUDTWhSkEuiQ8iBo4uV2Nc3GijGsL0VeDSDINUo6aTkz X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR12MB6952 X-BeenThere: intel-xe@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel Xe graphics driver List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-xe-bounces@lists.freedesktop.org Sender: "Intel-xe" On 6/13/25 17:18, Thomas Hellström wrote: > Let the locking functions take the new struct ttm_lru_walk_arg > as argument in order for them to be easily used from both > types of walk. > > Signed-off-by: Thomas Hellström We could even clean that up further I think, but for now Reviewed-by: Christian König Regards, Christian. > --- > drivers/gpu/drm/ttm/ttm_bo.c | 24 ++++++++++++++---------- > drivers/gpu/drm/ttm/ttm_bo_util.c | 26 ++++++++++++++------------ > include/drm/ttm/ttm_bo.h | 23 ++++++++++++++--------- > 3 files changed, 42 insertions(+), 31 deletions(-) > > diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c > index 0f874f1e2526..eca486dff976 100644 > --- a/drivers/gpu/drm/ttm/ttm_bo.c > +++ b/drivers/gpu/drm/ttm/ttm_bo.c > @@ -525,11 +525,11 @@ static s64 ttm_bo_evict_cb(struct ttm_lru_walk *walk, struct ttm_buffer_object * > return 0; > > if (bo->deleted) { > - lret = ttm_bo_wait_ctx(bo, walk->ctx); > + lret = ttm_bo_wait_ctx(bo, walk->arg.ctx); > if (!lret) > ttm_bo_cleanup_memtype_use(bo); > } else { > - lret = ttm_bo_evict(bo, walk->ctx); > + lret = ttm_bo_evict(bo, walk->arg.ctx); > } > > if (lret) > @@ -565,8 +565,10 @@ static int ttm_bo_evict_alloc(struct ttm_device *bdev, > struct ttm_bo_evict_walk evict_walk = { > .walk = { > .ops = &ttm_evict_walk_ops, > - .ctx = ctx, > - .ticket = ticket, > + .arg = { > + .ctx = ctx, > + .ticket = ticket, > + } > }, > .place = place, > .evictor = evictor, > @@ -575,7 +577,7 @@ static int ttm_bo_evict_alloc(struct ttm_device *bdev, > }; > s64 lret; > > - evict_walk.walk.trylock_only = true; > + evict_walk.walk.arg.trylock_only = true; > lret = ttm_lru_walk_for_evict(&evict_walk.walk, bdev, man, 1); > > /* One more attempt if we hit low limit? */ > @@ -589,12 +591,12 @@ static int ttm_bo_evict_alloc(struct ttm_device *bdev, > /* Reset low limit */ > evict_walk.try_low = evict_walk.hit_low = false; > /* If ticket-locking, repeat while making progress. */ > - evict_walk.walk.trylock_only = false; > + evict_walk.walk.arg.trylock_only = false; > > retry: > do { > /* The walk may clear the evict_walk.walk.ticket field */ > - evict_walk.walk.ticket = ticket; > + evict_walk.walk.arg.ticket = ticket; > evict_walk.evicted = 0; > lret = ttm_lru_walk_for_evict(&evict_walk.walk, bdev, man, 1); > } while (!lret && evict_walk.evicted); > @@ -1105,7 +1107,7 @@ ttm_bo_swapout_cb(struct ttm_lru_walk *walk, struct ttm_buffer_object *bo) > struct ttm_place place = {.mem_type = bo->resource->mem_type}; > struct ttm_bo_swapout_walk *swapout_walk = > container_of(walk, typeof(*swapout_walk), walk); > - struct ttm_operation_ctx *ctx = walk->ctx; > + struct ttm_operation_ctx *ctx = walk->arg.ctx; > s64 ret; > > /* > @@ -1216,8 +1218,10 @@ s64 ttm_bo_swapout(struct ttm_device *bdev, struct ttm_operation_ctx *ctx, > struct ttm_bo_swapout_walk swapout_walk = { > .walk = { > .ops = &ttm_swap_ops, > - .ctx = ctx, > - .trylock_only = true, > + .arg = { > + .ctx = ctx, > + .trylock_only = true, > + }, > }, > .gfp_flags = gfp_flags, > }; > diff --git a/drivers/gpu/drm/ttm/ttm_bo_util.c b/drivers/gpu/drm/ttm/ttm_bo_util.c > index b78365dc1fed..600145cdeb9c 100644 > --- a/drivers/gpu/drm/ttm/ttm_bo_util.c > +++ b/drivers/gpu/drm/ttm/ttm_bo_util.c > @@ -771,10 +771,12 @@ int ttm_bo_pipeline_gutting(struct ttm_buffer_object *bo) > return ret; > } > > -static bool ttm_lru_walk_trylock(struct ttm_operation_ctx *ctx, > +static bool ttm_lru_walk_trylock(struct ttm_lru_walk_arg *arg, > struct ttm_buffer_object *bo, > bool *needs_unlock) > { > + struct ttm_operation_ctx *ctx = arg->ctx; > + > *needs_unlock = false; > > if (dma_resv_trylock(bo->base.resv)) { > @@ -790,17 +792,17 @@ static bool ttm_lru_walk_trylock(struct ttm_operation_ctx *ctx, > return false; > } > > -static int ttm_lru_walk_ticketlock(struct ttm_lru_walk *walk, > +static int ttm_lru_walk_ticketlock(struct ttm_lru_walk_arg *arg, > struct ttm_buffer_object *bo, > bool *needs_unlock) > { > struct dma_resv *resv = bo->base.resv; > int ret; > > - if (walk->ctx->interruptible) > - ret = dma_resv_lock_interruptible(resv, walk->ticket); > + if (arg->ctx->interruptible) > + ret = dma_resv_lock_interruptible(resv, arg->ticket); > else > - ret = dma_resv_lock(resv, walk->ticket); > + ret = dma_resv_lock(resv, arg->ticket); > > if (!ret) { > *needs_unlock = true; > @@ -810,7 +812,7 @@ static int ttm_lru_walk_ticketlock(struct ttm_lru_walk *walk, > * after waiting for the ticketlock, revert back to > * trylocking for this walk. > */ > - walk->ticket = NULL; > + arg->ticket = NULL; > } else if (ret == -EDEADLK) { > /* Caller needs to exit the ww transaction. */ > ret = -ENOSPC; > @@ -877,10 +879,10 @@ s64 ttm_lru_walk_for_evict(struct ttm_lru_walk *walk, struct ttm_device *bdev, > * since if we do it the other way around, and the trylock fails, > * we need to drop the lru lock to put the bo. > */ > - if (ttm_lru_walk_trylock(walk->ctx, bo, &bo_needs_unlock)) > + if (ttm_lru_walk_trylock(&walk->arg, bo, &bo_needs_unlock)) > bo_locked = true; > - else if (!walk->ticket || walk->ctx->no_wait_gpu || > - walk->trylock_only) > + else if (!walk->arg.ticket || walk->arg.ctx->no_wait_gpu || > + walk->arg.trylock_only) > continue; > > if (!ttm_bo_get_unless_zero(bo)) { > @@ -893,7 +895,7 @@ s64 ttm_lru_walk_for_evict(struct ttm_lru_walk *walk, struct ttm_device *bdev, > > lret = 0; > if (!bo_locked) > - lret = ttm_lru_walk_ticketlock(walk, bo, &bo_needs_unlock); > + lret = ttm_lru_walk_ticketlock(&walk->arg, bo, &bo_needs_unlock); > > /* > * Note that in between the release of the lru lock and the > @@ -970,7 +972,7 @@ ttm_bo_lru_cursor_init(struct ttm_bo_lru_cursor *curs, > { > memset(curs, 0, sizeof(*curs)); > ttm_resource_cursor_init(&curs->res_curs, man); > - curs->ctx = ctx; > + curs->arg.ctx = ctx; > > return curs; > } > @@ -981,7 +983,7 @@ ttm_bo_from_res_reserved(struct ttm_resource *res, struct ttm_bo_lru_cursor *cur > { > struct ttm_buffer_object *bo = res->bo; > > - if (!ttm_lru_walk_trylock(curs->ctx, bo, &curs->needs_unlock)) > + if (!ttm_lru_walk_trylock(&curs->arg, bo, &curs->needs_unlock)) > return NULL; > > if (!ttm_bo_get_unless_zero(bo)) { > diff --git a/include/drm/ttm/ttm_bo.h b/include/drm/ttm/ttm_bo.h > index 8ad6e2713625..4e52283e5db1 100644 > --- a/include/drm/ttm/ttm_bo.h > +++ b/include/drm/ttm/ttm_bo.h > @@ -207,11 +207,9 @@ struct ttm_lru_walk_ops { > }; > > /** > - * struct ttm_lru_walk - Structure describing a LRU walk. > + * struct ttm_lru_walk_arg - Common part for the variants of BO LRU walk. > */ > -struct ttm_lru_walk { > - /** @ops: Pointer to the ops structure. */ > - const struct ttm_lru_walk_ops *ops; > +struct ttm_lru_walk_arg { > /** @ctx: Pointer to the struct ttm_operation_ctx. */ > struct ttm_operation_ctx *ctx; > /** @ticket: The struct ww_acquire_ctx if any. */ > @@ -219,6 +217,16 @@ struct ttm_lru_walk { > /** @trylock_only: Only use trylock for locking. */ > bool trylock_only; > }; > + > +/** > + * struct ttm_lru_walk - Structure describing a LRU walk. > + */ > +struct ttm_lru_walk { > + /** @ops: Pointer to the ops structure. */ > + const struct ttm_lru_walk_ops *ops; > + /** @arg: Common bo LRU walk arguments. */ > + struct ttm_lru_walk_arg arg; > +}; > > s64 ttm_lru_walk_for_evict(struct ttm_lru_walk *walk, struct ttm_device *bdev, > struct ttm_resource_manager *man, s64 target); > @@ -466,11 +474,6 @@ int ttm_bo_populate(struct ttm_buffer_object *bo, > struct ttm_bo_lru_cursor { > /** @res_curs: Embedded struct ttm_resource_cursor. */ > struct ttm_resource_cursor res_curs; > - /** > - * @ctx: The struct ttm_operation_ctx used while looping. > - * governs the locking mode. > - */ > - struct ttm_operation_ctx *ctx; > /** > * @bo: Buffer object pointer if a buffer object is refcounted, > * NULL otherwise. > @@ -481,6 +484,8 @@ struct ttm_bo_lru_cursor { > * unlock before the next iteration or after loop exit. > */ > bool needs_unlock; > + /** @arg: Common BO LRU walk arguments. */ > + struct ttm_lru_walk_arg arg; > }; > > void ttm_bo_lru_cursor_fini(struct ttm_bo_lru_cursor *curs);