diff options
author | Raghavendra Ambadas <quic_c_rambad@quicinc.com> | 2022-01-13 19:11:07 +0530 |
---|---|---|
committer | Carl Tsai <carltsai@google.com> | 2022-05-30 06:28:11 +0000 |
commit | 82869c3461ef9b2adfe05962350f6573009233f8 (patch) | |
tree | 5a470ae9b96f5d8e06cb5c2b843257e1ae250b12 | |
parent | aa59f40edbe6c2f046dd1e8c685b80d1de455460 (diff) | |
download | display-drivers-82869c3461ef9b2adfe05962350f6573009233f8.tar.gz |
disp: msm: use vzalloc/vfree for large allocationsandroid-t-beta-4_r0.3android-t-beta-3_r0.3android-t-beta-3.3_r0.3android-t-beta-3.2_r0.3android-13.0.0_r0.42android-13.0.0_r0.3android-13.0.0_r0.18android-13.0.0_r0.13android-msm-redbull-4.19-t-beta-4android-msm-redbull-4.19-t-beta-3android-msm-redbull-4.19-android13
Large allocations using kzalloc can lead to timeouts. This updates
the allocation calls accordingly to use vzalloc/vfree to remove
and manage requirements on contiguous memory.
Bug: 231528346
Change-Id: I9592f5b612d7b368ba3e389308f047a624355e99
Signed-off-by: Raghavendra Ambadas <quic_c_rambad@quicinc.com>
(cherry picked from commit 3127869dd5b4a343bee6ae6eb89bbc147a26f483)
-rw-r--r-- | msm/sde/sde_color_processing.c | 9 | ||||
-rw-r--r-- | msm/sde/sde_connector.c | 5 | ||||
-rw-r--r-- | msm/sde/sde_crtc.c | 5 | ||||
-rw-r--r-- | msm/sde/sde_plane.c | 5 | ||||
-rw-r--r-- | msm/sde_dbg.c | 16 | ||||
-rw-r--r-- | msm/sde_dbg_evtlog.c | 9 |
6 files changed, 25 insertions, 24 deletions
diff --git a/msm/sde/sde_color_processing.c b/msm/sde/sde_color_processing.c index 799dfdd4..4da816bd 100644 --- a/msm/sde/sde_color_processing.c +++ b/msm/sde/sde_color_processing.c @@ -1,5 +1,6 @@ // SPDX-License-Identifier: GPL-2.0-only /* + * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved. * Copyright (c) 2016-2021, The Linux Foundation. All rights reserved. */ @@ -3968,7 +3969,7 @@ void sde_cp_crtc_enable(struct drm_crtc *drm_crtc) if (!num_mixers) return; mutex_lock(&crtc->crtc_cp_lock); - info = kzalloc(sizeof(struct sde_kms_info), GFP_KERNEL); + info = vzalloc(sizeof(struct sde_kms_info)); if (info) { for (i = 0; i < ARRAY_SIZE(dspp_cap_update_func); i++) dspp_cap_update_func[i](crtc, info); @@ -3977,7 +3978,7 @@ void sde_cp_crtc_enable(struct drm_crtc *drm_crtc) info->data, SDE_KMS_INFO_DATALEN(info), CRTC_PROP_DSPP_INFO); } - kfree(info); + vfree(info); mutex_unlock(&crtc->crtc_cp_lock); } @@ -3992,12 +3993,12 @@ void sde_cp_crtc_disable(struct drm_crtc *drm_crtc) } crtc = to_sde_crtc(drm_crtc); mutex_lock(&crtc->crtc_cp_lock); - info = kzalloc(sizeof(struct sde_kms_info), GFP_KERNEL); + info = vzalloc(sizeof(struct sde_kms_info)); if (info) msm_property_set_blob(&crtc->property_info, &crtc->dspp_blob_info, info->data, SDE_KMS_INFO_DATALEN(info), CRTC_PROP_DSPP_INFO); mutex_unlock(&crtc->crtc_cp_lock); - kfree(info); + vfree(info); } diff --git a/msm/sde/sde_connector.c b/msm/sde/sde_connector.c index efb72e47..2f56caa8 100644 --- a/msm/sde/sde_connector.c +++ b/msm/sde/sde_connector.c @@ -1,5 +1,6 @@ // SPDX-License-Identifier: GPL-2.0-only /* + * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved. * Copyright (c) 2016-2020, The Linux Foundation. All rights reserved. */ @@ -2241,7 +2242,7 @@ int sde_connector_set_blob_data(struct drm_connector *conn, return -EINVAL; } - info = kzalloc(sizeof(*info), GFP_KERNEL); + info = vzalloc(sizeof(*info)); if (!info) return -ENOMEM; @@ -2299,7 +2300,7 @@ int sde_connector_set_blob_data(struct drm_connector *conn, SDE_KMS_INFO_DATALEN(info), prop_id); exit: - kfree(info); + vfree(info); return rc; } diff --git a/msm/sde/sde_crtc.c b/msm/sde/sde_crtc.c index 6af8ce3b..cdee2081 100644 --- a/msm/sde/sde_crtc.c +++ b/msm/sde/sde_crtc.c @@ -1,4 +1,5 @@ /* + * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved. * Copyright (c) 2014-2021 The Linux Foundation. All rights reserved. * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. * Copyright (C) 2013 Red Hat @@ -5117,7 +5118,7 @@ static void sde_crtc_install_properties(struct drm_crtc *crtc, return; } - info = kzalloc(sizeof(struct sde_kms_info), GFP_KERNEL); + info = vzalloc(sizeof(struct sde_kms_info)); if (!info) { SDE_ERROR("failed to allocate info memory\n"); return; @@ -5369,7 +5370,7 @@ static void sde_crtc_install_properties(struct drm_crtc *crtc, msm_property_set_blob(&sde_crtc->property_info, &sde_crtc->blob_info, info->data, SDE_KMS_INFO_DATALEN(info), CRTC_PROP_INFO); - kfree(info); + vfree(info); } static int _sde_crtc_get_output_fence(struct drm_crtc *crtc, diff --git a/msm/sde/sde_plane.c b/msm/sde/sde_plane.c index e991cbe7..8b680783 100644 --- a/msm/sde/sde_plane.c +++ b/msm/sde/sde_plane.c @@ -1,4 +1,5 @@ /* + * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved. * Copyright (C) 2014-2020 The Linux Foundation. All rights reserved. * Copyright (C) 2013 Red Hat * Author: Rob Clark <robdclark@gmail.com> @@ -3609,7 +3610,7 @@ static void _sde_plane_install_properties(struct drm_plane *plane, "prefill_time", 0x0, 0, ~0, 0, PLANE_PROP_PREFILL_TIME); - info = kzalloc(sizeof(struct sde_kms_info), GFP_KERNEL); + info = vzalloc(sizeof(struct sde_kms_info)); if (!info) { SDE_ERROR("failed to allocate info memory\n"); return; @@ -3720,7 +3721,7 @@ static void _sde_plane_install_properties(struct drm_plane *plane, info->data, SDE_KMS_INFO_DATALEN(info), PLANE_PROP_INFO); - kfree(info); + vfree(info); if (psde->features & BIT(SDE_SSPP_MEMCOLOR)) { snprintf(feature_name, sizeof(feature_name), "%s%d", diff --git a/msm/sde_dbg.c b/msm/sde_dbg.c index 2723d01c..3fad1079 100644 --- a/msm/sde_dbg.c +++ b/msm/sde_dbg.c @@ -1,5 +1,6 @@ // SPDX-License-Identifier: GPL-2.0-only /* + * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved. * Copyright (c) 2009-2020, The Linux Foundation. All rights reserved. */ @@ -3251,7 +3252,6 @@ static void _sde_dbg_dump_sde_dbg_bus(struct sde_dbg_sde_debug_bus *bus) u32 *dump_addr = NULL; u32 status = 0; struct sde_debug_bus_entry *head; - phys_addr_t phys = 0; int list_size; int i; u32 offset; @@ -3289,8 +3289,7 @@ static void _sde_dbg_dump_sde_dbg_bus(struct sde_dbg_sde_debug_bus *bus) if (in_mem) { if (!(*dump_mem)) - *dump_mem = dma_alloc_coherent(sde_dbg_base.dev, - list_size, &phys, GFP_KERNEL); + *dump_mem = vzalloc(list_size); if (*dump_mem) { dump_addr = *dump_mem; @@ -3400,7 +3399,6 @@ static void _sde_dbg_dump_vbif_dbg_bus(struct sde_dbg_vbif_debug_bus *bus) u32 value, d0, d1; unsigned long reg, reg1, reg2; struct vbif_debug_bus_entry *head; - phys_addr_t phys = 0; int i, list_size = 0; void __iomem *mem_base = NULL; struct vbif_debug_bus_entry *dbg_bus; @@ -3450,8 +3448,7 @@ static void _sde_dbg_dump_vbif_dbg_bus(struct sde_dbg_vbif_debug_bus *bus) if (in_mem) { if (!(*dump_mem)) - *dump_mem = dma_alloc_coherent(sde_dbg_base.dev, - list_size, &phys, GFP_KERNEL); + *dump_mem = vzalloc(list_size); if (*dump_mem) { dump_addr = *dump_mem; @@ -3542,13 +3539,11 @@ static void _sde_dump_array(struct sde_dbg_reg_base *blk_arr[], int i; u32 reg_dump_size; struct sde_dbg_base *dbg_base = &sde_dbg_base; - phys_addr_t phys = 0; mutex_lock(&sde_dbg_base.mutex); reg_dump_size = _sde_dbg_get_reg_dump_size(); - dbg_base->reg_dump_addr = dma_alloc_coherent(sde_dbg_base.dev, - reg_dump_size, &phys, GFP_KERNEL); + dbg_base->reg_dump_addr = vzalloc(reg_dump_size); if (dump_all) sde_evtlog_dump_all(sde_dbg_base.evtlog); @@ -4051,7 +4046,7 @@ static ssize_t sde_recovery_regdump_read(struct file *file, char __user *ubuf, mutex_lock(&sde_dbg_base.mutex); if (!rbuf->dump_done && !rbuf->cur_blk) { if (!rbuf->buf) - rbuf->buf = kzalloc(DUMP_BUF_SIZE, GFP_KERNEL); + rbuf->buf = vzalloc(DUMP_BUF_SIZE); if (!rbuf->buf) { len = -ENOMEM; goto err; @@ -4781,6 +4776,7 @@ static void sde_dbg_reg_base_destroy(void) list_del(&blk_base->reg_base_head); kfree(blk_base); } + vfree(dbg_base->reg_dump_addr); } /** * sde_dbg_destroy - destroy sde debug facilities diff --git a/msm/sde_dbg_evtlog.c b/msm/sde_dbg_evtlog.c index 5724d4cd..35fe335c 100644 --- a/msm/sde_dbg_evtlog.c +++ b/msm/sde_dbg_evtlog.c @@ -1,5 +1,6 @@ // SPDX-License-Identifier: GPL-2.0-only /* + * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved. * Copyright (c) 2016-2021, The Linux Foundation. All rights reserved. */ @@ -219,7 +220,7 @@ struct sde_dbg_evtlog *sde_evtlog_init(void) { struct sde_dbg_evtlog *evtlog; - evtlog = kzalloc(sizeof(*evtlog), GFP_KERNEL); + evtlog = vzalloc(sizeof(*evtlog)); if (!evtlog) return ERR_PTR(-ENOMEM); @@ -235,7 +236,7 @@ struct sde_dbg_reglog *sde_reglog_init(void) { struct sde_dbg_reglog *reglog; - reglog = kzalloc(sizeof(*reglog), GFP_KERNEL); + reglog = vzalloc(sizeof(*reglog)); if (!reglog) return ERR_PTR(-ENOMEM); @@ -343,7 +344,7 @@ void sde_evtlog_destroy(struct sde_dbg_evtlog *evtlog) list_del(&filter_node->list); kfree(filter_node); } - kfree(evtlog); + vfree(evtlog); } void sde_reglog_destroy(struct sde_dbg_reglog *reglog) @@ -351,5 +352,5 @@ void sde_reglog_destroy(struct sde_dbg_reglog *reglog) if (!reglog) return; - kfree(reglog); + vfree(reglog); } |