Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp1646940pxp; Thu, 17 Mar 2022 13:31:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwPiva/AMYJzXUNKM9WjPit0Q6jmcYIixI5Ee3S8cyCiWYgb0nLlAjw/Wn2Y7X/pEq4y+DI X-Received: by 2002:a17:902:8bc2:b0:149:1ce6:c28c with SMTP id r2-20020a1709028bc200b001491ce6c28cmr6659240plo.164.1647549112145; Thu, 17 Mar 2022 13:31:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647549112; cv=none; d=google.com; s=arc-20160816; b=aAkrNpVgjNRkN1Ofx7EZNpE9WM4xuS3rMEr7FNaBAsMZfPAtdMe2aYQvc1eaz9s5sG GFUWnc4UdQZEy/O2U525Q+vTXyaGrDn7Kmcf5IaryWaVLl//k9jwnkQ6lWRb3EfVta55 trZ8B1/CZnBr1IUBDacgUhUGI3BUjy0OETHeIrQ/6geMstmCWaJXNa1TPAVqnW9AfGGF oclMpemDDeTTcYRaIf4igVduIdEdBqlWfmhdEaqSQzmszursLjScm2h7SaIxJyLQkeTO gI4MLvNvIJJzxzNa9o75GCqOuNhkkncT8FXtnrb2vTw6LSVtn6UU1u0A4KkO2YLZk1Dx DE1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=IELfzsVU/wZ7ht4rR86rM2gpBonGJDThNUGcKLGVsXM=; b=UOgJn5O1bOCiOmgXj7T5lw6XmLsAiFQtUl2VZq+ICGPTXX2tu5IZRvDvcuGOnONFnr 5SZCWSH7PxTbWEOAza8tOII/rEx/dlLiSz3Qs18xY6vps3rlQcXRerg3ccnej9SYRu6R MmGsg+ZqCsfMLI9gffIUWIZ0bquKUGo2nRfmbsvjs3ZGgxraBrfo9MU2FxYWq7FiNkWs L4wVAJ7vJgfi81sVlcC88nPjHVRAMcjNy6At4e4MTK4/trXKsNHZL09sb7mIZMPsoSmW SkhhGto8jWltpoM997UzaCQ6iFa7FVCmiUcH9ABrqOqcl++wr6memGIZz276gyo5XFYl wSJg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="mS/mF26z"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id a11-20020a17090ad80b00b001c65375f1cesi3349340pjv.8.2022.03.17.13.31.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Mar 2022 13:31:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="mS/mF26z"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 6755F2D41FF; Thu, 17 Mar 2022 13:06:25 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236933AbiCQRgC (ORCPT + 99 others); Thu, 17 Mar 2022 13:36:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49348 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236505AbiCQRgB (ORCPT ); Thu, 17 Mar 2022 13:36:01 -0400 Received: from mail-wm1-x336.google.com (mail-wm1-x336.google.com [IPv6:2a00:1450:4864:20::336]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 70EF2C748B; Thu, 17 Mar 2022 10:34:44 -0700 (PDT) Received: by mail-wm1-x336.google.com with SMTP id k8-20020a05600c1c8800b003899c7ac55dso3775253wms.1; Thu, 17 Mar 2022 10:34:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=IELfzsVU/wZ7ht4rR86rM2gpBonGJDThNUGcKLGVsXM=; b=mS/mF26z2g6jRvaXO3oivJOR6aL0QS0imKt7OV668jL7lKlXy2pyb3R3n1Yd+tpN3M xJt00Lsh8EKat+SNZK5Z+bn7G+NKO3oFxtTPEFf3Uw+6EfDe1X+u9ArEH/6VN6icLWY3 7fKqbiNSDNZVPJvo41IRx33V70LSzHAhiIIChZqTseukFZb/vEu3iYb6gv9HWkr6Aa41 UXx88aOhL8Yis1PUCDFNTONVKZFRKl8JMEmKFX9YY9Vl264JMS1C6I4zYfqX0cSBHoLg ogeF5zeWlzHmpPY3NmQ68t2j+S+Nqei/fPw3e1/oG6gvKbjrJlJae/It6pWYl0RKNsji A1Qg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=IELfzsVU/wZ7ht4rR86rM2gpBonGJDThNUGcKLGVsXM=; b=3hw7qIJHvnszCVWWF2uUPDJZbDu+ZEyANaLQP7bQA07rV6JIsKW3yZUu6j7pf9Vtmr Powwdlwk/kthjwQ56dplcbPg8EpkIOtV4RHh5fr214rFuXJm6nCP6jIkRvazQ5Khtpl+ QpbmN05PmJJXwYLEEkv+OYCvAGtYJHUINGoNlXRAlbS9KRjHj5BPoeaWuhiuQjGFRtoc YNRE2caICBlmrYn8e+FZzVfGQhX5RJRiAPLylkvIwG4JKrVrhIkx1SHwFXX3Qd6GXTaY t+yJ6DjaK4H2E8C8XYGHBrFG0Wvu3wK2vnM8nVw8A2d8qJTw7bGyeXfHHYRyzOeECbZU oRTw== X-Gm-Message-State: AOAM5334tD9kiMYip24+gjrzom8MMjqaoLzqozrupgTbPz3bnwydEY28 zsTHYvs2zzSfYc+/HSi48meVK1HELKY79enuQNg= X-Received: by 2002:a7b:cc0d:0:b0:381:220e:a3a0 with SMTP id f13-20020a7bcc0d000000b00381220ea3a0mr5003576wmh.59.1647538482957; Thu, 17 Mar 2022 10:34:42 -0700 (PDT) MIME-Version: 1.0 References: <20220310234611.424743-1-robdclark@gmail.com> <20220310234611.424743-3-robdclark@gmail.com> <3945551d-47d2-1974-f637-1dbc61e14702@amd.com> <865abcff-9f52-dca4-df38-b11189c739ff@amd.com> <915537e2-ac5b-ab0e-3697-2b16a9ec8f91@amd.com> In-Reply-To: <915537e2-ac5b-ab0e-3697-2b16a9ec8f91@amd.com> From: Rob Clark Date: Thu, 17 Mar 2022 10:35:24 -0700 Message-ID: Subject: Re: [PATCH 2/3] drm/msm/gpu: Park scheduler threads for system suspend To: =?UTF-8?Q?Christian_K=C3=B6nig?= Cc: Andrey Grodzovsky , dri-devel , freedreno , linux-arm-msm , Rob Clark , Sean Paul , Abhinav Kumar , David Airlie , Akhil P Oommen , Jonathan Marek , AngeloGioacchino Del Regno , Bjorn Andersson , Vladimir Lypak , open list Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 Thu, Mar 17, 2022 at 9:45 AM Christian K=C3=B6nig wrote: > > Am 17.03.22 um 17:18 schrieb Rob Clark: > > On Thu, Mar 17, 2022 at 9:04 AM Christian K=C3=B6nig > > wrote: > >> Am 17.03.22 um 16:10 schrieb Rob Clark: > >>> [SNIP] > >>> userspace frozen !=3D kthread frozen .. that is what this patch is > >>> trying to address, so we aren't racing between shutting down the hw > >>> and the scheduler shoveling more jobs at us. > >> Well exactly that's the problem. The scheduler is supposed to shovelin= g > >> more jobs at us until it is empty. > >> > >> Thinking more about it we will then keep some dma_fence instance > >> unsignaled and that is and extremely bad idea since it can lead to > >> deadlocks during suspend. > > Hmm, perhaps that is true if you need to migrate things out of vram? > > It is at least not a problem when vram is not involved. > > No, it's much wider than that. > > See what can happen is that the memory management shrinkers want to wait > for a dma_fence during suspend. we don't wait on fences in shrinker, only purging or evicting things that are already ready. Actually, waiting on fences in shrinker path sounds like a pretty bad idea. > And if you stop the scheduler they will just wait forever. > > What you need to do instead is to drain the scheduler, e.g. call > drm_sched_entity_flush() with a proper timeout for each entity you have > created. yeah, it would work to drain the scheduler.. I guess that might be the more portable approach as far as generic solution for suspend. BR, -R > Regards, > Christian. > > > > >> So this patch here is an absolute clear NAK from my side. If amdgpu is > >> doing something similar that is a severe bug and needs to be addressed > >> somehow. > > I think amdgpu's use of kthread_park is not related to suspend, but > > didn't look too closely. > > > > And perhaps the solution for this problem is more complex in the case > > of amdgpu, I'm not super familiar with the constraints there. But I > > think it is a fine solution for integrated GPUs. > > > > BR, > > -R > > > >> Regards, > >> Christian. > >> > >>> BR, > >>> -R > >>> >