From: sashiko-bot@kernel.org
To: "Vishnu Reddy" <busanna.reddy@oss.qualcomm.com>
Cc: devicetree@vger.kernel.org, krzk+dt@kernel.org, robh@kernel.org,
conor+dt@kernel.org
Subject: Re: [PATCH v5 11/14] media: iris: Add support to select core for dual core platforms
Date: Sat, 09 May 2026 03:55:07 +0000 [thread overview]
Message-ID: <20260509035508.84B25C2BCB2@smtp.kernel.org> (raw)
In-Reply-To: <20260509-glymur-v5-11-7fbb340c5dbd@oss.qualcomm.com>
Thank you for your contribution! Sashiko AI review found 6 potential issue(s) to consider:
- [Critical] State Corruption / Admission Control Bypass via core_id error handling
- [High] Hardware Constraint Bypass via sequential core capacity checks
- [High] Permanent Clock Overprovisioning on failed stream initialization
- [High] Hardware Desynchronization and Under-clocking on dynamic core reassignment
- [High] MBPS Capacity Limit Validation is bypassed during stream initialization
- [High] Conflicting HFI Commands and Core Flipping across M2M Queue starts
--
commit a24b550f95eaa9370c3d20dc544af695464b53d4
Author: Vishnu Reddy <busanna.reddy@oss.qualcomm.com>
media: iris: Add support to select core for dual core platforms
On platforms with dual vcodec cores, select the hardware core for a
session based on current load. Assign the session to vcodec0 if its
MBPF/MBPS capacity allows it, otherwise assign to vcodec1. Communicate
the selected core to firmware using the new HFI_PROP_CORE_ID property.
> diff --git a/drivers/media/platform/qcom/iris/iris_power.c b/drivers/media/platform/qcom/iris/iris_power.c
> index 91aa21d4070eb..b72ce5b596b83 100644
> --- a/drivers/media/platform/qcom/iris/iris_power.c
> +++ b/drivers/media/platform/qcom/iris/iris_power.c
[ ... ]
> @@ -87,11 +87,14 @@ static int iris_set_clocks(struct iris_inst *inst)
> if (!instance->max_input_data_size)
> continue;
>
> - freq += instance->power.min_freq;
> + if (instance->core_id == IRIS_VCODEC0)
> + vcodec0_freq += instance->power.min_freq;
> + else
> + vcodec1_freq += instance->power.min_freq;
> }
If stream initialization fails in iris_vb2_start_streaming() after
calculating session power requirements but before a valid core is assigned,
inst->core_id remains 0.
Because 0 does not equal IRIS_VCODEC0, does this cause the failed session's
clock frequency to be permanently aggregated into vcodec1_freq during all
future clock recalculations?
> diff --git a/drivers/media/platform/qcom/iris/iris_utils.c b/drivers/media/platform/qcom/iris/iris_utils.c
> index cfc5b576ec56b..da8a89d3dd41c 100644
> --- a/drivers/media/platform/qcom/iris/iris_utils.c
> +++ b/drivers/media/platform/qcom/iris/iris_utils.c
[ ... ]
> +static int iris_check_and_assign_core(struct iris_inst *inst, bool mbpf)
> +{
[ ... ]
> + inst->core_id = 0;
> +
> + list_for_each_entry(instance, &inst->core->instances, list) {
[ ... ]
> + if (select_core0 && select_core1)
> + inst->core_id = (core0_load <= core1_load) ? IRIS_VCODEC0 : IRIS_VCODEC1;
> + else if (select_core0)
> + inst->core_id = IRIS_VCODEC0;
> + else if (select_core1)
> + inst->core_id = IRIS_VCODEC1;
> + else
> + return -ENOMEM;
> +
> return 0;
> }
If the requested load exceeds available capacity, this function returns
-ENOMEM but leaves inst->core_id set to 0.
If this happens dynamically, for example when userspace calls VIDIOC_S_PARM
to change the frame rate on an already active stream, does leaving core_id
as 0 exclude this session from future global load calculations?
Could this allow an attacker to bypass dual-core admission controls (such
as max_session_count and MBPS limits) by intentionally triggering an out
of memory condition?
Additionally, when system load shifts and this function dynamically
reassigns an active session to a different hardware core, is the new core
assignment ever communicated to firmware?
Since session_set_core_id() appears to only be called during stream
initialization, would dynamic reassignment cause iris_set_clocks() to route
the session's clock frequency requirements to the newly assigned core,
starving the original executing hardware core and risking hardware hangs?
> -int iris_check_core_mbpf(struct iris_inst *inst)
> +int iris_check_core_mbpf(struct iris_inst *inst)
> {
> struct iris_core *core = inst->core;
> + int ret;
>
> mutex_lock(&core->lock);
> + ret = iris_check_and_assign_core(inst, true);
> mutex_unlock(&core->lock);
>
> - if (total_mbpf > core->iris_platform_data->max_core_mbpf)
> - return -ENOMEM;
> + return ret;
> }
>
> -int iris_check_core_mbps(struct iris_inst *inst)
> +int iris_check_core_mbps(struct iris_inst *inst)
> {
> struct iris_core *core = inst->core;
> - struct iris_inst *instance;
> - u32 total_mbps = 0, fps = 0;
> + int ret;
>
> mutex_lock(&core->lock);
> - list_for_each_entry(instance, &core->instances, list) {
> - fps = max(instance->frame_rate, instance->operating_rate);
> - total_mbps += iris_get_mbpf(instance) * fps;
> - }
> + ret = iris_check_and_assign_core(inst, false);
> mutex_unlock(&core->lock);
>
> - if (total_mbps > core->iris_platform_data->max_core_mbps)
> - return -ENOMEM;
> -
> - return 0;
> + return ret;
> }
If a caller executes iris_check_core_mbpf() and immediately follows it
with iris_check_core_mbps(), won't the second call wipe the core assignment
made by the first pass?
Does this allow sessions to bypass hardware MBPF limits, as the final
assignment checks only MBPS capacity and ignores whether the core can
handle the session's MBPF load?
> diff --git a/drivers/media/platform/qcom/iris/iris_vb2.c b/drivers/media/platform/qcom/iris/iris_vb2.c
> index bf0b8400996ec..5a05f7d655017 100644
> --- a/drivers/media/platform/qcom/iris/iris_vb2.c
> +++ b/drivers/media/platform/qcom/iris/iris_vb2.c
> @@ -176,6 +176,10 @@ int iris_vb2_start_streaming(struct vb2_queue *q, unsigned int count)
> if (ret)
> goto error;
>
> + ret = iris_set_core_id(inst);
> + if (ret)
> + goto error;
> +
In this function, the driver validates hardware capacity before setting
the core ID. Does the validation check (iris_check_session_supported())
exclusively enforce the MBPF limit and omit the MBPS check entirely?
If the MBPS limit is bypassed during stream initialization, could users
start sessions that exceed the max_core_mbps limit right away, instead of
only being checked during dynamic frame rate changes?
Furthermore, V4L2 memory-to-memory drivers allow userspace to call
VIDIOC_STREAMON independently for the OUTPUT and CAPTURE queues.
Because iris_set_core_id() is called unconditionally for each queue start,
could concurrent session starts on other instances alter the global load
between a session's two STREAMON calls?
Would this cause the driver to assign and notify firmware of one core
during the first STREAMON, but then reassign and send a conflicting
HFI_PROP_CORE_ID during the second STREAMON while the session is already
active?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260509-glymur-v5-0-7fbb340c5dbd@oss.qualcomm.com?part=11
next prev parent reply other threads:[~2026-05-09 3:55 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-08 18:59 [PATCH v5 00/14] media: iris: Add support for glymur platform Vishnu Reddy
2026-05-08 18:59 ` [PATCH v5 01/14] media: iris: Add iris vpu bus support Vishnu Reddy
2026-05-08 19:16 ` Dmitry Baryshkov
2026-05-09 17:05 ` Vishnu Reddy
2026-05-08 23:20 ` sashiko-bot
2026-05-08 18:59 ` [PATCH v5 02/14] iommu: Add iris-vpu-bus to iommu_buses Vishnu Reddy
2026-05-08 19:16 ` Dmitry Baryshkov
2026-05-08 23:42 ` sashiko-bot
2026-05-08 18:59 ` [PATCH v5 03/14] media: iris: Fix VM count passed to firmware Vishnu Reddy
2026-05-08 19:20 ` Dmitry Baryshkov
2026-05-08 18:59 ` [PATCH v5 04/14] dt-bindings: media: qcom,venus: Remove clock, power-domain, and iommus from common schema Vishnu Reddy
2026-05-08 19:22 ` Dmitry Baryshkov
2026-05-09 17:04 ` Vishnu Reddy
2026-05-08 18:59 ` [PATCH v5 05/14] dt-bindings: media: qcom,glymur-iris: Add glymur video codec Vishnu Reddy
2026-05-08 18:59 ` [PATCH v5 06/14] media: iris: Add context bank hooks for platform specific initialization Vishnu Reddy
2026-05-09 0:41 ` sashiko-bot
2026-05-08 18:59 ` [PATCH v5 07/14] media: iris: Enable Secure PAS support with IOMMU managed by Linux Vishnu Reddy
2026-05-08 19:05 ` Trilok Soni
2026-05-08 20:20 ` Dmitry Baryshkov
2026-05-09 2:05 ` sashiko-bot
2026-05-08 18:59 ` [PATCH v5 08/14] media: iris: Rename clock and power domain macros to use vcodec prefix Vishnu Reddy
2026-05-08 20:22 ` Dmitry Baryshkov
2026-05-09 17:07 ` Vishnu Reddy
2026-05-09 2:18 ` sashiko-bot
2026-05-08 18:59 ` [PATCH v5 09/14] media: iris: Use power domain type to look up pd_devs index Vishnu Reddy
2026-05-08 20:44 ` Dmitry Baryshkov
2026-05-09 17:02 ` Vishnu Reddy
2026-05-08 18:59 ` [PATCH v5 10/14] media: iris: Add power sequence for Glymur Vishnu Reddy
2026-05-08 20:54 ` Dmitry Baryshkov
2026-05-09 2:56 ` sashiko-bot
2026-05-08 19:00 ` [PATCH v5 11/14] media: iris: Add support to select core for dual core platforms Vishnu Reddy
2026-05-08 21:00 ` Dmitry Baryshkov
2026-05-09 3:55 ` sashiko-bot [this message]
2026-05-08 19:00 ` [PATCH v5 12/14] media: iris: Add platform data for glymur Vishnu Reddy
2026-05-08 21:05 ` Dmitry Baryshkov
2026-05-09 4:23 ` sashiko-bot
2026-05-08 19:00 ` [PATCH v5 13/14] arm64: dts: qcom: glymur: Add iris video node Vishnu Reddy
2026-05-08 19:27 ` Dmitry Baryshkov
2026-05-09 16:56 ` Vishnu Reddy
2026-05-08 19:00 ` [PATCH v5 14/14] arm64: dts: qcom: glymur-crd: Enable iris video codec node Vishnu Reddy
2026-05-08 23:54 ` Dmitry Baryshkov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260509035508.84B25C2BCB2@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=busanna.reddy@oss.qualcomm.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=krzk+dt@kernel.org \
--cc=robh@kernel.org \
--cc=sashiko@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox