Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp260327pxm; Wed, 2 Mar 2022 14:50:49 -0800 (PST) X-Google-Smtp-Source: ABdhPJz63pXJdltE3CPUyfS84Q45mNsH/i30rEI6DYUO0pD15q7Obx2ac92sJrtNeaPJ1VC8hsmw X-Received: by 2002:a05:6a00:1646:b0:4f4:58f:b64 with SMTP id m6-20020a056a00164600b004f4058f0b64mr19567462pfc.47.1646261449695; Wed, 02 Mar 2022 14:50:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646261449; cv=none; d=google.com; s=arc-20160816; b=L59hZzx+nXnQPFKcse69+Uq1pjLVxdMfsxFvNogF7MBE0stKJpn8IWGopqGrPnLuRZ hPbCyZZ+7ibY48+lyFJL3ZLK2IlBxmNx3E+Rw2gieVPmR0QlHmqgK9dzu1C+t3kCNN5j dCbK0tsZvIUZBY62cbTv/ijVlmiD6uYdhpMqnap93BbID7bfkaxI97bhO6hWjvxZUH7l 2VJpyTLY825LMQbZzbVV/vdGh+f7+O5v/z0ToRc9xIeTGwoo9U5yYTIHJ+PBoMNKDatj OriT+2rF3s9RgDES8GJC3+ybqjD0bVQZ8+6oKfZmFLjkFVIjoZ8PwLcYNMmP4guZTz8f 28OQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=4jGJLuJREV0/X3q3GgipatfQyN9GFgYRI4OhL+IvVMg=; b=BSgV1JC8uQ/xm2mrJARzD1rdLLE0E9CnsxETEwF/qN/NX0/HUVWO+kg9YadHP9b+sY +KUuWuI3uLRpuprGvcFU9ipPnOHMlVQPD8vTn1SoBkQl/2GfL/R6cOeu3q1CgdhkLg2D y0S5qTTJFVHfqNCozILxEOFX+4zraJqOq/IlCOcX1ZbElct8hn3ORVS2o4lC30QUIw7d potAdQSkc3BwL8XNMZRK52xR8nCEwYNYtMyQEXI+VRNjS/HRnskzidJqo/HlHbYSrkoK sQ03TPtkK7S1d6HierbzWSuvY0KUjP46RAs5eFg5mqflsbi9x8d0JT/Kkz+5599/XW/N FGEA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id y4-20020a655a04000000b00372fbd2b572si292798pgs.313.2022.03.02.14.50.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Mar 2022 14:50:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id D966910BBEF; Wed, 2 Mar 2022 14:42:08 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239683AbiCBGUk (ORCPT + 99 others); Wed, 2 Mar 2022 01:20:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33430 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236520AbiCBGUk (ORCPT ); Wed, 2 Mar 2022 01:20:40 -0500 Received: from cstnet.cn (smtp21.cstnet.cn [159.226.251.21]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 2DBC870CF7 for ; Tue, 1 Mar 2022 22:19:55 -0800 (PST) Received: from localhost.localdomain (unknown [124.16.138.126]) by APP-01 (Coremail) with SMTP id qwCowAAXHPCDDB9it50DAg--.2938S2; Wed, 02 Mar 2022 14:19:48 +0800 (CST) From: Jiasheng Jiang To: jani.nikula@linux.intel.com, joonas.lahtinen@linux.intel.com, rodrigo.vivi@intel.com, tvrtko.ursulin@linux.intel.com, airlied@linux.ie, daniel@ffwll.ch, radhakrishna.sripada@intel.com, ville.syrjala@linux.intel.com, matthew.d.roper@intel.com, lucas.demarchi@intel.com, jose.souza@intel.com Cc: intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Jiasheng Jiang Subject: [PATCH] drm/i915/gt: Handle errors for i915_gem_object_trylock Date: Wed, 2 Mar 2022 14:19:46 +0800 Message-Id: <20220302061946.46630-1-jiasheng@iscas.ac.cn> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: qwCowAAXHPCDDB9it50DAg--.2938S2 X-Coremail-Antispam: 1UD129KBjvdXoWrKw4rJr18WFy3WF48Ww4Uurg_yoWDWwc_Ca yUtr97W3ZrCFnYk3WYkr1rZFy0yan2vF48Zw18ta95try5ZwsrXanrZr1rur17WFWUtrWD Aa1DuFZIvr129jkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUIcSsGvfJTRUUUbxAFF20E14v26r4j6ryUM7CY07I20VC2zVCF04k26cxKx2IYs7xG 6rWj6s0DM7CIcVAFz4kK6r1j6r18M28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48ve4kI8w A2z4x0Y4vE2Ix0cI8IcVAFwI0_Gr0_Xr1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI0_Gr1j 6F4UJwA2z4x0Y4vEx4A2jsIE14v26F4UJVW0owA2z4x0Y4vEx4A2jsIEc7CjxVAFwI0_Gc CE3s1le2I262IYc4CY6c8Ij28IcVAaY2xG8wAqx4xG64xvF2IEw4CE5I8CrVC2j2WlYx0E 2Ix0cI8IcVAFwI0_Jr0_Jr4lYx0Ex4A2jsIE14v26r1j6r4UMcvjeVCFs4IE7xkEbVWUJV W8JwACjcxG0xvY0x0EwIxGrwACjI8F5VA0II8E6IAqYI8I648v4I1lFIxGxcIEc7CjxVA2 Y2ka0xkIwI1l42xK82IYc2Ij64vIr41l4I8I3I0E4IkC6x0Yz7v_Jr0_Gr1lx2IqxVAqx4 xG67AKxVWUJVWUGwC20s026x8GjcxK67AKxVWUGVWUWwC2zVAF1VAY17CE14v26r1q6r43 MIIYrxkI7VAKI48JMIIF0xvE2Ix0cI8IcVAFwI0_Jr0_JF4lIxAIcVC0I7IYx2IY6xkF7I 0E14v26r4j6F4UMIIF0xvE42xK8VAvwI8IcIk0rVWrZr1j6s0DMIIF0xvEx4A2jsIE14v2 6r1j6r4UMIIF0xvEx4A2jsIEc7CjxVAFwI0_Gr0_Gr1UYxBIdaVFxhVjvjDU0xZFpf9x0J UdHUDUUUUU= X-Originating-IP: [124.16.138.126] X-CM-SenderInfo: pmld2xxhqjqxpvfd2hldfou0/ X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org As the potential failure of the i915_gem_object_trylock(), it should be better to check it and return error if fails. Fixes: 94ce0d65076c ("drm/i915/gt: Setup a default migration context on the GT") Signed-off-by: Jiasheng Jiang --- drivers/gpu/drm/i915/gt/selftest_migrate.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/gt/selftest_migrate.c b/drivers/gpu/drm/i915/gt/selftest_migrate.c index fa4293d2944f..79c6c68f7316 100644 --- a/drivers/gpu/drm/i915/gt/selftest_migrate.c +++ b/drivers/gpu/drm/i915/gt/selftest_migrate.c @@ -465,7 +465,11 @@ create_init_lmem_internal(struct intel_gt *gt, size_t sz, bool try_lmem) return obj; } - i915_gem_object_trylock(obj, NULL); + if (!i915_gem_object_trylock(obj, NULL)) { + i915_gem_object_put(obj); + return ERR_PTR(-EBUSY); + } + err = i915_gem_object_pin_pages(obj); if (err) { i915_gem_object_unlock(obj); -- 2.25.1