Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp227044pxk; Thu, 1 Oct 2020 00:27:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwPk8OrUSuns1N63xqFSXWkoshfGzHfxZeLtIxXSNIgXLvzWNO1JgQ+gO3sqC+cMyMe/JES X-Received: by 2002:a05:6402:1012:: with SMTP id c18mr6629129edu.77.1601537224714; Thu, 01 Oct 2020 00:27:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601537224; cv=none; d=google.com; s=arc-20160816; b=0bRr1tqcpZMNeedzeDmDU/M5IiFfBhD1PXUezYbHCJ0HuAsmPYJ7vtntoxLUrwEKDi VwxuLa+r1HJj8iCqXYrUFG4XtSOW4kXcQ6BbfLNkoMlzpGubiy9oOTWcB+NDaCaPSXtI uY9tHGqVmphgwkNTNiovdvpkMrGEuvMqngjGxJxUXQ99+GzXdu1K6/aAq4yphLchXhop o98WDcfD+VHwVDtgF1a0SrXlUlSP3glb6jnAFY0UptEif8VHanJTx9ooA6+qr7meY7mP 4Af0x7WSLJACcnCtJKE3BUdM6oJfltY681w/LYQWeU/JJsnB97fMOM/DwYatmEQ8h0KJ nEZA== 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=zfGZF4MV9LWG1+NodJbiuxHC3TceIWUFb6Ap4wdqNIA=; b=RH3WzY8GOYx5c6ckJlEWfaWWbeht7hkurWso1CsMBexDlpN0EMvPB1KbZEpMxQ5u9g 6e0M/gE8mXm50x7cTzcUhMsKUDLRsiwC01RKpbGW5Pt97sboMyROHNlUipcmTTLxJGnK uWoPQ7AoGTW4ei1VgWaJRKdQlv9/rgjbBZ+eenf03tgIak4fBJStBtMdICqqCfKscYmO m+Kn4mmX+9klXojypfHC/EusOduu3I4goVlvvvaSlolDUpvM17iGL9mF4Nx5G9KK5uwe 16dmSOHUQ/cKrVcsbCKNo38/k7G5KxdMRqih5HI2OXthlB+jrQ5Pxhgl33A3EARW1oY3 G5ug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ffwll.ch header.s=google header.b=TeI3sAnl; 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 g6si2883543ejx.47.2020.10.01.00.26.41; Thu, 01 Oct 2020 00:27:04 -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=TeI3sAnl; 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 S1730967AbgJAHZm (ORCPT + 99 others); Thu, 1 Oct 2020 03:25:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49046 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725921AbgJAHZl (ORCPT ); Thu, 1 Oct 2020 03:25:41 -0400 Received: from mail-ot1-x342.google.com (mail-ot1-x342.google.com [IPv6:2607:f8b0:4864:20::342]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 50381C0613E2 for ; Thu, 1 Oct 2020 00:25:40 -0700 (PDT) Received: by mail-ot1-x342.google.com with SMTP id s66so4463465otb.2 for ; Thu, 01 Oct 2020 00:25:40 -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=zfGZF4MV9LWG1+NodJbiuxHC3TceIWUFb6Ap4wdqNIA=; b=TeI3sAnlerg81mosNDi1OU1FCraSaz39/P0KX8M369xRjqBBQkO+GqE2gaeovGyU5N SbXwsl1688O6wtDdN6VHp62NfTmHkeBC1jiNQ35ZVLOsXBUby+JsGUj4lx3gCLV/odyn gV7DGZGClSGws3CNeOiHg/3Ob+oMbLzNx+/Jw= 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=zfGZF4MV9LWG1+NodJbiuxHC3TceIWUFb6Ap4wdqNIA=; b=pPcQba03RAF29wFzIjorT6nyYz0N9GvBzhle2o4jYesord3iwEZ3KwS1mLjMTjyfg3 KXRFY7GDJJps3J73l62OXOGwK4p7/7/l2OJ98JfD68Ic/o1laB9kIqaDzfXiU0MKV0If Lzn9UEyzKRq2G/8psnMtui/lfQMrTyCSripYnVlJC6WxdicLK0oFsz0U4eONBRRfTa4j iU+yPw3FaGoY3At+w53/X45g08HPug1BLBJiHT7skvEsDrvsP8A7IFwb9tUniTI3FVGP 8/sbCKl8I8ZhlIBk5qVKQaQ6cL7p1r46muRsLNn/2esp79pCYisWOumhXAVF36Oc0CFm Zjxw== X-Gm-Message-State: AOAM530HgYUF6Dm6yzAAXkL3yHdUl4LwwAHOlmuH5zmSpEmEXwTH/K0T 1hJlfetLO7HP26yi+lYEmKQ/6T3+tuYiLDx+gMlF+A== X-Received: by 2002:a05:6830:14d9:: with SMTP id t25mr4211927otq.188.1601537139212; Thu, 01 Oct 2020 00:25:39 -0700 (PDT) MIME-Version: 1.0 References: <20200930211723.3028059-1-robdclark@gmail.com> In-Reply-To: <20200930211723.3028059-1-robdclark@gmail.com> From: Daniel Vetter Date: Thu, 1 Oct 2020 09:25:28 +0200 Message-ID: Subject: Re: [PATCH v2 0/3] drm: commit_work scheduling To: Rob Clark Cc: dri-devel , linux-arm-msm , Tejun Heo , Tim Murray , Qais Yousef , Rob Clark , open list Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Sep 30, 2020 at 11:16 PM Rob Clark wrote: > > From: Rob Clark > > The android userspace treats the display pipeline as a realtime problem. > And arguably, if your goal is to not miss frame deadlines (ie. vblank), > it is. (See https://lwn.net/Articles/809545/ for the best explaination > that I found.) > > But this presents a problem with using workqueues for non-blocking > atomic commit_work(), because the SCHED_FIFO userspace thread(s) can > preempt the worker. Which is not really the outcome you want.. once > the required fences are scheduled, you want to push the atomic commit > down to hw ASAP. > > But the decision of whether commit_work should be RT or not really > depends on what userspace is doing. For a pure CFS userspace display > pipeline, commit_work() should remain SCHED_NORMAL. > > To handle this, convert non-blocking commit_work() to use per-CRTC > kthread workers, instead of system_unbound_wq. Per-CRTC workers are > used to avoid serializing commits when userspace is using a per-CRTC > update loop. And the last patch exposes the task id to userspace as > a CRTC property, so that userspace can adjust the priority and sched > policy to fit it's needs. > > > v2: Drop client cap and in-kernel setting of priority/policy in > favor of exposing the kworker tid to userspace so that user- > space can set priority/policy. Yeah I think this looks more reasonable. Still a bit irky interface, so I'd like to get some kworker/rt ack on this. Other opens: - needs userspace, the usual drill - we need this also for vblank workers, otherwise this wont work for drivers needing those because of another priority inversion. - we probably want some indication of whether this actually does something useful, not all drivers use atomic commit helpers. Not sure how to do that. - not sure whether the vfunc is an awesome idea, I'd frankly just open-code this inline. We have similar special cases already for e.g. dpms (and in multiple places), this isn't the worst. - still feeling we could at least change the default to highpriority niceness. - there's still the problem that commit works can overlap, and a single worker can't do that anymore. So rolling that out for everyone as-is feels a bit risky. Cheers, Daniel > > Rob Clark (3): > drm/crtc: Introduce per-crtc kworker > drm/atomic: Use kthread worker for nonblocking commits > drm: Expose CRTC's kworker task id > > drivers/gpu/drm/drm_atomic_helper.c | 13 ++++++++---- > drivers/gpu/drm/drm_crtc.c | 14 +++++++++++++ > drivers/gpu/drm/drm_mode_config.c | 14 +++++++++++++ > drivers/gpu/drm/drm_mode_object.c | 4 ++++ > include/drm/drm_atomic.h | 31 +++++++++++++++++++++++++++++ > include/drm/drm_crtc.h | 8 ++++++++ > include/drm/drm_mode_config.h | 9 +++++++++ > include/drm/drm_property.h | 9 +++++++++ > 8 files changed, 98 insertions(+), 4 deletions(-) > > -- > 2.26.2 > -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch