Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D6838C433F5 for ; Thu, 19 May 2022 07:58:11 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7E39A11AF0B; Thu, 19 May 2022 07:58:11 +0000 (UTC) Received: from mail-ed1-x52d.google.com (mail-ed1-x52d.google.com [IPv6:2a00:1450:4864:20::52d]) by gabe.freedesktop.org (Postfix) with ESMTPS id CA34611AF0B for ; Thu, 19 May 2022 07:58:09 +0000 (UTC) Received: by mail-ed1-x52d.google.com with SMTP id h11so4829075eda.8 for ; Thu, 19 May 2022 00:58:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:date:mime-version:user-agent:subject:content-language:to :cc:references:from:in-reply-to; bh=VtfiXNVfhqVF6VE650yCzOFgrQ7Apj+dP/J/xnWisCs=; b=qWNMx1DVtxbLNKWhHoXfXZYUqE3wZM/97V9VP3TiyGskE2lsKmdvUaLzgsl1XZbbx+ 8df22firB1tv9sf8VhUnsbiTd3/Kr6KI+YPsdYLiAbpl3zbQ78hpgu4pxsk7cedNUqXF 1NXVjqUdMuzhndM1g7f4yYyzn+Tjguqv+EEey8f5GaU7sNyLxyk+lqSEKETCr8LJ5vWk adLZXzYE1YGwXzhaTp37UiVPfsJ9h4ofDm4Bza95HTmNHUFuZ8L5cD49O5jHBrA+7gPI A7WszSgT0GQEQby9I2BJ9gaVrYnxHHHrcCFmBNPXS1ZgPHlkGu2621XBhXu4Uj1dvGRv JWkA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to; bh=VtfiXNVfhqVF6VE650yCzOFgrQ7Apj+dP/J/xnWisCs=; b=o37dDui17gmZJIt+h/9qfWpzTgtabKDFbiKJJNUpmhK5q4GKot7EYjfGqSTSdy87KH ggVDilu+WWxEfkzqx1jUqQyl02CUZsBC99qyucDz7tk7mHJemM2OE/tKyZiBhWeHQyPN FKwg1BI8i7e4XORUE7yx4XDh8Oo+FDmik3pdhIQpIZJht3MzceU4nk3g/voUSI8IfvjS S7H9jyEuMYy2SqwrdYUGiveTFLEXIj9qsNHX+P8rxLmnwvRgZMAJ9rBaJqs2wq0urzJT S50BQGicREo75szGU1CeQUJQYjBAqRAjFpXK94kHACaQksAdJgi2Hu2FLOKEKIOcs+eM eE9Q== X-Gm-Message-State: AOAM530v7OgYwi/h8cYZsTq2oOvL471F2Z5ndUDuh2nAiRUVwaKSrhfn ycxfoj8QnHwktMR/ZcoUo9k= X-Google-Smtp-Source: ABdhPJyiu2EuQ4lnEmtITAqenuKwiSuNBgjV2k7i1UUq9436RLBQgRMryZzcSveKFaHiv5po3qBTbQ== X-Received: by 2002:a05:6402:1e95:b0:42a:c466:52ad with SMTP id f21-20020a0564021e9500b0042ac46652admr3962207edf.340.1652947088243; Thu, 19 May 2022 00:58:08 -0700 (PDT) Received: from [192.168.178.21] (p57b0bdaa.dip0.t-ipconnect.de. [87.176.189.170]) by smtp.gmail.com with ESMTPSA id hy16-20020a1709068a7000b006f3ef214e27sm1773478ejc.141.2022.05.19.00.58.06 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 19 May 2022 00:58:07 -0700 (PDT) Content-Type: multipart/alternative; boundary="------------LQrtz0tD09MrzznbZ1CSDzzO" Message-ID: <3abdd2a3-2cb8-fc8f-fd5d-a8a7cd5fc828@gmail.com> Date: Thu, 19 May 2022 09:58:05 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.8.1 Subject: Re: [PATCH v2 0/7] Fix multiple GPU resets in XGMI hive. Content-Language: en-US To: Andrey Grodzovsky , =?UTF-8?Q?Christian_K=c3=b6nig?= , amd-gfx@lists.freedesktop.org References: <20220517192102.238176-1-andrey.grodzovsky@amd.com> <1a7fd05f-490b-9999-5f0b-e84af26504a9@amd.com> From: =?UTF-8?Q?Christian_K=c3=b6nig?= In-Reply-To: X-BeenThere: amd-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion list for AMD gfx List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Zoy.Bai@amd.com, lijo.lazar@amd.com Errors-To: amd-gfx-bounces@lists.freedesktop.org Sender: "amd-gfx" This is a multi-part message in MIME format. --------------LQrtz0tD09MrzznbZ1CSDzzO Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Am 18.05.22 um 16:24 schrieb Andrey Grodzovsky: > > > On 2022-05-18 02:07, Christian König wrote: >> Am 17.05.22 um 21:20 schrieb Andrey Grodzovsky: >>> Problem: >>> During hive reset caused by command timing out on a ring >>> extra resets are generated by triggered by KFD which is >>> unable to accesses registers on the resetting ASIC. >>> >>> Fix: Rework GPU reset to actively stop any pending reset >>> works while another in progress. >>> >>> v2: Switch from generic list as was in v1[1] to eplicit >>> stopping of each reset request from each reset source >>> per each request submitter. >> >> Looks mostly good to me. >> >> Apart from the naming nit pick on patch #1 the only thing I couldn't >> of hand figure out is why you are using a delayed work everywhere >> instead of a just a work item. >> >> That needs a bit further explanation what's happening here. >> >> Christian. > > > Check APIs for cancelling work vs. delayed work - > > For work_struct the only public API is this - > https://elixir.bootlin.com/linux/latest/source/kernel/workqueue.c#L3214 > - blocking cancel. > > For delayed_work we have both blocking and non blocking public APIs - > > https://elixir.bootlin.com/linux/latest/source/kernel/workqueue.c#L3295 > > https://elixir.bootlin.com/linux/latest/source/kernel/workqueue.c#L3295 > > I prefer not to go now into convincing core kernel people of exposing > another interface for our own sake - from my past experience API > changes in core code has slim chances and a lot of time spent on back > and forth arguments. > > "If the mountain will not come to Muhammad, then Muhammad must go to > the mountain" ;)* > * > Ah, good point. The cancel_work() function was removed a few years ago: commit 6417250d3f894e66a68ba1cd93676143f2376a6f Author: Stephen Hemminger Date:   Tue Mar 6 19:34:42 2018 -0800     workqueue: remove unused cancel_work()     Found this by accident.     There are no usages of bare cancel_work() in current kernel source.     Signed-off-by: Stephen Hemminger     Signed-off-by: Tejun Heo Maybe just revert that patch, export the function and use it. I think there is plenty of justification for this. Thanks, Christian. > ** > > Andrey > >> >>> >>> [1] - >>> https://lore.kernel.org/all/20220504161841.24669-1-andrey.grodzovsky@amd.com/ >>> >>> Andrey Grodzovsky (7): >>>    drm/amdgpu: Cache result of last reset at reset domain level. >>>    drm/amdgpu: Switch to delayed work from work_struct. >>>    drm/admgpu: Serialize RAS recovery work directly into reset domain >>>      queue. >>>    drm/amdgpu: Add delayed work for GPU reset from debugfs >>>    drm/amdgpu: Add delayed work for GPU reset from kfd. >>>    drm/amdgpu: Rename amdgpu_device_gpu_recover_imp back to >>>      amdgpu_device_gpu_recover >>>    drm/amdgpu: Stop any pending reset if another in progress. >>> >>>   drivers/gpu/drm/amd/amdgpu/amdgpu.h        |  4 +- >>>   drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c | 15 +++++- >>>   drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h |  1 + >>>   drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 62 >>> +++++++++++----------- >>>   drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c  | 19 ++++++- >>>   drivers/gpu/drm/amd/amdgpu/amdgpu_job.c    |  2 +- >>>   drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c    | 10 ++-- >>>   drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h    |  2 +- >>>   drivers/gpu/drm/amd/amdgpu/amdgpu_reset.c  |  1 + >>>   drivers/gpu/drm/amd/amdgpu/amdgpu_reset.h  |  5 +- >>>   drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h   |  2 +- >>>   drivers/gpu/drm/amd/amdgpu/mxgpu_ai.c      |  6 +-- >>>   drivers/gpu/drm/amd/amdgpu/mxgpu_nv.c      |  6 +-- >>>   drivers/gpu/drm/amd/amdgpu/mxgpu_vi.c      |  6 +-- >>>   14 files changed, 87 insertions(+), 54 deletions(-) >>> >> --------------LQrtz0tD09MrzznbZ1CSDzzO Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit

