summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPixelBot AutoMerger <android-nexus-securitybot@system.gserviceaccount.com>2023-10-01 18:20:31 -0700
committerPindar Yang <pindaryang@google.com>2023-10-02 02:33:38 +0000
commitd2429d159b0db18184298ad404009b3a38464ccb (patch)
treeb903b9501c1d60e5cfb205280a36425a0c9f4078
parent4b239980ff19577152fa4d31e0a3679af2e158a2 (diff)
parent241a3cfc12f8b45de331964b5f1a26712b64f6f5 (diff)
downloadgpu-d2429d159b0db18184298ad404009b3a38464ccb.tar.gz
Merge android13-gs-pixel-5.10-udc-qpr1 into android13-gs-pixel-5.10-24Q1
Bug: 300854197 SBMerger: 558810260 Change-Id: I2533a7f40800e1b5c32633543af66d1a58d66a43 Signed-off-by: SecurityBot <android-nexus-securitybot@system.gserviceaccount.com>
-rw-r--r--mali_kbase/context/mali_kbase_context.c1
-rw-r--r--mali_kbase/csf/mali_kbase_csf_tiler_heap_reclaim.c25
-rw-r--r--mali_kbase/mali_kbase_core_linux.c9
-rw-r--r--mali_kbase/mali_kbase_defs.h8
4 files changed, 33 insertions, 10 deletions
diff --git a/mali_kbase/context/mali_kbase_context.c b/mali_kbase/context/mali_kbase_context.c
index 70941ef..d227084 100644
--- a/mali_kbase/context/mali_kbase_context.c
+++ b/mali_kbase/context/mali_kbase_context.c
@@ -237,7 +237,6 @@ int kbase_context_common_init(struct kbase_context *kctx)
spin_lock_init(&kctx->waiting_soft_jobs_lock);
INIT_LIST_HEAD(&kctx->waiting_soft_jobs);
- init_waitqueue_head(&kctx->event_queue);
atomic_set(&kctx->event_count, 0);
#if !MALI_USE_CSF
diff --git a/mali_kbase/csf/mali_kbase_csf_tiler_heap_reclaim.c b/mali_kbase/csf/mali_kbase_csf_tiler_heap_reclaim.c
index c12ed65..39db1a0 100644
--- a/mali_kbase/csf/mali_kbase_csf_tiler_heap_reclaim.c
+++ b/mali_kbase/csf/mali_kbase_csf_tiler_heap_reclaim.c
@@ -20,6 +20,7 @@
*/
#include <mali_kbase.h>
+#include "backend/gpu/mali_kbase_pm_internal.h"
#include "mali_kbase_csf.h"
#include "mali_kbase_csf_tiler_heap.h"
#include "mali_kbase_csf_tiler_heap_reclaim.h"
@@ -193,7 +194,29 @@ static unsigned long reclaim_unused_heap_pages(struct kbase_device *kbdev)
unsigned long total_freed_pages = 0;
int prio;
- lockdep_assert_held(&kbdev->csf.scheduler.lock);
+ lockdep_assert_held(&scheduler->lock);
+
+ if (scheduler->state != SCHED_SUSPENDED) {
+ /* Clean and invalidate the L2 cache before reading from the heap contexts,
+ * headers of the individual chunks and buffer descriptors.
+ */
+ kbase_gpu_start_cache_clean(kbdev, GPU_COMMAND_CACHE_CLN_INV_L2);
+ if (kbase_gpu_wait_cache_clean_timeout(kbdev,
+ kbdev->mmu_or_gpu_cache_op_wait_time_ms))
+ dev_warn(
+ kbdev->dev,
+ "[%llu] Timeout waiting for CACHE_CLN_INV_L2 to complete before Tiler heap reclaim",
+ kbase_backend_get_cycle_cnt(kbdev));
+
+ } else {
+ /* Make sure power down transitions have completed, i.e. L2 has been
+ * powered off as that would ensure its contents are flushed to memory.
+ * This is needed as Scheduler doesn't wait for the power down to finish.
+ */
+ if (kbase_pm_wait_for_desired_state(kbdev))
+ dev_warn(kbdev->dev,
+ "Wait for power down transition failed before Tiler heap reclaim");
+ }
for (prio = KBASE_QUEUE_GROUP_PRIORITY_LOW;
total_freed_pages < HEAP_RECLAIM_SCAN_BATCH_SIZE &&
diff --git a/mali_kbase/mali_kbase_core_linux.c b/mali_kbase/mali_kbase_core_linux.c
index dd8ba7f..75e8023 100644
--- a/mali_kbase/mali_kbase_core_linux.c
+++ b/mali_kbase/mali_kbase_core_linux.c
@@ -326,6 +326,7 @@ static struct kbase_file *kbase_file_new(struct kbase_device *const kbdev,
#if IS_ENABLED(CONFIG_DEBUG_FS)
init_waitqueue_head(&kfile->zero_fops_count_wait);
#endif
+ init_waitqueue_head(&kfile->event_queue);
}
return kfile;
}
@@ -2501,7 +2502,7 @@ static ssize_t kbase_read(struct file *filp, char __user *buf, size_t count, lof
goto out;
}
- if (wait_event_interruptible(kctx->event_queue,
+ if (wait_event_interruptible(kctx->kfile->event_queue,
kbase_event_pending(kctx)) != 0) {
err = -ERESTARTSYS;
goto out;
@@ -2556,7 +2557,7 @@ static __poll_t kbase_poll(struct file *filp, poll_table *wait)
goto out;
}
- poll_wait(filp, &kctx->event_queue, wait);
+ poll_wait(filp, &kfile->event_queue, wait);
if (kbase_event_pending(kctx)) {
#if (KERNEL_VERSION(4, 19, 0) > LINUX_VERSION_CODE)
ret = POLLIN | POLLRDNORM;
@@ -2576,12 +2577,12 @@ void _kbase_event_wakeup(struct kbase_context *kctx, bool sync)
if(sync) {
dev_dbg(kctx->kbdev->dev,
"Waking event queue for context %pK (sync)\n", (void *)kctx);
- wake_up_interruptible_sync(&kctx->event_queue);
+ wake_up_interruptible_sync(&kctx->kfile->event_queue);
}
else {
dev_dbg(kctx->kbdev->dev,
"Waking event queue for context %pK (nosync)\n",(void *)kctx);
- wake_up_interruptible(&kctx->event_queue);
+ wake_up_interruptible(&kctx->kfile->event_queue);
}
}
diff --git a/mali_kbase/mali_kbase_defs.h b/mali_kbase/mali_kbase_defs.h
index efe690d..255281d 100644
--- a/mali_kbase/mali_kbase_defs.h
+++ b/mali_kbase/mali_kbase_defs.h
@@ -1599,6 +1599,9 @@ enum kbase_file_state {
* present.
* @zero_fops_count_wait: Waitqueue used to wait for the @fops_count to become 0.
* Currently needed only for the "mem_view" debugfs file.
+ * @event_queue: Wait queue used for blocking the thread, which consumes
+ * the base_jd_event corresponding to an atom, when there
+ * are no more posted events.
*/
struct kbase_file {
struct kbase_device *kbdev;
@@ -1614,6 +1617,7 @@ struct kbase_file {
#if IS_ENABLED(CONFIG_DEBUG_FS)
wait_queue_head_t zero_fops_count_wait;
#endif
+ wait_queue_head_t event_queue;
};
#if MALI_JIT_PRESSURE_LIMIT_BASE
/**
@@ -1835,9 +1839,6 @@ struct kbase_sub_alloc {
* used in conjunction with @cookies bitmask mainly for
* providing a mechansim to have the same value for CPU &
* GPU virtual address.
- * @event_queue: Wait queue used for blocking the thread, which consumes
- * the base_jd_event corresponding to an atom, when there
- * are no more posted events.
* @tgid: Thread group ID of the process whose thread created
* the context (by calling KBASE_IOCTL_VERSION_CHECK or
* KBASE_IOCTL_SET_FLAGS, depending on the @api_version).
@@ -2093,7 +2094,6 @@ struct kbase_context {
DECLARE_BITMAP(cookies, BITS_PER_LONG);
struct kbase_va_region *pending_regions[BITS_PER_LONG];
- wait_queue_head_t event_queue;
pid_t tgid;
pid_t pid;
atomic_t used_pages;