diff options
author | Jack Diver <diverj@google.com> | 2024-03-13 16:33:34 +0000 |
---|---|---|
committer | Jack Diver <diverj@google.com> | 2024-03-14 10:13:40 +0000 |
commit | cdce8efe7fc9a58b68843ce2f4c39186bf7b6750 (patch) | |
tree | 6c3bd2f8fe4b62926cc072a3d5a6884bae665334 | |
parent | 19b46b5347839da38a023873115ad8a147500584 (diff) | |
download | gpu-cdce8efe7fc9a58b68843ce2f4c39186bf7b6750.tar.gz |
[DO NOT MERGE ANYWHERE] Revert "mali_kbase: platform: Drop SLC demand on context idle"
Revert submission 2753879-gpu-slcv2-gs201
Reason for revert: Prebuild did not land before cutoff
Reverted changes: /q/submissionid:2753879-gpu-slcv2-gs201
Bug: 329447972
Change-Id: I9fd9a733a844bdc037b2ccbac2c8daf44186d319
-rw-r--r-- | mali_kbase/platform/pixel/mali_kbase_config_platform.h | 12 | ||||
-rw-r--r-- | mali_kbase/platform/pixel/pixel_gpu.c | 6 | ||||
-rw-r--r-- | mali_kbase/platform/pixel/pixel_gpu_slc.c | 76 | ||||
-rw-r--r-- | mali_kbase/platform/pixel/pixel_gpu_slc.h | 12 |
4 files changed, 7 insertions, 99 deletions
diff --git a/mali_kbase/platform/pixel/mali_kbase_config_platform.h b/mali_kbase/platform/pixel/mali_kbase_config_platform.h index a0bf623..ef73c65 100644 --- a/mali_kbase/platform/pixel/mali_kbase_config_platform.h +++ b/mali_kbase/platform/pixel/mali_kbase_config_platform.h @@ -438,22 +438,16 @@ struct pixel_context { /** * struct pixel_platform_data - Per kbase_context Pixel specific platform data * - * @kctx: Handle to the parent kctx - * @stats: Tracks the dvfs metrics for the UID associated with this context + * @stats: Tracks the dvfs metrics for the UID associated with this context * - * @slc.peak_demand: The parent context's maximum demand for SLC space - * @slc.peak_usage: The parent context's maximum use of SLC space - * @slc.idle_work: Work item used to queue SLC partition shrink upon context idle - * @slc.idle_work_cancelled: Flag for async cancellation of idle_work + * @slc.peak_demand: The parent context's maximum demand for SLC space + * @slc.peak_usage: The parent context's maximum use of SLC space */ struct pixel_platform_data { - struct kbase_context *kctx; struct gpu_dvfs_metrics_uid_stats* stats; struct { u64 peak_demand; u64 peak_usage; - struct work_struct idle_work; - atomic_t idle_work_cancelled; } slc; }; diff --git a/mali_kbase/platform/pixel/pixel_gpu.c b/mali_kbase/platform/pixel/pixel_gpu.c index ba0ceb8..7ecc156 100644 --- a/mali_kbase/platform/pixel/pixel_gpu.c +++ b/mali_kbase/platform/pixel/pixel_gpu.c @@ -150,7 +150,6 @@ static int gpu_fw_cfg_init(struct kbase_device *kbdev) { static int gpu_pixel_kctx_init(struct kbase_context *kctx) { struct kbase_device* kbdev = kctx->kbdev; - struct pixel_platform_data *platform_data; int err; kctx->platform_data = kzalloc(sizeof(struct pixel_platform_data), GFP_KERNEL); @@ -160,9 +159,6 @@ static int gpu_pixel_kctx_init(struct kbase_context *kctx) goto done; } - platform_data = kctx->platform_data; - platform_data->kctx = kctx; - err = gpu_dvfs_kctx_init(kctx); if (err) { dev_err(kbdev->dev, "pixel: DVFS kctx init failed\n"); @@ -280,8 +276,6 @@ struct kbase_platform_funcs_conf platform_funcs = { .platform_handler_context_term_func = &gpu_pixel_kctx_term, .platform_handler_work_begin_func = &gpu_dvfs_metrics_work_begin, .platform_handler_work_end_func = &gpu_dvfs_metrics_work_end, - .platform_handler_context_active = &gpu_slc_kctx_active, - .platform_handler_context_idle = &gpu_slc_kctx_idle, .platform_fw_cfg_init_func = &gpu_fw_cfg_init, .platform_handler_core_dump_func = &gpu_sscd_dump, }; diff --git a/mali_kbase/platform/pixel/pixel_gpu_slc.c b/mali_kbase/platform/pixel/pixel_gpu_slc.c index d6cb131..cb00d05 100644 --- a/mali_kbase/platform/pixel/pixel_gpu_slc.c +++ b/mali_kbase/platform/pixel/pixel_gpu_slc.c @@ -308,30 +308,6 @@ static void gpu_slc_liveness_update(struct kbase_context* kctx, gpu_slc_unlock_as(kctx); } -static void gpu_slc_kctx_idle_worker(struct work_struct *work) -{ - struct pixel_platform_data *pd = - container_of(work, struct pixel_platform_data, slc.idle_work); - struct kbase_context *kctx = pd->kctx; - struct kbase_device *kbdev = kctx->kbdev; - struct pixel_context *pc = kbdev->platform_context; - - if (atomic_read(&pd->slc.idle_work_cancelled)) - return; - - mutex_lock(&pc->slc.lock); - - pc->slc.demand -= pd->slc.peak_demand; - pc->slc.usage -= pd->slc.peak_usage; - - pd->slc.peak_demand = 0; - pd->slc.peak_usage = 0; - - gpu_slc_resize_partition(kctx->kbdev); - - mutex_unlock(&pc->slc.lock); -} - /** * gpu_pixel_handle_buffer_liveness_update_ioctl() - See gpu_slc_liveness_update * @@ -433,10 +409,7 @@ done: */ int gpu_slc_kctx_init(struct kbase_context *kctx) { - struct pixel_platform_data *pd = kctx->platform_data; - - INIT_WORK(&pd->slc.idle_work, gpu_slc_kctx_idle_worker); - + (void)kctx; return 0; } @@ -449,13 +422,10 @@ int gpu_slc_kctx_init(struct kbase_context *kctx) */ void gpu_slc_kctx_term(struct kbase_context *kctx) { - struct kbase_device *kbdev = kctx->kbdev; + struct kbase_device* kbdev = kctx->kbdev; struct pixel_context *pc = kbdev->platform_context; struct pixel_platform_data *kctx_pd = kctx->platform_data; - atomic_set(&kctx_pd->slc.idle_work_cancelled, 1); - cancel_work_sync(&kctx_pd->slc.idle_work); - mutex_lock(&pc->slc.lock); /* Deduct the usage and demand, freeing that SLC space for the next update */ @@ -468,48 +438,6 @@ void gpu_slc_kctx_term(struct kbase_context *kctx) mutex_unlock(&pc->slc.lock); } -/** - * gpu_slc_kctx_active() - Called when a kernel context is (re)activated - * - * @kctx: The &struct kbase_context that is now active - */ -void gpu_slc_kctx_active(struct kbase_context *kctx) -{ - struct kbase_device *kbdev = kctx->kbdev; - struct pixel_platform_data *pd = kctx->platform_data; - - lockdep_assert_held(&kbdev->hwaccess_lock); - - /* Asynchronously cancel the idle work, since we're in atomic context. - * The goal here is not to ensure that the idle_work doesn't run. Instead we need to ensure - * that any queued idle_work does not run *after* a liveness update for the now active kctx. - * Either the idle_work is executing now, and beats the cancellation check, or it runs later - * and early-exits at the cancellation check. - * In neither scenario will a 'cancelled' idle_work interfere with a later liveness update. - */ - atomic_set(&pd->slc.idle_work_cancelled, 1); -} - -/** - * gpu_slc_kctx_idle() - Called when a kernel context is idled - * - * @kctx: The &struct kbase_context that is now idle - */ -void gpu_slc_kctx_idle(struct kbase_context *kctx) -{ - struct kbase_device *kbdev = kctx->kbdev; - struct pixel_platform_data *pd = kctx->platform_data; - - lockdep_assert_held(&kbdev->hwaccess_lock); - - /* In the event that this line 'un-cancels' the idle_work, and that idle_work is executing, - * we will re-queue on the following line anyway, resulting in a unnecessary additional - * execution of the worker. - * While not optimal, it won't result in a correctness problem. - */ - atomic_set(&pd->slc.idle_work_cancelled, 0); - queue_work(system_highpri_wq, &pd->slc.idle_work); -} /** * gpu_slc_init - Initialize the SLC partition for the GPU diff --git a/mali_kbase/platform/pixel/pixel_gpu_slc.h b/mali_kbase/platform/pixel/pixel_gpu_slc.h index 82d0779..29b4eb3 100644 --- a/mali_kbase/platform/pixel/pixel_gpu_slc.h +++ b/mali_kbase/platform/pixel/pixel_gpu_slc.h @@ -18,10 +18,6 @@ void gpu_slc_term(struct kbase_device *kbdev); int gpu_slc_kctx_init(struct kbase_context *kctx); void gpu_slc_kctx_term(struct kbase_context *kctx); - -void gpu_slc_kctx_active(struct kbase_context *kctx); - -void gpu_slc_kctx_idle(struct kbase_context *kctx); #else static int __maybe_unused gpu_pixel_handle_buffer_liveness_update_ioctl(struct kbase_context* kctx, struct kbase_ioctl_buffer_liveness_update* update) @@ -29,17 +25,13 @@ static int __maybe_unused gpu_pixel_handle_buffer_liveness_update_ioctl(struct k return (void)kctx, (void)update, 0; } -static int __maybe_unused gpu_slc_init(struct kbase_device *kbdev) { return (void)kbdev, 0; } +int __maybe_unused gpu_slc_init(struct kbase_device *kbdev) { return (void)kbdev, 0; } -static void __maybe_unused gpu_slc_term(struct kbase_device *kbdev) { (void)kbdev; } +void __maybe_unused gpu_slc_term(struct kbase_device *kbdev) { (void)kbdev; } static int __maybe_unused gpu_slc_kctx_init(struct kbase_context *kctx) { return (void)kctx, 0; } static void __maybe_unused gpu_slc_kctx_term(struct kbase_context* kctx) { (void)kctx; } - -static void __maybe_unused gpu_slc_kctx_active(struct kbase_context *kctx) { (void)kctx; } - -static void __maybe_unused gpu_slc_kctx_idle(struct kbase_context *kctx) { (void)kctx; } #endif /* CONFIG_MALI_PIXEL_GPU_SLC */ #endif /* _PIXEL_GPU_SLC_H_ */ |