Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp5672867ybi; Wed, 31 Jul 2019 01:26:11 -0700 (PDT) X-Google-Smtp-Source: APXvYqyz6YNUNSueTcZq3RVG1VhtLBjH5nU8tEysPPo61OKW3gGzuDDvBN4eQ1Vo5ul29AKIBjdk X-Received: by 2002:a17:90a:28e4:: with SMTP id f91mr1626056pjd.99.1564561570909; Wed, 31 Jul 2019 01:26:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564561570; cv=none; d=google.com; s=arc-20160816; b=szFbj6ypIUAB9lsKT1Rn4OiJs2WXeEuDX9JSWDJV5IgCyd2IIBJuSgEAfBzxbTZor/ 5NgrvbmnsOdAvwe9rB4lZL2cSf65n9fE3xxxkDVQeajU/euaQNdeKJvC4Tnn+b0Da5RL DsaBoawaah4d7OY3IeMXgga7RxMLKHjprdmwpqax36vG+geoEdzez17YXf+7AUrnPNlp uzlDRqBG3LVsbz1o8iehMzj7xVbaDSuotUAvdnuTNo82SW18fkALsfTvPVbfWqMfQpga Tqm+xT2qHKG2tMoKaNYx9N6ULrTj4HIWtqfKS5sfHR6DuTow3v0wTvkKrtzhDeb6LrVv iadw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=xzym8/dUuXuGiOMMezN5bW3u98W2F4vTa3EFglwr9Xk=; b=hSFtj7b09/i/myXB5oQendcWN8Ma1O18YqnO8kQJ+3u+UYghPvBzXgV4WtztnFk261 Aie1T8TPrSjxTJO/Yb6VZNs3C8+MH1Yj6L9yVyLcS0+iKFR0f41i8hmy7r8DCF6CIQLl crMsgzE2/GZfonU0DWKTFC+g4lY6jxm5woRnydrayeKDpt2Uueo2BfoZyEtOsu2D17XQ rgt/JUzj2aWN7MBTYmMWdsQKJfPgKhl/pj4E6es8sPsh+eePS0AfJa/L4ww8F9GeY54B hsEaLPWSFQn2hympvmyjwZPqlAb4T6eXM4V4tyLYU1VETq+WhopeoNWTR+aPjbDqT6IE szZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=RlfDdsWw; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 3si30160921pli.12.2019.07.31.01.25.56; Wed, 31 Jul 2019 01:26:10 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=RlfDdsWw; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727406AbfGaG0T (ORCPT + 99 others); Wed, 31 Jul 2019 02:26:19 -0400 Received: from mail-yb1-f196.google.com ([209.85.219.196]:33355 "EHLO mail-yb1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726652AbfGaG0T (ORCPT ); Wed, 31 Jul 2019 02:26:19 -0400 Received: by mail-yb1-f196.google.com with SMTP id c202so22718390ybf.0 for ; Tue, 30 Jul 2019 23:26:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=xzym8/dUuXuGiOMMezN5bW3u98W2F4vTa3EFglwr9Xk=; b=RlfDdsWwTMhs4L47y3YvK1IPZw4kW+5WVucupuREnMgiVDQyq+AyL3EVp7fWh23/wG qABS5+Ebz42PHuy3fYI4w2XUSESBZJIykM24cdwR25y1KLutNJ8Zo72oaMmiB9RUhHkX B4L+kxotm1UTrBAuWrKKV/xSFhQVD+Sy5XaD50zRbR3fqgAiSb6pXERpm/Pfk1K4CH6Z zUh2+YiKza+gZE075cQjGveh6Iq1ud9e9wzHGkHkF5IpZyHOfQRld5tV0JxqPHI8X8TT 2UsrEud3np2irIlQkjf1UD+qGxCiSINhcqJmspatsmCjrKglau8M5UdxGaRDnrQyIto6 rU+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=xzym8/dUuXuGiOMMezN5bW3u98W2F4vTa3EFglwr9Xk=; b=MToa0mCx+MbUYiDCWaJQaurir82No02XQTLxq37mLSwzeQShan1M/h0QdbI1umCWj+ GjureK1ifB/GhwSDKfPVqx67StSaHrdaQREuaL4hAHfIc8NeAvO7n5gMBz+SABm9pPmd KlUfMGqgpzPjKB+SzvwJOa78ahycU1CQa2WSpDKG0h6O4I3LuppJQrXeXx3iPPXkWRyS s333mhCbTjxwl6XxrlLPrWDESZB8KWDIBr9+rzeEWdwn/qqzM0WEIErTu+8TJrjNqr3z JpIlJfC+7b9IHe+FaU5eIiKlOkqlagJ8SzB/3PZdveik9PwsG78rDktsWgXrfdOrg+Ck aOgw== X-Gm-Message-State: APjAAAWzJTRO1Vy71RSPikyTN5DnnRz9kW4NaXCbkxUokvUq6bWQQnNz G2/vT5spDkKzOpO0e77WwByOehmB+VUGEEJAe1k= X-Received: by 2002:a25:830e:: with SMTP id s14mr74917205ybk.500.1564554378800; Tue, 30 Jul 2019 23:26:18 -0700 (PDT) MIME-Version: 1.0 References: <20190731024533.22264-1-huangfq.daxian@gmail.com> <520bd0f7367e77ffd2e0150187f6ffb64b0e8b71.camel@perches.com> In-Reply-To: <520bd0f7367e77ffd2e0150187f6ffb64b0e8b71.camel@perches.com> From: Fuqian Huang Date: Wed, 31 Jul 2019 14:26:07 +0800 Message-ID: Subject: Re: [PATCH] drm: use trace_printk rather than printk in drm_dbg. To: Joe Perches Cc: Maarten Lankhorst , Maxime Ripard , Sean Paul , David Airlie , Daniel Vetter , dri-devel@lists.freedesktop.org, Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Joe Perches =E6=96=BC 2019=E5=B9=B47=E6=9C=8831=E6=97=A5= =E9=80=B1=E4=B8=89 =E4=B8=8B=E5=8D=882:06=E5=AF=AB=E9=81=93=EF=BC=9A > > On Wed, 2019-07-31 at 10:45 +0800, Fuqian Huang wrote: > > In drivers/gpu/drm/amd/amdgpu/amdgpu_ih.c, > > amdgpu_ih_process calls DRM_DEBUG which calls drm_dbg and > > finally calls printk. > > As amdgpu_ih_process is called from an interrupt handler, > > and interrupt handler should be short as possible. > > > > As printk may lead to bogging down the system or can even > > create a live lock. printk should not be used in IRQ context. > > Instead, trace_printk is recommended. > > Link: https://lwn.net/Articles/365835 > [] > > diff --git a/drivers/gpu/drm/drm_print.c b/drivers/gpu/drm/drm_print.c > [] > > @@ -236,7 +236,7 @@ void drm_dbg(unsigned int category, const char *for= mat, ...) > > vaf.fmt =3D format; > > vaf.va =3D &args; > > > > - printk(KERN_DEBUG "[" DRM_NAME ":%ps] %pV", > > + trace_printk(KERN_DEBUG "[" DRM_NAME ":%ps] %pV", > > __builtin_return_address(0), &vaf); > > > > va_end(args); > > This makes all 4000+ drm_dbg/DRM_DEBUG uses emit > a trace_printk. > > I suggest instead you make only the interrupt uses > use a different function and not drm_dbg. > > Or maybe add an in_interrupt() check like > > if (in_interrupt()) > printk(KERN_DEBUG etc...) > else > trace_printk(etc...) I will send a v2 patch to fix this.