From patchwork Mon Apr 22 10:38:36 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chunming Zhou X-Patchwork-Id: 10910891 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D8AF114DB for ; Mon, 22 Apr 2019 10:38:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CA36C28462 for ; Mon, 22 Apr 2019 10:38:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BE1D32862D; Mon, 22 Apr 2019 10:38:49 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 2D69528462 for ; Mon, 22 Apr 2019 10:38:49 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 482F589361; Mon, 22 Apr 2019 10:38:47 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM01-BN3-obe.outbound.protection.outlook.com (mail-eopbgr740058.outbound.protection.outlook.com [40.107.74.58]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7F96D89361 for ; Mon, 22 Apr 2019 10:38:46 +0000 (UTC) Received: from BN6PR1201CA0009.namprd12.prod.outlook.com (2603:10b6:405:4c::19) by MN2PR12MB2973.namprd12.prod.outlook.com (2603:10b6:208:cc::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1813.14; Mon, 22 Apr 2019 10:38:44 +0000 Received: from CO1NAM03FT021.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e48::203) by BN6PR1201CA0009.outlook.office365.com (2603:10b6:405:4c::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1813.12 via Frontend Transport; Mon, 22 Apr 2019 10:38:44 +0000 Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) Received: from SATLEXCHOV02.amd.com (165.204.84.17) by CO1NAM03FT021.mail.protection.outlook.com (10.152.80.180) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1771.16 via Frontend Transport; Mon, 22 Apr 2019 10:38:43 +0000 Received: from zhoucm1.amd.com (10.34.1.3) by SATLEXCHOV02.amd.com (10.181.40.72) with Microsoft SMTP Server id 14.3.389.1; Mon, 22 Apr 2019 05:38:42 -0500 From: Chunming Zhou To: Subject: [PATCH] ttm: wait mem space if user allow while gpu busy Date: Mon, 22 Apr 2019 18:38:36 +0800 Message-ID: <20190422103836.4300-1-david1.zhou@amd.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:165.204.84.17; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(39860400002)(396003)(376002)(346002)(136003)(2980300002)(428003)(189003)(199004)(4744005)(305945005)(1076003)(54906003)(6916009)(97736004)(16586007)(86362001)(356004)(4326008)(51416003)(7696005)(6666004)(53936002)(2351001)(2906002)(126002)(476003)(2616005)(50226002)(8936002)(70586007)(336012)(426003)(486006)(70206006)(68736007)(81156014)(53416004)(77096007)(5660300002)(50466002)(8676002)(81166006)(72206003)(478600001)(47776003)(316002)(36756003)(48376002)(186003)(26005); DIR:OUT; SFP:1101; SCL:1; SRVR:MN2PR12MB2973; H:SATLEXCHOV02.amd.com; FPR:; SPF:None; LANG:en; PTR:InfoDomainNonexistent; MX:1; A:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 449c2e24-d6e5-4fd5-58bb-08d6c70eb194 X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600141)(711020)(4605104)(2017052603328); SRVR:MN2PR12MB2973; X-MS-TrafficTypeDiagnostic: MN2PR12MB2973: X-Microsoft-Antispam-PRVS: X-Forefront-PRVS: 00159D1518 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Message-Info: avnmmnTA+4wfbJReJgsxh8Z4u9qFci2nl59QB50UnqRjAUgfvNgfYrfCCx/evpJ/+cc1pgj7ltyLAud/ZaIlcd2k22CQm+Y6zpWztzQ46QXoCW7rS+YP8UVYuSl5N24cvRAwDWsGAnY7JLqSvf+hJCe1vgMVy+E8Y8Wjgnd4G2q17VQLAHEgppYsvsxICZF1j4Ih7/iy0eJIqYVlVd7LNmW4bkj9F5i4KUGnM9hXdpwGnvIgdCsXjc4Sn6nZomB9ZBuNaVW2O1dW0a3yLo2nR5rubefwqAKzmNvGqryvgmyhQMhNZouujOM9rJ8jCciaMB+cMfcKo+JTSpFJpTO8SD+XDxdUZAhNcs/mSwGDTKNJL3b2HhTUvA7bdRZyjCN4Ul+tsXiXGPHeFO8JxFcaY7NbAROIP7g8bx651ao5d2E= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Apr 2019 10:38:43.9890 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 449c2e24-d6e5-4fd5-58bb-08d6c70eb194 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXCHOV02.amd.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB2973 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector1-amd-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=3kAtCEULpg3cldhCx2OLxYgcioJJYChbv4sSk8gUDg4=; b=KqR++NXwaHgg4i7CuMhuw9lKM/P7Oi5n6nL6llRCUa7i81KGGclGH+JDyLghadjgX2uWy03RHpwBwFvGWdoCs4kD6cVpSObvJr01mVY2waRp68bEWahRI3dCzJFypNZXcdp/JbcSHAO5dHYbEtkbsuEDrcahr7uYBCjWunYSqv0= X-Mailman-Original-Authentication-Results: spf=none (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; lists.freedesktop.org; dkim=none (message not signed) header.d=none;lists.freedesktop.org; dmarc=permerror action=none header.from=amd.com; X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: prike.liang@amd.com Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP heavy gpu job could occupy memory long time, which could lead to other user fail to get memory. Change-Id: I0b322d98cd76e5ac32b00462bbae8008d76c5e11 Signed-off-by: Chunming Zhou Acked-by: Prike Liang Signed-off-by: Chunming Zhou Signed-off-by: Chunming Zhou Signed-off-by: Chunming Zhou --- drivers/gpu/drm/ttm/ttm_bo.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c index 7c484729f9b2..6c596cc24bec 100644 --- a/drivers/gpu/drm/ttm/ttm_bo.c +++ b/drivers/gpu/drm/ttm/ttm_bo.c @@ -830,8 +830,10 @@ static int ttm_bo_mem_force_space(struct ttm_buffer_object *bo, if (mem->mm_node) break; ret = ttm_mem_evict_first(bdev, mem_type, place, ctx); - if (unlikely(ret != 0)) - return ret; + if (unlikely(ret != 0)) { + if (!ctx || ctx->no_wait_gpu || ret != -EBUSY) + return ret; + } } while (1); mem->mem_type = mem_type; return ttm_bo_add_move_fence(bo, man, mem);