Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 49B39C61DA3 for ; Fri, 24 Feb 2023 10:51:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229838AbjBXKvC (ORCPT ); Fri, 24 Feb 2023 05:51:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51378 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229379AbjBXKu6 (ORCPT ); Fri, 24 Feb 2023 05:50:58 -0500 Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 517BA15885; Fri, 24 Feb 2023 02:50:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1677235857; x=1708771857; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=noOJVEfLjfjFl/8iEsWqjV4iJjt7i8IK2bqJaCilVlY=; b=OR8VPi5FrAlSThRFuSp5Y9adIXNg7iBF2UqtxcOq1GIbh5mGeAYB1VwE SycYXo+O3CO8LRql0/Wr779re7zuQmr+4P87VcRMFwYFPP5Dqw/kf4MvQ vNQKJZroyj8TkQOb6K+AS5ytyn3eDrUsZWluDQGYWBZrXgBN3A7I9gQs/ lOBFSTaOqnXXZ8YcpKWKLFIWFfVqT89mIStoLgOh6OfDU/XzumC9oqrEo 0xXYCUR3ysO/qib2Xmu3+0tgEgILKUTUHwIhs3NGK8S1RI+N9nnWQTN6O cJlhAqpxrU6Rsizoqtk84q+ALp+MD/LYbHKwfmf542S7cxlTG9jwVU8Tc A==; X-IronPort-AV: E=McAfee;i="6500,9779,10630"; a="313838846" X-IronPort-AV: E=Sophos;i="5.97,324,1669104000"; d="scan'208";a="313838846" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Feb 2023 02:50:57 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10630"; a="622674319" X-IronPort-AV: E=Sophos;i="5.97,324,1669104000"; d="scan'208";a="622674319" Received: from wmao-mobl.amr.corp.intel.com (HELO [10.212.63.133]) ([10.212.63.133]) by orsmga003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Feb 2023 02:50:53 -0800 Message-ID: <582a9b92-d246-fce2-cf39-539d9a2db17f@linux.intel.com> Date: Fri, 24 Feb 2023 10:50:51 +0000 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.8.0 Subject: Re: [PATCH v4 06/14] dma-buf/sync_file: Support (E)POLLPRI Content-Language: en-US To: Pekka Paalanen Cc: Rob Clark , Rob Clark , Tvrtko Ursulin , Gustavo Padovan , =?UTF-8?Q?Michel_D=c3=a4nzer?= , Rodrigo Vivi , open list , dri-devel@lists.freedesktop.org, Sumit Semwal , "moderated list:DMA BUFFER SHARING FRAMEWORK" , Luben Tuikov , =?UTF-8?Q?Christian_K=c3=b6nig?= , Alex Deucher , freedreno@lists.freedesktop.org, =?UTF-8?Q?Christian_K=c3=b6nig?= , "open list:SYNC FILE FRAMEWORK" References: <20230218211608.1630586-1-robdclark@gmail.com> <20230218211608.1630586-7-robdclark@gmail.com> <20230220105345.70e46fa5@eldfell> <20230222114900.1b6baf95@eldfell> <20230223113814.3010cedc@eldfell> <20230224112630.313d7b76@eldfell> <20230224122403.6a088da1@eldfell> From: Tvrtko Ursulin Organization: Intel Corporation UK Plc In-Reply-To: <20230224122403.6a088da1@eldfell> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 24/02/2023 10:24, Pekka Paalanen wrote: > On Fri, 24 Feb 2023 09:41:46 +0000 > Tvrtko Ursulin wrote: > >> On 24/02/2023 09:26, Pekka Paalanen wrote: >>> On Thu, 23 Feb 2023 10:51:48 -0800 >>> Rob Clark wrote: >>> >>>> On Thu, Feb 23, 2023 at 1:38 AM Pekka Paalanen wrote: >>>>> >>>>> On Wed, 22 Feb 2023 07:37:26 -0800 >>>>> Rob Clark wrote: >>>>> >>>>>> On Wed, Feb 22, 2023 at 1:49 AM Pekka Paalanen wrote: >>> >>> ... >>> >>>>>>> On another matter, if the application uses SET_DEADLINE with one >>>>>>> timestamp, and the compositor uses SET_DEADLINE on the same thing with >>>>>>> another timestamp, what should happen? >>>>>> >>>>>> The expectation is that many deadline hints can be set on a fence. >>>>>> The fence signaller should track the soonest deadline. >>>>> >>>>> You need to document that as UAPI, since it is observable to userspace. >>>>> It would be bad if drivers or subsystems would differ in behaviour. >>>>> >>>> >>>> It is in the end a hint. It is about giving the driver more >>>> information so that it can make better choices. But the driver is >>>> even free to ignore it. So maybe "expectation" is too strong of a >>>> word. Rather, any other behavior doesn't really make sense. But it >>>> could end up being dictated by how the hw and/or fw works. >>> >>> It will stop being a hint once it has been implemented and used in the >>> wild long enough. The kernel userspace regression rules make sure of >>> that. >> >> Yeah, tricky and maybe a gray area in this case. I think we eluded >> elsewhere in the thread that renaming the thing might be an option. >> >> So maybe instead of deadline, which is a very strong word, use something >> along the lines of "present time hint", or "signalled time hint"? Maybe >> reads clumsy. Just throwing some ideas for a start. > > You can try, but I fear that if it ever changes behaviour and > someone notices that, it's labelled as a kernel regression. I don't > think documentation has ever been the authoritative definition of UABI > in Linux, it just guides drivers and userspace towards a common > understanding and common usage patterns. > > So even if the UABI contract is not documented (ugh), you need to be > prepared to set the UABI contract through kernel implementation. To be the devil's advocate it probably wouldn't be an ABI regression but just an regression. Same way as what nice(2) priorities mean hasn't always been the same over the years, I don't think there is a strict contract. Having said that, it may be different with latency sensitive stuff such as UIs though since it is very observable and can be very painful to users. > If you do not document the UABI contract, then different drivers are > likely to implement it differently, leading to differing behaviour. > Also userspace will invent wild ways to abuse the UABI if there is no > documentation guiding it on proper use. If userspace or end users > observe different behaviour, that's bad even if it's not a regression. > > I don't like the situation either, but it is what it is. UABI stability > trumps everything regardless of whether it was documented or not. > > I bet userspace is going to use this as a "make it faster, make it > hotter" button. I would not be surprised if someone wrote a LD_PRELOAD > library that stamps any and all fences with an expired deadline to > just squeeze out a little more through some weird side-effect. > > Well, that's hopefully overboard in scaring, but in the end, I would > like to see UABI documented so I can have a feeling of what it is for > and how it was intended to be used. That's all. We share the same concern. If you read elsewhere in these threads you will notice I have been calling this an "arms race". If the ability to make yourself go faster does not required additional privilege I also worry everyone will do it at which point it becomes pointless. So yes, I do share this concern about exposing any of this as an unprivileged uapi. Is it possible to limit access to only compositors in some sane way? Sounds tricky when dma-fence should be disconnected from DRM.. Regards, Tvrtko