Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp27336435rwd; Tue, 4 Jul 2023 01:16:47 -0700 (PDT) X-Google-Smtp-Source: APBJJlG8TMy5UVlg/l9R0WiuDGmeUNa1GTbfWFjAxwKuhsHy7oX70YcbzKWj+nuGeYawZPiLpbX/ X-Received: by 2002:a17:90a:dc0f:b0:263:5efe:5ff with SMTP id i15-20020a17090adc0f00b002635efe05ffmr9405614pjv.33.1688458606757; Tue, 04 Jul 2023 01:16:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688458606; cv=none; d=google.com; s=arc-20160816; b=u8QhsBbqJPPyAFkw1KN6MNpzEX18qJXjyD22fwaM4Y7pjr48HcYBuO1lJ36JRuYUJ+ JJNK5dEPLL4qAEYYqhwI9z/cofvMWQx9jw1ikmTsA9Vat936+Nr1bmINF1eP8hNVgBOd mJdHrZmoKXxyAam9k/T2fy+Z9Qs0qgL5R6Ow3WIRh6CWrlEWmlktU5nZWn2hb2MXfMKX pCTpc2NX5fC+gXoB3Ic7p8l/SG9fV0UaOzhBF/9Qx9dJrxiZJ1BBICYDZRV7GnZwgbn/ C5NuD6t8CYm7xfmbTW6iE9iW8wvb6eYzYbIDnpx547LhDyAf/dzQgJvmNlQHG9hKaTHJ HwEA== 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 :references:cc:to:content-language:subject:mime-version:date :message-id:dkim-signature; bh=0liI8Pu/8xa8Dl9jFpuxkH+YuWCmEEgP3GWm7h7OAwI=; fh=B7yr5SAylInf49jPkknLnFu8JVsWfitugtTHQ+/9CQE=; b=n1UzBCqd3t+SsqWxnltUrJ312T9pFWyxvUt8ABft+9Wgjop3oDGlgekrTMKhlqK9Cl j0GwQtWMOPj4/9zFMcielsg4SxsJxip3w+WiUXI6IoiGajcMm6HfOYqfAY40yoEMxiUY T1AoQprjkCIHKVM9bbx1niF8SXzhPHSY0jylTZVsID+WcvHLbFd7Du2bmFma78E2DZPh 9g3iKFv7IvFcNiS/g5ZblcQzN8PRVDj+W23On7W1Alm6hhYK7F2LpU8eJbzOOnDFBN0V BNBRGR18dlJcBlYrNz5TWrTwMC40Qc+JoD1ou0APF4uEPQoEI6CEPZ+ywOQ0kE68SZ5D 1vBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mailbox.org header.s=mail20150812 header.b=EZQdCPvZ; 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 29-20020a17090a035d00b00262fe7a04f3si15694324pjf.95.2023.07.04.01.16.30; Tue, 04 Jul 2023 01:16:46 -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=EZQdCPvZ; 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 S231555AbjGDHzd (ORCPT + 99 others); Tue, 4 Jul 2023 03:55:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35708 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231548AbjGDHzR (ORCPT ); Tue, 4 Jul 2023 03:55:17 -0400 Received: from mout-p-201.mailbox.org (mout-p-201.mailbox.org [IPv6:2001:67c:2050:0:465::201]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C535CE62 for ; Tue, 4 Jul 2023 00:55:03 -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-201.mailbox.org (Postfix) with ESMTPS id 4QwFSd6sBGz9sSN; Tue, 4 Jul 2023 09:54:57 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mailbox.org; s=mail20150812; t=1688457297; 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=0liI8Pu/8xa8Dl9jFpuxkH+YuWCmEEgP3GWm7h7OAwI=; b=EZQdCPvZeFjSFnJ5SdpvtbUDc9N2TrFnvCeTnK1wQJV3g1ZhmznGtL7ElaLVkMLtgzxZGM n+EzK/MCUuCh+gKyQ0+zEyyZkz3OAeTEkHJa7SA7Z1JeVwPk8C2SA5ZAKL7E5dG75hUQ/g n8yjkbDiwJZ5aJuqcdJCH3/MnAMNeD2uU644w0En+YmPOAQvttO/A30+ZuHzzD5uWe/ryj tWacaPUgCIT4uk3Qv0Fbcsl0eLmRgs8qvU6jaTkMD+eu1D45T3gk4fSom/saBvPsT76JX+ sCm+V/KakYxzh6I79AHCDl5qhpIeT6Hk6vXRyPSTHFtk8Dx2ZQJi7EbHwSZmng== Message-ID: Date: Tue, 4 Jul 2023 09:54:55 +0200 MIME-Version: 1.0 Subject: Re: [PATCH v5 1/1] drm/doc: Document DRM device reset expectations Content-Language: de-CH-frami, en-CA To: =?UTF-8?B?TWFyZWsgT2zFocOhaw==?= Cc: Pierre-Eric Pelloux-Prayer , Sebastian Wick , =?UTF-8?Q?Andr=c3=a9_Almeida?= , =?UTF-8?Q?Timur_Krist=c3=b3f?= , Randy Dunlap , Linux Kernel Mailing List , amd-gfx mailing list , Pekka Paalanen , Samuel Pitoiset , dri-devel , kernel-dev@igalia.com, "Deucher, Alexander" , Pekka Paalanen , =?UTF-8?Q?Christian_K=c3=b6nig?= References: <20230627132323.115440-1-andrealmeid@igalia.com> <7c1e6df5-1ad4-be3c-b95d-92dc62a8c537@mailbox.org> 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: 6f75c7af4b51ba2a261 X-MBO-RS-META: 79ms488kzhmr48ukwrpa61pk87dn8fd7 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/4/23 04:34, Marek Olšák wrote: > On Mon, Jul 3, 2023, 03:12 Michel Dänzer > wrote: > On 6/30/23 22:32, Marek Olšák wrote: > > On Fri, Jun 30, 2023 at 11:11 AM Michel Dänzer >> wrote: > >> On 6/30/23 16:59, Alex Deucher wrote: > >>> On Fri, Jun 30, 2023 at 10:49 AM Sebastian Wick > >>> >> wrote: > >>>> On Tue, Jun 27, 2023 at 3:23 PM André Almeida >> wrote: > >>>>> > >>>>> +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. > >>>> > >>>> I still don't think it's good to let the kernel arbitrarily kill > >>>> processes that it thinks are not well-behaved based on some heuristics > >>>> and policy. > >>>> > >>>> Can't this be outsourced to user space? Expose the information about > >>>> processes causing a device and let e.g. systemd deal with coming up > >>>> with a policy and with killing stuff. > >>> > >>> I don't think it's the kernel doing the killing, it would be the UMD. > >>> E.g., if the app is guilty and doesn't support robustness the UMD can > >>> just call exit(). > >> > >> It would be safer to just ignore API calls[0], similarly to what is done until the application destroys the context with robustness. Calling exit() likely results in losing any unsaved work, whereas at least some applications might otherwise allow saving the work by other means. > > > > That's a terrible idea. Ignoring API calls would be identical to a freeze. You might as well disable GPU recovery because the result would be the same. > > No GPU recovery would affect everything using the GPU, whereas this affects only non-robust applications. > > which is currently the majority. Not sure where you're going with this. Applications need to use robustness to be able to recover from a GPU hang, and the GPU needs to be reset for that. So disabling GPU reset is not the same as what we're discussing here. > > - non-robust contexts: call exit(1) immediately, which is the best way to recover > > That's not the UMD's call to make. > > That's absolutely the UMD's call to make because that's mandated by the hw and API design Can you point us to a spec which mandates that the process must be killed in this case? > and only driver devs know this, which this thread is a proof of. The default behavior is to skip all command submission if a non-robust context is lost, which looks like a freeze. That's required to prevent infinite hangs from the same context and can be caused by the side effects of the GPU reset itself, not by the cause of the previous hang. The only way out of that is killing the process. The UMD killing the process is not the only way out of that, and doing so is overreach on its part. The UMD is but one out of many components in a process, not the main one or a special one. It doesn't get to decide when the process must die, certainly not under circumstances where it must be able to continue while ignoring API calls (that's required for robustness). > >>     [0] Possibly accompanied by a one-time message to stderr along the lines of "GPU reset detected but robustness not enabled in context, ignoring OpenGL API calls". -- Earthling Michel Dänzer | https://redhat.com Libre software enthusiast | Mesa and Xwayland developer