Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp582915ybv; Thu, 13 Feb 2020 06:06:03 -0800 (PST) X-Google-Smtp-Source: APXvYqw7nI55asd7tzWnYAIGP3jYhKoMhFdTb2wsrzbtmkC/iVFDHrAF9gj3Du1/zlfSQAL2p9Y8 X-Received: by 2002:aca:f0b:: with SMTP id 11mr3135919oip.34.1581602763247; Thu, 13 Feb 2020 06:06:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581602763; cv=none; d=google.com; s=arc-20160816; b=z/zx9UJ6aWolEmqvLUx/l6bxKARpSgM3WqWFxiZ8rqS2WkBVoQm+rReFDmEeoZgQLf sTrsLSXD+mLwgwK1vRiALjOXCVkV7KMsv53Tq5K2x7UYPN6LttNAU5Db3RmPMeHAPRKk +0SMVfZBY/AaMS/AoUg59Xdi+LCgFrU1f+JCgZTV9T0SaHxu5A2kEEIs2Fko2Zhmi3w1 AcoHdlcMk39H/iytKARR6OVMlvME0yfw5M3flDjB+e6eyt2vb0SHfH+weugfnBomcGrL WWu2kj0vWstbs9Nk/VelctcxzT/rYf7URh+tk3lbYrVXD3Neb+zaOCuS547wxon4FII8 f1dw== 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:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=CboiRGwPccU16JPmwJNycmk1OL4vm5JgAqCGlW1NfgY=; b=VGeJCU0nNohgzEX3za6OyCJ+VuyTDxF1qiVjL21gy01X3XeEXSCje64TRVSeq1GprE V1O+epUl9ClY/4OEu2XXLWcctWfL/mthftCk4zYhKBrO7s6W4BUzpTJ83jT3tW3pK8Kk V5XD7Af5lxu9hRR+PbdbrYK/blras79yRgoSlbz1KLrtTVr8uqqcdTHYVPU1q41t1Rr0 YV6wUqawY2u2tM++U/c1jDhM7hmQtTLA1t9VxXUfwEbvw+z3RsRyfHQ74O5nenQDurIi h9c0M007c8NBd6ZAw6iqvRknkuQ9GV56DAN8131KrDFmiTRcsb1iqzTCKBCFFB82yvUv S29A== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z22si1075945otq.94.2020.02.13.06.05.39; Thu, 13 Feb 2020 06:06:03 -0800 (PST) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730140AbgBMODL (ORCPT + 99 others); Thu, 13 Feb 2020 09:03:11 -0500 Received: from mail.kernel.org ([198.145.29.99]:42446 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729957AbgBMODL (ORCPT ); Thu, 13 Feb 2020 09:03:11 -0500 Received: from gandalf.local.home (cpe-66-24-58-225.stny.res.rr.com [66.24.58.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 4B0A72073C; Thu, 13 Feb 2020 14:03:10 +0000 (UTC) Date: Thu, 13 Feb 2020 09:03:08 -0500 From: Steven Rostedt To: zzyiwei@google.com Cc: linux-kernel@vger.kernel.org, prahladk@google.com, joelaf@google.com, android-kernel@google.com Subject: Re: [PATCH v3] gpu/trace: add gpu memory tracepoints Message-ID: <20200213090308.223f3f20@gandalf.local.home> In-Reply-To: <20200213042331.157606-1-zzyiwei@google.com> References: <20200212222922.5dfa9f36@oasis.local.home> <20200213042331.157606-1-zzyiwei@google.com> X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Yiwei, You left off a lot of people that you Cc'd for the previous versions. You'll need at least Greg's acked-by on this, and perhaps even others that own the gpu directory. -- Steve On Wed, 12 Feb 2020 20:23:31 -0800 zzyiwei@google.com wrote: > From: Yiwei Zhang > > This change adds the below gpu memory tracepoint: > gpu_mem/gpu_mem_total: track global or process gpu memory total counters > > Signed-off-by: Yiwei Zhang > --- > drivers/Kconfig | 2 ++ > drivers/gpu/Makefile | 1 + > drivers/gpu/trace/Kconfig | 4 +++ > drivers/gpu/trace/Makefile | 3 ++ > drivers/gpu/trace/trace_gpu_mem.c | 13 +++++++ > include/trace/events/gpu_mem.h | 57 +++++++++++++++++++++++++++++++ > 6 files changed, 80 insertions(+) > create mode 100644 drivers/gpu/trace/Kconfig > create mode 100644 drivers/gpu/trace/Makefile > create mode 100644 drivers/gpu/trace/trace_gpu_mem.c > create mode 100644 include/trace/events/gpu_mem.h > > diff --git a/drivers/Kconfig b/drivers/Kconfig > index 8befa53f43be..e0eda1a5c3f9 100644 > --- a/drivers/Kconfig > +++ b/drivers/Kconfig > @@ -200,6 +200,8 @@ source "drivers/thunderbolt/Kconfig" > > source "drivers/android/Kconfig" > > +source "drivers/gpu/trace/Kconfig" > + > source "drivers/nvdimm/Kconfig" > > source "drivers/dax/Kconfig" > diff --git a/drivers/gpu/Makefile b/drivers/gpu/Makefile > index f17d01f076c7..835c88318cec 100644 > --- a/drivers/gpu/Makefile > +++ b/drivers/gpu/Makefile > @@ -5,3 +5,4 @@ > obj-$(CONFIG_TEGRA_HOST1X) += host1x/ > obj-y += drm/ vga/ > obj-$(CONFIG_IMX_IPUV3_CORE) += ipu-v3/ > +obj-$(CONFIG_TRACE_GPU_MEM) += trace/ > diff --git a/drivers/gpu/trace/Kconfig b/drivers/gpu/trace/Kconfig > new file mode 100644 > index 000000000000..c24e9edd022e > --- /dev/null > +++ b/drivers/gpu/trace/Kconfig > @@ -0,0 +1,4 @@ > +# SPDX-License-Identifier: GPL-2.0-only > + > +config TRACE_GPU_MEM > + bool > diff --git a/drivers/gpu/trace/Makefile b/drivers/gpu/trace/Makefile > new file mode 100644 > index 000000000000..b70fbdc5847f > --- /dev/null > +++ b/drivers/gpu/trace/Makefile > @@ -0,0 +1,3 @@ > +# SPDX-License-Identifier: GPL-2.0 > + > +obj-$(CONFIG_TRACE_GPU_MEM) += trace_gpu_mem.o > diff --git a/drivers/gpu/trace/trace_gpu_mem.c b/drivers/gpu/trace/trace_gpu_mem.c > new file mode 100644 > index 000000000000..01e855897b6d > --- /dev/null > +++ b/drivers/gpu/trace/trace_gpu_mem.c > @@ -0,0 +1,13 @@ > +// SPDX-License-Identifier: GPL-2.0 > +/* > + * GPU memory trace points > + * > + * Copyright (C) 2020 Google, Inc. > + */ > + > +#include > + > +#define CREATE_TRACE_POINTS > +#include > + > +EXPORT_TRACEPOINT_SYMBOL(gpu_mem_total); > diff --git a/include/trace/events/gpu_mem.h b/include/trace/events/gpu_mem.h > new file mode 100644 > index 000000000000..1897822a9150 > --- /dev/null > +++ b/include/trace/events/gpu_mem.h > @@ -0,0 +1,57 @@ > +/* SPDX-License-Identifier: GPL-2.0 */ > +/* > + * GPU memory trace points > + * > + * Copyright (C) 2020 Google, Inc. > + */ > + > +#undef TRACE_SYSTEM > +#define TRACE_SYSTEM gpu_mem > + > +#if !defined(_TRACE_GPU_MEM_H) || defined(TRACE_HEADER_MULTI_READ) > +#define _TRACE_GPU_MEM_H > + > +#include > + > +/* > + * The gpu_memory_total event indicates that there's an update to either the > + * global or process total gpu memory counters. > + * > + * This event should be emitted whenever the kernel device driver allocates, > + * frees, imports, unimports memory in the GPU addressable space. > + * > + * @gpu_id: This is the gpu id. > + * > + * @pid: Put 0 for global total, while positive pid for process total. > + * > + * @size: Virtual size of the allocation in bytes. > + * > + */ > +TRACE_EVENT(gpu_mem_total, > + > + TP_PROTO(uint32_t gpu_id, uint32_t pid, uint64_t size), > + > + TP_ARGS(gpu_id, pid, size), > + > + TP_STRUCT__entry( > + __field(uint32_t, gpu_id) > + __field(uint32_t, pid) > + __field(uint64_t, size) > + ), > + > + TP_fast_assign( > + __entry->gpu_id = gpu_id; > + __entry->pid = pid; > + __entry->size = size; > + ), > + > + TP_printk("gpu_id=%u pid=%u size=%llu", > + __entry->gpu_id, > + __entry->pid, > + __entry->size) > +); > + > +#endif /* _TRACE_GPU_MEM_H */ > + > +/* This part must be outside protection */ > +#include