Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp962406rwr; Wed, 3 May 2023 08:25:13 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5ZU0nxn4nRuThG/oU1i70FtCFTyvVDQJw8lzKlLsB3DKxnbn5jrQVD9Q6JconxBD+9hW8J X-Received: by 2002:a17:90a:19d6:b0:236:1ec1:6d30 with SMTP id 22-20020a17090a19d600b002361ec16d30mr5610105pjj.3.1683127513562; Wed, 03 May 2023 08:25:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683127513; cv=none; d=google.com; s=arc-20160816; b=vk2baAqy1QIm7O7+ElASlIR/sYa08nrkvFk8JImRMnPNobMvdYSPZw+kKJdCjiqj6k jPnkaSOjbn0V9PrIKBQIfPHsu5BE8av/iRToRJAQ9vEUNQzmUF+h0Tv+SG34ANoL69rG gfC9zLMFuhQRw+kM4yifiM3iEd9fP0YXj3+eJlTULqCwzPPro7OPTzCtMFgORAtEJbYx 8DuamER/F/banO/RgaGwXQfWAqFSU6y8ad4mZgGhI+cEucZZJFFzln7ivxy9wquISISz Eq1CttsAoz+XYzQGjpS1C05ypBQqnNkFS+ERdJZPQKtOU6gpnzl5VzkkFOnDjSpX2+eL V1ow== 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:user-agent:mime-version :date:message-id:dkim-signature; bh=dhDKDeVvIIcyVSoI0Q7SQy/SoT7BeRHrFaibMKbsE1c=; b=qwtBuc6FI3xxY1W9QghLcS27wcyIX+Dg+BQYr1GEsR9tdK2sIlCQD1DnjFezo0Nvgj Kfe7VZNA1GBsGXqcLWW+cObe9hx4vItTNC/o7aQft28M0SDXaXucwobJTbQt4x192tAe NGLXVCb7qgIaUY4Fmi75/T91LuR4bU4Jhi1UNVg1bXUSdt0vVgfIxTpo/018fg2Dox3V S6f7g5rjFX1uOp+/5qgDFm1KI/ArsKFK90qUa6R5jsaLnn02uifZ6eZSDL82x+qHrsxy qjVooyVqWfT+ZPvxz865wACDiPh5+SCc9dcWTOIzgRSFNzVUbqhqxDcgzZTPfMHm6cVG Q4SA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=fS+Og3Lh; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x7-20020a17090a2b0700b0024e43558fbdsi1679459pjc.129.2023.05.03.08.25.02; Wed, 03 May 2023 08:25:13 -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=@gmail.com header.s=20221208 header.b=fS+Og3Lh; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230220AbjECPXl (ORCPT + 99 others); Wed, 3 May 2023 11:23:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49410 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230183AbjECPXh (ORCPT ); Wed, 3 May 2023 11:23:37 -0400 Received: from mail-ed1-x533.google.com (mail-ed1-x533.google.com [IPv6:2a00:1450:4864:20::533]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3E381420F for ; Wed, 3 May 2023 08:23:35 -0700 (PDT) Received: by mail-ed1-x533.google.com with SMTP id 4fb4d7f45d1cf-50bc456cc39so6422212a12.1 for ; Wed, 03 May 2023 08:23:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1683127414; x=1685719414; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=dhDKDeVvIIcyVSoI0Q7SQy/SoT7BeRHrFaibMKbsE1c=; b=fS+Og3Lh+XmnS0ELaglWBWPwSrdpWsl65t/lHTdwL8loYIlJ8h9ECR02lpKbbe4IDH +gVg0ecWqiYsYqn6I7QWpPT4O4eydRjQ6D8wFrqxEvpDz5lYc7Jd3qXx9Y7BY8byFZRK 5Dwk5T0D65XjCE0phB2xSpKIbgQzflGtVgp3kTCkAqfORaI8Jh8pxO5YjywkhvV9YiYM oixhlkYIh1y2lUXvTIfyhnMh1j48YBnhX3xEtZaAp2zJ6/8amCN66iMLqd2OMtdAjLWe ZIvelngraBDlo5E89HJ1wFysn0h4a1dIK/o0a0FNW3g+ZTFBg+ONALdGqxL8RdmN0x6Y AXYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683127414; x=1685719414; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=dhDKDeVvIIcyVSoI0Q7SQy/SoT7BeRHrFaibMKbsE1c=; b=dpg25Ieh2hkCj+hXVY8JVz2YWtmyhariaSmfbsgdBHdpG+MloCC4ZbeRwiJujSs5SL IukiHresYLKeN8+4xkShpqZCiL7H9kNOoiImCd/pAGqPQ8kPyhb2iBnYHp/dUkdKtDbQ UgMeMlLvu5L9My5X5/n9j5EysYm/HN0joAt7wBBP9AbUC6ymWLO8rJTuaayz+12eqxvO 9of1884uGJ5FzL404HVw7IasLSeuQFA/AyZuVOvSAIPQuC//aM1tzBb/fL9rg3PxOHWM FMPe/FdSwnUnC+v+0kNQ98T0bUdX6XgMw9TBnPa2BzgxnyF6zSVCujQAXrl2ZFhHdndp Jtaw== X-Gm-Message-State: AC+VfDyxh5g3VMQJvSeVwLgrkbFHVTPjwMry8NJMMFb1aMjueuLqv9J6 JBLvZ7uetZz6Yr8wc8qDl4Q= X-Received: by 2002:a17:906:da8c:b0:956:fdb6:bc77 with SMTP id xh12-20020a170906da8c00b00956fdb6bc77mr3410999ejb.30.1683127413483; Wed, 03 May 2023 08:23:33 -0700 (PDT) Received: from ?IPV6:2a02:908:1256:79a0:130a:3ed0:3dbc:854b? ([2a02:908:1256:79a0:130a:3ed0:3dbc:854b]) by smtp.gmail.com with ESMTPSA id hx4-20020a170906846400b009659ad1072fsm7651ejc.113.2023.05.03.08.23.32 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 03 May 2023 08:23:33 -0700 (PDT) Message-ID: <76bd16ac-9251-c71f-8da3-4c4c14d3bdcf@gmail.com> Date: Wed, 3 May 2023 17:23:31 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0 Subject: Re: [RFC PATCH 0/1] Add AMDGPU_INFO_GUILTY_APP ioctl Content-Language: en-US To: Felix Kuehling , Alex Deucher , =?UTF-8?Q?Timur_Krist=c3=b3f?= Cc: "Pelloux-Prayer, Pierre-Eric" , =?UTF-8?Q?Andr=c3=a9_Almeida?= , =?UTF-8?B?TWFyZWsgT2zFocOhaw==?= , michel.daenzer@mailbox.org, dri-devel , linux-kernel@vger.kernel.org, Samuel Pitoiset , amd-gfx list , kernel-dev@igalia.com, "Deucher, Alexander" , =?UTF-8?Q?Christian_K=c3=b6nig?= References: <20230501185747.33519-1-andrealmeid@igalia.com> <6ab2ff76-4518-6fac-071e-5d0d5adc4fcd@igalia.com> <85c538b01efb6f3fa6ff05ed1a0bc3ff87df7a61.camel@gmail.com> <57fa0ee4-de4f-3797-f817-d05f72541d0e@gmail.com> <2bf162d0-6112-8370-8828-0e0b21ac22ba@amd.com> From: =?UTF-8?Q?Christian_K=c3=b6nig?= In-Reply-To: <2bf162d0-6112-8370-8828-0e0b21ac22ba@amd.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-6.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,NICE_REPLY_A, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 Am 03.05.23 um 17:08 schrieb Felix Kuehling: > Am 2023-05-03 um 03:59 schrieb Christian König: >> Am 02.05.23 um 20:41 schrieb Alex Deucher: >>> On Tue, May 2, 2023 at 11:22 AM Timur Kristóf >>> wrote: >>>> [SNIP] >>>>>>>> In my opinion, the correct solution to those problems would be >>>>>>>> if >>>>>>>> the kernel could give userspace the necessary information about >>>>>>>> a >>>>>>>> GPU hang before a GPU reset. >>>>>>>> >>>>>>>   The fundamental problem here is that the kernel doesn't have >>>>>>> that >>>>>>> information either. We know which IB timed out and can >>>>>>> potentially do >>>>>>> a devcoredump when that happens, but that's it. >>>>>> >>>>>> Is it really not possible to know such a fundamental thing as what >>>>>> the >>>>>> GPU was doing when it hung? How are we supposed to do any kind of >>>>>> debugging without knowing that? >> >> Yes, that's indeed something at least I try to figure out for years >> as well. >> >> Basically there are two major problems: >> 1. When the ASIC is hung you can't talk to the firmware engines any >> more and most state is not exposed directly, but just through some >> fw/hw interface. >>     Just take a look at how umr reads the shader state from the SQ. >> When that block is hung you can't do that any more and basically have >> no chance at all to figure out why it's hung. >> >>     Same for other engines, I remember once spending a week figuring >> out why the UVD block is hung during suspend. Turned out to be a >> debugging nightmare because any time you touch any register of that >> block the whole system would hang. >> >> 2. There are tons of things going on in a pipeline fashion or even >> completely in parallel. For example the CP is just the beginning of a >> rather long pipeline which at the end produces a bunch of pixels. >>     In almost all cases I've seen you ran into a problem somewhere >> deep in the pipeline and only very rarely at the beginning. >> >>>>>> >>>>>> I wonder what AMD's Windows driver team is doing with this problem, >>>>>> surely they must have better tools to deal with GPU hangs? >>>>> For better or worse, most teams internally rely on scan dumps via >>>>> JTAG >>>>> which sort of limits the usefulness outside of AMD, but also gives >>>>> you >>>>> the exact state of the hardware when it's hung so the hardware teams >>>>> prefer it. >>>>> >>>> How does this approach scale? It's not something we can ask users to >>>> do, and even if all of us in the radv team had a JTAG device, we >>>> wouldn't be able to play every game that users experience random hangs >>>> with. >>> It doesn't scale or lend itself particularly well to external >>> development, but that's the current state of affairs. >> >> The usual approach seems to be to reproduce a problem in a lab and >> have a JTAG attached to give the hw guys a scan dump and they can >> then tell you why something didn't worked as expected. > > That's the worst-case scenario where you're debugging HW or FW issues. > Those should be pretty rare post-bringup. But are there hangs caused > by user mode driver or application bugs that are easier to debug and > probably don't even require a GPU reset? For example most VM faults > can be handled without hanging the GPU. Similarly, a shader in an > endless loop should not require a full GPU reset. In the KFD compute > case, that's still preemptible and the offending process can be killed > with Ctrl-C or debugged with rocm-gdb. We also have infinite loop in shader abort for gfx and page faults are pretty rare with OpenGL (a bit more often with Vulkan) and can be handled gracefully on modern hw (they just spam the logs). The majority of the problems is unfortunately that we really get hard hangs because of some hw issues. That can be caused by unlucky timing, power management or doing things in an order the hw doesn't expected. Regards, Christian. > > It's more complicated for graphics because of the more complex > pipeline and the lack of CWSR. But it should still be possible to do > some debugging without JTAG if the problem is in SW and not HW or FW. > It's probably worth improving that debugability without getting > hung-up on the worst case. > > Maybe user mode graphics queues will offer a better way of recovering > from these kinds of bugs, if the graphics pipeline can be unstuck > without a GPU reset, just by killing the offending user mode queue. > > Regards, >   Felix > > >> >> And yes that absolutely doesn't scale. >> >> Christian. >> >>> >>> Alex >>