Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp666282pxx; Thu, 29 Oct 2020 11:25:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxkG1kr77qtNBRTlBawbtlc5W+l7QqqAZARmTE+oRh0XHf3G67I3QwGLgx04dCLfSjvg9o0 X-Received: by 2002:a05:6402:293:: with SMTP id l19mr5471499edv.227.1603995927957; Thu, 29 Oct 2020 11:25:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603995927; cv=none; d=google.com; s=arc-20160816; b=qzpM8GwdkXqS4R1KtxbKBu2DkwUIwSQbplmGdNzoQxptNdogdkNbgi/JQh7VEP68xt IZZcfR8b+cZU2nw+SFR3qj39yKVeSkHDniEtKP7jMDKuPFvQ/onAAz4V/JjH93z+Zcs5 SgeeXP6ozDUxisXFskUj3ZoLJhmdFa/Vjda4+uDEbQYbEU7i0Fry/s0Ul9N2JKZASfT4 R3I7EJ3BwJvH+kO+BtlUJr4PZTZNZIe/UEdlkNLcBErbJDxdzpxDlpZK+Jf1UxGUILjo uVPxn8t1lqaj8mPPVW6ltOPtTCMB1aYbGNgy2K4LMBkxGgB8UTGJURBMhQTkcyZ5Z5+Z f0PA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:mail-followup-to:message-id:subject:cc:to:from:date :dkim-signature; bh=WptYepIxvUtBGbdfe98byMus1rF84W8IHfRhIetB8kE=; b=LXxyXPSspgugsXbkOIDH/6N2FSG1KzYD/eSlzZKDUMwtAGkK/MWj0q1scL/V+4YjcG LpGxOfcsZMVviz6EAMmVG7PjzpDGwjpQT6RioHe778BrVfMK19I5ENZXbIksCXsdIjfH ujMwb0MV9LYzm+FMxxf/vV1j9OJbiU+fYtG2CVTiymZNWBsWuxFfiuXy218IB4NpdqjB PbZ+2+117/1DHIvcqZTHXaxGetafdzYOH+I0UoAk0SeBK+CoxZVIKd35ditMHaNj+ECK uRRoEpc2oHPhgkZc3FfQua4uIvqPehPg4i4mC/+13FF9HGS+Na8iarErPR23jhbreI6G twCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ffwll.ch header.s=google header.b=RQBKJR+7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r12si2359388ejx.247.2020.10.29.11.25.03; Thu, 29 Oct 2020 11:25:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@ffwll.ch header.s=google header.b=RQBKJR+7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725840AbgJ2SXC (ORCPT + 99 others); Thu, 29 Oct 2020 14:23:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45498 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725805AbgJ2SXB (ORCPT ); Thu, 29 Oct 2020 14:23:01 -0400 Received: from mail-wm1-x343.google.com (mail-wm1-x343.google.com [IPv6:2a00:1450:4864:20::343]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9D941C0613D2 for ; Thu, 29 Oct 2020 11:23:00 -0700 (PDT) Received: by mail-wm1-x343.google.com with SMTP id v5so740455wmh.1 for ; Thu, 29 Oct 2020 11:23:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=date:from:to:cc:subject:message-id:mail-followup-to:references :mime-version:content-disposition:in-reply-to; bh=WptYepIxvUtBGbdfe98byMus1rF84W8IHfRhIetB8kE=; b=RQBKJR+7mIXmVt2BzbUwRmfEBlPWlq+vo62QPLGc5veKhuZtO2NmyOyX6KqEa1cc/V Pz9XOpHJ6eo/sdS5lsc4BUAU+00BrTZ5SZd1Y9nLLzCOZ4x68BFzBDGCOdzdT1K9ldrC yGPHEjqMynYomFJgV0EfMfpmEf+0TFA+yueS8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id :mail-followup-to:references:mime-version:content-disposition :in-reply-to; bh=WptYepIxvUtBGbdfe98byMus1rF84W8IHfRhIetB8kE=; b=rzb7KKMDt4kutsEUpRiGv420wm266JB/pKQxfHfrKW+gtoxMwNN7FZWBnPGVhBtyFG 5xcY086T+Lr3YHQZDRKrtNp1/elIjRFYJr40F1hBTYu2St0PfZPgb0xa92n0paFJrLks fqmAE+HiwbEjzEmnue11kIcam9i/TDAl0WiTLQiGbgbsU4Y9S+I/MFPxngbdeJrBYQPh qYwfkrxjj6RZY9GdxHVb0wDFdF6JPsUdhndcslRsfj4A3iFmza3fAjatRjfJ+4Dm/fg4 CjNdW9MmlL2FIH+4qtj/EO6Fm4tkm9T6JEYwW110rcsbKHTj2frae5AWU2es+P4TpAR+ rW6A== X-Gm-Message-State: AOAM530jHMXT+wJbwIL5zS5xj8nAbB148yAAKpzEbfNEGzZnUH5hoEMF PJiQGQc0XkZt9k+LLzLNsKL1/w== X-Received: by 2002:a1c:7c1a:: with SMTP id x26mr170768wmc.4.1603995779199; Thu, 29 Oct 2020 11:22:59 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:57f4:0:efd0:b9e5:5ae6:c2fa]) by smtp.gmail.com with ESMTPSA id o184sm1025591wmo.37.2020.10.29.11.22.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Oct 2020 11:22:58 -0700 (PDT) Date: Thu, 29 Oct 2020 19:22:56 +0100 From: Daniel Vetter To: Rob Clark Cc: Daniel Vetter , Lucas Stach , Rob Clark , freedreno , David Airlie , linux-arm-msm , open list , dri-devel , "Kristian H . Kristensen" , Sean Paul Subject: Re: [PATCH v4 23/23] drm/msm: Don't implicit-sync if only a single ring Message-ID: <20201029182256.GD401619@phenom.ffwll.local> Mail-Followup-To: Rob Clark , Lucas Stach , Rob Clark , freedreno , David Airlie , linux-arm-msm , open list , dri-devel , "Kristian H . Kristensen" , Sean Paul References: <20201023165136.561680-1-robdclark@gmail.com> <20201023165136.561680-24-robdclark@gmail.com> <20201026093405.GG401619@phenom.ffwll.local> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Operating-System: Linux phenom 5.7.0-1-amd64 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Oct 29, 2020 at 09:59:09AM -0700, Rob Clark wrote: > On Thu, Oct 29, 2020 at 9:14 AM Daniel Vetter wrote: > > > > On Mon, Oct 26, 2020 at 10:34 AM Daniel Vetter wrote: > > > > > > On Fri, Oct 23, 2020 at 08:49:14PM -0700, Rob Clark wrote: > > > > On Fri, Oct 23, 2020 at 11:20 AM Lucas Stach wrote: > > > > > > > > > > On Fr, 2020-10-23 at 09:51 -0700, Rob Clark wrote: > > > > > > From: Rob Clark > > > > > > > > > > > > If there is only a single ring (no-preemption), everything is FIFO order > > > > > > and there is no need to implicit-sync. > > > > > > > > > > > > Mesa should probably just always use MSM_SUBMIT_NO_IMPLICIT, as behavior > > > > > > is undefined when fences are not used to synchronize buffer usage across > > > > > > contexts (which is the only case where multiple different priority rings > > > > > > could come into play). > > > > > > > > > > Really, doesn't this break cross-device implicit sync? Okay, you may > > > > > not have many peripherals that rely on implicit sync on devices where > > > > > Adreno is usually found, but it seems rather heavy-handed. > > > > > > > > > > Wouldn't it be better to only ignore fences from your own ring context > > > > > in the implicit sync, like we do in the common DRM scheduler > > > > > (drm_sched_dependency_optimized)? > > > > > > > > we already do this.. as was discussed on an earlier iteration of this patchset > > > > > > > > But I'm not aware of any other non-gpu related implicit sync use-case > > > > (even on imx devices where display is decoupled from gpu).. I'll > > > > revert the patch if someone comes up with one, but otherwise lets let > > > > the implicit sync baggage die > > > > > > The thing is, dma_resv won't die, even if implicit sync is dead. We're > > > using internally for activity tracking and memory management. If you don't > > > set these, then we can't share generic code with msm, and I think everyone > > > inventing their own memory management is a bit a mistake. > > > > > > Now you only kill the implicit write sync stuff here, but I'm not sure > > > that's worth much since you still install all the read fences for > > > consistency. And if userspace doesn't want to be synced, they can set the > > > flag and do this on their own: I think you should be able to achieve > > > exactly the same thing in mesa. > > > > > > Aside: If you're worried about overhead, you can do O(1) submit if you > > > manage your ppgtt like amdgpu does. > > > > So just remember a use-case which is maybe a bit yucky, but it is > > actually possible to implement race-free. If you have implicit sync. > > > > There's screen-capture tool in mplayer and obs which capture your > > compositor by running getfb2 in a loop. It works, and after some > > initial screaming I realized it does actually work race-free. If you > > have implicit sync. > > > > I really don't think you can sunset this, as much as you want to. And > > sunsetting it inconsistently is probably the worst. > > For the case where you only have a single ring, as long as it is > importing the fb in to egl to read it (which it would need to do to > get a linear view), this would still all work Hm right we still have the implicit sync of the ringbuffer. At least until you add a submit scheduler to msm ... > (but I may drop this patch because it is just a micro-optimization and > seems to cause more confusion) Yeah I'd say without numbers to justify it it feels a bit on thin ice :-) -Daniel > > BR, > -R > > > > -Daniel > > > > > -Daniel > > > > > > > > > > > BR, > > > > -R > > > > > > > > > > > > > > > > > > > > > > Regards, > > > > > Lucas > > > > > > > > > > > Signed-off-by: Rob Clark > > > > > > Reviewed-by: Kristian H. Kristensen > > > > > > --- > > > > > > drivers/gpu/drm/msm/msm_gem_submit.c | 7 ++++--- > > > > > > 1 file changed, 4 insertions(+), 3 deletions(-) > > > > > > > > > > > > diff --git a/drivers/gpu/drm/msm/msm_gem_submit.c b/drivers/gpu/drm/msm/msm_gem_submit.c > > > > > > index d04c349d8112..b6babc7f9bb8 100644 > > > > > > --- a/drivers/gpu/drm/msm/msm_gem_submit.c > > > > > > +++ b/drivers/gpu/drm/msm/msm_gem_submit.c > > > > > > @@ -283,7 +283,7 @@ static int submit_lock_objects(struct msm_gem_submit *submit) > > > > > > return ret; > > > > > > } > > > > > > > > > > > > -static int submit_fence_sync(struct msm_gem_submit *submit, bool no_implicit) > > > > > > +static int submit_fence_sync(struct msm_gem_submit *submit, bool implicit_sync) > > > > > > { > > > > > > int i, ret = 0; > > > > > > > > > > > > @@ -303,7 +303,7 @@ static int submit_fence_sync(struct msm_gem_submit *submit, bool no_implicit) > > > > > > return ret; > > > > > > } > > > > > > > > > > > > - if (no_implicit) > > > > > > + if (!implicit_sync) > > > > > > continue; > > > > > > > > > > > > ret = msm_gem_sync_object(&msm_obj->base, submit->ring->fctx, > > > > > > @@ -774,7 +774,8 @@ int msm_ioctl_gem_submit(struct drm_device *dev, void *data, > > > > > > if (ret) > > > > > > goto out; > > > > > > > > > > > > - ret = submit_fence_sync(submit, !!(args->flags & MSM_SUBMIT_NO_IMPLICIT)); > > > > > > + ret = submit_fence_sync(submit, (gpu->nr_rings > 1) && > > > > > > + !(args->flags & MSM_SUBMIT_NO_IMPLICIT)); > > > > > > if (ret) > > > > > > goto out; > > > > > > > > > > > > > > > _______________________________________________ > > > > dri-devel mailing list > > > > dri-devel@lists.freedesktop.org > > > > https://lists.freedesktop.org/mailman/listinfo/dri-devel > > > > > > -- > > > Daniel Vetter > > > Software Engineer, Intel Corporation > > > http://blog.ffwll.ch > > > > > > > > -- > > Daniel Vetter > > Software Engineer, Intel Corporation > > http://blog.ffwll.ch -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch