From patchwork Mon Sep 24 11:50:02 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Hellstrom X-Patchwork-Id: 10612279 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 864AD112B for ; Mon, 24 Sep 2018 11:50:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 734C829CED for ; Mon, 24 Sep 2018 11:50:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 64F1229C9B; Mon, 24 Sep 2018 11:50:06 +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 0DCD429C9B for ; Mon, 24 Sep 2018 11:50:06 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1BF6689D1D; Mon, 24 Sep 2018 11:50:05 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM04-CO1-obe.outbound.protection.outlook.com (mail-eopbgr690087.outbound.protection.outlook.com [40.107.69.87]) by gabe.freedesktop.org (Postfix) with ESMTPS id D28B189D1D for ; Mon, 24 Sep 2018 11:50:03 +0000 (UTC) Received: from SN6PR05MB4589.namprd05.prod.outlook.com (52.135.75.151) by SN6PR05MB4845.namprd05.prod.outlook.com (52.135.117.11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1164.15; Mon, 24 Sep 2018 11:50:02 +0000 Received: from SN6PR05MB4589.namprd05.prod.outlook.com ([fe80::38a5:a632:bd0f:c117]) by SN6PR05MB4589.namprd05.prod.outlook.com ([fe80::38a5:a632:bd0f:c117%3]) with mapi id 15.20.1185.014; Mon, 24 Sep 2018 11:50:02 +0000 From: Thomas Hellstrom To: "dri-devel@lists.freedesktop.org" Subject: [PATCH] drm/vmwgfx: Fix a buffer object eviction regression v2 Thread-Topic: [PATCH] drm/vmwgfx: Fix a buffer object eviction regression v2 Thread-Index: AQHUU/y6NYXmpi/n8EuDhjAcwGSm5Q== Date: Mon, 24 Sep 2018 11:50:02 +0000 Message-ID: <20180924114927.2741-1-thellstrom@vmware.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: BYAPR07CA0020.namprd07.prod.outlook.com (2603:10b6:a02:bc::33) To SN6PR05MB4589.namprd05.prod.outlook.com (2603:10b6:805:38::23) x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [155.4.205.56] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; SN6PR05MB4845; 20:mwdhlboDVgZv+yinLHxKsCwW7F2+eF+QzDbOk6qo8aVKASN9EOKRj/XkdghIYCYwjjDBVRVD3LQSGQX/w5K5ldqmWnutPP6+M44/R7n/3sURwOeTpTebapFL8fw71Ce3Hb4vV4x6K8QqsXE02lSMU626F0RGSXNVmmusXevY/JM= x-ms-office365-filtering-correlation-id: 1abcd003-6181-474e-6b61-08d62213dc35 x-microsoft-antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(4534165)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(2017052603328)(7153060)(7193020); SRVR:SN6PR05MB4845; x-ms-traffictypediagnostic: SN6PR05MB4845: bcl: 0 x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(61668805478150); x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3002001)(10201501046)(93006095)(93001095)(3231355)(944501410)(52105095)(149066)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123562045)(20161123558120)(20161123560045)(201708071742011)(7699051)(76991041); SRVR:SN6PR05MB4845; BCL:0; PCL:0; RULEID:; SRVR:SN6PR05MB4845; x-forefront-prvs: 0805EC9467 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(136003)(366004)(346002)(39860400002)(396003)(376002)(199004)(189003)(52116002)(2906002)(316002)(99286004)(478600001)(5250100002)(2501003)(71190400001)(71200400001)(186003)(6486002)(2900100001)(97736004)(68736007)(102836004)(6346003)(256004)(4326008)(5660300001)(7736002)(6506007)(386003)(53936002)(6512007)(3846002)(8936002)(14444005)(54906003)(105586002)(36756003)(8676002)(26005)(106356001)(2351001)(6436002)(81156014)(81166006)(6916009)(1857600001)(486006)(1076002)(6116002)(5640700003)(25786009)(66066001)(14454004)(86362001)(305945005)(476003)(2616005); DIR:OUT; SFP:1101; SCL:1; SRVR:SN6PR05MB4845; H:SN6PR05MB4589.namprd05.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: vmware.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: QTYHkTxm4NfdsHqwQKVRocmasANWZoBkIRbQim+ssa2EI2K8PMOUL2pxNvuELcW7JAxckirelBdBpjJ07NSm6ENsJkQjzs8fYmZWJ9jtifQY+dPaiNoCITuwUCNBmx3dAkB0W6BNQFoMxUN7v1Y+w3rP5id6TBSDvlN7BBBuk7b0YSZ1xBcbPhPZ/VCoMyl7V5udf60AEDnUmmllGj6FDm1hG/8Xg5agb53lPDzY86cbVcDbPeIdmS3IHDpGK8zPSBV+a6c2qieQveL7sA0BZoUyvg/xfP3x9qbqcn9+hPfhZxoziJwniQwX3Wxr3/5N5sOQQnIAEUDb0D0oK3dDq2ECbv0gILvEe5tZRRfqIV8= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: vmware.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1abcd003-6181-474e-6b61-08d62213dc35 X-MS-Exchange-CrossTenant-originalarrivaltime: 24 Sep 2018 11:50:02.2621 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: b39138ca-3cee-4b4a-a4d6-cd83d9dd62f0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR05MB4845 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: Thomas Hellstrom , "willy@infradead.org" Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Commit 4eb085e42fde ("drm/vmwgfx: Convert to new IDA API") introduced an incorrect return value from the function vmw_gmrid_man_get_node(), when we run out of integer ids. Instead of returning 0 (meaning non-fatal error) we forward the ida_simple_get error code -ENOSPC. This causes TTM not to retry allocation after buffer eviction and instead return -ENOSPC to user-space. Fix this by returning 0 when ida_simple_get() returns other error codes than -ENOMEM: Tested using glretrace. Cc: Signed-off-by: Thomas Hellstrom Reviewed-by: Sinclair Yeh Reviewed-by: Matthew Wilcox --- v2: Test for -ENOMEM instead of -ENOSPC --- drivers/gpu/drm/vmwgfx/vmwgfx_gmrid_manager.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_gmrid_manager.c b/drivers/gpu/drm/vmwgfx/vmwgfx_gmrid_manager.c index b93c558dd86e..c1cdf6975396 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_gmrid_manager.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_gmrid_manager.c @@ -57,7 +57,7 @@ static int vmw_gmrid_man_get_node(struct ttm_mem_type_manager *man, id = ida_alloc_max(&gman->gmr_ida, gman->max_gmr_ids - 1, GFP_KERNEL); if (id < 0) - return id; + return (id == -ENOMEM ? -ENOMEM : 0); spin_lock(&gman->lock);