From: "Bartminski, Jakub" Subject: Re: [RFC] drm/i915: Don't reset on preemptible workloads Date: Thu, 2 Aug 2018 12:32:31 +0000 Message-ID: References: <20180801135611.20666-1-jakub.bartminski@intel.com> <153313332859.13234.4658472481486811653@skylake-alporthouse-com> <153320127059.13234.9936925365650978762@skylake-alporthouse-com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1349092607==" Return-path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by gabe.freedesktop.org (Postfix) with ESMTPS id C129B6E5A2 for ; Thu, 2 Aug 2018 12:33:28 +0000 (UTC) In-Reply-To: <153320127059.13234.9936925365650978762@skylake-alporthouse-com> Content-Language: en-US List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" To: "intel-gfx@lists.freedesktop.org" , "chris@chris-wilson.co.uk" List-Id: intel-gfx@lists.freedesktop.org --===============1349092607== Content-Language: en-US Content-Type: multipart/signed; micalg=sha-1; protocol="application/x-pkcs7-signature"; boundary="=-JPsU5itMQV2SN8CsZyUg" --=-JPsU5itMQV2SN8CsZyUg Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, 2018-08-02 at 10:14 +0100, Chris Wilson wrote: > Quoting Bartminski, Jakub (2018-08-02 09:56:10) > > On Wed, 2018-08-01 at 15:22 +0100, Chris Wilson wrote: > > > Quoting Jakub Bartmi=C5=84ski (2018-08-01 14:56:11) > > > > [...] > > > Though the argument that as long as its preemptible (and > > > isolated) it > > > is not acting as DoS so we don't need to enforce a timeout. That > > > also > > > suggests that we need not reset until the request is blocking > > > others > > > or userspace. > >=20 > > So if I'm understanding correctly you are suggesting that if we > > have > > preemption enabled we could drop the hangcheck entirely, and just > > reset > > if preemption fails? >=20 > Yes, but we still need the reset if we are stuck at the head of a > chain. I see a potential problem with that approach. If we have a request that is actually hung and introduce a higher-priority request, when trying to preempt the hung request we experience some considerable latency since we need to do the hangcheck at that time, whereas if we were hangchecking regularly it would have been declared hung before that. > [...] > > As I've mentioned before, one other problem with this patch is that > > we > > can't have more than one "background" request working before the > > first > > one finishes. While this could be solved at hangcheck by putting > > the > > background requests in the back of the background-priority queue > > instead of at the front during preemption, this breaks if the > > background requests are dependent on each other. These dependencies > > could be resolved in the tasklet (only in the case hangcheck was > > called > > so it wouldn't slow us down too much, they could also be resolved > > in > > the hangcheck itself but the timeline could change in between the > > hangcheck and the tasklet, which would make doing it correctly more > > complicated I think). >=20 > I think the very simple rule that you reset if there are any > dependencies and demote otherwise covers that. > -Chris So from what I understand, what you meant by that is that you would scratch the opt-in and just demote the priority by some constant on the hangcheck, handle the change in the tasklet, possibly preempting, and if so then wait until the next hangcheck to see if the preempt worked (and if not then reset the engine)?=20 While this is an elegant solution, if we want to allow (do we want to?) multiple "background" requests working interweaved with each other this can still lead to starvation.=20 Imagine the following scenario: we leave a "background" request working for a long enough time that its priority is decreased substantially. If we now introduce a second "background" request with the same starting priority, it will starve the first one for as long as it takes for it to be demoted to the first's current priority. We could avoid demoting if the request is the only one of that priority, but then the same starvation happens if we have two starting requests instead of one, and introduce the third one after some time. I think one way to fix this could be to demote not by a constant, but to a bottom ("background") queue, and then maybe rotate the bottom queue on hangcheck (if that's possible, we should have no dependencies there with what you proposed) to let multiple background requests work interweaved. What is your opinion on that approach? --=-JPsU5itMQV2SN8CsZyUg Content-Type: application/x-pkcs7-signature; name="smime.p7s" Content-Disposition: attachment; filename="smime.p7s" Content-Transfer-Encoding: base64 MIAGCSqGSIb3DQEHAqCAMIACAQExCzAJBgUrDgMCGgUAMIAGCSqGSIb3DQEHAQAAoIIKeTCCBOsw ggPToAMCAQICEDabxALowUBS+21KC0JI8fcwDQYJKoZIhvcNAQEFBQAwbzELMAkGA1UEBhMCU0Ux FDASBgNVBAoTC0FkZFRydXN0IEFCMSYwJAYDVQQLEx1BZGRUcnVzdCBFeHRlcm5hbCBUVFAgTmV0 d29yazEiMCAGA1UEAxMZQWRkVH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Jwx2N6zg4okdmRmf7Yymp8bpwKV40ac+TTk1dDUcIQVSc5Ls1JWfpyw1xUCR2Z/2az uZseIDptDgPQPPJa0j6d4NG48sk34c5JotI6B+zbOXJDH/lFWUSTJ/iLYl3N00eATIyar0Ar68FQ aeWaWIE7+hJoxgIKAldb6ptzEy8PfMSqaqqo4gytJSl6WGBvMcIFIQUB5KgoKKttGqxWlmo2MYIC FzCCAhMCAQEwgZAweTELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMRQwEgYDVQQHEwtTYW50YSBD bGFyYTEaMBgGA1UEChMRSW50ZWwgQ29ycG9yYXRpb24xKzApBgNVBAMTIkludGVsIEV4dGVybmFs IEJhc2ljIElzc3VpbmcgQ0EgNEICEzMAAGUdS+0yypIGyYkAAAAAZR0wCQYFKw4DAhoFAKBdMBgG CSqGSIb3DQEJAzELBgkqhkiG9w0BBwEwHAYJKoZIhvcNAQkFMQ8XDTE4MDgwMjEyMzIyOVowIwYJ KoZIhvcNAQkEMRYEFFUU0IhSUMT4+gHcmK4vT8ngv9blMA0GCSqGSIb3DQEBAQUABIIBABSviWjL j14JtgFUff2LmelyfdcFXCUygAtcK9SlKdV9ooGFTEHFB4Y9etJYHg81WXkNtlHvSlo0RCKHmlLa fqAUFqYjCnMVAUw2oF6EceRhv/VfWtFwU+cKu3VEoMDVo8JqE4ckO1iyaTeDjzFOSdgfXEuuAfcL FxoOx2vi3nOf2nD3d9nqhJHLxH+VkXFCzhXrHfppIlPLxkBi/ZGfjkzU50SAlpWN4soWpSRlnHRK q0xapc+j747Fdrpa/XGhPo9RREE4M7hk7Wpk9WQmhEP6eMzcA+rFACcQHmYmAKcVKPWWGaJwi4t9 UJVJnvyQOn0ATE98arjQL7u4izuJnKkAAAAAAAA= --=-JPsU5itMQV2SN8CsZyUg-- --===============1349092607== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KSW50ZWwtZ2Z4 IG1haWxpbmcgbGlzdApJbnRlbC1nZnhAbGlzdHMuZnJlZWRlc2t0b3Aub3JnCmh0dHBzOi8vbGlz dHMuZnJlZWRlc2t0b3Aub3JnL21haWxtYW4vbGlzdGluZm8vaW50ZWwtZ2Z4Cg== --===============1349092607==--