[PATCH] drm: Print unadorned pointers

Greg Kroah-Hartman gregkh at linuxfoundation.org
Wed Apr 18 15:52:09 UTC 2018


On Wed, Apr 18, 2018 at 12:24:50PM +0300, Alexey Brodkin wrote:
> After commit ad67b74 ("printk: hash addresses printed with %p")
> pointers are being hashed when printed. However, this makes
> debug output completely useless. Switch to %px in order to see the
> unadorned kernel pointers.
> 
> This was done with the following one-liner:
>  find drivers/gpu/drm -type f -name "*.c" -exec sed -r -i '/DRM_DEBUG|KERN_DEBUG|pr_debug/ s/%p\b/%px/g' {} +
> 
> Signed-off-by: Alexey Brodkin <abrodkin at synopsys.com>
> Cc: Borislav Petkov <bp at suse.de>
> Cc: Tobin C. Harding <me at tobin.cc>
> Cc: Alex Deucher <alexander.deucher at amd.com>
> Cc: Andrey Grodzovsky <andrey.grodzovsky at amd.com>
> Cc: Arnd Bergmann <arnd at arndb.de>
> Cc: Benjamin Gaignard <benjamin.gaignard at linaro.org>
> Cc: Chen-Yu Tsai <wens at csie.org>
> Cc: Christian Gmeiner <christian.gmeiner at gmail.com>
> Cc: "Christian König" <christian.koenig at amd.com>
> Cc: Cihangir Akturk <cakturk at gmail.com>
> Cc: CK Hu <ck.hu at mediatek.com>
> Cc: Daniel Vetter <daniel.vetter at ffwll.ch>
> Cc: Dave Airlie <airlied at redhat.com>
> Cc: David Airlie <airlied at linux.ie>
> Cc: "David (ChunMing) Zhou" <David1.Zhou at amd.com>
> Cc: Gerd Hoffmann <kraxel at redhat.com>
> Cc: Greg Kroah-Hartman <gregkh at linuxfoundation.org>
> Cc: Gustavo Padovan <gustavo at padovan.org>
> Cc: Harry Wentland <harry.wentland at amd.com>
> Cc: "Heiko Stübner" <heiko at sntech.de>
> Cc: Ingo Molnar <mingo at kernel.org>
> Cc: Jani Nikula <jani.nikula at linux.intel.com>
> Cc: "Jerry (Fangzhi) Zuo" <Jerry.Zuo at amd.com>
> Cc: Joonas Lahtinen <joonas.lahtinen at linux.intel.com>
> Cc: Krzysztof Kozlowski <krzk at kernel.org>
> Cc: "Leo (Sunpeng) Li" <sunpeng.li at amd.com>
> Cc: Lucas Stach <l.stach at pengutronix.de>
> Cc: Maarten Lankhorst <maarten.lankhorst at linux.intel.com>
> Cc: Matthias Brugger <matthias.bgg at gmail.com>
> Cc: Maxime Ripard <maxime.ripard at bootlin.com>
> Cc: "Michel Dänzer" <michel.daenzer at amd.com>
> Cc: Oded Gabbay <oded.gabbay at gmail.com>
> Cc: Philipp Zabel <p.zabel at pengutronix.de>
> Cc: Rob Clark <robdclark at gmail.com>
> Cc: Rodrigo Vivi <rodrigo.vivi at intel.com>
> Cc: Roger He <Hongbo.He at amd.com>
> Cc: Roman Li <Roman.Li at amd.com>
> Cc: Russell King <linux at armlinux.org.uk>
> Cc: Samuel Li <Samuel.Li at amd.com>
> Cc: Sandy Huang <hjc at rock-chips.com>
> Cc: Sean Paul <seanpaul at chromium.org>
> Cc: Shirish S <shirish.s at amd.com>
> Cc: Sinclair Yeh <syeh at vmware.com>
> Cc: Thomas Hellstrom <thellstrom at vmware.com>
> Cc: Tom Lendacky <thomas.lendacky at amd.com>
> Cc: Tony Cheng <Tony.Cheng at amd.com>
> Cc: Vincent Abriou <vincent.abriou at st.com>
> Cc: VMware Graphics <linux-graphics-maintainer at vmware.com>
> Cc: linux-arm-kernel at lists.infradead.org
> Cc: linux-arm-msm at vger.kernel.org
> Cc: linux-kernel at vger.kernel.org
> Cc: linux-mediatek at lists.infradead.org
> Cc: linux-rockchip at lists.infradead.org
> Cc: etnaviv at lists.freedesktop.org
> Cc: freedreno at lists.freedesktop.org
> Cc: amd-gfx at lists.freedesktop.org
> Cc: intel-gfx at lists.freedesktop.org
> Cc: virtualization at lists.linux-foundation.org
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c   | 14 +++----
>  drivers/gpu/drm/amd/amdgpu/amdgpu_display.c        |  4 +-
>  drivers/gpu/drm/amd/amdkfd/kfd_chardev.c           |  4 +-
>  drivers/gpu/drm/amd/amdkfd/kfd_dbgdev.c            |  2 +-
>  drivers/gpu/drm/amd/amdkfd/kfd_device.c            | 10 ++---
>  drivers/gpu/drm/amd/amdkfd/kfd_doorbell.c          |  4 +-
>  drivers/gpu/drm/amd/amdkfd/kfd_events.c            |  4 +-
>  drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue.c      |  2 +-
>  drivers/gpu/drm/amd/amdkfd/kfd_process.c           |  4 +-
>  drivers/gpu/drm/amd/amdkfd/kfd_queue.c             | 18 ++++-----
>  drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c  | 14 +++----
>  .../amd/display/amdgpu_dm/amdgpu_dm_mst_types.c    |  2 +-
>  drivers/gpu/drm/armada/armada_gem.c                | 12 +++---
>  drivers/gpu/drm/drm_atomic.c                       | 44 +++++++++++-----------
>  drivers/gpu/drm/drm_bufs.c                         |  8 ++--
>  drivers/gpu/drm/drm_dp_mst_topology.c              |  4 +-
>  drivers/gpu/drm/drm_lease.c                        |  6 +--
>  drivers/gpu/drm/drm_lock.c                         |  2 +-
>  drivers/gpu/drm/drm_scatter.c                      |  4 +-
>  drivers/gpu/drm/etnaviv/etnaviv_drv.c              |  6 +--
>  drivers/gpu/drm/i810/i810_dma.c                    |  2 +-
>  drivers/gpu/drm/i915/i915_perf.c                   |  2 +-
>  drivers/gpu/drm/i915/intel_display.c               |  2 +-
>  drivers/gpu/drm/i915/intel_guc_ct.c                |  4 +-
>  drivers/gpu/drm/i915/intel_guc_submission.c        |  2 +-
>  drivers/gpu/drm/i915/intel_uc_fw.c                 |  2 +-
>  drivers/gpu/drm/mediatek/mtk_drm_gem.c             |  2 +-
>  drivers/gpu/drm/mga/mga_warp.c                     |  2 +-
>  drivers/gpu/drm/msm/msm_drv.c                      |  4 +-
>  drivers/gpu/drm/qxl/qxl_cmd.c                      |  4 +-
>  drivers/gpu/drm/qxl/qxl_fb.c                       |  2 +-
>  drivers/gpu/drm/qxl/qxl_ttm.c                      |  2 +-
>  drivers/gpu/drm/radeon/radeon_display.c            |  2 +-
>  drivers/gpu/drm/radeon/radeon_dp_mst.c             | 12 +++---
>  drivers/gpu/drm/radeon/radeon_object.c             |  2 +-
>  drivers/gpu/drm/rockchip/rockchip_drm_fbdev.c      |  2 +-
>  drivers/gpu/drm/savage/savage_bci.c                |  2 +-
>  drivers/gpu/drm/sti/sti_gdp.c                      |  4 +-
>  drivers/gpu/drm/sti/sti_mixer.c                    |  2 +-
>  drivers/gpu/drm/sun4i/sun4i_crtc.c                 |  4 +-
>  drivers/gpu/drm/ttm/ttm_page_alloc.c               |  2 +-
>  drivers/gpu/drm/udl/udl_fb.c                       |  2 +-
>  drivers/gpu/drm/via/via_dma.c                      |  4 +-
>  drivers/gpu/drm/via/via_irq.c                      |  2 +-
>  drivers/gpu/drm/vmwgfx/vmwgfx_overlay.c            |  2 +-
>  45 files changed, 120 insertions(+), 120 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
> index 1d6e1479da38..32e85fe83152 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
> @@ -438,7 +438,7 @@ static int add_bo_to_vm(struct amdgpu_device *adev, struct kgd_mem *mem,
>  	if (!bo_va_entry)
>  		return -ENOMEM;
>  
> -	pr_debug("\t add VA 0x%llx - 0x%llx to vm %p\n", va,
> +	pr_debug("\t add VA 0x%llx - 0x%llx to vm %px\n", va,
>  			va + bo_size, vm);
>  
>  	/* Add BO to VM internal data structures*/

<snip>

As others have pointed out, please do not do this.  Use %pK as needed.
And perhaps revisit some of the "need" for these pointers at all in the
first place...

thanks,

greg k-h


More information about the amd-gfx mailing list