Commit 454da4d2 authored by Hans de Goede's avatar Hans de Goede Committed by Mauro Carvalho Chehab
Browse files

media: atomisp: remove hmm_mem_stats

Without pool support the (optional) debug logging done by these is
not really meaningful, drop it all.

Link: https://lore.kernel.org/linux-media/20220615205037.16549-13-hdegoede@redhat.com


Reviewed-by: default avatarAndy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@kernel.org>
parent c35f36b7
Loading
Loading
Loading
Loading
+0 −8
Original line number Diff line number Diff line
@@ -87,14 +87,6 @@ ia_css_ptr hmm_host_vaddr_to_hrt_vaddr(const void *ptr);
 */
int hmm_mmap(struct vm_area_struct *vma, ia_css_ptr virt);

/* show memory statistic
 */
void hmm_show_mem_stat(const char *func, const int line);

/* init memory statistic
 */
void hmm_init_mem_stat(int res_pgnr, int dyc_en, int dyc_pgnr);

extern bool dypool_enable;
extern unsigned int dypool_pgnr;
extern struct hmm_bo_device bo_device;
+0 −26
Original line number Diff line number Diff line
@@ -68,30 +68,4 @@
#define	check_null_return_void(ptr, fmt, arg ...)	\
		var_equal_return_void(ptr, NULL, fmt, ## arg)

/* hmm_mem_stat is used to trace the hmm mem used by ISP pipe. The unit is page
 * number.
 *
 * res_size:  reserved mem pool size, being allocated from system at system boot time.
 *		res_size >= res_cnt.
 * sys_size:  system mem pool size, being allocated from system at camera running time.
 *		dyc_size:  dynamic mem pool size.
 *		dyc_thr:   dynamic mem pool high watermark.
 *		dyc_size <= dyc_thr.
 * usr_size:  user ptr mem size.
 *
 * res_cnt:   track the mem allocated from reserved pool at camera running time.
 * tol_cnt:   track the total mem used by ISP pipe at camera running time.
 */
struct _hmm_mem_stat {
	int res_size;
	int sys_size;
	int dyc_size;
	int dyc_thr;
	int usr_size;
	int res_cnt;
	int tol_cnt;
};

extern struct _hmm_mem_stat hmm_mem_stat;

#endif
+1 −6
Original line number Diff line number Diff line
@@ -45,10 +45,8 @@ struct _iunit_debug {

#define OPTION_BIN_LIST			BIT(0)
#define OPTION_BIN_RUN			BIT(1)
#define OPTION_MEM_STAT			BIT(2)
#define OPTION_VALID			(OPTION_BIN_LIST \
					| OPTION_BIN_RUN \
					| OPTION_MEM_STAT)
					| OPTION_BIN_RUN)

static struct _iunit_debug iunit_debug = {
	.dbglvl = 0,
@@ -81,9 +79,6 @@ static inline int iunit_dump_dbgopt(struct atomisp_device *isp,
				goto opt_err;
			}
		}

		if (opt & OPTION_MEM_STAT)
			hmm_show_mem_stat(__func__, __LINE__);
	} else {
		ret = -EINVAL;
		dev_err(isp->dev, "%s dump nothing[ret=%d]\n", __func__, ret);
+0 −1
Original line number Diff line number Diff line
@@ -1770,7 +1770,6 @@ static int atomisp_pci_probe(struct pci_dev *pdev, const struct pci_device_id *i
	pm_runtime_put_noidle(&pdev->dev);
	pm_runtime_allow(&pdev->dev);

	hmm_init_mem_stat(repool_pgnr, dypool_enable, dypool_pgnr);
	/* Init ISP memory management */
	hmm_init();

+0 −36
Original line number Diff line number Diff line
@@ -38,7 +38,6 @@
struct hmm_bo_device bo_device;
static ia_css_ptr dummy_ptr = mmgr_EXCEPTION;
static bool hmm_initialized;
struct _hmm_mem_stat hmm_mem_stat;

/*
 * p: private
@@ -209,8 +208,6 @@ ia_css_ptr hmm_alloc(size_t bytes, enum hmm_bo_type type,
		goto bind_err;
	}

	hmm_mem_stat.tol_cnt += pgnr;

	if (attrs & ATOMISP_MAP_FLAG_CLEARED)
		hmm_set(bo->start, 0, bytes);

@@ -246,8 +243,6 @@ void hmm_free(ia_css_ptr virt)
		return;
	}

	hmm_mem_stat.tol_cnt -= bo->pgnr;

	hmm_bo_unbind(bo);
	hmm_bo_free_pages(bo);
	hmm_bo_unref(bo);
@@ -637,34 +632,3 @@ ia_css_ptr hmm_host_vaddr_to_hrt_vaddr(const void *ptr)
		ptr);
	return 0;
}

void hmm_show_mem_stat(const char *func, const int line)
{
	pr_info("tol_cnt=%d usr_size=%d res_size=%d res_cnt=%d sys_size=%d  dyc_thr=%d dyc_size=%d.\n",
		hmm_mem_stat.tol_cnt,
		hmm_mem_stat.usr_size, hmm_mem_stat.res_size,
		hmm_mem_stat.res_cnt, hmm_mem_stat.sys_size,
		hmm_mem_stat.dyc_thr, hmm_mem_stat.dyc_size);
}

void hmm_init_mem_stat(int res_pgnr, int dyc_en, int dyc_pgnr)
{
	hmm_mem_stat.res_size = res_pgnr;
	/* If reserved mem pool is not enabled, set its "mem stat" values as -1. */
	if (hmm_mem_stat.res_size == 0) {
		hmm_mem_stat.res_size = -1;
		hmm_mem_stat.res_cnt = -1;
	}

	/* If dynamic memory pool is not enabled, set its "mem stat" values as -1. */
	if (!dyc_en) {
		hmm_mem_stat.dyc_size = -1;
		hmm_mem_stat.dyc_thr = -1;
	} else {
		hmm_mem_stat.dyc_size = 0;
		hmm_mem_stat.dyc_thr = dyc_pgnr;
	}
	hmm_mem_stat.usr_size = 0;
	hmm_mem_stat.sys_size = 0;
	hmm_mem_stat.tol_cnt = 0;
}
Loading