Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp1195745iog; Thu, 16 Jun 2022 00:39:41 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uQjTYgRPta0fyE4kqmXqb/kKQDkLWoMphIuSSlSsmWH2V3EEcOMpnVXMLkqyyfpVsKv39G X-Received: by 2002:a17:906:58cd:b0:71b:cc19:58ca with SMTP id e13-20020a17090658cd00b0071bcc1958camr996804ejs.682.1655365181185; Thu, 16 Jun 2022 00:39:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655365181; cv=none; d=google.com; s=arc-20160816; b=m+u9lkk6e3WFnGqZU5utJXqFNY2fUbCctwcKWMS4nr2OEJqJeMh/J58EowybEumX0y 3xcectWXaYyImG3pAd6U24hXw78vou3P2P0N/PNC0Orn/Sn4u/By776pbJPsNq5pi1Fb oY9rE0GVDH+9mjMhuL7TaT5PYCHVBaHQrBO0hhRFPN1AJWzi+tft0tdhu8SNqguc9ngT zAB7+4BIeILG7eC/EVD5+k9Uo70UUCSuBc94/Z7LCG+AU35MsOfSKMlfaxnvboLr2Uwt 5JVacPXBHDNeAnSXyd7AqCwaN0l5Ih/UI5X+yG7oDtlzps8/GADY58yKOm7ZIlmvIbsH uWVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :organization:from:references:cc:to:content-language:subject :user-agent:mime-version:date:message-id:dkim-signature; bh=K4x1rZIoB27fGnmU/YlBOdXKJP0SlA2ijc8PEsQo0WQ=; b=PIThZZd5BTrBqwZhQmTtcAPIBmuVyx1bUkWOOgKIh7kGQUHwWxRO1XkRWsQ71CPegi VfUQ4I+i/yp4FzWbvRqLj02Dhi4rHv9fdNq80Gyrl0OXC/HHU/V/Jeo4CSOk3FHWscyG HEPWdm1B1It1rv3xI9p+R3yQaVML47JU2axocQzUIZ2nmkBGHc0EaXygLt5UGeC70EJQ vQRoqk+CbQ4cNRNmelGmwJqIbTbIcQQLjjxMwYik3ASt7E/Gj5QC8WyE1QARGIEU5OSm K/XlDfw8eUvQdx69ZWvXxnorqjbCw392g9MuMjM1kyp28lGG3YA9frsKw2vx/RGA8c0i NZbg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=fB2ceX+O; 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=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gn9-20020a1709070d0900b006fea42b2e6fsi1243553ejc.642.2022.06.16.00.39.15; Thu, 16 Jun 2022 00:39:41 -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=pass header.i=@intel.com header.s=Intel header.b=fB2ceX+O; 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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1359508AbiFPHf5 (ORCPT + 99 others); Thu, 16 Jun 2022 03:35:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55606 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1359008AbiFPHf4 (ORCPT ); Thu, 16 Jun 2022 03:35:56 -0400 Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E79112DE6; Thu, 16 Jun 2022 00:35:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1655364955; x=1686900955; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=tGxxL6Ozay1esf8g8lTKwUO8uO7QkHG2DiuqpgEUeWU=; b=fB2ceX+OnOquh+BDSW0L3OfKsfrxtSJ8xiSoAi8mkXe2ksXjkSK7BqKG oyyWjC1kMO7RUCc6RljVpF6lZA4F3RSi/Y2Pq8MzwvkdDSdvca1COPY0D NJM+9bKASVQa044hLSXuxpnI0uQ1fY/99kvl3OwFa92DQ7TpRQiKSDiTa PNzphukU9x5GrEW/hdF0d2P5Tt4/y8PfnfFOHu6FkNWF53AnYxM+8Z+7U B5RBSh2Gx5ORcN+umhjv7kPoim0MWBCBsN5VgnhKYtZ9ITlQ3kcGacg5g uuQ74fmr7UWC1buS2lneyhubQ5vRPixpbVrnJsaYop7iM0zuSK9mJurBm Q==; X-IronPort-AV: E=McAfee;i="6400,9594,10379"; a="259652216" X-IronPort-AV: E=Sophos;i="5.91,304,1647327600"; d="scan'208";a="259652216" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Jun 2022 00:35:55 -0700 X-IronPort-AV: E=Sophos;i="5.91,304,1647327600"; d="scan'208";a="912048645" Received: from mstokes1-mobl.ger.corp.intel.com (HELO [10.213.198.82]) ([10.213.198.82]) by fmsmga005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Jun 2022 00:35:51 -0700 Message-ID: <8b9ae441-a291-fe45-ceac-be8c211a4f73@linux.intel.com> Date: Thu, 16 Jun 2022 08:35:49 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.10.0 Subject: Re: [PATCH 5/6] drm/i915/gt: Serialize GRDOM access between multiple engine resets Content-Language: en-US To: Mauro Carvalho Chehab Cc: Chris Wilson , Fei Yang , Thomas Hellstrom , Bruce Chang , Daniel Vetter , Dave Airlie , David Airlie , Jani Nikula , John Harrison , Joonas Lahtinen , Matt Roper , Matthew Brost , Rodrigo Vivi , Tejas Upadhyay , Umesh Nerlige Ramappa , dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org, mauro.chehab@linux.intel.com, Mika Kuoppala , Chris Wilson , Andi Shyti , stable@vger.kernel.org, =?UTF-8?Q?Thomas_Hellstr=c3=b6m?= References: <5ee647f243a774927ec328bfca8212abc4957909.1655306128.git.mchehab@kernel.org> From: Tvrtko Ursulin Organization: Intel Corporation UK Plc In-Reply-To: <5ee647f243a774927ec328bfca8212abc4957909.1655306128.git.mchehab@kernel.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-5.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,HK_RANDOM_ENVFROM,HK_RANDOM_FROM, NICE_REPLY_A,RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_NONE, 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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 15/06/2022 16:27, Mauro Carvalho Chehab wrote: > From: Chris Wilson > > Don't allow two engines to be reset in parallel, as they would both > try to select a reset bit (and send requests to common registers) > and wait on that register, at the same time. Serialize control of > the reset requests/acks using the uncore->lock, which will also ensure > that no other GT state changes at the same time as the actual reset. > > Fixes: 7938d61591d3 ("drm/i915: Flush TLBs before releasing backing store") Ah okay I get it, the fixes tag was applied indiscriminately to the whole series. :) It definitely does not belong in this patch. Otherwise LGTM: Reviewed-by: Tvrtko Ursulin Regards, Tvrtko > Reported-by: Mika Kuoppala > Signed-off-by: Chris Wilson > Cc: Mika Kuoppala > Cc: Andi Shyti > Cc: stable@vger.kernel.org > Acked-by: Thomas Hellström > Signed-off-by: Mauro Carvalho Chehab > --- > > See [PATCH 0/6] at: https://lore.kernel.org/all/cover.1655306128.git.mchehab@kernel.org/ > > drivers/gpu/drm/i915/gt/intel_reset.c | 37 ++++++++++++++++++++------- > 1 file changed, 28 insertions(+), 9 deletions(-) > > diff --git a/drivers/gpu/drm/i915/gt/intel_reset.c b/drivers/gpu/drm/i915/gt/intel_reset.c > index a5338c3fde7a..c68d36fb5bbd 100644 > --- a/drivers/gpu/drm/i915/gt/intel_reset.c > +++ b/drivers/gpu/drm/i915/gt/intel_reset.c > @@ -300,9 +300,9 @@ static int gen6_hw_domain_reset(struct intel_gt *gt, u32 hw_domain_mask) > return err; > } > > -static int gen6_reset_engines(struct intel_gt *gt, > - intel_engine_mask_t engine_mask, > - unsigned int retry) > +static int __gen6_reset_engines(struct intel_gt *gt, > + intel_engine_mask_t engine_mask, > + unsigned int retry) > { > struct intel_engine_cs *engine; > u32 hw_mask; > @@ -321,6 +321,20 @@ static int gen6_reset_engines(struct intel_gt *gt, > return gen6_hw_domain_reset(gt, hw_mask); > } > > +static int gen6_reset_engines(struct intel_gt *gt, > + intel_engine_mask_t engine_mask, > + unsigned int retry) > +{ > + unsigned long flags; > + int ret; > + > + spin_lock_irqsave(>->uncore->lock, flags); > + ret = __gen6_reset_engines(gt, engine_mask, retry); > + spin_unlock_irqrestore(>->uncore->lock, flags); > + > + return ret; > +} > + > static struct intel_engine_cs *find_sfc_paired_vecs_engine(struct intel_engine_cs *engine) > { > int vecs_id; > @@ -487,9 +501,9 @@ static void gen11_unlock_sfc(struct intel_engine_cs *engine) > rmw_clear_fw(uncore, sfc_lock.lock_reg, sfc_lock.lock_bit); > } > > -static int gen11_reset_engines(struct intel_gt *gt, > - intel_engine_mask_t engine_mask, > - unsigned int retry) > +static int __gen11_reset_engines(struct intel_gt *gt, > + intel_engine_mask_t engine_mask, > + unsigned int retry) > { > struct intel_engine_cs *engine; > intel_engine_mask_t tmp; > @@ -583,8 +597,11 @@ static int gen8_reset_engines(struct intel_gt *gt, > struct intel_engine_cs *engine; > const bool reset_non_ready = retry >= 1; > intel_engine_mask_t tmp; > + unsigned long flags; > int ret; > > + spin_lock_irqsave(>->uncore->lock, flags); > + > for_each_engine_masked(engine, gt, engine_mask, tmp) { > ret = gen8_engine_reset_prepare(engine); > if (ret && !reset_non_ready) > @@ -612,17 +629,19 @@ static int gen8_reset_engines(struct intel_gt *gt, > * This is best effort, so ignore any error from the initial reset. > */ > if (IS_DG2(gt->i915) && engine_mask == ALL_ENGINES) > - gen11_reset_engines(gt, gt->info.engine_mask, 0); > + __gen11_reset_engines(gt, gt->info.engine_mask, 0); > > if (GRAPHICS_VER(gt->i915) >= 11) > - ret = gen11_reset_engines(gt, engine_mask, retry); > + ret = __gen11_reset_engines(gt, engine_mask, retry); > else > - ret = gen6_reset_engines(gt, engine_mask, retry); > + ret = __gen6_reset_engines(gt, engine_mask, retry); > > skip_reset: > for_each_engine_masked(engine, gt, engine_mask, tmp) > gen8_engine_reset_cancel(engine); > > + spin_unlock_irqrestore(>->uncore->lock, flags); > + > return ret; > } >