aboutsummaryrefslogtreecommitdiff
path: root/core/test/run-mem_region.c
AgeCommit message (Collapse)AuthorFilesLines
2017-12-20lock: Add additional lock auditing codeBenjamin Herrenschmidt1-1/+2
Keep track of lock owner name and replace lock_depth counter with a per-cpu list of locks held by the cpu. This allows us to print the actual locks held in case we hit the (in)famous message about opal_pollers being run with a lock held. It also allows us to warn (and drop them) if locks are still held when returning to the OS or completing a scheduled job. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Reviewed-by: Nicholas Piggin <npiggin@gmail.com> [stewart: fix unit tests] Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2016-08-18check: Fix bugs in mem region testsBenjamin Herrenschmidt1-1/+0
We shouldn't delete the list element after list_pop, it's already been deleted. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-07-02Add mem_dump_free() call to mem_region unit testStewart Smith1-0/+2
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-05-13core/test: Use skiboot's own malloc for mem_region testsJeremy Kerr1-15/+8
Comments in the run-mem_region test imply that it uses skiboot's own malloc for the malloc implementation, but this isn't true; a malloc inside the mem_region code itself will use the glibc malloc. This change implements the intention of the test, and uses skiboot malloc for the file-under-test. real_malloc() is available for actual glibc mallocs. Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-05-13core/test: simulate proper locking in run-mem_region testJeremy Kerr1-2/+13
Currently, this test doesn't do locking during region changes or allocations. This change adds the appropriate locking. Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-05-13core: Add asserts for region free-list lockingJeremy Kerr1-0/+5
This change adds asserts to the mem_region calls that should have the per-region lock held. To keep the tests working, they need the lock_held_by_me() function. The run-mem_region.c test has a bogus implementation of this, as it doesn't do any locking at the moment. This will be addressed in a later change. Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-05-13core: Move free-list locking to a separate per-region lockJeremy Kerr1-1/+1
Currently, we have a single lock for the entire mem_region system; this protects both the global region list, and the allocations from each region. This means we can't allocate memory while traversing the global region list, as any malloc/realloc/free will try to acquire the mem_region lock again. This change separates the locking into different functions. We keep the mem_region_lock to protect the regions list, and introduce a per-region lock to protect allocations from the regions' free_lists. Then we remove the open-coded invocations of mem_alloc, where we'd avoided malloc() due to the above locking issue. Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2014-10-17Rename mem_size() to mem_allocated_size()Stewart Smith1-4/+4
This better states the intention of what it should return. I was bit unsure when fixing mem_size(), so hopefully this makes future me (or other people) less unsure as to the intended return value of this function. No functional changes, just rename. Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com> Acked-by: Rusty Russell <rusty@au1.ibm.com>
2014-07-02Initial commit of Open Source releaseBenjamin Herrenschmidt1-0/+250
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>