From patchwork Wed Jan 24 16:18:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tvrtko Ursulin X-Patchwork-Id: 10183253 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 6F86D60353 for ; Wed, 24 Jan 2018 23:09:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 570D028928 for ; Wed, 24 Jan 2018 23:09:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4BF0128942; Wed, 24 Jan 2018 23:09:04 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id D0A9328928 for ; Wed, 24 Jan 2018 23:09:03 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7BB616E6C9; Wed, 24 Jan 2018 23:08:22 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wr0-x242.google.com (mail-wr0-x242.google.com [IPv6:2a00:1450:400c:c0c::242]) by gabe.freedesktop.org (Postfix) with ESMTPS id 409F36E60C for ; Wed, 24 Jan 2018 16:18:56 +0000 (UTC) Received: by mail-wr0-x242.google.com with SMTP id e41so4622266wre.9 for ; Wed, 24 Jan 2018 08:18:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ursulin-net.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=TvWSowJOuG7SUGXk7ZMgSm3jZLcuGdWtZ9ZVw7lESrk=; b=mpRQqx8SHWrPVHQIzNwriuEOEqAkFhJY6YLJwxGf9BDthu5DEEuGhq21maQUxLn4NY mi+wcYXMUBsKCkmopzPcMP7R8flitSrtbZ2W07efCyH6ASJO3bfcxCfW8x8MVR5diACr Co6sm2dr2sIu+Q6cJM68wgI/A3On6eVBmToCKqZVubPpvp5mhBCy4zvyTNZc9gtllf9f mkiOGh7vFNt0mBci8QukM2vEGlN0Nn1e0Q7nZdSgBaf0x5P29HqzK6iqXyALVZznPBGZ 8YKbi1zw+LO+QsRCCz7yppJMGLLmaPCnr89guPminr58LaDOV+Nyx3LGlfW6R94ZUGS/ +0LQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=TvWSowJOuG7SUGXk7ZMgSm3jZLcuGdWtZ9ZVw7lESrk=; b=WI+31+o5xttM1GRemTEUxvSu/Jx57UxCO2G4Z9T6MD6Ofu23dtA3kzyK1v42jrvlve IfwfEkAL5RKfidKP+NCrM23J/ctljMEHTO1Z6xi8y9b1MCKEbCNQwDe61DRmUXNHRV7x lIPyhbI9X056tD9UQl5VILPf0lZTADn2ZbGujKo3ELd8uIH2PlV2P+L8a0jeHE0hvdf9 KoWTjzJznUoPj+NHIndLhFQ//7EwYWzdrl3ol20c0bK8CZtVhBt3hs61KkdfAfQveaQs UcgmoBmwCRlAmVLMr1gI6u+BQ6hgWKiyRVLRcS3/lRuxjRDJVfSZp//c0zsm6016qFoK vuvQ== X-Gm-Message-State: AKwxyteQ5pSa8FfEmvR0a6yBVtJpl/esUQ+tl4tJFMeuk9tY+8AwaAxD RioVx1YPCItZ4I8PEC8OTraGGg== X-Google-Smtp-Source: AH8x227EA3nEZBhPfCYP+kN9XnVLb4jZdDmXvnthVrQ9Tm9k+hYrsPM6esRGvYkcgLms4gfOSgEm4g== X-Received: by 10.223.139.67 with SMTP id v3mr5921163wra.162.1516810734876; Wed, 24 Jan 2018 08:18:54 -0800 (PST) Received: from localhost.localdomain ([95.146.148.3]) by smtp.gmail.com with ESMTPSA id y62sm5702609wrb.48.2018.01.24.08.18.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 24 Jan 2018 08:18:54 -0800 (PST) From: Tvrtko Ursulin X-Google-Original-From: Tvrtko Ursulin To: Intel-gfx@lists.freedesktop.org Subject: [RFC 4/6] drm: Respect driver set DRM_LOG_NAME in drm_printk Date: Wed, 24 Jan 2018 16:18:19 +0000 Message-Id: <20180124161821.28780-5-tvrtko.ursulin@linux.intel.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180124161821.28780-1-tvrtko.ursulin@linux.intel.com> References: <20180124161821.28780-1-tvrtko.ursulin@linux.intel.com> X-Mailman-Approved-At: Wed, 24 Jan 2018 23:07:46 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Tvrtko Ursulin , David Airlie , dri-devel@lists.freedesktop.org, tursulin@ursulin.net, Daniel Vetter MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Tvrtko Ursulin Since drm_printk is built inside the DRM core module, it will not respect the potentially overriden by the driver DRM_LOG_NAME. Make it tale the driver prefix and change it's wrappers so it is passed in from the driver code. This makes the driver log messages correctly identify from which driver they originated. For instance i915, instead of: [drm:edp_panel_off [i915]] Wait for panel power off time would now log debug messages as: [i915:edp_panel_off [i915]] Wait for panel power off time Signed-off-by: Tvrtko Ursulin Cc: Daniel Vetter Cc: Gustavo Padovan Cc: Sean Paul Cc: David Airlie Cc: dri-devel@lists.freedesktop.org --- drivers/gpu/drm/drm_print.c | 6 +++--- drivers/gpu/drm/i915/intel_display.c | 3 ++- include/drm/drm_print.h | 20 ++++++++++---------- 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/drivers/gpu/drm/drm_print.c b/drivers/gpu/drm/drm_print.c index 27244f11c9a3..90d38c830392 100644 --- a/drivers/gpu/drm/drm_print.c +++ b/drivers/gpu/drm/drm_print.c @@ -89,7 +89,7 @@ void drm_dev_printk(const struct device *dev, const char *level, } EXPORT_SYMBOL(drm_dev_printk); -void drm_printk(const char *level, unsigned int category, +void drm_printk(const char *level, unsigned int category, const char *driver, const char *format, ...) { struct va_format vaf; @@ -102,8 +102,8 @@ void drm_printk(const char *level, unsigned int category, vaf.fmt = format; vaf.va = &args; - printk("%s" "[" DRM_LOG_NAME ":%ps]%s %pV", - level, __builtin_return_address(0), + printk("%s[%s:%ps]%s %pV", + level, driver, __builtin_return_address(0), strcmp(level, KERN_ERR) == 0 ? " *ERROR*" : "", &vaf); va_end(args); diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index d585ce4c8732..51fea2eb1b2e 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c @@ -10973,7 +10973,8 @@ pipe_config_err(bool adjust, const char *name, const char *format, ...) vaf.fmt = format; vaf.va = &args; - drm_printk(level, category, "mismatch in %s %pV", name, &vaf); + drm_printk(level, category, DRM_LOG_NAME, "mismatch in %s %pV", name, + &vaf); va_end(args); } diff --git a/include/drm/drm_print.h b/include/drm/drm_print.h index d6901128faf2..c6047de9cbcc 100644 --- a/include/drm/drm_print.h +++ b/include/drm/drm_print.h @@ -207,8 +207,8 @@ __printf(6, 7) void drm_dev_printk(const struct device *dev, const char *level, unsigned int category, const char *function_name, const char *prefix, const char *format, ...); -__printf(3, 4) -void drm_printk(const char *level, unsigned int category, +__printf(4, 5) +void drm_printk(const char *level, unsigned int category, const char *driver, const char *format, ...); /* Macros to make printk easier */ @@ -243,7 +243,7 @@ void drm_printk(const char *level, unsigned int category, drm_dev_printk(dev, KERN_ERR, DRM_UT_NONE, __func__, " *ERROR*",\ fmt, ##__VA_ARGS__) #define DRM_ERROR(fmt, ...) \ - drm_printk(KERN_ERR, DRM_UT_NONE, fmt, ##__VA_ARGS__) + drm_printk(KERN_ERR, DRM_UT_NONE, DRM_LOG_NAME, fmt, ##__VA_ARGS__) /** * Rate limited error output. Like DRM_ERROR() but won't flood the log. @@ -286,40 +286,40 @@ void drm_printk(const char *level, unsigned int category, drm_dev_printk(dev, KERN_DEBUG, DRM_UT_CORE, __func__, "", fmt, \ ##args) #define DRM_DEBUG(fmt, ...) \ - drm_printk(KERN_DEBUG, DRM_UT_CORE, fmt, ##__VA_ARGS__) + drm_printk(KERN_DEBUG, DRM_UT_CORE, DRM_LOG_NAME, fmt, ##__VA_ARGS__) #define DRM_DEV_DEBUG_DRIVER(dev, fmt, args...) \ drm_dev_printk(dev, KERN_DEBUG, DRM_UT_DRIVER, __func__, "", \ fmt, ##args) #define DRM_DEBUG_DRIVER(fmt, ...) \ - drm_printk(KERN_DEBUG, DRM_UT_DRIVER, fmt, ##__VA_ARGS__) + drm_printk(KERN_DEBUG, DRM_UT_DRIVER, DRM_LOG_NAME, fmt, ##__VA_ARGS__) #define DRM_DEV_DEBUG_KMS(dev, fmt, args...) \ drm_dev_printk(dev, KERN_DEBUG, DRM_UT_KMS, __func__, "", fmt, \ ##args) #define DRM_DEBUG_KMS(fmt, ...) \ - drm_printk(KERN_DEBUG, DRM_UT_KMS, fmt, ##__VA_ARGS__) + drm_printk(KERN_DEBUG, DRM_UT_KMS, DRM_LOG_NAME, fmt, ##__VA_ARGS__) #define DRM_DEV_DEBUG_PRIME(dev, fmt, args...) \ drm_dev_printk(dev, KERN_DEBUG, DRM_UT_PRIME, __func__, "", \ fmt, ##args) #define DRM_DEBUG_PRIME(fmt, ...) \ - drm_printk(KERN_DEBUG, DRM_UT_PRIME, fmt, ##__VA_ARGS__) + drm_printk(KERN_DEBUG, DRM_UT_PRIME, DRM_LOG_NAME, fmt, ##__VA_ARGS__) #define DRM_DEV_DEBUG_ATOMIC(dev, fmt, args...) \ drm_dev_printk(dev, KERN_DEBUG, DRM_UT_ATOMIC, __func__, "", \ fmt, ##args) #define DRM_DEBUG_ATOMIC(fmt, ...) \ - drm_printk(KERN_DEBUG, DRM_UT_ATOMIC, fmt, ##__VA_ARGS__) + drm_printk(KERN_DEBUG, DRM_UT_ATOMIC, DRM_LOG_NAME, fmt, ##__VA_ARGS__) #define DRM_DEV_DEBUG_VBL(dev, fmt, args...) \ drm_dev_printk(dev, KERN_DEBUG, DRM_UT_VBL, __func__, "", fmt, \ ##args) #define DRM_DEBUG_VBL(fmt, ...) \ - drm_printk(KERN_DEBUG, DRM_UT_VBL, fmt, ##__VA_ARGS__) + drm_printk(KERN_DEBUG, DRM_UT_VBL, DRM_LOG_NAME, fmt, ##__VA_ARGS__) #define DRM_DEBUG_LEASE(fmt, ...) \ - drm_printk(KERN_DEBUG, DRM_UT_LEASE, fmt, ##__VA_ARGS__) + drm_printk(KERN_DEBUG, DRM_UT_LEASE, DRM_LOG_NAME, fmt, ##__VA_ARGS__) #define _DRM_DEV_DEFINE_DEBUG_RATELIMITED(dev, level, fmt, args...) \ ({ \