Skip to content

Commit 99c3ce3

Browse files
apopplempe
authored andcommitted
powerpc/powernv/npu: Add a debugfs setting to change ATSD threshold
The threshold at which it becomes more efficient to coalesce a range of ATSDs into a single per-PID ATSD is currently not well understood due to a lack of real-world work loads. This patch adds a debugfs parameter allowing the threshold to be altered at runtime in order to aid future development and refinement of the value. Signed-off-by: Alistair Popple <[email protected]> Acked-by: Balbir Singh <[email protected]> Signed-off-by: Michael Ellerman <[email protected]>
1 parent d69ccc0 commit 99c3ce3

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

arch/powerpc/platforms/powernv/npu-dma.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@
1717
#include <linux/pci.h>
1818
#include <linux/memblock.h>
1919
#include <linux/iommu.h>
20+
#include <linux/debugfs.h>
2021

22+
#include <asm/debugfs.h>
2123
#include <asm/tlb.h>
2224
#include <asm/powernv.h>
2325
#include <asm/reg.h>
@@ -44,7 +46,8 @@ static DEFINE_SPINLOCK(npu_context_lock);
4446
* entire TLB on the GPU for the given PID rather than each specific address in
4547
* the range.
4648
*/
47-
#define ATSD_THRESHOLD (2*1024*1024)
49+
static uint64_t atsd_threshold = 2 * 1024 * 1024;
50+
static struct dentry *atsd_threshold_dentry;
4851

4952
/*
5053
* Other types of TCE cache invalidation are not functional in the
@@ -683,7 +686,7 @@ static void pnv_npu2_mn_invalidate_range(struct mmu_notifier *mn,
683686
struct npu_context *npu_context = mn_to_npu_context(mn);
684687
unsigned long address;
685688

686-
if (end - start > ATSD_THRESHOLD) {
689+
if (end - start > atsd_threshold) {
687690
/*
688691
* Just invalidate the entire PID if the address range is too
689692
* large.
@@ -958,6 +961,11 @@ int pnv_npu2_init(struct pnv_phb *phb)
958961
static int npu_index;
959962
uint64_t rc = 0;
960963

964+
if (!atsd_threshold_dentry) {
965+
atsd_threshold_dentry = debugfs_create_x64("atsd_threshold",
966+
0600, powerpc_debugfs_root, &atsd_threshold);
967+
}
968+
961969
phb->npu.nmmu_flush =
962970
of_property_read_bool(phb->hose->dn, "ibm,nmmu-flush");
963971
for_each_child_of_node(phb->hose->dn, dn) {

0 commit comments

Comments
 (0)