Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp4618143pxu; Wed, 21 Oct 2020 00:29:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzYwzB+L9PtgvJjhKgJWLj53lnbjvUb7uFEslK0CMq9pu0g6GKNlRszcTFa33M7+ZJGCEGU X-Received: by 2002:a17:906:5f96:: with SMTP id a22mr2105259eju.168.1603265362213; Wed, 21 Oct 2020 00:29:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603265362; cv=none; d=google.com; s=arc-20160816; b=xLWbpqWYdkIViQid6+JMtfIQX5CbixwISnJFC9fK6tuBPzU0KLhlnSx4ITvNWgl/lK Y4fUtsy+cp6sUTnl4Wkc4CHSNP9MeOPJ+1EcwFIECpk29Fho/x/kVOaUdVikJRdzsvDL r0BvElEuKjnrRDmnMkhNj1kLUFMaP2PqGZb3fkmFrTRCJRvT3mqwIhjPW5iQQAs5iNBG yWW2l6WjGBGKX9iX+b8jCKZp6ttyT8bl++a3JJJe3AEVtIOzNl+bDTOMjKJQUih3O8Ce PzWdS8ghHZ7uBoWOEObONUVVUHF7Fmy0yEhwmfCAVQACtfqs3QuTjaH1SzNYBBsqgLfd 4Dow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=Iw+9FQHNyoJkvzpR4HG8l9FMoO2YHaW76z2YEMGyQNk=; b=UR2WZW/cWAmNUVvivOd/2xWMaI/CMJRbIz7e6mXH9Ro/gHh0I5sakfxG8G0gLyyx68 MhXrePFcyO1CggFZGKRAjkrNLvi5/291L9jaEvbfOSSk4ct8bs08sRwOQk9DmN+N3WTl 7UxLzyR8bjrhPJ+Lf9TrXrxqXG1F7+h4WmQ/nLDbmd8L0UajVz02KUHICOgAALFTTK0+ mJZTAEz2p78WzIYBtyWt5YuCvEpn/Q18Gfjfih4Sq0n5FecOkG7ziMKFbuUAnomMLIDi 4vZP2wwV09ii9I62JvXz9DZv1Y+4lIVmIKfwtIIjxohS4QRsERxpIAht8rsrbIbXU/4b Z1hw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ffwll.ch header.s=google header.b=b8klL9mJ; 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 u18si842053edo.394.2020.10.21.00.29.00; Wed, 21 Oct 2020 00:29:22 -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=b8klL9mJ; 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 S2408056AbgJTO3u (ORCPT + 99 others); Tue, 20 Oct 2020 10:29:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40330 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2408107AbgJTO3r (ORCPT ); Tue, 20 Oct 2020 10:29:47 -0400 Received: from mail-oi1-x243.google.com (mail-oi1-x243.google.com [IPv6:2607:f8b0:4864:20::243]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A43F9C0613CE for ; Tue, 20 Oct 2020 07:29:47 -0700 (PDT) Received: by mail-oi1-x243.google.com with SMTP id t77so2348683oie.4 for ; Tue, 20 Oct 2020 07:29:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Iw+9FQHNyoJkvzpR4HG8l9FMoO2YHaW76z2YEMGyQNk=; b=b8klL9mJfc+hHeOGr0XuJsKHWTOT+MJczln6i0Y2pX/+ODV/m1GccK/uieJTeMCDFW PSRjyHfsysfrsF2Z1aadY4bxFoB1Adrj8Ucaa4H2UOOTrynEpoUR2z4ojR6XuUGhowCV RloQNtd0ndcn9whfCnU3SNC8rW2KyeBevbLOo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Iw+9FQHNyoJkvzpR4HG8l9FMoO2YHaW76z2YEMGyQNk=; b=bhLkgnSBaW5lv5BzBAskgy0jFqR2o38kYYmfIRsgRExv/F9FeHz7H24il44afOXxHi fsO5J/StJ1U+ON9DcWU6PKYc0G6VDz50g/hN5STNzthCEZjBHKN6JEitHiUulIZ5hj7z 1SIX8OOL7/tZrBSgiF6V9+hB0QXIzrSh24aL5W3ju4MPj7QUlHOY8eTONgTDnT4uWlNj pU7+XaHAvD32FXDr2pPCYBIeSygyb45IxQuRvsQpLM3lwh+jkWlkJD3YVoHW6E1mBzsa KHYO2HdF/Zmo71JYu5R1KbTvhE6xceOMX6+nMXNZ5Yur1dK0gzYkQcANPw/as4XyfFEE W9Qw== X-Gm-Message-State: AOAM532gdz/usYx/lK5aP0XHXMty8Sti7W68un/5HYDHBwOISPRHA2Os F8lpDjbvTZE19ILtlxupBb+GQDFQopG8C0I691/FAw== X-Received: by 2002:aca:cc01:: with SMTP id c1mr2067105oig.128.1603204186995; Tue, 20 Oct 2020 07:29:46 -0700 (PDT) MIME-Version: 1.0 References: <20201019211101.143327-1-robdclark@gmail.com> <20201020082404.GJ401619@phenom.ffwll.local> In-Reply-To: From: Daniel Vetter Date: Tue, 20 Oct 2020 16:29:35 +0200 Message-ID: Subject: Re: [PATCH 0/3] drm/msm: kthread_worker conversion To: Rob Clark Cc: dri-devel , Akhil P Oommen , Tanmay Shah , Bjorn Andersson , AngeloGioacchino Del Regno , Sam Ravnborg , Emil Velikov , Rob Clark , Jonathan Marek , Qinglang Miao , Roy Spliet , Wambui Karuga , linux-arm-msm , Sharat Masetty , Kalyan Thota , Rajendra Nayak , "Gustavo A. R. Silva" , open list , tongtiangen , Thomas Zimmermann , Drew Davenport , "open list:DRM DRIVER FOR MSM ADRENO GPU" Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Oct 20, 2020 at 4:01 PM Rob Clark wrote: > > On Tue, Oct 20, 2020 at 1:24 AM Daniel Vetter wrote: > > > > On Mon, Oct 19, 2020 at 02:10:50PM -0700, Rob Clark wrote: > > > From: Rob Clark > > > > > > In particular, converting the async atomic commit (for cursor updates, > > > etc) to SCHED_FIFO kthread_worker helps with some cases where we > > > wouldn't manage to flush the updates within the 1ms-before-vblank > > > deadline resulting in fps drops when there is cursor movement. > > > > > > Rob Clark (3): > > > drm/msm/gpu: Convert retire/recover work to kthread_worker > > > drm/msm/kms: Update msm_kms_init/destroy > > > drm/msm/atomic: Convert to per-CRTC kthread_work > > > > So i915 has it's own commit worker already for $reasons, but I don't think > > that's a good path to go down with more drivers. And the problem seems > > entirely generic in nature ... > > I'm not *entirely* sure what your point is here? This is just > migrating away from a shared ordered wq to per-crtc kthread so that we > don't miss vblank deadlines for silly reasons (and then stall on the > next frame's pageflip because we are still waiting for the cursor > update to latch). Kind of like vblank-work but scheduled prior to, > rather than after, vblank. > > And you're right that the problem is partially generic.. hw that (a) > doesn't have true async (cursor and/or otherwise) updates, and (b) has > various flush bits that latch register updates on vblank, is not that > uncommon. But the current atomic helper API would have to be a bit > redesigned to look more like the interface between msm_atomic and the > display backend. That is a fair bit of churn for re-using a small bit > of code. I was making some assumptions about what you're doing, and I was wrong. So I went and tried to understand what's actually going on here. I'm trying to understand what exactly you've added with that async msm support 2d99ced787e3d. I think this breaks the state structure update model, you can't access any ->state pointers from the commit functions after you've called drm_atomic_helper_commit_hw_done, or you might have a use after free. And that seems to be happening from this commit work thing you added to your existing commit work that the atomic helpers provide already. The various commit functions seem to grab various state objects by just chasing pointers from the objects (instead of the drm_atomic_state stuff), so this all feels like it's yolo free-wheeling. You also seem to be using the async_commit stuff from the atomic helpers (which is actually synchronous (i.e. blocking) from the pov of how the code runs, but seems to be for mdp5 only and not others. Also your can_do_async still checks for legacy_cursor_update (maybe a leftover, or needed on !mdp5 platforms) and ->async_update. I'm thoroughly confused how this all works. I do agree though that you probably want this to be a real time fifo kthread worker, like for the vblank worker. Except now that I looked, I'm not sure it's actually working intended and correct. -Daniel > BR, > -R > > > -Daniel > > > > > > > > drivers/gpu/drm/msm/adreno/a5xx_gpu.c | 3 +-- > > > drivers/gpu/drm/msm/adreno/a5xx_preempt.c | 6 ++--- > > > drivers/gpu/drm/msm/adreno/a6xx_gmu.c | 4 +-- > > > drivers/gpu/drm/msm/adreno/a6xx_gpu.c | 4 +-- > > > drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 8 +++++- > > > drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.c | 8 +++++- > > > drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c | 11 ++++++--- > > > drivers/gpu/drm/msm/disp/mdp_kms.h | 9 +++++-- > > > drivers/gpu/drm/msm/msm_atomic.c | 25 +++++++++++++++---- > > > drivers/gpu/drm/msm/msm_drv.h | 3 ++- > > > drivers/gpu/drm/msm/msm_gpu.c | 30 +++++++++++++++-------- > > > drivers/gpu/drm/msm/msm_gpu.h | 13 +++++++--- > > > drivers/gpu/drm/msm/msm_kms.h | 23 ++++++++++++++--- > > > 13 files changed, 104 insertions(+), 43 deletions(-) > > > > > > -- > > > 2.26.2 > > > > > > _______________________________________________ > > > 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 > _______________________________________________ > 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