Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3266209pxk; Mon, 21 Sep 2020 09:13:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJycnhxhqmvJgjgWyY94Mhmljc61zWWlpHs8EZoAau2kV+AL4B4uWfHJFlBoMsY8D549ViQZ X-Received: by 2002:a17:906:d93b:: with SMTP id rn27mr205356ejb.330.1600704817141; Mon, 21 Sep 2020 09:13:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600704817; cv=none; d=google.com; s=arc-20160816; b=XEOwZ1/jZpAxJLrtdkf06TlzfHLkbE/VPegxZnBdg16h7DY12EjjdLALGuy9l7Aqyo N95ph3RIIaFOrxuo31UkS3jYxPma44OliPTqzCzJDCTl0pKKEwN1uJCiFBHgvAiB1DtZ lAz6HVIn/OAHJ1988mZexywpc8IU8g/v4xIhPWvUL4wfuCr8iwJHqwZvDbqj4lWzcRSt RdhoB2vDhMFnxHZPB+5ghaB2i/QrBdYyfMVxkyPLSqvTBT/r7T2Lyb6oQ4PIgz3muXWd eyb0enwKzzI2LlD9CjGtWiMomZFSF3dYvZHGGLGL6cg2ds6b8A5X79PDgY83n5uXH9xt +Svw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=DAiqIP79iVE0siXGh2O4WHPol5B5wjoeFzE7xpl3RfM=; b=TP7Bjpyt+Y8NbapFoVA7leWoIx5KEoxX/ojA2Z2ChtaHUPocEi8+Os/BIhGc9mGJGM SbEQ432QWwJwp4aVEh+Nz7jdFxpQ9ypXoHIudof8F/Eq8P7LYvbUGrZBATymntno+xLR 7sI2C8UqSYlvxNcfdG2x5HnnUiH9SO76JBbbB7slME5WPpuxTGdtTnn0fqwDMhWocF6h 8LqJ1sE/w0cEKX4+Na2F85nQFl29CGR4CzD0TUG3oA5WiHvYVX6FVX56WBxjXcmBCCNm VUo+eoHCvstFqups1bBQsm8mN5bnIrlPRw8FQSKMB7M/qzgfSnbtLkMfzEK61JkK4ddZ NuEw== ARC-Authentication-Results: i=1; mx.google.com; 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 gh1si8562305ejb.604.2020.09.21.09.13.13; Mon, 21 Sep 2020 09:13:37 -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; 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 S1728085AbgIUQK0 (ORCPT + 99 others); Mon, 21 Sep 2020 12:10:26 -0400 Received: from foss.arm.com ([217.140.110.172]:46088 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727386AbgIUQKZ (ORCPT ); Mon, 21 Sep 2020 12:10:25 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 7956F147A; Mon, 21 Sep 2020 09:10:24 -0700 (PDT) Received: from e107158-lin.cambridge.arm.com (e107158-lin.cambridge.arm.com [10.1.195.21]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 5D50D3F73B; Mon, 21 Sep 2020 09:10:23 -0700 (PDT) Date: Mon, 21 Sep 2020 17:10:21 +0100 From: Qais Yousef To: Rob Clark Cc: dri-devel@lists.freedesktop.org, Peter Zijlstra , Tejun Heo , timmurray@google.com, linux-arm-msm@vger.kernel.org, Rob Clark , open list Subject: Re: [PATCH 0/3] drm: commit_work scheduling Message-ID: <20200921161020.pjd6v6ul3beljwot@e107158-lin.cambridge.arm.com> References: <20200919193727.2093945-1-robdclark@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20200919193727.2093945-1-robdclark@gmail.com> User-Agent: NeoMutt/20171215 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 09/19/20 12:37, 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. Just a side note; this RT vs CFS inter-operatability is an issue that creeps up every now and again. https://lore.kernel.org/lkml/1567048502-6064-1-git-send-email-jing-ting.wu@mediatek.com/ Does the UI thread in Android ever run as RT by the way? I always suspected it is one susceptible to such potential delays since it is part of the application thread and thought it can't be trusted to become RT. Those 120MHz displays will stress the pipeline :-) > > 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. This is a function of num_cpus too. As long as nr_cpus > nr_running_rt_tasks you should be fine. Cheers -- Qais Yousef