Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 846BFC433F5 for ; Fri, 29 Oct 2021 14:32:27 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 41BD760FC1 for ; Fri, 29 Oct 2021 14:32:27 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 41BD760FC1 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.intel.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B15926EA64; Fri, 29 Oct 2021 14:32:26 +0000 (UTC) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by gabe.freedesktop.org (Postfix) with ESMTPS id A1C676EA64; Fri, 29 Oct 2021 14:32:25 +0000 (UTC) X-IronPort-AV: E=McAfee;i="6200,9189,10151"; a="294136305" X-IronPort-AV: E=Sophos;i="5.87,193,1631602800"; d="scan'208";a="294136305" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Oct 2021 07:32:25 -0700 X-IronPort-AV: E=Sophos;i="5.87,193,1631602800"; d="scan'208";a="495743806" Received: from ekolpasx-mobl.ccr.corp.intel.com (HELO [10.249.254.219]) ([10.249.254.219]) by fmsmga007-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Oct 2021 07:32:23 -0700 Message-ID: <59e6d31b-1269-1c7b-1a1d-b5baebae1d1f@linux.intel.com> Date: Fri, 29 Oct 2021 16:32:21 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.1.0 Content-Language: en-US To: Matthew Auld , intel-gfx@lists.freedesktop.org Cc: dri-devel@lists.freedesktop.org, Daniel Vetter References: <20211029122137.3484203-1-matthew.auld@intel.com> From: =?UTF-8?Q?Thomas_Hellstr=c3=b6m?= In-Reply-To: <20211029122137.3484203-1-matthew.auld@intel.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Subject: Re: [Intel-gfx] [PATCH v2] drm/i915/dmabuf: drop the flush on discrete X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" On 10/29/21 14:21, Matthew Auld wrote: > We were overzealous here; even though discrete is non-LLC, it should > still be always coherent. > > v2(Thomas & Daniel) > - Be extra cautious and limit to DG1 > - Add some more commentary > > Signed-off-by: Matthew Auld > Cc: Thomas Hellström > Cc: Daniel Vetter Reviewed-by: Thomas Hellström > --- > drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c | 15 +++++++++++++-- > 1 file changed, 13 insertions(+), 2 deletions(-) > > diff --git a/drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c b/drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c > index a45d0ec2c5b6..a2b485a1be8c 100644 > --- a/drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c > +++ b/drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c > @@ -250,8 +250,19 @@ static int i915_gem_object_get_pages_dmabuf(struct drm_i915_gem_object *obj) > if (IS_ERR(pages)) > return PTR_ERR(pages); > > - /* XXX: consider doing a vmap flush or something */ > - if (!HAS_LLC(i915) || i915_gem_object_can_bypass_llc(obj)) > + /* > + * DG1 is special here since it still snoops transactions even with > + * CACHE_NONE. This is not the case with other HAS_SNOOP platforms. We > + * might need to revisit this as we add new discrete platforms. > + * > + * XXX: Consider doing a vmap flush or something, where possible. > + * Currently we just do a heavy handed wbinvd_on_all_cpus() here since > + * the underlying sg_table might not even point to struct pages, so we > + * can't just call drm_clflush_sg or similar, like we do elsewhere in > + * the driver. > + */ > + if (i915_gem_object_can_bypass_llc(obj) || > + (!HAS_LLC(i915) && !IS_DG1(i915))) > wbinvd_on_all_cpus(); > > sg_page_sizes = i915_sg_dma_sizes(pages->sgl);