Am 18.05.22 um 16:24 schrieb Andrey Grodzovsky:


On 2022-05-18 02:07, Christian König wrote:
Am 17.05.22 um 21:20 schrieb Andrey Grodzovsky:
Problem:
During hive reset caused by command timing out on a ring
extra resets are generated by triggered by KFD which is
unable to accesses registers on the resetting ASIC.

Fix: Rework GPU reset to actively stop any pending reset
works while another in progress.

v2: Switch from generic list as was in v1[1] to eplicit
stopping of each reset request from each reset source
per each request submitter.

Looks mostly good to me.

Apart from the naming nit pick on patch #1 the only thing I couldn't of hand figure out is why you are using a delayed work everywhere instead of a just a work item.

That needs a bit further explanation what's happening here.

Christian.


Check APIs for cancelling work vs. delayed work -

For work_struct the only public API is this - https://elixir.bootlin.com/linux/latest/source/kernel/workqueue.c#L3214 - blocking cancel.

For delayed_work we have both blocking and non blocking public APIs -

https://elixir.bootlin.com/linux/latest/source/kernel/workqueue.c#L3295

https://elixir.bootlin.com/linux/latest/source/kernel/workqueue.c#L3295

I prefer not to go now into convincing core kernel people of exposing another interface for our own sake - from my past experience API changes in core code has slim chances and a lot of time spent on back and forth arguments.

