gpu: nvgpu: fix debugfs to disable big pages

After setting 'Y' in disable_bigpage, in native SMMU case,
we could still see 64K GMMU pages beeing used.

Fixed the following:
    - enforce disable_bigpage in nvgpu_vm_map
    - update GPU characteristics so that new clients know
      whether or not big pages are enabled. For instance
      this may affect how CUDA requests memory mapping.

JIRA EVLR-1694

Change-Id: I62841096add3bd798c5c11090054f82c8a2be832
Signed-off-by: Thomas Fleury <tfleury@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1532429
Reviewed-by: Richard Zhao <rizhao@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: svccoveritychecker <svccoveritychecker@nvidia.com>
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
This commit is contained in:
Thomas Fleury
2017-08-01 17:17:34 -07:00
committed by mobile promotions
parent 2492142224
commit 525489f26e
2 changed files with 47 additions and 3 deletions

View File

@@ -28,6 +28,7 @@
#include <linux/debugfs.h>
#include <linux/seq_file.h>
#include <linux/uaccess.h>
#include <nvgpu/debug.h>
@@ -173,6 +174,45 @@ void gk20a_debug_show_dump(struct gk20a *g, struct gk20a_debug_output *o)
gk20a_debug_dump_all_channel_status_ramfc(g, o);
}
static ssize_t disable_bigpage_read(struct file *file, char __user *user_buf, size_t count, loff_t *ppos)
{
char buf[3];
struct gk20a *g = file->private_data;
if (g->mm.disable_bigpage)
buf[0] = 'Y';
else
buf[0] = 'N';
buf[1] = '\n';
buf[2] = 0x00;
return simple_read_from_buffer(user_buf, count, ppos, buf, 2);
}
static ssize_t disable_bigpage_write(struct file *file, const char __user *user_buf, size_t count, loff_t *ppos)
{
char buf[32];
int buf_size;
bool bv;
struct gk20a *g = file->private_data;
buf_size = min(count, (sizeof(buf)-1));
if (copy_from_user(buf, user_buf, buf_size))
return -EFAULT;
if (strtobool(buf, &bv) == 0) {
g->mm.disable_bigpage = bv;
gk20a_init_gpu_characteristics(g);
}
return count;
}
static struct file_operations disable_bigpage_fops = {
.open = simple_open,
.read = disable_bigpage_read,
.write = disable_bigpage_write,
};
static int railgate_residency_show(struct seq_file *s, void *data)
{
struct gk20a *g = s->private;
@@ -296,10 +336,11 @@ void gk20a_debug_init(struct gk20a *g, const char *debugfs_symlink)
l->debugfs,
&g->mm.bypass_smmu);
l->debugfs_disable_bigpage =
debugfs_create_bool("disable_bigpage",
debugfs_create_file("disable_bigpage",
S_IRUGO|S_IWUSR,
l->debugfs,
&g->mm.disable_bigpage);
g,
&disable_bigpage_fops);
l->debugfs_timeslice_low_priority_us =
debugfs_create_u32("timeslice_low_priority_us",

View File

@@ -260,6 +260,9 @@ u64 nvgpu_vm_map(struct vm_gk20a *vm,
map_offset = offset_align;
bfr.align = nvgpu_get_buffer_alignment(g, sgl, aperture);
if (g->mm.disable_bigpage)
bfr.pgsz_idx = gmmu_page_size_small;
else
bfr.pgsz_idx = __get_pte_size(vm, map_offset,
min_t(u64, bfr.size, bfr.align));
mapping_size = mapping_size ? mapping_size : bfr.size;