From patchwork Wed Dec 5 16:56:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Michel_D=C3=A4nzer?= X-Patchwork-Id: 10714631 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D47F01731 for ; Wed, 5 Dec 2018 16:56:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C36322DDF7 for ; Wed, 5 Dec 2018 16:56:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B54AC2DE5F; Wed, 5 Dec 2018 16:56:27 +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=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham 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 4B57B2DDF7 for ; Wed, 5 Dec 2018 16:56:27 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2F3AB6E4B0; Wed, 5 Dec 2018 16:56:26 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from netline-mail3.netline.ch (mail.netline.ch [148.251.143.178]) by gabe.freedesktop.org (Postfix) with ESMTP id 065AA6E4A7 for ; Wed, 5 Dec 2018 16:56:25 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by netline-mail3.netline.ch (Postfix) with ESMTP id 246082A604C; Wed, 5 Dec 2018 17:56:24 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at netline-mail3.netline.ch Received: from netline-mail3.netline.ch ([127.0.0.1]) by localhost (netline-mail3.netline.ch [127.0.0.1]) (amavisd-new, port 10024) with LMTP id b476zuukV2dg; Wed, 5 Dec 2018 17:56:22 +0100 (CET) Received: from kaveri (39.1.199.178.dynamic.wline.res.cust.swisscom.ch [178.199.1.39]) by netline-mail3.netline.ch (Postfix) with ESMTPSA id 892332A604B; Wed, 5 Dec 2018 17:56:22 +0100 (CET) Received: from daenzer by kaveri with local (Exim 4.91) (envelope-from ) id 1gUaTF-0001WN-UA; Wed, 05 Dec 2018 17:56:21 +0100 From: =?utf-8?q?Michel_D=C3=A4nzer?= To: Christian Koenig , Huang Rui , Junwei Zhang , Maarten Lankhorst , Maxime Ripard , Sean Paul , David Airlie Subject: [PATCH 1/2] drm: Only #define DEBUG if CONFIG_DYNAMIC_DEBUG is disabled Date: Wed, 5 Dec 2018 17:56:20 +0100 Message-Id: <20181205165621.5805-1-michel@daenzer.net> X-Mailer: git-send-email 2.20.0.rc2 MIME-Version: 1.0 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: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Michel Dänzer The following cases are possible for pr_debug(): 1. CONFIG_DYNAMIC_DEBUG disabled a) DEBUG not defined: pr_debug() translates to no_printk(...), i.e. it never generates any output. b) DEBUG defined: pr_debug() translates to printk(KERN_DEBUG ...), i.e. it generates output which doesn't appear in dmesg by default, can be enabled dynamically. 2. CONFIG_DYNAMIC_DEBUG enabled: pr_debug() translates to dynamic_pr_debug() a) DEBUG not defined: dynamic_pr_debug() generates no output by default, can be enabled dynamically. b) DEBUG defined: dynamic_pr_debug() generates output by default, can be disabled dynamically. The intention for drm_debug_printer() is to generate output which doesn't appear in dmesg by default, but can be enabled dynamically, i.e. cases 1b) and 2a). However, defining DEBUG unconditionally gave us 2b) instead of 2a) with CONFIG_DYNAMIC_DEBUG enabled. Fixes: 79a5ad2fdb3c ("drm: Enable pr_debug() for drm_printer") Signed-off-by: Michel Dänzer Reviewed-by: Junwei Zhang --- drivers/gpu/drm/drm_print.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/drm_print.c b/drivers/gpu/drm/drm_print.c index 0e7fc3e7dfb4..ee56e4a1b343 100644 --- a/drivers/gpu/drm/drm_print.c +++ b/drivers/gpu/drm/drm_print.c @@ -23,11 +23,13 @@ * Rob Clark */ -#define DEBUG /* for pr_debug() */ - #include #include #include + +#ifndef CONFIG_DYNAMIC_DEBUG +#define DEBUG /* for pr_debug() */ +#endif #include void __drm_puts_coredump(struct drm_printer *p, const char *str) From patchwork Wed Dec 5 16:56:21 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Michel_D=C3=A4nzer?= X-Patchwork-Id: 10714633 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 582DF1731 for ; Wed, 5 Dec 2018 16:56:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 46F2D2DD8F for ; Wed, 5 Dec 2018 16:56:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 39AE92DDFA; Wed, 5 Dec 2018 16:56:30 +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=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham 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 D92462DD8F for ; Wed, 5 Dec 2018 16:56:29 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4606C6E4A7; Wed, 5 Dec 2018 16:56:28 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from netline-mail3.netline.ch (mail.netline.ch [148.251.143.178]) by gabe.freedesktop.org (Postfix) with ESMTP id C87156E4A7 for ; Wed, 5 Dec 2018 16:56:25 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by netline-mail3.netline.ch (Postfix) with ESMTP id 243312A604B; Wed, 5 Dec 2018 17:56:25 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at netline-mail3.netline.ch Received: from netline-mail3.netline.ch ([127.0.0.1]) by localhost (netline-mail3.netline.ch [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 6kANUdsGjnjo; Wed, 5 Dec 2018 17:56:22 +0100 (CET) Received: from kaveri (39.1.199.178.dynamic.wline.res.cust.swisscom.ch [178.199.1.39]) by netline-mail3.netline.ch (Postfix) with ESMTPSA id 828B72A604A; Wed, 5 Dec 2018 17:56:22 +0100 (CET) Received: from daenzer by kaveri with local (Exim 4.91) (envelope-from ) id 1gUaTF-0001WP-Vb; Wed, 05 Dec 2018 17:56:21 +0100 From: =?utf-8?q?Michel_D=C3=A4nzer?= To: Christian Koenig , Huang Rui , Junwei Zhang , Maarten Lankhorst , Maxime Ripard , Sean Paul , David Airlie Subject: [PATCH 2/2] drm/ttm: Use pr_debug for all output from ttm_bo_evict Date: Wed, 5 Dec 2018 17:56:21 +0100 Message-Id: <20181205165621.5805-2-michel@daenzer.net> X-Mailer: git-send-email 2.20.0.rc2 In-Reply-To: <20181205165621.5805-1-michel@daenzer.net> References: <20181205165621.5805-1-michel@daenzer.net> MIME-Version: 1.0 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: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Michel Dänzer All the output is related, so it should all be printed the same way. Some of it was using pr_debug, but some of it appeared in dmesg by default. The caller should handle failure, so there's no need to spam dmesg with potentially quite a lot of output by default. Signed-off-by: Michel Dänzer --- drivers/gpu/drm/ttm/ttm_bo.c | 39 ++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c index d87935bf8e30..5e9b9dd91629 100644 --- a/drivers/gpu/drm/ttm/ttm_bo.c +++ b/drivers/gpu/drm/ttm/ttm_bo.c @@ -77,38 +77,39 @@ static inline int ttm_mem_type_from_place(const struct ttm_place *place, return 0; } -static void ttm_mem_type_debug(struct ttm_bo_device *bdev, int mem_type) +static void ttm_mem_type_debug(struct ttm_bo_device *bdev, struct drm_printer *p, + int mem_type) { struct ttm_mem_type_manager *man = &bdev->man[mem_type]; - struct drm_printer p = drm_debug_printer(TTM_PFX); - pr_err(" has_type: %d\n", man->has_type); - pr_err(" use_type: %d\n", man->use_type); - pr_err(" flags: 0x%08X\n", man->flags); - pr_err(" gpu_offset: 0x%08llX\n", man->gpu_offset); - pr_err(" size: %llu\n", man->size); - pr_err(" available_caching: 0x%08X\n", man->available_caching); - pr_err(" default_caching: 0x%08X\n", man->default_caching); + drm_printf(p, " has_type: %d\n", man->has_type); + drm_printf(p, " use_type: %d\n", man->use_type); + drm_printf(p, " flags: 0x%08X\n", man->flags); + drm_printf(p, " gpu_offset: 0x%08llX\n", man->gpu_offset); + drm_printf(p, " size: %llu\n", man->size); + drm_printf(p, " available_caching: 0x%08X\n", man->available_caching); + drm_printf(p, " default_caching: 0x%08X\n", man->default_caching); if (mem_type != TTM_PL_SYSTEM) - (*man->func->debug)(man, &p); + (*man->func->debug)(man, p); } static void ttm_bo_mem_space_debug(struct ttm_buffer_object *bo, struct ttm_placement *placement) { + struct drm_printer p = drm_debug_printer(TTM_PFX); int i, ret, mem_type; - pr_err("No space for %p (%lu pages, %luK, %luM)\n", - bo, bo->mem.num_pages, bo->mem.size >> 10, - bo->mem.size >> 20); + drm_printf(&p, "No space for %p (%lu pages, %luK, %luM)\n", + bo, bo->mem.num_pages, bo->mem.size >> 10, + bo->mem.size >> 20); for (i = 0; i < placement->num_placement; i++) { ret = ttm_mem_type_from_place(&placement->placement[i], &mem_type); if (ret) return; - pr_err(" placement[%d]=0x%08X (%d)\n", - i, placement->placement[i].flags, mem_type); - ttm_mem_type_debug(bo->bdev, mem_type); + drm_printf(&p, " placement[%d]=0x%08X (%d)\n", + i, placement->placement[i].flags, mem_type); + ttm_mem_type_debug(bo->bdev, &p, mem_type); } } @@ -728,8 +729,8 @@ static int ttm_bo_evict(struct ttm_buffer_object *bo, ret = ttm_bo_mem_space(bo, &placement, &evict_mem, ctx); if (ret) { if (ret != -ERESTARTSYS) { - pr_err("Failed to find memory space for buffer 0x%p eviction\n", - bo); + pr_debug("Failed to find memory space for buffer 0x%p eviction\n", + bo); ttm_bo_mem_space_debug(bo, &placement); } goto out; @@ -738,7 +739,7 @@ static int ttm_bo_evict(struct ttm_buffer_object *bo, ret = ttm_bo_handle_move_mem(bo, &evict_mem, true, ctx); if (unlikely(ret)) { if (ret != -ERESTARTSYS) - pr_err("Buffer eviction failed\n"); + pr_debug("Buffer eviction failed\n"); ttm_bo_mem_put(bo, &evict_mem); goto out; }