Received: by 10.192.165.148 with SMTP id m20csp4847205imm; Tue, 24 Apr 2018 09:17:55 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+Jrks4rchWzqLNSerNz/5euJ1eiwef82eHDvVvCCzBNcRhQrZ5HrP795NTrlptlpS7HaLC X-Received: by 10.98.12.202 with SMTP id 71mr24384262pfm.61.1524586675351; Tue, 24 Apr 2018 09:17:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524586675; cv=none; d=google.com; s=arc-20160816; b=ehHLl9ygFjXMVqIZCjlFFoNEJ3kZZOKi1ndebJ+gqLdEQ7aJsctJebaIt9BFmUduRy 1GKM/tCIkXzK5Pf4H6gSkKDf9IHYPWoQIWdz0LwNlOfCc7Ofl7UC+rXm2wB62zh7h0gF +bZMj/qFPmDcKdw7S08m8JrifQ4B2AgTKPBXabafWrmw+eINktr91Siky6l+ozpWQ5m9 jNggYi5fLjl9P5XnIH8phKDQgLEsqm1zUZpJ0M0yoxHxlnCXgT+SUBEJ6ET316M9BXj/ AFzLGa+md2hDNFBFp/4jX6AHWYbkBgxOs8u+fNfOjVkGlgRZDFdfAudlTsIMqd+Fh9LG p1ig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:subject:mime-version:user-agent :message-id:in-reply-to:date:references:cc:to:from :arc-authentication-results; bh=QKkoB5/6dO15UMfESzGO66RMk5xpGTGAWC+MqmuYd3s=; b=PDrl1b6idS3tFSQR27ZYeXlUh+dSzGYovyzgIs3MEbBRqEJAIoSopB6VVz/eClPKjP IikV1dUeQpbdQFw6a+nA7zfuasEnKxZSsig7F1lpPNnb0pE4cXgjPqcZaa032RbkYs3K J4bN0VhmlnF2AUuatpVWwfO8t57N7wHwrdCI0oAy3mpRERSgXC52OL7FRypkX9CnjhTV H2HoNLpdkeh+vPg6T4EBckMYj2g6e3hII9O21SY5WWWscovd2kCYOg+ib+lZtBIN/F7K 9KzVpo6rUqBnp4Goi1+7/U4E+ewOA0EurKIfittBdRynugr1Lls0nnQg9HnQAY/RBpHR d8AA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a7si8813831pgv.415.2018.04.24.09.17.40; Tue, 24 Apr 2018 09:17:55 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752193AbeDXQPx (ORCPT + 99 others); Tue, 24 Apr 2018 12:15:53 -0400 Received: from out02.mta.xmission.com ([166.70.13.232]:48148 "EHLO out02.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750835AbeDXQPu (ORCPT ); Tue, 24 Apr 2018 12:15:50 -0400 Received: from in02.mta.xmission.com ([166.70.13.52]) by out02.mta.xmission.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.87) (envelope-from ) id 1fB0bd-0005tj-PY; Tue, 24 Apr 2018 10:15:49 -0600 Received: from [97.119.174.25] (helo=x220.xmission.com) by in02.mta.xmission.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.87) (envelope-from ) id 1fB0bd-00041h-Ag; Tue, 24 Apr 2018 10:15:49 -0600 From: ebiederm@xmission.com (Eric W. Biederman) To: Andrey Grodzovsky Cc: , , , , , , References: <1524583836-12130-1-git-send-email-andrey.grodzovsky@amd.com> <1524583836-12130-4-git-send-email-andrey.grodzovsky@amd.com> Date: Tue, 24 Apr 2018 11:14:24 -0500 In-Reply-To: <1524583836-12130-4-git-send-email-andrey.grodzovsky@amd.com> (Andrey Grodzovsky's message of "Tue, 24 Apr 2018 11:30:36 -0400") Message-ID: <8736zkd1jz.fsf@xmission.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-XM-SPF: eid=1fB0bd-00041h-Ag;;;mid=<8736zkd1jz.fsf@xmission.com>;;;hst=in02.mta.xmission.com;;;ip=97.119.174.25;;;frm=ebiederm@xmission.com;;;spf=neutral X-XM-AID: U2FsdGVkX1++h1tAL8Jn6P51YW9m9RVClvHL8c/sq5E= X-SA-Exim-Connect-IP: 97.119.174.25 X-SA-Exim-Mail-From: ebiederm@xmission.com X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on sa06.xmission.com X-Spam-Level: ** X-Spam-Status: No, score=2.0 required=8.0 tests=ALL_TRUSTED,BAYES_50, DCC_CHECK_NEGATIVE,T_TM2_M_HEADER_IN_MSG,T_TooManySym_01,XMNoVowels,XMSubLong autolearn=disabled version=3.4.1 X-Spam-Report: * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP * 1.5 XMNoVowels Alpha-numberic number with no vowels * 0.7 XMSubLong Long Subject * 0.0 T_TM2_M_HEADER_IN_MSG BODY: No description available. * 0.8 BAYES_50 BODY: Bayes spam probability is 40 to 60% * [score: 0.5000] * -0.0 DCC_CHECK_NEGATIVE Not listed in DCC * [sa06 1397; Body=1 Fuz1=1 Fuz2=1] * 0.0 T_TooManySym_01 4+ unique symbols in subject X-Spam-DCC: XMission; sa06 1397; Body=1 Fuz1=1 Fuz2=1 X-Spam-Combo: **;Andrey Grodzovsky X-Spam-Relay-Country: X-Spam-Timing: total 180 ms - load_scoreonly_sql: 0.03 (0.0%), signal_user_changed: 2.4 (1.3%), b_tie_ro: 1.62 (0.9%), parse: 0.72 (0.4%), extract_message_metadata: 10 (5.4%), get_uri_detail_list: 1.18 (0.7%), tests_pri_-1000: 6 (3.1%), tests_pri_-950: 1.14 (0.6%), tests_pri_-900: 0.95 (0.5%), tests_pri_-400: 18 (9.9%), check_bayes: 17 (9.3%), b_tokenize: 6 (3.1%), b_tok_get_all: 5 (3.0%), b_comp_prob: 1.65 (0.9%), b_tok_touch_all: 2.5 (1.4%), b_finish: 0.50 (0.3%), tests_pri_0: 135 (75.2%), check_dkim_signature: 0.45 (0.3%), check_dkim_adsp: 2.7 (1.5%), tests_pri_500: 3.7 (2.0%), rewrite_mail: 0.00 (0.0%) Subject: Re: [PATCH 3/3] drm/amdgpu: Switch to interrupted wait to recover from ring hang. X-Spam-Flag: No X-SA-Exim-Version: 4.2.1 (built Thu, 05 May 2016 13:38:54 -0600) X-SA-Exim-Scanned: Yes (on in02.mta.xmission.com) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Andrey Grodzovsky writes: > If the ring is hanging for some reason allow to recover the waiting > by sending fatal signal. > > Originally-by: David Panariti > Signed-off-by: Andrey Grodzovsky > --- > drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c | 14 ++++++++++---- > 1 file changed, 10 insertions(+), 4 deletions(-) > > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c > index eb80edf..37a36af 100644 > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c > @@ -421,10 +421,16 @@ int amdgpu_ctx_wait_prev_fence(struct amdgpu_ctx *ctx, unsigned ring_id) > > if (other) { > signed long r; > - r = dma_fence_wait_timeout(other, false, MAX_SCHEDULE_TIMEOUT); > - if (r < 0) { > - DRM_ERROR("Error (%ld) waiting for fence!\n", r); > - return r; > + > + while (true) { > + if ((r = dma_fence_wait_timeout(other, true, > + MAX_SCHEDULE_TIMEOUT)) >= 0) > + return 0; > + > + if (fatal_signal_pending(current)) { > + DRM_ERROR("Error (%ld) waiting for fence!\n", r); > + return r; > + } It looks like if you make this code say: if (fatal_signal_pending(current) || (current->flags & PF_EXITING)) { DRM_ERROR("Error (%ld) waiting for fence!\n", r); return r; > } > } Than you would not need the horrible hack want_signal to deliver signals to processes who have passed exit_signal() and don't expect to need their signal handling mechanisms anymore. Eric