Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp4528364imw; Tue, 12 Jul 2022 09:26:55 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sNxMtjSgEDGkLsM7iL4is6B1OvEP79qnUbn/mX3NS5tvrHtQVTIoS/J6idP86487nWKYfy X-Received: by 2002:a17:906:2086:b0:712:1257:77bf with SMTP id 6-20020a170906208600b00712125777bfmr25818920ejq.655.1657643215567; Tue, 12 Jul 2022 09:26:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657643215; cv=none; d=google.com; s=arc-20160816; b=dtrCaO96jalGd6Uf9IAGW7AE7IfilJ1p+te9CD8n/Ekv6rV4oIzCMjRhxyEA4+0iDM 98trY58FRf1VBf85c/eSzFYMF3dZ28Pc/Zp1uZA7oMxdkx6+IDhnQQArCIoCENuK6wgu 20MxKLxJ1Rnr0ouPPLjtreRFG7bQGQ4PuaIt9i5fecRX7eqiCevySLdSWuuQrcDl8Lve gj5K2w20qO+UQQn5IYnerfkVVHtW6YOXKhOtjNaOaKf0gvzTjhVBopl4JzRmOfYuivsk m6hbUDj7Os0Ypncj0tDwX9AXkRGeQL+Ik7lCzD2lk1CNypfZjQfzZKZipqcGHWC89J7Z ZaHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:content-transfer-encoding:mime-version :message-id:date:subject:cc:from:dkim-signature; bh=Q3zjCu3m5DzPAl8wsR3Xir92X5ldIJGknyYeBmMzzWc=; b=vK0apXmY/r8NkjBZt+221644DBbCb80ZZlG/lAXgI3TTtMmBLbsS3icUcEOq5HAFzB xu/MU+zzbVy9pcbFx6hajruJKm6Hf5idwV2wdiIEXUgssNpVSchgT+lubXm6h35eof9D 0RKA2Tafo3bquZK8UVtMfXkRU7A1vtNEnsQw4MmOm7pX5ri7MLmwpHoN1W9en1Tks4yz k9/Bw28FqiGIaQOD3NlQpSr/hHV9BKboS5vP7Ts18A86QfLczrcwVLm5QfDzMcqTV+Lx ketlEUyA4F3pf17qTqwrbXrVXhGyGmqiYBjnhsURW2pt4vUEcg88OmDdAyarGc3JcHmR 0igQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@kernel.org header.s=k20201202 header.b=tB9YX9UZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f13-20020a17090624cd00b0072af6d136a4si12110620ejb.805.2022.07.12.09.26.30; Tue, 12 Jul 2022 09:26:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=fail header.i=@kernel.org header.s=k20201202 header.b=tB9YX9UZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233729AbiGLPXV (ORCPT + 99 others); Tue, 12 Jul 2022 11:23:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55402 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232716AbiGLPWx (ORCPT ); Tue, 12 Jul 2022 11:22:53 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EC2ABC5976 for ; Tue, 12 Jul 2022 08:21:38 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5D779616C3 for ; Tue, 12 Jul 2022 15:21:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AB8DAC341CA; Tue, 12 Jul 2022 15:21:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1657639297; bh=YjiACTc5o8wzoAIL5H67t0QDn6A61quTQK6/++1jJpc=; h=From:To:Cc:Subject:Date:From; b=tB9YX9UZGS9yMpBVA/eTt7ywxac7MHMGddybNyrYtXjL0t++gkp8dKXqinf456Jrr 75gxMmsd2zGIc+chyDr9RDMn78atnZa6rWXJzD+N+8GMvmMSLpO5VBfiP3XPscdmsu GAmOQlCLJxL/eIuSv2RqTcuwsqamhxbEa2Sth92KIYEyH/hnegffzfELxbl9LrVXhb sQn+Z4wIX5rDVyDuP2Jfe5FiDhgHO0z+1mv/6kkPiPvfnGxEKAWzGE6B97LjoTpN4r UYsX7fziXHe2tsKsf+KszLS6TsmD3eiXgCtbsU5C+vz8gQJnCKvC3BluBGQVDztY/r oS+AcQOQgm4pA== Received: from mchehab by mail.kernel.org with local (Exim 4.95) (envelope-from ) id 1oBHhe-004k20-9f; Tue, 12 Jul 2022 16:21:34 +0100 From: Mauro Carvalho Chehab Cc: Mauro Carvalho Chehab , Andi Shyti , Bruce Chang , Chris Wilson , Daniel Vetter , Daniele Ceraolo Spurio , Dave Airlie , David Airlie , Jani Nikula , John Harrison , Joonas Lahtinen , Lucas De Marchi , Matt Roper , Matthew Brost , Rodrigo Vivi , Tejas Upadhyay , Tvrtko Ursulin , Umesh Nerlige Ramappa , dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH v5 0/2] Fix TLB invalidate issues with Broadwell Date: Tue, 12 Jul 2022 16:21:31 +0100 Message-Id: X-Mailer: git-send-email 2.36.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org i915 selftest hangcheck is causing the i915 driver timeouts, as reported by Intel CI bot: http://gfx-ci.fi.intel.com/cibuglog-ng/issuefilterassoc/24297?query_key=42a999f48fa6ecce068bc8126c069be7c31153b4 When such test runs, the only output is: [ 68.811639] i915: Performing live selftests with st_random_seed=0xe138eac7 st_timeout=500 [ 68.811792] i915: Running hangcheck [ 68.811859] i915: Running intel_hangcheck_live_selftests/igt_hang_sanitycheck [ 68.816910] i915 0000:00:02.0: [drm] Cannot find any crtc or sizes [ 68.841597] i915: Running intel_hangcheck_live_selftests/igt_reset_nop [ 69.346347] igt_reset_nop: 80 resets [ 69.362695] i915: Running intel_hangcheck_live_selftests/igt_reset_nop_engine [ 69.863559] igt_reset_nop_engine(rcs0): 709 resets [ 70.364924] igt_reset_nop_engine(bcs0): 903 resets [ 70.866005] igt_reset_nop_engine(vcs0): 659 resets [ 71.367934] igt_reset_nop_engine(vcs1): 549 resets [ 71.869259] igt_reset_nop_engine(vecs0): 553 resets [ 71.882592] i915: Running intel_hangcheck_live_selftests/igt_reset_idle_engine [ 72.383554] rcs0: Completed 16605 idle resets [ 72.884599] bcs0: Completed 18641 idle resets [ 73.385592] vcs0: Completed 17517 idle resets [ 73.886658] vcs1: Completed 15474 idle resets [ 74.387600] vecs0: Completed 17983 idle resets [ 74.387667] i915: Running intel_hangcheck_live_selftests/igt_reset_active_engine [ 74.889017] rcs0: Completed 747 active resets [ 75.174240] intel_engine_reset(bcs0) failed, err:-110 [ 75.174301] bcs0: Completed 525 active resets After that, the machine just silently hangs. Bisecting the issue, the patch that introduced the regression is: 7938d61591d3 ("drm/i915: Flush TLBs before releasing backing store") Reverting it fix the issues, but introduce other problems, as TLB won't be invalidated anymore. So, instead, let's fix the root cause. It turns that the TLB flush logic ends conflicting with i915 reset, which is called during selftest hangcheck. So, the TLB cache should be serialized together with i915 reset. Tested on an Intel NUC5i7RYB with an i7-5557U Broadwell CPU. v5: - Added a missing SoB on patch 2. - No other changes. v4: - No functional changes. All changes are at the patch descriptions: - collected acked-by/reviewed-by; - use the same e-mail on Author and SoB on patch 1. v3: - Removed the logic that would check if the engine is awake before doing TLB flush invalidation as backporting PM logic up to Kernel 4.x could be too painful. After getting this one merged, I'll submit a separate patch with the PM awake logic. v2: - Reduced to bare minimum fixes, as this shoud be backported deeply into stable. Chris Wilson (2): drm/i915/gt: Serialize GRDOM access between multiple engine resets drm/i915/gt: Serialize TLB invalidates with GT resets drivers/gpu/drm/i915/gt/intel_gt.c | 15 ++++++++++- drivers/gpu/drm/i915/gt/intel_reset.c | 37 ++++++++++++++++++++------- 2 files changed, 42 insertions(+), 10 deletions(-) -- 2.36.1