gpu: nvgpu: rename profiler object structure

Rename profiler object structure from struct dbg_profiler_object_data
to struct nvgpu_profiler_object.

Annotate the structure members appropriately.

Bug 2510974

Change-Id: I9454388f8ad143b39daca6bbc2b12511ffa3fd95
Signed-off-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2365675
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Deepak Nibade
2020-04-29 18:04:44 +05:30
committed by Alex Waterman
parent e4e6be85ea
commit d869040d7a
8 changed files with 60 additions and 41 deletions

View File

@@ -242,7 +242,7 @@ int nvgpu_dbg_set_powergate(struct dbg_session_gk20a *dbg_s, bool disable_powerg
bool nvgpu_check_and_set_global_reservation( bool nvgpu_check_and_set_global_reservation(
struct dbg_session_gk20a *dbg_s, struct dbg_session_gk20a *dbg_s,
struct dbg_profiler_object_data *prof_obj) struct nvgpu_profiler_object *prof_obj)
{ {
struct gk20a *g = dbg_s->g; struct gk20a *g = dbg_s->g;
@@ -258,7 +258,7 @@ bool nvgpu_check_and_set_global_reservation(
bool nvgpu_check_and_set_context_reservation( bool nvgpu_check_and_set_context_reservation(
struct dbg_session_gk20a *dbg_s, struct dbg_session_gk20a *dbg_s,
struct dbg_profiler_object_data *prof_obj) struct nvgpu_profiler_object *prof_obj)
{ {
struct gk20a *g = dbg_s->g; struct gk20a *g = dbg_s->g;
@@ -272,7 +272,7 @@ bool nvgpu_check_and_set_context_reservation(
} }
void nvgpu_release_profiler_reservation(struct dbg_session_gk20a *dbg_s, void nvgpu_release_profiler_reservation(struct dbg_session_gk20a *dbg_s,
struct dbg_profiler_object_data *prof_obj) struct nvgpu_profiler_object *prof_obj)
{ {
struct gk20a *g = dbg_s->g; struct gk20a *g = dbg_s->g;

View File

@@ -33,9 +33,9 @@ static int generate_unique_id(void)
} }
int nvgpu_profiler_alloc(struct gk20a *g, int nvgpu_profiler_alloc(struct gk20a *g,
struct dbg_profiler_object_data **_prof) struct nvgpu_profiler_object **_prof)
{ {
struct dbg_profiler_object_data *prof; struct nvgpu_profiler_object *prof;
*_prof = NULL; *_prof = NULL;
nvgpu_log(g, gpu_dbg_fn | gpu_dbg_gpu_dbg, " "); nvgpu_log(g, gpu_dbg_fn | gpu_dbg_gpu_dbg, " ");
@@ -55,7 +55,7 @@ int nvgpu_profiler_alloc(struct gk20a *g,
return 0; return 0;
} }
void nvgpu_profiler_free(struct dbg_profiler_object_data *prof) void nvgpu_profiler_free(struct nvgpu_profiler_object *prof)
{ {
struct gk20a *g = prof->g; struct gk20a *g = prof->g;

View File

@@ -137,7 +137,7 @@ static int vgpu_sendrecv_prof_cmd(struct dbg_session_gk20a *dbg_s, u32 mode)
bool vgpu_check_and_set_global_reservation( bool vgpu_check_and_set_global_reservation(
struct dbg_session_gk20a *dbg_s, struct dbg_session_gk20a *dbg_s,
struct dbg_profiler_object_data *prof_obj) struct nvgpu_profiler_object *prof_obj)
{ {
struct gk20a *g = dbg_s->g; struct gk20a *g = dbg_s->g;
@@ -158,7 +158,7 @@ bool vgpu_check_and_set_global_reservation(
bool vgpu_check_and_set_context_reservation( bool vgpu_check_and_set_context_reservation(
struct dbg_session_gk20a *dbg_s, struct dbg_session_gk20a *dbg_s,
struct dbg_profiler_object_data *prof_obj) struct nvgpu_profiler_object *prof_obj)
{ {
struct gk20a *g = dbg_s->g; struct gk20a *g = dbg_s->g;
@@ -181,7 +181,7 @@ bool vgpu_check_and_set_context_reservation(
void vgpu_release_profiler_reservation( void vgpu_release_profiler_reservation(
struct dbg_session_gk20a *dbg_s, struct dbg_session_gk20a *dbg_s,
struct dbg_profiler_object_data *prof_obj) struct nvgpu_profiler_object *prof_obj)
{ {
struct gk20a *g = dbg_s->g; struct gk20a *g = dbg_s->g;

View File

@@ -25,7 +25,7 @@
struct dbg_session_gk20a; struct dbg_session_gk20a;
struct nvgpu_dbg_reg_op; struct nvgpu_dbg_reg_op;
struct dbg_profiler_object_data; struct nvgpu_profiler_object;
struct gk20a; struct gk20a;
struct nvgpu_channel; struct nvgpu_channel;
@@ -39,12 +39,12 @@ int vgpu_dbg_set_powergate(struct dbg_session_gk20a *dbg_s,
bool disable_powergate); bool disable_powergate);
bool vgpu_check_and_set_global_reservation( bool vgpu_check_and_set_global_reservation(
struct dbg_session_gk20a *dbg_s, struct dbg_session_gk20a *dbg_s,
struct dbg_profiler_object_data *prof_obj); struct nvgpu_profiler_object *prof_obj);
bool vgpu_check_and_set_context_reservation( bool vgpu_check_and_set_context_reservation(
struct dbg_session_gk20a *dbg_s, struct dbg_session_gk20a *dbg_s,
struct dbg_profiler_object_data *prof_obj); struct nvgpu_profiler_object *prof_obj);
void vgpu_release_profiler_reservation( void vgpu_release_profiler_reservation(
struct dbg_session_gk20a *dbg_s, struct dbg_session_gk20a *dbg_s,
struct dbg_profiler_object_data *prof_obj); struct nvgpu_profiler_object *prof_obj);
#endif /* NVGPU_DBG_VGPU_H */ #endif /* NVGPU_DBG_VGPU_H */

View File

@@ -33,7 +33,7 @@
struct gk20a; struct gk20a;
struct nvgpu_channel; struct nvgpu_channel;
struct dbg_session_gk20a; struct dbg_session_gk20a;
struct dbg_profiler_object_data; struct nvgpu_profiler_object;
struct nvgpu_channel * struct nvgpu_channel *
nvgpu_dbg_gpu_get_session_channel(struct dbg_session_gk20a *dbg_s); nvgpu_dbg_gpu_get_session_channel(struct dbg_session_gk20a *dbg_s);
@@ -111,12 +111,12 @@ void nvgpu_dbg_gpu_clear_broadcast_stop_trigger(struct nvgpu_channel *ch);
int nvgpu_dbg_set_powergate(struct dbg_session_gk20a *dbg_s, bool disable_powergate); int nvgpu_dbg_set_powergate(struct dbg_session_gk20a *dbg_s, bool disable_powergate);
bool nvgpu_check_and_set_global_reservation( bool nvgpu_check_and_set_global_reservation(
struct dbg_session_gk20a *dbg_s, struct dbg_session_gk20a *dbg_s,
struct dbg_profiler_object_data *prof_obj); struct nvgpu_profiler_object *prof_obj);
bool nvgpu_check_and_set_context_reservation( bool nvgpu_check_and_set_context_reservation(
struct dbg_session_gk20a *dbg_s, struct dbg_session_gk20a *dbg_s,
struct dbg_profiler_object_data *prof_obj); struct nvgpu_profiler_object *prof_obj);
void nvgpu_release_profiler_reservation(struct dbg_session_gk20a *dbg_s, void nvgpu_release_profiler_reservation(struct dbg_session_gk20a *dbg_s,
struct dbg_profiler_object_data *prof_obj); struct nvgpu_profiler_object *prof_obj);
void nvgpu_dbg_session_post_event(struct dbg_session_gk20a *dbg_s); void nvgpu_dbg_session_post_event(struct dbg_session_gk20a *dbg_s);
u32 nvgpu_set_powergate_locked(struct dbg_session_gk20a *dbg_s, u32 nvgpu_set_powergate_locked(struct dbg_session_gk20a *dbg_s,

View File

@@ -78,7 +78,7 @@ struct sim_nvgpu;
struct nvgpu_ce_app; struct nvgpu_ce_app;
struct gk20a_ctxsw_trace; struct gk20a_ctxsw_trace;
struct nvgpu_mem_alloc_tracker; struct nvgpu_mem_alloc_tracker;
struct dbg_profiler_object_data; struct nvgpu_profiler_object;
struct nvgpu_debug_context; struct nvgpu_debug_context;
struct nvgpu_clk_pll_debug_data; struct nvgpu_clk_pll_debug_data;
struct nvgpu_nvhost_dev; struct nvgpu_nvhost_dev;
@@ -437,13 +437,13 @@ struct gpu_ops {
bool disable_powergate); bool disable_powergate);
bool (*check_and_set_global_reservation)( bool (*check_and_set_global_reservation)(
struct dbg_session_gk20a *dbg_s, struct dbg_session_gk20a *dbg_s,
struct dbg_profiler_object_data *prof_obj); struct nvgpu_profiler_object *prof_obj);
bool (*check_and_set_context_reservation)( bool (*check_and_set_context_reservation)(
struct dbg_session_gk20a *dbg_s, struct dbg_session_gk20a *dbg_s,
struct dbg_profiler_object_data *prof_obj); struct nvgpu_profiler_object *prof_obj);
void (*release_profiler_reservation)( void (*release_profiler_reservation)(
struct dbg_session_gk20a *dbg_s, struct dbg_session_gk20a *dbg_s,
struct dbg_profiler_object_data *prof_obj); struct nvgpu_profiler_object *prof_obj);
} debugger; } debugger;
struct { struct {
void (*enable_membuf)(struct gk20a *g, u32 size, void (*enable_membuf)(struct gk20a *g, u32 size,

View File

@@ -30,25 +30,44 @@
struct gk20a; struct gk20a;
struct nvgpu_channel; struct nvgpu_channel;
struct dbg_profiler_object_data { struct nvgpu_profiler_object {
struct gk20a *g; struct gk20a *g;
/*
* Debug session id. Only valid for profiler objects
* allocated through debug session i.e. in ioctl_dbg.c.
*/
int session_id; int session_id;
/* Unique profiler object handle. Also used as reservation id. */
u32 prof_handle; u32 prof_handle;
/*
* Pointer to context being profiled, applicable only for profiler
* objects with context scope.
*/
struct nvgpu_tsg *tsg; struct nvgpu_tsg *tsg;
/* If profiler object has HWPM reservation. */
bool has_reservation; bool has_reservation;
/*
* Entry of this object into global list of objects
* maintained in struct gk20a.
*/
struct nvgpu_list_node prof_obj_entry; struct nvgpu_list_node prof_obj_entry;
}; };
static inline struct dbg_profiler_object_data * static inline struct nvgpu_profiler_object *
dbg_profiler_object_data_from_prof_obj_entry(struct nvgpu_list_node *node) nvgpu_profiler_object_from_prof_obj_entry(struct nvgpu_list_node *node)
{ {
return (struct dbg_profiler_object_data *) return (struct nvgpu_profiler_object *)
((uintptr_t)node - offsetof(struct dbg_profiler_object_data, prof_obj_entry)); ((uintptr_t)node - offsetof(struct nvgpu_profiler_object, prof_obj_entry));
}; };
int nvgpu_profiler_alloc(struct gk20a *g, int nvgpu_profiler_alloc(struct gk20a *g,
struct dbg_profiler_object_data **_prof); struct nvgpu_profiler_object **_prof);
void nvgpu_profiler_free(struct dbg_profiler_object_data *prof); void nvgpu_profiler_free(struct nvgpu_profiler_object *prof);
#endif /* CONFIG_NVGPU_PROFILER */ #endif /* CONFIG_NVGPU_PROFILER */
#endif /* NVGPU_PROFILER_H */ #endif /* NVGPU_PROFILER_H */

View File

@@ -183,7 +183,7 @@ int gk20a_dbg_gpu_dev_release(struct inode *inode, struct file *filp)
struct dbg_session_gk20a_linux *dbg_session_linux = filp->private_data; struct dbg_session_gk20a_linux *dbg_session_linux = filp->private_data;
struct dbg_session_gk20a *dbg_s = &dbg_session_linux->dbg_s; struct dbg_session_gk20a *dbg_s = &dbg_session_linux->dbg_s;
struct gk20a *g = dbg_s->g; struct gk20a *g = dbg_s->g;
struct dbg_profiler_object_data *prof_obj, *tmp_obj; struct nvgpu_profiler_object *prof_obj, *tmp_obj;
nvgpu_log(g, gpu_dbg_gpu_dbg | gpu_dbg_fn, "%s", g->name); nvgpu_log(g, gpu_dbg_gpu_dbg | gpu_dbg_fn, "%s", g->name);
@@ -208,7 +208,7 @@ int gk20a_dbg_gpu_dev_release(struct inode *inode, struct file *filp)
* dbg_unbind_all_channels. We could still have global ones. * dbg_unbind_all_channels. We could still have global ones.
*/ */
nvgpu_list_for_each_entry_safe(prof_obj, tmp_obj, &g->profiler_objects, nvgpu_list_for_each_entry_safe(prof_obj, tmp_obj, &g->profiler_objects,
dbg_profiler_object_data, prof_obj_entry) { nvgpu_profiler_object, prof_obj_entry) {
if (prof_obj->session_id == dbg_s->id) { if (prof_obj->session_id == dbg_s->id) {
if (prof_obj->has_reservation) if (prof_obj->has_reservation)
g->ops.debugger. g->ops.debugger.
@@ -444,7 +444,7 @@ static int dbg_unbind_single_channel_gk20a(struct dbg_session_gk20a *dbg_s,
struct gk20a *g = dbg_s->g; struct gk20a *g = dbg_s->g;
u32 chid; u32 chid;
struct dbg_session_data *session_data; struct dbg_session_data *session_data;
struct dbg_profiler_object_data *prof_obj, *tmp_obj; struct nvgpu_profiler_object *prof_obj, *tmp_obj;
struct dbg_session_channel_data_linux *ch_data_linux; struct dbg_session_channel_data_linux *ch_data_linux;
struct nvgpu_channel *ch; struct nvgpu_channel *ch;
@@ -457,7 +457,7 @@ static int dbg_unbind_single_channel_gk20a(struct dbg_session_gk20a *dbg_s,
* session/channel pair, release it. * session/channel pair, release it.
*/ */
nvgpu_list_for_each_entry_safe(prof_obj, tmp_obj, &g->profiler_objects, nvgpu_list_for_each_entry_safe(prof_obj, tmp_obj, &g->profiler_objects,
dbg_profiler_object_data, prof_obj_entry) { nvgpu_profiler_object, prof_obj_entry) {
if ((prof_obj->session_id == dbg_s->id) && if ((prof_obj->session_id == dbg_s->id) &&
(prof_obj->tsg->tsgid == ch->tsgid)) { (prof_obj->tsg->tsgid == ch->tsgid)) {
if (prof_obj->has_reservation) { if (prof_obj->has_reservation) {
@@ -1171,7 +1171,7 @@ static int nvgpu_ioctl_allocate_profiler_object(
int err = 0; int err = 0;
struct dbg_session_gk20a *dbg_s = &dbg_session_linux->dbg_s; struct dbg_session_gk20a *dbg_s = &dbg_session_linux->dbg_s;
struct gk20a *g = get_gk20a(dbg_session_linux->dev); struct gk20a *g = get_gk20a(dbg_session_linux->dev);
struct dbg_profiler_object_data *prof_obj; struct nvgpu_profiler_object *prof_obj;
struct nvgpu_channel *ch = NULL; struct nvgpu_channel *ch = NULL;
struct nvgpu_tsg *tsg; struct nvgpu_tsg *tsg;
@@ -1220,7 +1220,7 @@ static int nvgpu_ioctl_free_profiler_object(
int err = 0; int err = 0;
struct dbg_session_gk20a *dbg_s = &dbg_s_linux->dbg_s; struct dbg_session_gk20a *dbg_s = &dbg_s_linux->dbg_s;
struct gk20a *g = get_gk20a(dbg_s_linux->dev); struct gk20a *g = get_gk20a(dbg_s_linux->dev);
struct dbg_profiler_object_data *prof_obj, *tmp_obj; struct nvgpu_profiler_object *prof_obj, *tmp_obj;
bool obj_found = false; bool obj_found = false;
nvgpu_log_fn(g, "%s session_id = %d profiler_handle = %x", nvgpu_log_fn(g, "%s session_id = %d profiler_handle = %x",
@@ -1230,7 +1230,7 @@ static int nvgpu_ioctl_free_profiler_object(
/* Remove profiler object from the list, if a match is found */ /* Remove profiler object from the list, if a match is found */
nvgpu_list_for_each_entry_safe(prof_obj, tmp_obj, &g->profiler_objects, nvgpu_list_for_each_entry_safe(prof_obj, tmp_obj, &g->profiler_objects,
dbg_profiler_object_data, prof_obj_entry) { nvgpu_profiler_object, prof_obj_entry) {
if (prof_obj->prof_handle == args->profiler_handle) { if (prof_obj->prof_handle == args->profiler_handle) {
if (prof_obj->session_id != dbg_s->id) { if (prof_obj->session_id != dbg_s->id) {
nvgpu_err(g, nvgpu_err(g,
@@ -1257,15 +1257,15 @@ static int nvgpu_ioctl_free_profiler_object(
return err; return err;
} }
static struct dbg_profiler_object_data *find_matching_prof_obj( static struct nvgpu_profiler_object *find_matching_prof_obj(
struct dbg_session_gk20a *dbg_s, struct dbg_session_gk20a *dbg_s,
u32 profiler_handle) u32 profiler_handle)
{ {
struct gk20a *g = dbg_s->g; struct gk20a *g = dbg_s->g;
struct dbg_profiler_object_data *prof_obj; struct nvgpu_profiler_object *prof_obj;
nvgpu_list_for_each_entry(prof_obj, &g->profiler_objects, nvgpu_list_for_each_entry(prof_obj, &g->profiler_objects,
dbg_profiler_object_data, prof_obj_entry) { nvgpu_profiler_object, prof_obj_entry) {
if (prof_obj->prof_handle == profiler_handle) { if (prof_obj->prof_handle == profiler_handle) {
if (prof_obj->session_id != dbg_s->id) { if (prof_obj->session_id != dbg_s->id) {
nvgpu_err(g, nvgpu_err(g,
@@ -1683,7 +1683,7 @@ static int nvgpu_profiler_reserve_release(struct dbg_session_gk20a *dbg_s,
u32 profiler_handle) u32 profiler_handle)
{ {
struct gk20a *g = dbg_s->g; struct gk20a *g = dbg_s->g;
struct dbg_profiler_object_data *prof_obj; struct nvgpu_profiler_object *prof_obj;
int err = 0; int err = 0;
nvgpu_log_fn(g, "%s profiler_handle = %x", g->name, profiler_handle); nvgpu_log_fn(g, "%s profiler_handle = %x", g->name, profiler_handle);
@@ -1715,7 +1715,7 @@ static int nvgpu_profiler_reserve_acquire(struct dbg_session_gk20a *dbg_s,
u32 profiler_handle) u32 profiler_handle)
{ {
struct gk20a *g = dbg_s->g; struct gk20a *g = dbg_s->g;
struct dbg_profiler_object_data *prof_obj, *my_prof_obj; struct nvgpu_profiler_object *prof_obj, *my_prof_obj;
int err = 0; int err = 0;
nvgpu_log_fn(g, "%s profiler_handle = %x", g->name, profiler_handle); nvgpu_log_fn(g, "%s profiler_handle = %x", g->name, profiler_handle);
@@ -1764,7 +1764,7 @@ static int nvgpu_profiler_reserve_acquire(struct dbg_session_gk20a *dbg_s,
u32 my_tsgid = my_prof_obj->tsg->tsgid; u32 my_tsgid = my_prof_obj->tsg->tsgid;
nvgpu_list_for_each_entry(prof_obj, &g->profiler_objects, nvgpu_list_for_each_entry(prof_obj, &g->profiler_objects,
dbg_profiler_object_data, prof_obj_entry) { nvgpu_profiler_object, prof_obj_entry) {
if (prof_obj->has_reservation && if (prof_obj->has_reservation &&
(prof_obj->tsg->tsgid == my_tsgid)) { (prof_obj->tsg->tsgid == my_tsgid)) {
nvgpu_err(g, nvgpu_err(g,