gpu: nvgpu: unit: mm: add coverage & traceability

This patch adds new tests to improve test coverage. Also, updating test
target tags to increase traceability.

Jira NVGPU-4780

Change-Id: I87341efa3fa7d741f7abb611ff28ad6d5e1c6880
Signed-off-by: Vedashree Vidwans <vvidwans@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2279644
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Vedashree Vidwans
2019-12-31 11:00:24 -08:00
committed by Alex Waterman
parent 4bcd419a0b
commit f46c3064ed
27 changed files with 934 additions and 240 deletions

View File

@@ -294,7 +294,7 @@ static void nvgpu_buddy_allocator_destroy(struct nvgpu_allocator *na)
struct nvgpu_rbtree_node *node = NULL;
struct nvgpu_buddy *bud;
struct nvgpu_fixed_alloc *falloc;
struct nvgpu_buddy_allocator *a = na->priv;
struct nvgpu_buddy_allocator *a = buddy_allocator(na);
alloc_lock(na);
@@ -909,7 +909,7 @@ static u64 nvgpu_buddy_balloc_pte(struct nvgpu_allocator *na, u64 len,
{
u64 order, addr;
u32 pte_size;
struct nvgpu_buddy_allocator *a = na->priv;
struct nvgpu_buddy_allocator *a = buddy_allocator(na);
if (len == 0ULL) {
alloc_dbg(balloc_owner(a), "Alloc fail");
@@ -968,7 +968,7 @@ static u64 nvgpu_balloc_fixed_buddy_locked(struct nvgpu_allocator *na,
u64 ret, real_bytes = 0;
struct nvgpu_buddy *bud;
struct nvgpu_fixed_alloc *falloc = NULL;
struct nvgpu_buddy_allocator *a = na->priv;
struct nvgpu_buddy_allocator *a = buddy_allocator(na);
/* If base isn't aligned to an order 0 block, fail. */
nvgpu_assert(a->blk_size > 0ULL);
@@ -1050,7 +1050,7 @@ static u64 nvgpu_balloc_fixed_buddy(struct nvgpu_allocator *na,
u64 base, u64 len, u32 page_size)
{
u64 alloc;
struct nvgpu_buddy_allocator *a = na->priv;
struct nvgpu_buddy_allocator *a = buddy_allocator(na);
alloc_lock(na);
alloc = nvgpu_balloc_fixed_buddy_locked(na, base, len, page_size);
@@ -1071,7 +1071,7 @@ static void nvgpu_buddy_bfree_locked(struct nvgpu_allocator *na, u64 addr)
{
struct nvgpu_buddy *bud;
struct nvgpu_fixed_alloc *falloc;
struct nvgpu_buddy_allocator *a = na->priv;
struct nvgpu_buddy_allocator *a = buddy_allocator(na);
/*
* First see if this is a fixed alloc. If not fall back to a regular
@@ -1148,7 +1148,7 @@ static bool nvgpu_buddy_reserve_is_possible(struct nvgpu_buddy_allocator *a,
static int nvgpu_buddy_reserve_co(struct nvgpu_allocator *na,
struct nvgpu_alloc_carveout *co)
{
struct nvgpu_buddy_allocator *a = na->priv;
struct nvgpu_buddy_allocator *a = buddy_allocator(na);
u64 addr;
int err = 0;
@@ -1203,21 +1203,21 @@ static void nvgpu_buddy_release_co(struct nvgpu_allocator *na,
static u64 nvgpu_buddy_alloc_length(struct nvgpu_allocator *a)
{
struct nvgpu_buddy_allocator *ba = a->priv;
struct nvgpu_buddy_allocator *ba = buddy_allocator(a);
return ba->length;
}
static u64 nvgpu_buddy_alloc_base(struct nvgpu_allocator *a)
{
struct nvgpu_buddy_allocator *ba = a->priv;
struct nvgpu_buddy_allocator *ba = buddy_allocator(a);
return ba->start;
}
static bool nvgpu_buddy_alloc_inited(struct nvgpu_allocator *a)
{
struct nvgpu_buddy_allocator *ba = a->priv;
struct nvgpu_buddy_allocator *ba = buddy_allocator(a);
bool inited = ba->initialized;
nvgpu_smp_rmb();
@@ -1226,14 +1226,14 @@ static bool nvgpu_buddy_alloc_inited(struct nvgpu_allocator *a)
static u64 nvgpu_buddy_alloc_end(struct nvgpu_allocator *a)
{
struct nvgpu_buddy_allocator *ba = a->priv;
struct nvgpu_buddy_allocator *ba = buddy_allocator(a);
return ba->end;
}
static u64 nvgpu_buddy_alloc_space(struct nvgpu_allocator *a)
{
struct nvgpu_buddy_allocator *ba = a->priv;
struct nvgpu_buddy_allocator *ba = buddy_allocator(a);
u64 space;
alloc_lock(a);
@@ -1259,7 +1259,7 @@ static void nvgpu_buddy_print_stats(struct nvgpu_allocator *na,
struct nvgpu_rbtree_node *node = NULL;
struct nvgpu_fixed_alloc *falloc;
struct nvgpu_alloc_carveout *tmp;
struct nvgpu_buddy_allocator *a = na->priv;
struct nvgpu_buddy_allocator *a = buddy_allocator(na);
alloc_pstat(s, na, "base = %llu, limit = %llu, blk_size = %llu",
a->base, a->length, a->blk_size);

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011-2019, NVIDIA CORPORATION. All rights reserved.
* Copyright (c) 2011-2020, NVIDIA CORPORATION. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -681,26 +681,6 @@ int nvgpu_alloc_common_init(struct nvgpu_allocator *a, struct gk20a *g,
const char *name, void *priv, bool dbg,
const struct nvgpu_allocator_ops *ops);
/**
* @brief Enable allocator debug.
*
* @param[in] a Pointer to nvgpu allocator.
*/
static inline void nvgpu_alloc_enable_dbg(struct nvgpu_allocator *a)
{
a->debug = true;
}
/**
* @brief Disable allocator debug.
*
* @param[in] a Pointer to nvgpu allocator.
*/
static inline void nvgpu_alloc_disable_dbg(struct nvgpu_allocator *a)
{
a->debug = false;
}
/*
* Debug stuff.
*/

View File

@@ -548,6 +548,7 @@ nvgpu_mc_intr_stall_unit_config
nvgpu_memcmp
nvgpu_memcpy
nvgpu_memset
nvgpu_mem_create_from_mem
nvgpu_mem_create_from_phys
nvgpu_mem_get_addr
nvgpu_mem_iommu_translate