Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp738572rwb; Wed, 26 Jul 2023 01:55:18 -0700 (PDT) X-Google-Smtp-Source: APBJJlFn+woRadKPjr9AOgBP6BjX7YHe3F9rK6KPglvNJ1zpsQuK6+hM3aJBR8ovMfVhDy4iXdST X-Received: by 2002:a17:902:a40f:b0:1bb:c896:1da3 with SMTP id p15-20020a170902a40f00b001bbc8961da3mr1879128plq.24.1690361718501; Wed, 26 Jul 2023 01:55:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690361718; cv=none; d=google.com; s=arc-20160816; b=QDjqnwHh+PI8W/n0p8w4EaEuslEoFwyn+zE7+Gfy5JGxETeboi0yU/Y2Dpo71FXrlv Bu5XrND9CDyOUQdpxcRBB5vpPtv0ZuSPFKlmhe+8kmSZS2Ujgipj5n7kAfethl5bcxl9 9bzyc9puyK9gHrJjl1soAObMowVfRXbi/spB+Dfzu1ycvlfcQ0xIZxbT3iR2XfJIcNjX cVZ5RIyRj36+nyW8zWomVKh9nTQT4/jpW6nu9PzB1YlC9aFhyKBsURI23tshpSIAZBXz o5s22xbjRRDL/ApyGpG+QTKIieyIiR6pijP1/UVFAVDqn0JxXzbnUDIKVRvjbczgTOAc wXww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :content-language:references:cc:to:subject:mime-version:date :message-id:dkim-signature; bh=xHAU2WtxLXCpVwOzHZxYiWNoKZatMkP5oCbz6WI4SPA=; fh=nPYyOiMt5o9CrElyKeW1oAbHagfzTuFuJKgEJrPJBh4=; b=adna/JtJ6/hLBoh242ul3sqPp/ktizuvr1WQDnPffPvxZAMJdneeVXvQvaAvF1Wdvp TiVwHMIThuPHGC4MiWYVMfE8ey/h9Ka9OIVjHd+7IfTPRo78dRgRf8ZWKwHy51zMuHzZ T+TUnhX1YV3JSrnPL81U8cqvjF8N0jFlATZCKVQucRYbGUIe5m5Nwo02r3zSn3tASc29 ldoTraJG0Ykxxq+MJTGVFYUdKkGmx520DoVnghWQJKNwWZ5fW8j/ps99Gda4fUT/h4d9 HRwZf49Wc3exwvpQpthj6p8LotYGvdCR2PFhQ4lmG79AzuvuSgPOd3TV7cZjIQ42cXIS 2otg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mailbox.org header.s=mail20150812 header.b=vMEbZRzJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=mailbox.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id lg16-20020a170902fb9000b001b9d335175asi12138899plb.292.2023.07.26.01.55.05; Wed, 26 Jul 2023 01:55:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@mailbox.org header.s=mail20150812 header.b=vMEbZRzJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=mailbox.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231892AbjGZISY (ORCPT + 99 others); Wed, 26 Jul 2023 04:18:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59914 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231684AbjGZIRo (ORCPT ); Wed, 26 Jul 2023 04:17:44 -0400 Received: from mout-p-102.mailbox.org (mout-p-102.mailbox.org [80.241.56.152]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D2BB1658B for ; Wed, 26 Jul 2023 01:07:27 -0700 (PDT) Received: from smtp102.mailbox.org (smtp102.mailbox.org [10.196.197.102]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-102.mailbox.org (Postfix) with ESMTPS id 4R9mhn71bVz9slb; Wed, 26 Jul 2023 10:07:21 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mailbox.org; s=mail20150812; t=1690358842; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=xHAU2WtxLXCpVwOzHZxYiWNoKZatMkP5oCbz6WI4SPA=; b=vMEbZRzJAQ3lUXTzas65sGQJH7SiTk2H9+hGxGPfZBgaoNnDDESraZNFpqi+KbbBY3Bn76 pg3PEa4GhMsndYsMHpjPfNTK54A1xOPLLgp+dfcWlaWMem0PuTXRoCsFRDHqtxtZcX6Jur Q/HIIU1v8MR3O5Ii0s72NZnFWy8/W/zKsmiKeYGAVbdkmMVb4pNpzZZFxv6TTg92E83vVQ QOPqcNW1EBrlF3HSifSTgscVfHRV1vfMQKlpGoMnGSaZB9gM7YROGdoUXkiU2QdrnLen3Z l5YzlmE1/iDJypA4/AkNcR/1B6s5Rc7/yATifP8rv4TJHBjWZh86d4MpPq/nnw== Message-ID: <8eb58a5f-02d0-fadf-1d5a-790b6af2d81e@mailbox.org> Date: Wed, 26 Jul 2023 10:07:19 +0200 MIME-Version: 1.0 Subject: Re: Non-robust apps and resets (was Re: [PATCH v5 1/1] drm/doc: Document DRM device reset expectations) To: =?UTF-8?Q?Andr=c3=a9_Almeida?= Cc: pierre-eric.pelloux-prayer@amd.com, amd-gfx@lists.freedesktop.org, Pekka Paalanen , =?UTF-8?B?J01hcmVrIE9sxaHDoWsn?= , =?UTF-8?Q?Timur_Krist=c3=b3f?= , Randy Dunlap , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Pekka Paalanen , Samuel Pitoiset , kernel-dev@igalia.com, alexander.deucher@amd.com, christian.koenig@amd.com References: <20230627132323.115440-1-andrealmeid@igalia.com> <45a1e527-f5dc-aa6f-9482-8958566ecb96@mailbox.org> Content-Language: de-CH-frami, en-CA From: =?UTF-8?Q?Michel_D=c3=a4nzer?= In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-MBO-RS-ID: c99f3890bef0434ccc7 X-MBO-RS-META: 7uaxsifuwngj5cyzfa3ngxf83jx37585 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 7/25/23 15:02, André Almeida wrote: > Em 25/07/2023 05:03, Michel Dänzer escreveu: >> On 7/25/23 04:55, André Almeida wrote: >>> Hi everyone, >>> >>> It's not clear what we should do about non-robust OpenGL apps after GPU resets, so I'll try to summarize the topic, show some options and my proposal to move forward on that. >>> >>> Em 27/06/2023 10:23, André Almeida escreveu: >>>> +Robustness >>>> +---------- >>>> + >>>> +The only way to try to keep an application working after a reset is if it >>>> +complies with the robustness aspects of the graphical API that it is using. >>>> + >>>> +Graphical APIs provide ways to applications to deal with device resets. However, >>>> +there is no guarantee that the app will use such features correctly, and the >>>> +UMD can implement policies to close the app if it is a repeating offender, >>>> +likely in a broken loop. This is done to ensure that it does not keep blocking >>>> +the user interface from being correctly displayed. This should be done even if >>>> +the app is correct but happens to trigger some bug in the hardware/driver. >>>> + >>> Depending on the OpenGL version, there are different robustness API available: >>> >>> - OpenGL ABR extension [0] >>> - OpenGL KHR extension [1] >>> - OpenGL ES extension  [2] >>> >>> Apps written in OpenGL should use whatever version is available for them to make the app robust for GPU resets. That usually means calling GetGraphicsResetStatusARB(), checking the status, and if it encounter something different from NO_ERROR, that means that a reset has happened, the context is considered lost and should be recreated. If an app follow this, it will likely succeed recovering a reset. >>> >>> What should non-robustness apps do then? They certainly will not be notified if a reset happens, and thus can't recover if their context is lost. OpenGL specification does not explicitly define what should be done in such situations[3], and I believe that usually when the spec mandates to close the app, it would explicitly note it. >>> >>> However, in reality there are different types of device resets, causing different results. A reset can be precise enough to damage only the guilty context, and keep others alive. >>> >>> Given that, I believe drivers have the following options: >>> >>> a) Kill all non-robust apps after a reset. This may lead to lose work from innocent applications. >>> >>> b) Ignore all non-robust apps OpenGL calls. That means that applications would still be alive, but the user interface would be freeze. The user would need to close it manually anyway, but in some corner cases, the app could autosave some work or the user might be able to interact with it using some alternative method (command line?). >>> >>> c) Kill just the affected non-robust applications. To do that, the driver need to be 100% sure on the impact of its resets. >>> >>> RadeonSI currently implements a), as can be seen at [4], while Iris implements what I think it's c)[5]. >>> >>> For the user experience point-of-view, c) is clearly the best option, but it's the hardest to archive. There's not much gain on having b) over a), perhaps it could be an optional env var for such corner case applications. >> >> I disagree on these conclusions. >> >> c) is certainly better than a), but it's not "clearly the best" in all cases. The OpenGL UMD is not a privileged/special component and is in no position to decide whether or not the process as a whole (only some thread(s) of which may use OpenGL at all) gets to continue running or not. >> > > Thank you for the feedback. How do you think the documentation should look like for this part? The initial paragraph about robustness should say "keep OpenGL working" instead of "keep an application working". If an OpenGL context stops working, it doesn't necessarily mean the application stops working altogether. If the application doesn't use the robustness extensions, your option b) is what should happen by default whenever possible. And it really has to be possible if the robustness extensions are supported. -- Earthling Michel Dänzer | https://redhat.com Libre software enthusiast | Mesa and Xwayland developer