diff options
author | Thomas Fleury <tfleury@nvidia.com> | 2017-08-01 20:17:34 -0400 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2017-08-07 16:47:06 -0400 |
commit | 525489f26eba34804de93a07d6035fc3458deeab (patch) | |
tree | 05208cc22149f2d24be3cf3ab77c696e8f780e41 /drivers | |
parent | 2492142224e3cc7f83f19cdebdadf5cc54fb2956 (diff) |
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>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/gpu/nvgpu/common/linux/debug.c | 45 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/common/linux/vm.c | 5 |
2 files changed, 47 insertions, 3 deletions
diff --git a/drivers/gpu/nvgpu/common/linux/debug.c b/drivers/gpu/nvgpu/common/linux/debug.c index 36f142d7..7dce74d6 100644 --- a/drivers/gpu/nvgpu/common/linux/debug.c +++ b/drivers/gpu/nvgpu/common/linux/debug.c | |||
@@ -28,6 +28,7 @@ | |||
28 | 28 | ||
29 | #include <linux/debugfs.h> | 29 | #include <linux/debugfs.h> |
30 | #include <linux/seq_file.h> | 30 | #include <linux/seq_file.h> |
31 | #include <linux/uaccess.h> | ||
31 | 32 | ||
32 | #include <nvgpu/debug.h> | 33 | #include <nvgpu/debug.h> |
33 | 34 | ||
@@ -173,6 +174,45 @@ void gk20a_debug_show_dump(struct gk20a *g, struct gk20a_debug_output *o) | |||
173 | gk20a_debug_dump_all_channel_status_ramfc(g, o); | 174 | gk20a_debug_dump_all_channel_status_ramfc(g, o); |
174 | } | 175 | } |
175 | 176 | ||
177 | static ssize_t disable_bigpage_read(struct file *file, char __user *user_buf, size_t count, loff_t *ppos) | ||
178 | { | ||
179 | char buf[3]; | ||
180 | struct gk20a *g = file->private_data; | ||
181 | |||
182 | if (g->mm.disable_bigpage) | ||
183 | buf[0] = 'Y'; | ||
184 | else | ||
185 | buf[0] = 'N'; | ||
186 | buf[1] = '\n'; | ||
187 | buf[2] = 0x00; | ||
188 | return simple_read_from_buffer(user_buf, count, ppos, buf, 2); | ||
189 | } | ||
190 | |||
191 | static ssize_t disable_bigpage_write(struct file *file, const char __user *user_buf, size_t count, loff_t *ppos) | ||
192 | { | ||
193 | char buf[32]; | ||
194 | int buf_size; | ||
195 | bool bv; | ||
196 | struct gk20a *g = file->private_data; | ||
197 | |||
198 | buf_size = min(count, (sizeof(buf)-1)); | ||
199 | if (copy_from_user(buf, user_buf, buf_size)) | ||
200 | return -EFAULT; | ||
201 | |||
202 | if (strtobool(buf, &bv) == 0) { | ||
203 | g->mm.disable_bigpage = bv; | ||
204 | gk20a_init_gpu_characteristics(g); | ||
205 | } | ||
206 | |||
207 | return count; | ||
208 | } | ||
209 | |||
210 | static struct file_operations disable_bigpage_fops = { | ||
211 | .open = simple_open, | ||
212 | .read = disable_bigpage_read, | ||
213 | .write = disable_bigpage_write, | ||
214 | }; | ||
215 | |||
176 | static int railgate_residency_show(struct seq_file *s, void *data) | 216 | static int railgate_residency_show(struct seq_file *s, void *data) |
177 | { | 217 | { |
178 | struct gk20a *g = s->private; | 218 | struct gk20a *g = s->private; |
@@ -296,10 +336,11 @@ void gk20a_debug_init(struct gk20a *g, const char *debugfs_symlink) | |||
296 | l->debugfs, | 336 | l->debugfs, |
297 | &g->mm.bypass_smmu); | 337 | &g->mm.bypass_smmu); |
298 | l->debugfs_disable_bigpage = | 338 | l->debugfs_disable_bigpage = |
299 | debugfs_create_bool("disable_bigpage", | 339 | debugfs_create_file("disable_bigpage", |
300 | S_IRUGO|S_IWUSR, | 340 | S_IRUGO|S_IWUSR, |
301 | l->debugfs, | 341 | l->debugfs, |
302 | &g->mm.disable_bigpage); | 342 | g, |
343 | &disable_bigpage_fops); | ||
303 | 344 | ||
304 | l->debugfs_timeslice_low_priority_us = | 345 | l->debugfs_timeslice_low_priority_us = |
305 | debugfs_create_u32("timeslice_low_priority_us", | 346 | debugfs_create_u32("timeslice_low_priority_us", |
diff --git a/drivers/gpu/nvgpu/common/linux/vm.c b/drivers/gpu/nvgpu/common/linux/vm.c index d47d6bb1..dec05209 100644 --- a/drivers/gpu/nvgpu/common/linux/vm.c +++ b/drivers/gpu/nvgpu/common/linux/vm.c | |||
@@ -260,7 +260,10 @@ u64 nvgpu_vm_map(struct vm_gk20a *vm, | |||
260 | map_offset = offset_align; | 260 | map_offset = offset_align; |
261 | 261 | ||
262 | bfr.align = nvgpu_get_buffer_alignment(g, sgl, aperture); | 262 | bfr.align = nvgpu_get_buffer_alignment(g, sgl, aperture); |
263 | bfr.pgsz_idx = __get_pte_size(vm, map_offset, | 263 | if (g->mm.disable_bigpage) |
264 | bfr.pgsz_idx = gmmu_page_size_small; | ||
265 | else | ||
266 | bfr.pgsz_idx = __get_pte_size(vm, map_offset, | ||
264 | min_t(u64, bfr.size, bfr.align)); | 267 | min_t(u64, bfr.size, bfr.align)); |
265 | mapping_size = mapping_size ? mapping_size : bfr.size; | 268 | mapping_size = mapping_size ? mapping_size : bfr.size; |
266 | 269 | ||