From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alexandre Courbot Subject: Re: [PATCH 3/4] drm/nouveau: hook up cache sync functions Date: Fri, 23 May 2014 15:01:26 +0900 Message-ID: References: <1400483458-9648-1-git-send-email-acourbot@nvidia.com> <1400483458-9648-4-git-send-email-acourbot@nvidia.com> <1400491887.8467.15.camel@weser.hi.pengutronix.de> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1400491887.8467.15.camel-WzVe3FnzCwFR6QfukMTsflXZhhPuCNm+@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: nouveau-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org Sender: "Nouveau" To: Lucas Stach Cc: David Airlie , "nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org" , Linux Kernel Mailing List , "dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org" , Ben Skeggs , "linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org" List-Id: linux-tegra@vger.kernel.org On Mon, May 19, 2014 at 6:31 PM, Lucas Stach wrote: > Am Montag, den 19.05.2014, 16:10 +0900 schrieb Alexandre Courbot: >> From: Lucas Stach >> >> Signed-off-by: Lucas Stach >> [acourbot-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org: make conditional and platform-friendly] >> Signed-off-by: Alexandre Courbot >> --- >> drivers/gpu/drm/nouveau/nouveau_bo.c | 32 ++++++++++++++++++++++++++++++++ >> drivers/gpu/drm/nouveau/nouveau_bo.h | 20 ++++++++++++++++++++ >> drivers/gpu/drm/nouveau/nouveau_gem.c | 8 +++++++- >> 3 files changed, 59 insertions(+), 1 deletion(-) >> >> diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.c b/drivers/gpu/drm/nouveau/nouveau_bo.c >> index b6dc85c614be..0886f47e5244 100644 >> --- a/drivers/gpu/drm/nouveau/nouveau_bo.c >> +++ b/drivers/gpu/drm/nouveau/nouveau_bo.c >> @@ -407,6 +407,8 @@ nouveau_bo_validate(struct nouveau_bo *nvbo, bool interruptible, >> { >> int ret; >> >> + nouveau_bo_sync_for_device(nvbo); >> + >> ret = ttm_bo_validate(&nvbo->bo, &nvbo->placement, >> interruptible, no_wait_gpu); >> if (ret) >> @@ -487,6 +489,36 @@ nouveau_bo_invalidate_caches(struct ttm_bo_device *bdev, uint32_t flags) >> return 0; >> } >> >> +#ifdef NOUVEAU_NEED_CACHE_SYNC > > I don't like this ifdef at all. I know calling this functions will add a > little overhead to x86 where it isn't strictly required, but I think > it's negligible. > > When I looked at them the dma_sync_single_for_[device|cpu] functions > which are called here map out to just a drain of the PCI store buffer on > x86, which should be fast enough to be done unconditionally. They won't > so any time-consuming cache synchronization on PCI coherent arches. If Ben agrees with it I am also perfectly fine with getting rid of this #ifdef. From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752612AbaEWGBt (ORCPT ); Fri, 23 May 2014 02:01:49 -0400 Received: from mail-vc0-f173.google.com ([209.85.220.173]:48654 "EHLO mail-vc0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751721AbaEWGBr (ORCPT ); Fri, 23 May 2014 02:01:47 -0400 MIME-Version: 1.0 In-Reply-To: <1400491887.8467.15.camel@weser.hi.pengutronix.de> References: <1400483458-9648-1-git-send-email-acourbot@nvidia.com> <1400483458-9648-4-git-send-email-acourbot@nvidia.com> <1400491887.8467.15.camel@weser.hi.pengutronix.de> From: Alexandre Courbot Date: Fri, 23 May 2014 15:01:26 +0900 Message-ID: Subject: Re: [PATCH 3/4] drm/nouveau: hook up cache sync functions To: Lucas Stach Cc: Alexandre Courbot , David Airlie , Ben Skeggs , Lucas Stach , Thierry Reding , "nouveau@lists.freedesktop.org" , Linux Kernel Mailing List , "dri-devel@lists.freedesktop.org" , "linux-tegra@vger.kernel.org" Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, May 19, 2014 at 6:31 PM, Lucas Stach wrote: > Am Montag, den 19.05.2014, 16:10 +0900 schrieb Alexandre Courbot: >> From: Lucas Stach >> >> Signed-off-by: Lucas Stach >> [acourbot@nvidia.com: make conditional and platform-friendly] >> Signed-off-by: Alexandre Courbot >> --- >> drivers/gpu/drm/nouveau/nouveau_bo.c | 32 ++++++++++++++++++++++++++++++++ >> drivers/gpu/drm/nouveau/nouveau_bo.h | 20 ++++++++++++++++++++ >> drivers/gpu/drm/nouveau/nouveau_gem.c | 8 +++++++- >> 3 files changed, 59 insertions(+), 1 deletion(-) >> >> diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.c b/drivers/gpu/drm/nouveau/nouveau_bo.c >> index b6dc85c614be..0886f47e5244 100644 >> --- a/drivers/gpu/drm/nouveau/nouveau_bo.c >> +++ b/drivers/gpu/drm/nouveau/nouveau_bo.c >> @@ -407,6 +407,8 @@ nouveau_bo_validate(struct nouveau_bo *nvbo, bool interruptible, >> { >> int ret; >> >> + nouveau_bo_sync_for_device(nvbo); >> + >> ret = ttm_bo_validate(&nvbo->bo, &nvbo->placement, >> interruptible, no_wait_gpu); >> if (ret) >> @@ -487,6 +489,36 @@ nouveau_bo_invalidate_caches(struct ttm_bo_device *bdev, uint32_t flags) >> return 0; >> } >> >> +#ifdef NOUVEAU_NEED_CACHE_SYNC > > I don't like this ifdef at all. I know calling this functions will add a > little overhead to x86 where it isn't strictly required, but I think > it's negligible. > > When I looked at them the dma_sync_single_for_[device|cpu] functions > which are called here map out to just a drain of the PCI store buffer on > x86, which should be fast enough to be done unconditionally. They won't > so any time-consuming cache synchronization on PCI coherent arches. If Ben agrees with it I am also perfectly fine with getting rid of this #ifdef.