mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-22 17:36:20 +03:00
gpu: nvgpu: rearrange linux specific fecs trace support
We have 3 header files for FECS tracing support
include/nvgpu/gr/fecs_trace.h : common header
include/nvgpu/ctxsw_trace.h : header that includes both common and
os-specific functions
os/linux/ctxsw_trace.h : linux specific header
Remove the second header since it is not needed.
Move all structures that are needed in common code to
include/nvgpu/gr/fecs_trace.h
Move all function declarations that are needed in common code to
include/nvgpu/gr/fecs_trace.h
Move all linux specific declarations in os/linux/ctxsw_trace.h and
rename this file as os/linux/fecs_trace_linux.h
Also rename os/linux/ctxsw_trace.c to os/linux/fecs_trace_linux.c
Jira NVGPU-1880
Change-Id: I05cc4489c4b6a64880b7d59c02b22cd2244d5e22
Signed-off-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2070766
Reviewed-by: svc-misra-checker <svc-misra-checker@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
committed by
mobile promotions
parent
bbb0caa42c
commit
1208ad7cef
@@ -267,7 +267,7 @@ nvgpu-$(CONFIG_DEBUG_FS) += \
|
||||
endif
|
||||
|
||||
nvgpu-$(CONFIG_GK20A_CTXSW_TRACE) += \
|
||||
os/linux/ctxsw_trace.o
|
||||
os/linux/fecs_trace_linux.o
|
||||
|
||||
ifeq ($(CONFIG_GK20A_CTXSW_TRACE),y)
|
||||
nvgpu-$(CONFIG_DEBUG_FS) += \
|
||||
|
||||
@@ -39,7 +39,6 @@
|
||||
#include <nvgpu/debugger.h>
|
||||
#include <nvgpu/ltc.h>
|
||||
#include <nvgpu/barrier.h>
|
||||
#include <nvgpu/ctxsw_trace.h>
|
||||
#include <nvgpu/error_notifier.h>
|
||||
#include <nvgpu/os_sched.h>
|
||||
#include <nvgpu/log2.h>
|
||||
|
||||
@@ -31,7 +31,6 @@
|
||||
#include <nvgpu/gr/ctx.h>
|
||||
#include <nvgpu/gr/subctx.h>
|
||||
#include <nvgpu/gr/fecs_trace.h>
|
||||
#include <nvgpu/ctxsw_trace.h>
|
||||
|
||||
#ifdef CONFIG_GK20A_CTXSW_TRACE
|
||||
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
#include <nvgpu/kmem.h>
|
||||
#include <nvgpu/bug.h>
|
||||
#include <nvgpu/enabled.h>
|
||||
#include <nvgpu/ctxsw_trace.h>
|
||||
#include <nvgpu/gr/fecs_trace.h>
|
||||
#include <nvgpu/dt.h>
|
||||
#include <nvgpu/vgpu/vgpu_ivm.h>
|
||||
|
||||
@@ -30,7 +30,6 @@
|
||||
#include <nvgpu/clk_arb.h>
|
||||
#include <nvgpu/string.h>
|
||||
#include <nvgpu/ltc.h>
|
||||
#include <nvgpu/ctxsw_trace.h>
|
||||
|
||||
#include "fecs_trace_vgpu.h"
|
||||
|
||||
|
||||
@@ -38,7 +38,6 @@
|
||||
#include <nvgpu/debug.h>
|
||||
#include <nvgpu/nvhost.h>
|
||||
#include <nvgpu/barrier.h>
|
||||
#include <nvgpu/ctxsw_trace.h>
|
||||
#include <nvgpu/error_notifier.h>
|
||||
#include <nvgpu/ptimer.h>
|
||||
#include <nvgpu/io.h>
|
||||
@@ -58,6 +57,7 @@
|
||||
#include <nvgpu/power_features/cg.h>
|
||||
#include <nvgpu/power_features/pg.h>
|
||||
#include <nvgpu/power_features/power_features.h>
|
||||
#include <nvgpu/gr/fecs_trace.h>
|
||||
|
||||
#include "mm_gk20a.h"
|
||||
|
||||
|
||||
@@ -36,7 +36,6 @@
|
||||
#include <nvgpu/mm.h>
|
||||
#include <nvgpu/debugger.h>
|
||||
#include <nvgpu/netlist.h>
|
||||
#include <nvgpu/ctxsw_trace.h>
|
||||
#include <nvgpu/error_notifier.h>
|
||||
#include <nvgpu/ecc.h>
|
||||
#include <nvgpu/io.h>
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
#include <nvgpu/bug.h>
|
||||
#include <nvgpu/enabled.h>
|
||||
#include <nvgpu/ptimer.h>
|
||||
#include <nvgpu/ctxsw_trace.h>
|
||||
#include <nvgpu/error_notifier.h>
|
||||
#include <nvgpu/gk20a.h>
|
||||
#include <nvgpu/debugger.h>
|
||||
|
||||
@@ -132,7 +132,6 @@
|
||||
#include <nvgpu/ptimer.h>
|
||||
#include <nvgpu/debug.h>
|
||||
#include <nvgpu/enabled.h>
|
||||
#include <nvgpu/ctxsw_trace.h>
|
||||
#include <nvgpu/error_notifier.h>
|
||||
#include <nvgpu/clk_arb.h>
|
||||
#include <nvgpu/gk20a.h>
|
||||
|
||||
@@ -35,7 +35,6 @@
|
||||
#include <nvgpu/barrier.h>
|
||||
#include <nvgpu/mm.h>
|
||||
#include <nvgpu/log2.h>
|
||||
#include <nvgpu/ctxsw_trace.h>
|
||||
#include <nvgpu/io_usermode.h>
|
||||
#include <nvgpu/ptimer.h>
|
||||
#include <nvgpu/io.h>
|
||||
@@ -51,6 +50,7 @@
|
||||
#include <nvgpu/power_features/cg.h>
|
||||
#include <nvgpu/power_features/pg.h>
|
||||
#include <nvgpu/power_features/power_features.h>
|
||||
#include <nvgpu/gr/fecs_trace.h>
|
||||
|
||||
#include "gk20a/fifo_gk20a.h"
|
||||
|
||||
|
||||
@@ -110,7 +110,6 @@
|
||||
#include <nvgpu/ptimer.h>
|
||||
#include <nvgpu/debug.h>
|
||||
#include <nvgpu/enabled.h>
|
||||
#include <nvgpu/ctxsw_trace.h>
|
||||
#include <nvgpu/error_notifier.h>
|
||||
#include <nvgpu/bug.h>
|
||||
#include <nvgpu/debugger.h>
|
||||
|
||||
@@ -60,6 +60,8 @@ struct gk20a;
|
||||
struct nvgpu_mem;
|
||||
struct nvgpu_gr_subctx;
|
||||
struct nvgpu_gr_ctx;
|
||||
struct tsg_gk20a;
|
||||
struct vm_area_struct;
|
||||
|
||||
struct nvgpu_gr_fecs_trace {
|
||||
struct nvgpu_list_node context_list;
|
||||
@@ -82,6 +84,33 @@ struct nvgpu_fecs_trace_record {
|
||||
u64 ts[];
|
||||
};
|
||||
|
||||
/* must be consistent with nvgpu_ctxsw_ring_header */
|
||||
struct nvgpu_ctxsw_ring_header_internal {
|
||||
u32 magic;
|
||||
u32 version;
|
||||
u32 num_ents;
|
||||
u32 ent_size;
|
||||
u32 drop_count; /* excluding filtered out events */
|
||||
u32 write_seqno;
|
||||
u32 write_idx;
|
||||
u32 read_idx;
|
||||
};
|
||||
|
||||
/*
|
||||
* The binary format of 'struct nvgpu_gpu_ctxsw_trace_entry' introduced here
|
||||
* should match that of 'struct nvgpu_ctxsw_trace_entry' defined in uapi
|
||||
* header, since this struct is intended to be a mirror copy of the uapi
|
||||
* struct.
|
||||
*/
|
||||
struct nvgpu_gpu_ctxsw_trace_entry {
|
||||
u8 tag;
|
||||
u8 vmid;
|
||||
u16 seqno; /* sequence number to detect drops */
|
||||
u32 context_id; /* context_id as allocated by FECS */
|
||||
u64 pid; /* 64-bit is max bits of different OS pid */
|
||||
u64 timestamp; /* 64-bit time */
|
||||
};
|
||||
|
||||
struct nvgpu_gpu_ctxsw_trace_filter {
|
||||
u64 tag_bits[(NVGPU_GPU_CTXSW_FILTER_SIZE + 63) / 64];
|
||||
};
|
||||
@@ -141,4 +170,17 @@ int nvgpu_gr_fecs_trace_bind_channel(struct gk20a *g,
|
||||
int nvgpu_gr_fecs_trace_unbind_channel(struct gk20a *g,
|
||||
struct nvgpu_mem *inst_block);
|
||||
|
||||
/*
|
||||
* Below functions are defined in OS-specific code.
|
||||
* Declare them here in common header since they are called from common code
|
||||
*/
|
||||
int gk20a_ctxsw_dev_ring_alloc(struct gk20a *g, void **buf, size_t *size);
|
||||
int gk20a_ctxsw_dev_ring_free(struct gk20a *g);
|
||||
int gk20a_ctxsw_dev_mmap_buffer(struct gk20a *g, struct vm_area_struct *vma);
|
||||
void gk20a_ctxsw_trace_tsg_reset(struct gk20a *g, struct tsg_gk20a *tsg);
|
||||
u8 nvgpu_gpu_ctxsw_tags_to_common_tags(u8 tags);
|
||||
int gk20a_ctxsw_trace_write(struct gk20a *g,
|
||||
struct nvgpu_gpu_ctxsw_trace_entry *entry);
|
||||
void gk20a_ctxsw_trace_wake_up(struct gk20a *g, int vmid);
|
||||
|
||||
#endif /* NVGPU_GR_FECS_TRACE_H */
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2016-2017, NVIDIA CORPORATION. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
* version 2, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __CTXSW_TRACE_H__
|
||||
#define __CTXSW_TRACE_H__
|
||||
|
||||
#include <nvgpu/types.h>
|
||||
|
||||
#define GK20A_CTXSW_TRACE_NUM_DEVS 1
|
||||
|
||||
struct file;
|
||||
struct inode;
|
||||
struct poll_table_struct;
|
||||
|
||||
struct gk20a;
|
||||
|
||||
int gk20a_ctxsw_dev_release(struct inode *inode, struct file *filp);
|
||||
int gk20a_ctxsw_dev_open(struct inode *inode, struct file *filp);
|
||||
long gk20a_ctxsw_dev_ioctl(struct file *filp,
|
||||
unsigned int cmd, unsigned long arg);
|
||||
ssize_t gk20a_ctxsw_dev_read(struct file *filp, char __user *buf,
|
||||
size_t size, loff_t *offs);
|
||||
unsigned int gk20a_ctxsw_dev_poll(struct file *filp,
|
||||
struct poll_table_struct *pts);
|
||||
|
||||
#endif /* __CTXSW_TRACE_H__ */
|
||||
@@ -20,7 +20,6 @@
|
||||
#include <linux/poll.h>
|
||||
#include <trace/events/gk20a.h>
|
||||
#include <uapi/linux/nvgpu.h>
|
||||
#include <nvgpu/ctxsw_trace.h>
|
||||
#include <nvgpu/kmem.h>
|
||||
#include <nvgpu/log.h>
|
||||
#include <nvgpu/atomic.h>
|
||||
@@ -34,7 +33,7 @@
|
||||
|
||||
#include "platform_gk20a.h"
|
||||
#include "os_linux.h"
|
||||
#include "ctxsw_trace.h"
|
||||
#include "fecs_trace_linux.h"
|
||||
|
||||
#include <nvgpu/hw/gk20a/hw_gr_gk20a.h>
|
||||
|
||||
@@ -77,8 +76,9 @@ static inline int ring_len(struct nvgpu_ctxsw_ring_header *hdr)
|
||||
return (hdr->write_idx - hdr->read_idx) % hdr->num_ents;
|
||||
}
|
||||
|
||||
static void nvgpu_set_ctxsw_trace_entry(struct nvgpu_ctxsw_trace_entry *entry_dst,
|
||||
struct nvgpu_gpu_ctxsw_trace_entry *entry_src)
|
||||
static void nvgpu_set_ctxsw_trace_entry(
|
||||
struct nvgpu_ctxsw_trace_entry *entry_dst,
|
||||
struct nvgpu_gpu_ctxsw_trace_entry *entry_src)
|
||||
{
|
||||
entry_dst->tag = entry_src->tag;
|
||||
entry_dst->vmid = entry_src->vmid;
|
||||
@@ -119,7 +119,8 @@ ssize_t gk20a_ctxsw_dev_read(struct file *filp, char __user *buf, size_t size,
|
||||
if (ring_is_empty(hdr))
|
||||
break;
|
||||
|
||||
nvgpu_set_ctxsw_trace_entry(&user_entry, &dev->ents[hdr->read_idx]);
|
||||
nvgpu_set_ctxsw_trace_entry(&user_entry,
|
||||
&dev->ents[hdr->read_idx]);
|
||||
if (copy_to_user(entry, &user_entry,
|
||||
sizeof(*entry))) {
|
||||
nvgpu_mutex_release(&dev->write_lock);
|
||||
@@ -250,14 +251,16 @@ static int gk20a_ctxsw_dev_ioctl_ring_setup(struct gk20a_ctxsw_dev *dev,
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void nvgpu_set_ctxsw_trace_filter_args(struct nvgpu_gpu_ctxsw_trace_filter *filter_dst,
|
||||
struct nvgpu_ctxsw_trace_filter *filter_src)
|
||||
static void nvgpu_set_ctxsw_trace_filter_args(
|
||||
struct nvgpu_gpu_ctxsw_trace_filter *filter_dst,
|
||||
struct nvgpu_ctxsw_trace_filter *filter_src)
|
||||
{
|
||||
nvgpu_memcpy((u8 *)filter_dst->tag_bits, (u8 *)filter_src->tag_bits,
|
||||
(NVGPU_CTXSW_FILTER_SIZE + 63) / 64);
|
||||
}
|
||||
|
||||
static void nvgpu_get_ctxsw_trace_filter_args(struct nvgpu_ctxsw_trace_filter *filter_dst,
|
||||
static void nvgpu_get_ctxsw_trace_filter_args(
|
||||
struct nvgpu_ctxsw_trace_filter *filter_dst,
|
||||
struct nvgpu_gpu_ctxsw_trace_filter *filter_src)
|
||||
{
|
||||
nvgpu_memcpy((u8 *)filter_dst->tag_bits, (u8 *)filter_src->tag_bits,
|
||||
@@ -20,61 +20,33 @@
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef NVGPU_CTXSW_TRACE_H
|
||||
#define NVGPU_CTXSW_TRACE_H
|
||||
#ifndef NVGPU_FECS_TRACE_LINUX_H
|
||||
#define NVGPU_FECS_TRACE_LINUX_H
|
||||
|
||||
#include <nvgpu/types.h>
|
||||
|
||||
#define GK20A_CTXSW_TRACE_NUM_DEVS 1
|
||||
|
||||
struct file;
|
||||
struct inode;
|
||||
struct gk20a;
|
||||
struct tsg_gk20a;
|
||||
struct channel_gk20a;
|
||||
|
||||
/* must be consistent with nvgpu_ctxsw_ring_header */
|
||||
struct nvgpu_ctxsw_ring_header_internal {
|
||||
u32 magic;
|
||||
u32 version;
|
||||
u32 num_ents;
|
||||
u32 ent_size;
|
||||
u32 drop_count; /* excluding filtered out events */
|
||||
u32 write_seqno;
|
||||
u32 write_idx;
|
||||
u32 read_idx;
|
||||
};
|
||||
|
||||
/*
|
||||
* The binary format of 'struct nvgpu_gpu_ctxsw_trace_entry' introduced here
|
||||
* should match that of 'struct nvgpu_ctxsw_trace_entry' defined in uapi
|
||||
* header, since this struct is intended to be a mirror copy of the uapi
|
||||
* struct.
|
||||
*/
|
||||
struct nvgpu_gpu_ctxsw_trace_entry {
|
||||
u8 tag;
|
||||
u8 vmid;
|
||||
u16 seqno; /* sequence number to detect drops */
|
||||
u32 context_id; /* context_id as allocated by FECS */
|
||||
u64 pid; /* 64-bit is max bits of different OS pid */
|
||||
u64 timestamp; /* 64-bit time */
|
||||
};
|
||||
struct vm_area_struct;
|
||||
struct poll_table_struct;
|
||||
|
||||
int gk20a_ctxsw_trace_init(struct gk20a *g);
|
||||
|
||||
void gk20a_ctxsw_trace_tsg_reset(struct gk20a *g, struct tsg_gk20a *tsg);
|
||||
|
||||
void gk20a_ctxsw_trace_cleanup(struct gk20a *g);
|
||||
int gk20a_ctxsw_trace_write(struct gk20a *g,
|
||||
struct nvgpu_gpu_ctxsw_trace_entry *entry);
|
||||
void gk20a_ctxsw_trace_wake_up(struct gk20a *g, int vmid);
|
||||
|
||||
#ifdef CONFIG_GK20A_CTXSW_TRACE
|
||||
struct file;
|
||||
struct vm_area_struct;
|
||||
|
||||
int gk20a_ctxsw_dev_mmap(struct file *filp, struct vm_area_struct *vma);
|
||||
int gk20a_ctxsw_dev_ring_alloc(struct gk20a *g, void **buf, size_t *size);
|
||||
int gk20a_ctxsw_dev_ring_free(struct gk20a *g);
|
||||
int gk20a_ctxsw_dev_mmap_buffer(struct gk20a *g, struct vm_area_struct *vma);
|
||||
#endif
|
||||
|
||||
u8 nvgpu_gpu_ctxsw_tags_to_common_tags(u8 tags);
|
||||
int gk20a_ctxsw_dev_release(struct inode *inode, struct file *filp);
|
||||
int gk20a_ctxsw_dev_open(struct inode *inode, struct file *filp);
|
||||
long gk20a_ctxsw_dev_ioctl(struct file *filp,
|
||||
unsigned int cmd, unsigned long arg);
|
||||
ssize_t gk20a_ctxsw_dev_read(struct file *filp, char __user *buf,
|
||||
size_t size, loff_t *offs);
|
||||
unsigned int gk20a_ctxsw_dev_poll(struct file *filp,
|
||||
struct poll_table_struct *pts);
|
||||
|
||||
#endif /*NVGPU_CTXSW_TRACE_H */
|
||||
#endif /*NVGPU_FECS_TRACE_LINUX_H */
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* NVGPU IOCTLs
|
||||
*
|
||||
* Copyright (c) 2011-2018, NVIDIA CORPORATION. All rights reserved.
|
||||
* Copyright (c) 2011-2019, NVIDIA CORPORATION. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
@@ -19,7 +19,6 @@
|
||||
#include <linux/file.h>
|
||||
|
||||
#include <nvgpu/nvgpu_common.h>
|
||||
#include <nvgpu/ctxsw_trace.h>
|
||||
#include <nvgpu/gk20a.h>
|
||||
|
||||
#include "ioctl_channel.h"
|
||||
@@ -29,7 +28,7 @@
|
||||
#include "ioctl_dbg.h"
|
||||
#include "module.h"
|
||||
#include "os_linux.h"
|
||||
#include "ctxsw_trace.h"
|
||||
#include "fecs_trace_linux.h"
|
||||
#include "platform_gk20a.h"
|
||||
|
||||
#define GK20A_NUM_CDEVS 7
|
||||
|
||||
@@ -47,7 +47,6 @@
|
||||
#include "ioctl_channel.h"
|
||||
#include "channel.h"
|
||||
#include "os_linux.h"
|
||||
#include "ctxsw_trace.h"
|
||||
|
||||
/* the minimal size of client buffer */
|
||||
#define CSS_MIN_CLIENT_SNAPSHOT_SIZE \
|
||||
|
||||
@@ -42,7 +42,6 @@
|
||||
#include <nvgpu/soc.h>
|
||||
#include <nvgpu/enabled.h>
|
||||
#include <nvgpu/debug.h>
|
||||
#include <nvgpu/ctxsw_trace.h>
|
||||
#include <nvgpu/vidmem.h>
|
||||
#include <nvgpu/sim.h>
|
||||
#include <nvgpu/clk_arb.h>
|
||||
@@ -63,7 +62,7 @@
|
||||
|
||||
#include "os_linux.h"
|
||||
#include "os_ops.h"
|
||||
#include "ctxsw_trace.h"
|
||||
#include "fecs_trace_linux.h"
|
||||
#include "driver_common.h"
|
||||
#include "channel.h"
|
||||
#include "debug_pmgr.h"
|
||||
|
||||
@@ -14,10 +14,10 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <nvgpu/ctxsw_trace.h>
|
||||
#include <nvgpu/vgpu/tegra_vgpu.h>
|
||||
#include <nvgpu/vgpu/vgpu_ivm.h>
|
||||
#include <nvgpu/gk20a.h>
|
||||
#include <nvgpu/gr/fecs_trace.h>
|
||||
|
||||
#include <linux/mm.h>
|
||||
|
||||
|
||||
@@ -29,7 +29,6 @@
|
||||
#include <nvgpu/enabled.h>
|
||||
#include <nvgpu/debug.h>
|
||||
#include <nvgpu/soc.h>
|
||||
#include <nvgpu/ctxsw_trace.h>
|
||||
#include <nvgpu/defaults.h>
|
||||
#include <nvgpu/ltc.h>
|
||||
#include <nvgpu/channel.h>
|
||||
|
||||
@@ -147,7 +147,6 @@
|
||||
#include <nvgpu/ptimer.h>
|
||||
#include <nvgpu/debug.h>
|
||||
#include <nvgpu/enabled.h>
|
||||
#include <nvgpu/ctxsw_trace.h>
|
||||
#include <nvgpu/error_notifier.h>
|
||||
#include <nvgpu/gk20a.h>
|
||||
#include <nvgpu/clk_arb.h>
|
||||
|
||||
Reference in New Issue
Block a user