Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp3554810iob; Sun, 1 May 2022 22:31:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxTRynnu53yv7dzQYcFLFbuDdcZ0TobrAIBJcDuI9ze1fh+zT+hwTL98+9kTRYN3PWAgrlf X-Received: by 2002:a2e:a235:0:b0:24f:1209:fcbf with SMTP id i21-20020a2ea235000000b0024f1209fcbfmr6955489ljm.313.1651469519390; Sun, 01 May 2022 22:31:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651469519; cv=none; d=google.com; s=arc-20160816; b=h05nXz5Pvd0XVYbblrKG4YcmiWH+xjAp6uDLy3jh1MuHkCGuhD0KR5cMufvU64mfgG N6Xh1S8BvWn2HOwxNmZ9gCE3P8Ki361XotPfJnkkj5ych/yvlEzRdQchglf6bT8OTb2W 6hHJAbDO7YxgWPV0RPmwzrrpsODAmi0tMJeFJ4Clgbd5jRBuC/7x610kzMwVElG0PaSZ ymWHQH7iC+NbSVVkzQVvoeoWp3oresiWx/m2CnTIjXWgclWQHfDPdLdRPhoCC0sxJIok OiQGtgscWS/z/n7wrAYCcuf1sRgU+t+ciMDjl5+rpeemaQ0AbLlT2qxoJyiRqohXVio2 Q2pQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=vtuxsDJkfuXL6miXD7Jn/4A4oW+gIOESPprjyWMnzo4=; b=Td0fPX7sXrjZjcfuTnyT+WCscF5YYat18s/3oeTgB9bbGiw0+4fKwhzPpKBtXpPeZ5 dWPOKjle9+KjPTvPCbzsgYJdVsV3rUhzE+djTV9NGAGZ9Dx0tzV9By1bOv12H0zFCu8h VGuFKqVpPP7W5Y+kENa7Fvi3zyLa03ZAp7HR3LbywlDy+Dxw6cpgxPXE1nF1NatwOdQA EF6F+8xQkz7QT9u0cPbOB3b5hVjZVInSZA18+FzBCZBkXudIf4MOjpQ9HAofVk/gc/nY nekNTUti/pPAmqCnJzUScP0gltRnMpcmz9gibrE0YIdi2KaIxrwKfOrnIlvVNQxLso6Q XjNw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=MlALFfJW; 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=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h2-20020a0565123c8200b004722dd11721si19212710lfv.30.2022.05.01.22.31.32; Sun, 01 May 2022 22:31:59 -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=@redhat.com header.s=mimecast20190719 header.b=MlALFfJW; 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=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240916AbiD3J1G (ORCPT + 99 others); Sat, 30 Apr 2022 05:27:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51206 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376314AbiD3J1D (ORCPT ); Sat, 30 Apr 2022 05:27:03 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 8889B8BF05 for ; Sat, 30 Apr 2022 02:23:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1651310620; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=vtuxsDJkfuXL6miXD7Jn/4A4oW+gIOESPprjyWMnzo4=; b=MlALFfJW7fv4k/8p7fJ0M0ppNHwKeZVQl6VUu0e3tbruCT9guZ0g4BAv9k5pUoSj8w33k/ K/gKmcyTNTSltTT6Qb0WTou2MnOn+CkeGBOvqqLoqOJkwTcWQ7pMw9a+SnDkJ5xyMsHtm6 e3HKdgDU43/5xwz7QKe7kwcT+rRbXbU= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-569-YPq5OOLKMY-SlQJjWlVVVA-1; Sat, 30 Apr 2022 05:23:39 -0400 X-MC-Unique: YPq5OOLKMY-SlQJjWlVVVA-1 Received: by mail-wm1-f72.google.com with SMTP id i131-20020a1c3b89000000b00393fbb0718bso5948798wma.0 for ; Sat, 30 Apr 2022 02:23:38 -0700 (PDT) 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; bh=vtuxsDJkfuXL6miXD7Jn/4A4oW+gIOESPprjyWMnzo4=; b=hiQ8ACDZQ/cNUxle4Nc1a2ZyMhX+sNb/oTpnnCdi+VoGcs3X4DGwRWFDPng0fZi3Tv mHukMah/GbQeEtAWfUinarNlPn+ChnZHfGGRBvbzkr8yPMCEvXMo2h8Ha1SiQ+xBt3QH tWWyUdc0GhoOhuXIgszQ+9st9WRe6nsuYRmluxCuefqdDSxvvEQxg6b5OrFyVj4N37XN ZlxLldrsz9RtwxfEHJXnlwmxJ/d+1vSDHEIFpVr6mTD/Z9yc8GwMV7cdJ4YqDbbCERU/ uTaHP/0KQSXzYqlyEiBiywzvnjcJDFwY7oOy1i+Dmwp21Y1ZAh4xFkktEuJMdHz0Vy7w xs/Q== X-Gm-Message-State: AOAM533xaGnBf2bppJIQkk16uB7hmLP5B8rtuSHROt5V66Y2CTP7utOw M6JlBwrHaHtQffA8YA9Cf1PwJIyq3H7tnnS0GfduK1Q+VqOGgExRdF92URI2ZlKPKxWkydtj3Uf 0ZhIWmaBs/goEjfYzqS2nQzu+mHKmgMAZFpnDTYwt X-Received: by 2002:a5d:63ce:0:b0:20a:da1f:aac5 with SMTP id c14-20020a5d63ce000000b0020ada1faac5mr2414831wrw.589.1651310617252; Sat, 30 Apr 2022 02:23:37 -0700 (PDT) X-Received: by 2002:a5d:63ce:0:b0:20a:da1f:aac5 with SMTP id c14-20020a5d63ce000000b0020ada1faac5mr2414820wrw.589.1651310616990; Sat, 30 Apr 2022 02:23:36 -0700 (PDT) MIME-Version: 1.0 References: <20220429195350.85620-1-lyude@redhat.com> In-Reply-To: From: Karol Herbst Date: Sat, 30 Apr 2022 11:23:26 +0200 Message-ID: Subject: Re: [PATCH] drm/nouveau/subdev/bus: Ratelimit logging for fault errors To: Lyude Paul Cc: nouveau , dri-devel , Ben Skeggs , David Airlie , Daniel Vetter , open list Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-3.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, SPF_HELO_NONE,SPF_NONE 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 On Sat, Apr 30, 2022 at 1:04 AM Lyude Paul wrote: > > On Sat, 2022-04-30 at 00:56 +0200, Karol Herbst wrote: > > On Fri, Apr 29, 2022 at 9:54 PM Lyude Paul wrote: > > > > > > There's plenty of ways to fudge the GPU when developing on nouveau by > > > mistake, some of which can result in nouveau seriously spamming dmesg with > > > fault errors. This can be somewhat annoying, as it can quickly overrun the > > > message buffer (or your terminal emulator's buffer) and get rid of > > > actually > > > useful feedback from the driver. While working on my new atomic only MST > > > branch, I ran into this issue a couple of times. > > > > > > So, let's fix this by adding nvkm_error_ratelimited(), and using it to > > > ratelimit errors from faults. This should be fine for developers, since > > > it's nearly always only the first few faults that we care about seeing. > > > Plus, you can turn off rate limiting in the kernel if you really need to. > > > > > > > good idea :) > > > > Although I think we ultimately need a detection of "GPU state is > > trashed" where we cease to do anything and disable interrupts as some > > of those issues actually cause the kernel to get DOSed by nouveau > > spamming/handling interrupts. Not sure if we should go with this patch > > in the meantime, or if we should just go straight ahead and disable > > interrupts, which would also stop the spam. > > > > Do you know if this patch here is enough to get the system to reboot > > normally or is it only spamming less? > > I'd have to try to come up with a setup that can hit this again, although it > might not be that hard - last time I hit this it was because I was programming > the wrong PBN values for MST payloads into nvidia's hardware. > > So I can't remember for sure if I could reboot, but I do know I could actually > log into the system easily and do stuff with ratelimiting applied so it's > definitely better then the current situation. > I can play around with your patch a little, as with broken multithreading and OpenCL I can trash my entire machine within split seconds quite reliably :) > > > > > Signed-off-by: Lyude Paul > > > --- > > > drivers/gpu/drm/nouveau/include/nvkm/core/subdev.h | 2 ++ > > > drivers/gpu/drm/nouveau/nvkm/subdev/bus/gf100.c | 14 +++++++------- > > > drivers/gpu/drm/nouveau/nvkm/subdev/bus/nv31.c | 6 +++--- > > > drivers/gpu/drm/nouveau/nvkm/subdev/bus/nv50.c | 6 +++--- > > > 4 files changed, 15 insertions(+), 13 deletions(-) > > > > > > diff --git a/drivers/gpu/drm/nouveau/include/nvkm/core/subdev.h > > > b/drivers/gpu/drm/nouveau/include/nvkm/core/subdev.h > > > index 1665738948fb..96113c8bee8c 100644 > > > --- a/drivers/gpu/drm/nouveau/include/nvkm/core/subdev.h > > > +++ b/drivers/gpu/drm/nouveau/include/nvkm/core/subdev.h > > > @@ -62,4 +62,6 @@ void nvkm_subdev_intr(struct nvkm_subdev *); > > > #define nvkm_debug(s,f,a...) nvkm_printk((s), DEBUG, info, f, ##a) > > > #define nvkm_trace(s,f,a...) nvkm_printk((s), TRACE, info, f, ##a) > > > #define nvkm_spam(s,f,a...) nvkm_printk((s), SPAM, dbg, f, ##a) > > > + > > > +#define nvkm_error_ratelimited(s,f,a...) nvkm_printk((s), ERROR, > > > err_ratelimited, f, ##a) > > > #endif > > > diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/bus/gf100.c > > > b/drivers/gpu/drm/nouveau/nvkm/subdev/bus/gf100.c > > > index 53a6651ac225..80b5aaceeaad 100644 > > > --- a/drivers/gpu/drm/nouveau/nvkm/subdev/bus/gf100.c > > > +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/bus/gf100.c > > > @@ -35,13 +35,13 @@ gf100_bus_intr(struct nvkm_bus *bus) > > > u32 addr = nvkm_rd32(device, 0x009084); > > > u32 data = nvkm_rd32(device, 0x009088); > > > > > > - nvkm_error(subdev, > > > - "MMIO %s of %08x FAULT at %06x [ %s%s%s]\n", > > > - (addr & 0x00000002) ? "write" : "read", data, > > > - (addr & 0x00fffffc), > > > - (stat & 0x00000002) ? "!ENGINE " : "", > > > - (stat & 0x00000004) ? "PRIVRING " : "", > > > - (stat & 0x00000008) ? "TIMEOUT " : ""); > > > + nvkm_error_ratelimited(subdev, > > > + "MMIO %s of %08x FAULT at %06x [ > > > %s%s%s]\n", > > > + (addr & 0x00000002) ? "write" : > > > "read", data, > > > + (addr & 0x00fffffc), > > > + (stat & 0x00000002) ? "!ENGINE " : > > > "", > > > + (stat & 0x00000004) ? "PRIVRING " : > > > "", > > > + (stat & 0x00000008) ? "TIMEOUT " : > > > ""); > > > > > > nvkm_wr32(device, 0x009084, 0x00000000); > > > nvkm_wr32(device, 0x001100, (stat & 0x0000000e)); > > > diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/bus/nv31.c > > > b/drivers/gpu/drm/nouveau/nvkm/subdev/bus/nv31.c > > > index ad8da523bb22..c75e463f3501 100644 > > > --- a/drivers/gpu/drm/nouveau/nvkm/subdev/bus/nv31.c > > > +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/bus/nv31.c > > > @@ -45,9 +45,9 @@ nv31_bus_intr(struct nvkm_bus *bus) > > > u32 addr = nvkm_rd32(device, 0x009084); > > > u32 data = nvkm_rd32(device, 0x009088); > > > > > > - nvkm_error(subdev, "MMIO %s of %08x FAULT at %06x\n", > > > - (addr & 0x00000002) ? "write" : "read", data, > > > - (addr & 0x00fffffc)); > > > + nvkm_error_ratelimited(subdev, "MMIO %s of %08x FAULT at > > > %06x\n", > > > + (addr & 0x00000002) ? "write" : > > > "read", data, > > > + (addr & 0x00fffffc)); > > > > > > stat &= ~0x00000008; > > > nvkm_wr32(device, 0x001100, 0x00000008); > > > diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/bus/nv50.c > > > b/drivers/gpu/drm/nouveau/nvkm/subdev/bus/nv50.c > > > index 3a1e45adeedc..2055d0b100d3 100644 > > > --- a/drivers/gpu/drm/nouveau/nvkm/subdev/bus/nv50.c > > > +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/bus/nv50.c > > > @@ -60,9 +60,9 @@ nv50_bus_intr(struct nvkm_bus *bus) > > > u32 addr = nvkm_rd32(device, 0x009084); > > > u32 data = nvkm_rd32(device, 0x009088); > > > > > > - nvkm_error(subdev, "MMIO %s of %08x FAULT at %06x\n", > > > - (addr & 0x00000002) ? "write" : "read", data, > > > - (addr & 0x00fffffc)); > > > + nvkm_error_ratelimited(subdev, "MMIO %s of %08x FAULT at > > > %06x\n", > > > + (addr & 0x00000002) ? "write" : > > > "read", data, > > > + (addr & 0x00fffffc)); > > > > > > stat &= ~0x00000008; > > > nvkm_wr32(device, 0x001100, 0x00000008); > > > -- > > > 2.35.1 > > > > > > > -- > Cheers, > Lyude Paul (she/her) > Software Engineer at Red Hat >