"If the mountain will not come to Muhammad, then Muhammad must go to the mountain" ;)


Ah, good point. The cancel_work() function was removed a few years ago:

commit 6417250d3f894e66a68ba1cd93676143f2376a6f
Author: Stephen Hemminger <stephen@networkplumber.org>
Date:   Tue Mar 6 19:34:42 2018 -0800

    workqueue: remove unused cancel_work()
    
    Found this by accident.
    There are no usages of bare cancel_work() in current kernel source.
    
    Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
    Signed-off-by: Tejun Heo <tj@kernel.org>


Maybe just revert that patch, export the function and use it. I think there is plenty of justification for this.

Thanks,
Christian.

Andrey



[1] - https://lore.kernel.org/all/20220504161841.24669-1-andrey.grodzovsky@amd.com/

Andrey Grodzovsky (7):
   drm/amdgpu: Cache result of last reset at reset domain level.
   drm/amdgpu: Switch to delayed work from work_struct.
   drm/admgpu: Serialize RAS recovery work directly into reset domain
     queue.
   drm/amdgpu: Add delayed work for GPU reset from debugfs
   drm/amdgpu: Add delayed work for GPU reset from kfd.
   drm/amdgpu: Rename amdgpu_device_gpu_recover_imp back to
     amdgpu_device_gpu_recover
   drm/amdgpu: Stop any pending reset if another in progress.

  drivers/gpu/drm/amd/amdgpu/amdgpu.h        |  4 +-
  drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c | 15 +++++-
  drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h |  1 +
  drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 62 +++++++++++-----------
  drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c  | 19 ++++++-
  drivers/gpu/drm/amd/amdgpu/amdgpu_job.c    |  2 +-
  drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c    | 10 ++--
  drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h    |  2 +-
  drivers/gpu/drm/amd/amdgpu/amdgpu_reset.c  |  1 +
  drivers/gpu/drm/amd/amdgpu/amdgpu_reset.h  |  5 +-
  drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h   |  2 +-
  drivers/gpu/drm/amd/amdgpu/mxgpu_ai.c      |  6 +--
  drivers/gpu/drm/amd/amdgpu/mxgpu_nv.c      |  6 +--
  drivers/gpu/drm/amd/amdgpu/mxgpu_vi.c      |  6 +--
  14 files changed, 87 insertions(+), 54 deletions(-)



--------------LQrtz0tD09MrzznbZ1CSDzzO--