mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-23 01:50:07 +03:00
gpu: nvgpu: unit: branch coverage for tsg
Cover remaining branches for: - nvgpu_tsg_abort - nvgpu_tsg_unbind - nvgpu_tsg_mark_error Jira NVGPU-4673 Change-Id: I9dacbf286f1a63cb4c82854984d83b6b9d1fcde3 Signed-off-by: Thomas Fleury <tfleury@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/2266485 Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
committed by
Alex Waterman
parent
9963b09101
commit
cb273476b6
@@ -3161,6 +3161,12 @@
|
|||||||
"unit": "nvgpu_tsg",
|
"unit": "nvgpu_tsg",
|
||||||
"test_level": 0
|
"test_level": 0
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"test": "test_tsg_mark_error",
|
||||||
|
"case": "mark_error",
|
||||||
|
"unit": "nvgpu_tsg",
|
||||||
|
"test_level": 0
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"test": "test_tsg_open",
|
"test": "test_tsg_open",
|
||||||
"case": "open",
|
"case": "open",
|
||||||
@@ -3179,6 +3185,18 @@
|
|||||||
"unit": "nvgpu_tsg",
|
"unit": "nvgpu_tsg",
|
||||||
"test_level": 0
|
"test_level": 0
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"test": "test_tsg_reset_faulted_eng_pbdma",
|
||||||
|
"case": "reset_faulted_eng_pbdma",
|
||||||
|
"unit": "nvgpu_tsg",
|
||||||
|
"test_level": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"test": "test_tsg_set_ctx_mmu_error",
|
||||||
|
"case": "set_ctx_mmu_error",
|
||||||
|
"unit": "nvgpu_tsg",
|
||||||
|
"test_level": 0
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"test": "test_tsg_setup_sw",
|
"test": "test_tsg_setup_sw",
|
||||||
"case": "setup_sw",
|
"case": "setup_sw",
|
||||||
|
|||||||
@@ -390,7 +390,8 @@ done:
|
|||||||
#define F_TSG_UNBIND_CHANNEL_RUNLIST_UPDATE_FAIL BIT(5)
|
#define F_TSG_UNBIND_CHANNEL_RUNLIST_UPDATE_FAIL BIT(5)
|
||||||
#define F_TSG_UNBIND_CHANNEL_UNBIND_HAL BIT(6)
|
#define F_TSG_UNBIND_CHANNEL_UNBIND_HAL BIT(6)
|
||||||
#define F_TSG_UNBIND_CHANNEL_UNBIND_HAL_FAIL BIT(7)
|
#define F_TSG_UNBIND_CHANNEL_UNBIND_HAL_FAIL BIT(7)
|
||||||
#define F_TSG_UNBIND_CHANNEL_LAST BIT(8)
|
#define F_TSG_UNBIND_CHANNEL_ABORT_CLEAN_UP_NULL BIT(8)
|
||||||
|
#define F_TSG_UNBIND_CHANNEL_LAST BIT(9)
|
||||||
|
|
||||||
static int stub_fifo_preempt_tsg_EINVAL(
|
static int stub_fifo_preempt_tsg_EINVAL(
|
||||||
struct gk20a *g, struct nvgpu_tsg *tsg)
|
struct gk20a *g, struct nvgpu_tsg *tsg)
|
||||||
@@ -468,6 +469,7 @@ int test_tsg_unbind_channel(struct unit_module *m,
|
|||||||
"runlist_update_fail",
|
"runlist_update_fail",
|
||||||
"unbind_hal",
|
"unbind_hal",
|
||||||
"unbind_hal_fail",
|
"unbind_hal_fail",
|
||||||
|
"abort_cleanup_null"
|
||||||
};
|
};
|
||||||
u32 fail =
|
u32 fail =
|
||||||
F_TSG_UNBIND_CHANNEL_PREEMPT_TSG_FAIL |
|
F_TSG_UNBIND_CHANNEL_PREEMPT_TSG_FAIL |
|
||||||
@@ -540,6 +542,10 @@ int test_tsg_unbind_channel(struct unit_module *m,
|
|||||||
g->ops.tsg.unbind_channel = NULL;
|
g->ops.tsg.unbind_channel = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
g->ops.channel.abort_clean_up =
|
||||||
|
branches & F_TSG_UNBIND_CHANNEL_ABORT_CLEAN_UP_NULL ?
|
||||||
|
NULL : gops.channel.abort_clean_up;
|
||||||
|
|
||||||
err = nvgpu_tsg_unbind_channel(tsg, chA);
|
err = nvgpu_tsg_unbind_channel(tsg, chA);
|
||||||
|
|
||||||
if (branches & fail) {
|
if (branches & fail) {
|
||||||
@@ -549,6 +555,11 @@ int test_tsg_unbind_channel(struct unit_module *m,
|
|||||||
assert(chB->unserviceable);
|
assert(chB->unserviceable);
|
||||||
assert(chA->tsgid == NVGPU_INVALID_TSG_ID);
|
assert(chA->tsgid == NVGPU_INVALID_TSG_ID);
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
if (branches & F_TSG_UNBIND_CHANNEL_ABORT_CLEAN_UP_NULL) {
|
||||||
|
gops.channel.abort_clean_up(chA);
|
||||||
|
}
|
||||||
|
|
||||||
assert(chA->tsgid == NVGPU_INVALID_TSG_ID);
|
assert(chA->tsgid == NVGPU_INVALID_TSG_ID);
|
||||||
assert(nvgpu_list_empty(&chA->ch_entry));
|
assert(nvgpu_list_empty(&chA->ch_entry));
|
||||||
/* check that TSG has not been torn down */
|
/* check that TSG has not been torn down */
|
||||||
@@ -1059,19 +1070,19 @@ done:
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define F_TSG_ABORT_STUB BIT(0)
|
#define F_TSG_ABORT_CH_ABORT_CLEANUP_NULL BIT(0)
|
||||||
#define F_TSG_ABORT_PREEMPT BIT(1)
|
#define F_TSG_ABORT_PREEMPT BIT(1)
|
||||||
#define F_TSG_ABORT_CH BIT(2)
|
#define F_TSG_ABORT_CH BIT(2)
|
||||||
#define F_TSG_ABORT_CH_ABORT_CLEANUP_NULL BIT(3)
|
#define F_TSG_ABORT_NON_ABORTABLE BIT(3)
|
||||||
#define F_TSG_ABORT_NON_ABORTABLE BIT(4)
|
#define F_TSG_ABORT_CH_NON_REFERENCABLE BIT(4)
|
||||||
#define F_TSG_ABORT_LAST BIT(5)
|
#define F_TSG_ABORT_LAST BIT(5)
|
||||||
|
|
||||||
static const char *f_tsg_abort[] = {
|
static const char *f_tsg_abort[] = {
|
||||||
"stub",
|
|
||||||
"preempt",
|
"preempt",
|
||||||
"ch",
|
"ch",
|
||||||
"ch_abort_cleanup_null",
|
"ch_abort_cleanup_null",
|
||||||
"non_abortable",
|
"non_abortable",
|
||||||
|
"non_referenceable"
|
||||||
};
|
};
|
||||||
|
|
||||||
static int stub_fifo_preempt_tsg(struct gk20a *g, struct nvgpu_tsg *tsg)
|
static int stub_fifo_preempt_tsg(struct gk20a *g, struct nvgpu_tsg *tsg)
|
||||||
@@ -1107,9 +1118,6 @@ int test_tsg_abort(struct unit_module *m, struct gk20a *g, void *args)
|
|||||||
chA = nvgpu_channel_open_new(g, ~0U, false, getpid(), getpid());
|
chA = nvgpu_channel_open_new(g, ~0U, false, getpid(), getpid());
|
||||||
assert(chA != NULL);
|
assert(chA != NULL);
|
||||||
|
|
||||||
err = nvgpu_tsg_bind_channel(tsgA, chA);
|
|
||||||
assert(err == 0);
|
|
||||||
|
|
||||||
for (branches = 0U; branches < F_TSG_ABORT_LAST; branches++) {
|
for (branches = 0U; branches < F_TSG_ABORT_LAST; branches++) {
|
||||||
|
|
||||||
if (pruned(branches, prune)) {
|
if (pruned(branches, prune)) {
|
||||||
@@ -1122,14 +1130,10 @@ int test_tsg_abort(struct unit_module *m, struct gk20a *g, void *args)
|
|||||||
branches_str(branches, f_tsg_abort));
|
branches_str(branches, f_tsg_abort));
|
||||||
|
|
||||||
g->ops.channel.abort_clean_up =
|
g->ops.channel.abort_clean_up =
|
||||||
branches & F_TSG_ABORT_STUB ?
|
branches & F_TSG_ABORT_CH_ABORT_CLEANUP_NULL ?
|
||||||
stub_channel_abort_clean_up :
|
NULL : stub_channel_abort_clean_up;
|
||||||
gops.channel.abort_clean_up;
|
|
||||||
|
|
||||||
g->ops.fifo.preempt_tsg =
|
g->ops.fifo.preempt_tsg = stub_fifo_preempt_tsg;
|
||||||
branches & F_TSG_ABORT_STUB ?
|
|
||||||
stub_fifo_preempt_tsg :
|
|
||||||
gops.fifo.preempt_tsg;
|
|
||||||
|
|
||||||
tsg = branches & F_TSG_ABORT_CH ? tsgA : tsgB;
|
tsg = branches & F_TSG_ABORT_CH ? tsgA : tsgB;
|
||||||
|
|
||||||
@@ -1142,31 +1146,32 @@ int test_tsg_abort(struct unit_module *m, struct gk20a *g, void *args)
|
|||||||
g->ops.channel.abort_clean_up = NULL;
|
g->ops.channel.abort_clean_up = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (branches & F_TSG_ABORT_CH_NON_REFERENCABLE) {
|
||||||
|
chA->referenceable = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (chA->tsgid == NVGPU_INVALID_TSG_ID) {
|
||||||
|
err = nvgpu_tsg_bind_channel(tsgA, chA);
|
||||||
|
assert(err == 0);
|
||||||
|
}
|
||||||
|
|
||||||
nvgpu_tsg_abort(g, tsg, preempt);
|
nvgpu_tsg_abort(g, tsg, preempt);
|
||||||
|
|
||||||
if (branches & F_TSG_ABORT_STUB) {
|
assert(preempt == (stub[0].tsgid == tsg->tsgid));
|
||||||
if (preempt) {
|
|
||||||
assert(stub[0].tsgid == tsg->tsgid);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!(branches & F_TSG_ABORT_CH_ABORT_CLEANUP_NULL)) {
|
assert(chA->unserviceable ==
|
||||||
if (tsg == tsgA) {
|
((tsg == tsgA) && (chA->referenceable)));
|
||||||
assert(stub[1].chid == chA->chid);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tsg == tsgB) {
|
if (!((branches & F_TSG_ABORT_CH_ABORT_CLEANUP_NULL) ||
|
||||||
assert(stub[1].chid ==
|
(branches & F_TSG_ABORT_CH_NON_REFERENCABLE))) {
|
||||||
NVGPU_INVALID_CHANNEL_ID);
|
assert((stub[1].chid == chA->chid) == (tsg == tsgA) );
|
||||||
}
|
assert((stub[1].chid == NVGPU_INVALID_CHANNEL_ID) ==
|
||||||
}
|
(tsg == tsgB));
|
||||||
|
|
||||||
}
|
|
||||||
if (tsg == tsgA) {
|
|
||||||
assert(chA->unserviceable);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
tsg->abortable = true;
|
tsg->abortable = true;
|
||||||
chA->unserviceable = false;
|
chA->unserviceable = false;
|
||||||
|
chA->referenceable = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = UNIT_SUCCESS;
|
ret = UNIT_SUCCESS;
|
||||||
@@ -1246,7 +1251,7 @@ done:
|
|||||||
}
|
}
|
||||||
|
|
||||||
#define F_TSG_MARK_ERROR_NO_CHANNEL BIT(0)
|
#define F_TSG_MARK_ERROR_NO_CHANNEL BIT(0)
|
||||||
#define F_TSG_MARK_ERROR_UNSERVICEABLE BIT(1)
|
#define F_TSG_MARK_ERROR_NON_REFERENCABLE BIT(1)
|
||||||
#define F_TSG_MARK_ERROR_VERBOSE BIT(2)
|
#define F_TSG_MARK_ERROR_VERBOSE BIT(2)
|
||||||
#define F_TSG_MARK_ERROR_LAST BIT(3)
|
#define F_TSG_MARK_ERROR_LAST BIT(3)
|
||||||
|
|
||||||
@@ -1262,12 +1267,12 @@ int test_tsg_mark_error(struct unit_module *m,
|
|||||||
u32 branches;
|
u32 branches;
|
||||||
static const char *labels[] = {
|
static const char *labels[] = {
|
||||||
"no_channel",
|
"no_channel",
|
||||||
"unserviceable",
|
"non_referencable",
|
||||||
"verbose",
|
"verbose",
|
||||||
};
|
};
|
||||||
u32 prune =
|
u32 prune =
|
||||||
F_TSG_MARK_ERROR_NO_CHANNEL |
|
F_TSG_MARK_ERROR_NO_CHANNEL |
|
||||||
F_TSG_MARK_ERROR_UNSERVICEABLE;
|
F_TSG_MARK_ERROR_NON_REFERENCABLE;
|
||||||
struct nvgpu_posix_channel ch_priv;
|
struct nvgpu_posix_channel ch_priv;
|
||||||
|
|
||||||
for (branches = 0U; branches < F_TSG_MARK_ERROR_LAST; branches++) {
|
for (branches = 0U; branches < F_TSG_MARK_ERROR_LAST; branches++) {
|
||||||
@@ -1296,8 +1301,8 @@ int test_tsg_mark_error(struct unit_module *m,
|
|||||||
assert(err == 0);
|
assert(err == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (branches & F_TSG_MARK_ERROR_UNSERVICEABLE) {
|
if (branches & F_TSG_MARK_ERROR_NON_REFERENCABLE) {
|
||||||
nvgpu_channel_set_unserviceable(ch);
|
ch->referenceable = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
ch->ctxsw_timeout_debug_dump =
|
ch->ctxsw_timeout_debug_dump =
|
||||||
@@ -1309,7 +1314,7 @@ int test_tsg_mark_error(struct unit_module *m,
|
|||||||
verbose = nvgpu_tsg_mark_error(g, tsg);
|
verbose = nvgpu_tsg_mark_error(g, tsg);
|
||||||
|
|
||||||
if ((branches & F_TSG_MARK_ERROR_NO_CHANNEL) ||
|
if ((branches & F_TSG_MARK_ERROR_NO_CHANNEL) ||
|
||||||
(branches & F_TSG_MARK_ERROR_UNSERVICEABLE)) {
|
(branches & F_TSG_MARK_ERROR_NON_REFERENCABLE)) {
|
||||||
assert(!verbose);
|
assert(!verbose);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user