Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp2991455pxk; Mon, 21 Sep 2020 02:23:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyTj0PgJCkZUL2Pxvt3z2cFdR71133NmzkIFd4KFGyW034VNzPjIn4XT+H1XQ99/X1+xcKU X-Received: by 2002:a50:9d0a:: with SMTP id v10mr50599499ede.144.1600680233725; Mon, 21 Sep 2020 02:23:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600680233; cv=none; d=google.com; s=arc-20160816; b=TWh8OxYQlMKT+u3Ij43veG6AXM3tjkWvoT5A6v/3dwEXITterkcfvjsQoPecvBul/J 1B8l2NY/dJk2Nr9KXSggUXZrBFSxZ7fCgDgu5A41eTKX+7DXiAv2IHvmBPnDqyESoIy9 3nYX+p7copEM5gCrdWJOW3diKcBa8dfU6hI41WPoILw/71DVuWUZS36Td+IvdPIQrXOV ughQ3OwMlvkAcckK8SAxtLlY3z4xEAAL5e0Gv2BxZn23yUcKT7+zrAZYJWeYI3V3BHen yP9EnXrc32wXDq63G2m3bu7+37P0FLKyZN+6K7XV7uuH2vDWWLWgYuQlXBjwKgJ+4AjE WnDg== 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=YqKqR0hF6fgI2DEw61l59gzK3p9FhF5q6Czpi0j7p9k=; b=nR9ngLUHT/6JXn4kO+GcPK0B9pEpy6Z+1LCMlsIa8+kOj/DV1BRrBs3INRFVp92d/H jKJf+7ZaolcaP4Tz3YZdNZ0vLhxmDM4oF/qsDlbOMSXsxTr4FA1TKKV6ueWcSbS+BZga ZSrAk53dvSfQJe7izQiN7MmBx0LoQXYl8oZo6i/XgtqbyTIq9MPUjgdLx5v2zGPCc6+R Iod6uDuGjEb5en9/oMjwYNytE+YUz/obWJqvHdF7AZomK0Z8lkVhwMYok2GOG8EjtUd+ /q1TSDfbSO0jFTc+8RNrnz/do9LjAeoIXCGxieGBzn9E8Jllrybe3wSh2ECF/qepI9gC O21Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ffwll.ch header.s=google header.b="jX/yFwZd"; 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 j23si8045215ejm.736.2020.09.21.02.23.30; Mon, 21 Sep 2020 02:23:53 -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="jX/yFwZd"; 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 S1726448AbgIUJV6 (ORCPT + 99 others); Mon, 21 Sep 2020 05:21:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49984 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726424AbgIUJV6 (ORCPT ); Mon, 21 Sep 2020 05:21:58 -0400 Received: from mail-wm1-x341.google.com (mail-wm1-x341.google.com [IPv6:2a00:1450:4864:20::341]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D880AC0613CF for ; Mon, 21 Sep 2020 02:21:57 -0700 (PDT) Received: by mail-wm1-x341.google.com with SMTP id e17so11390778wme.0 for ; Mon, 21 Sep 2020 02:21:57 -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=YqKqR0hF6fgI2DEw61l59gzK3p9FhF5q6Czpi0j7p9k=; b=jX/yFwZdfpGSLFOVl5chRXI0Ee9qPdjRvBS+RbMFxC6ZQC4zYinasExTnCdSTvwhJn dS8dAIzPamllhx3KNwNSRUpkptEr9HU1kyZRS88tVi5/5q8145+smWxo2NtX3dwh+l6f UpGiN7Z2BLm1NQGFWK+JYx37uUl1Nk8T9ZI0w= 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=YqKqR0hF6fgI2DEw61l59gzK3p9FhF5q6Czpi0j7p9k=; b=dRB10thlOx+hE16+nZZr8rz33Fe0cT3Bwz7rhbLCRVLZ24JBhia0tOLh2xA2Ua+XpN sY7qmLRB5tMdgUpJ+xu5cmHvefTvxLPr1hQaPGLK5eaH4BwVVilvNeSNiJDVrzkuTOVz v7QOyHAclnZL+9ZzmiFaHT91eNnEejiM6oO18xsdaRyZAxmCP06jL+sZnNCc6jND42no k5TWQxhKUyY4HZhsUjYO5Uavy46gxt44eESPMXN335PWJ6QAIXlG3Chue4fBEJ12XbqT H3ueNSx6qT44tXM47jlbzfs1sroZq65Wg1BibBxBRtraSHg44+ID9OBvo4XU91wIwbpr KDcw== X-Gm-Message-State: AOAM532qtTXipm+85A04d8Fb3hx9QGoQqe3ecmwyHpdflpesUveU/qJw 0ft4ED2Whpw8qRXXj7G1iZ4efw== X-Received: by 2002:a7b:c92b:: with SMTP id h11mr28935308wml.6.1600680116416; Mon, 21 Sep 2020 02:21:56 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:57f4:0:efd0:b9e5:5ae6:c2fa]) by smtp.gmail.com with ESMTPSA id a83sm18731626wmh.48.2020.09.21.02.21.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Sep 2020 02:21:55 -0700 (PDT) Date: Mon, 21 Sep 2020 11:21:54 +0200 From: Daniel Vetter To: Rob Clark Cc: dri-devel@lists.freedesktop.org, Rob Clark , Peter Zijlstra , linux-arm-msm@vger.kernel.org, open list , timmurray@google.com, Tejun Heo Subject: Re: [PATCH 0/3] drm: commit_work scheduling Message-ID: <20200921092154.GJ438822@phenom.ffwll.local> Mail-Followup-To: Rob Clark , dri-devel@lists.freedesktop.org, Rob Clark , Peter Zijlstra , linux-arm-msm@vger.kernel.org, open list , timmurray@google.com, Tejun Heo References: <20200919193727.2093945-1-robdclark@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200919193727.2093945-1-robdclark@gmail.com> X-Operating-System: Linux phenom 5.7.0-1-amd64 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Sep 19, 2020 at 12:37:23PM -0700, 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. > > A client-cap is introduced so that userspace can opt-in to SCHED_FIFO > priority commit work. > > A potential issue is that since 616d91b68cd ("sched: Remove > sched_setscheduler*() EXPORTs") we have limited RT priority levels, > meaning that commit_work() ends up running at the same priority level > as vblank-work. This shouldn't be a big problem *yet*, due to limited > use of vblank-work at this point. And if it could be arranged that > vblank-work is scheduled before signaling out-fences and/or sending > pageflip events, it could probably work ok to use a single priority > level for both commit-work and vblank-work. The part I don't like about this is that it all feels rather hacked together, and if we add more stuff (or there's some different thing in the system that also needs rt scheduling) then it doesn't compose. So question to rt/worker folks: What's the best way to let userspace set the scheduling mode and priorities of things the kernel does on its behalf? Surely we're not the first ones where if userspace runs with some rt priority it'll starve out the kernel workers that it needs. Hardcoding something behind a subsystem ioctl (which just means every time userspace changes what it does, we need a new such flag or mode) can't be the right thing. Peter, Tejun? Thanks, Daniel > > Rob Clark (3): > drm/crtc: Introduce per-crtc kworker > drm/atomic: Use kthread worker for nonblocking commits > drm: Add a client-cap to set scheduling mode > > drivers/gpu/drm/drm_atomic_helper.c | 13 ++++++---- > drivers/gpu/drm/drm_auth.c | 4 ++++ > drivers/gpu/drm/drm_crtc.c | 37 +++++++++++++++++++++++++++++ > drivers/gpu/drm/drm_ioctl.c | 13 ++++++++++ > include/drm/drm_atomic.h | 31 ++++++++++++++++++++++++ > include/drm/drm_crtc.h | 10 ++++++++ > include/uapi/drm/drm.h | 13 ++++++++++ > 7 files changed, 117 insertions(+), 4 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