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 07E04C41513 for ; Wed, 29 May 2024 01:05:41 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8FBFF112C8B; Wed, 29 May 2024 01:05:41 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="QEdCALql"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.8]) by gabe.freedesktop.org (Postfix) with ESMTPS id F13BD112C88 for ; Wed, 29 May 2024 01:05:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1716944733; x=1748480733; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=qIEvHvyZVDcIceeUlmA5KHSEqt2jonYOGYXmcBxcr7A=; b=QEdCALqltD6sMl1WJznPDq3ZLZy0RO8Yk0rwuFDNUe6ZxjdQf8KZkvbT B3bD7/WxubhUV4wX66kJFwbpPBkHzj7fNR0qD1QEChQ9h5P/p4xA4rced Yv/juUJExo9p6tSV1YQRBMUh75L18vQE0TxLH6/RoMxTXQ4sZcuegE9je 8x8c+5BvPIoqu23k97cguhwohWfupdSTVQOtgnpVXsTemOSnc9RyOfKqI Xc5oaAAbnr+JONi1a0DLab5DK5PN2ghw/0NRslA5uUq6dQdPgpvh+GW1p 39vBIkZAseCcbZEm4pYEaevYSa4rUuAapY8yBOmqnwQGxk+/PNi/dWNFv A==; X-CSE-ConnectionGUID: NGaDbmV6S/2P5P+cG34/tA== X-CSE-MsgGUID: BF4igbdTScCBhgnRfGIZ6w== X-IronPort-AV: E=McAfee;i="6600,9927,11085"; a="30849806" X-IronPort-AV: E=Sophos;i="6.08,197,1712646000"; d="scan'208";a="30849806" Received: from orviesa001.jf.intel.com ([10.64.159.141]) by fmvoesa102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 May 2024 18:05:18 -0700 X-CSE-ConnectionGUID: BviGG3dQR+OlWUtNurig0Q== X-CSE-MsgGUID: 6EyXW01tRbi0bVk2H1quig== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,197,1712646000"; d="scan'208";a="72700512" Received: from szeng-desk.jf.intel.com ([10.165.21.149]) by smtpauth.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 May 2024 18:05:18 -0700 From: Oak Zeng To: intel-xe@lists.freedesktop.org Subject: [CI v3 21/26] drm/xe: Retry BO allocation Date: Tue, 28 May 2024 21:19:19 -0400 Message-Id: <20240529011924.4125173-21-oak.zeng@intel.com> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20240529011924.4125173-1-oak.zeng@intel.com> References: <20240529011924.4125173-1-oak.zeng@intel.com> MIME-Version: 1.0 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-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-xe-bounces@lists.freedesktop.org Sender: "Intel-xe" From: Matthew Brost TTM doesn't support fair eviction via WW locking, this mitigated in by using retry loops in exec and preempt rebind worker. Extend this retry loop to BO allocation. Once TTM supports fair eviction this patch can be reverted. Signed-off-by: Matthew Brost --- drivers/gpu/drm/xe/xe_bo.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/xe/xe_bo.c b/drivers/gpu/drm/xe/xe_bo.c index a838ce520c2e..fae913e1acf5 100644 --- a/drivers/gpu/drm/xe/xe_bo.c +++ b/drivers/gpu/drm/xe/xe_bo.c @@ -1932,6 +1932,7 @@ int xe_gem_create_ioctl(struct drm_device *dev, void *data, struct xe_file *xef = to_xe_file(file); struct drm_xe_gem_create *args = data; struct xe_vm *vm = NULL; + ktime_t end = 0; struct xe_bo *bo; unsigned int bo_flags; u32 handle; @@ -1997,11 +1998,14 @@ int xe_gem_create_ioctl(struct drm_device *dev, void *data, vm = xe_vm_lookup(xef, args->vm_id); if (XE_IOCTL_DBG(xe, !vm)) return -ENOENT; + } + +retry: + if (vm) { err = xe_vm_lock(vm, true); if (err) goto out_vm; } - bo = xe_bo_create_user(xe, NULL, vm, args->size, args->cpu_caching, ttm_bo_type_device, bo_flags); @@ -2010,6 +2014,8 @@ int xe_gem_create_ioctl(struct drm_device *dev, void *data, if (IS_ERR(bo)) { err = PTR_ERR(bo); + if (xe_vm_validate_should_retry(NULL, err, &end)) + goto retry; goto out_vm; } -- 2.26.3