devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Vishnu Reddy" <busanna.reddy@oss.qualcomm.com>
Cc: devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org,
	media-ci@linuxtv.org
Subject: Re: [PATCH v12 6/9] media: iris: Add support to select core for dual core platforms
Date: Wed, 25 Nov 2026 03:47:20 +0000	[thread overview]
Message-ID: <sashiko-outbox-232501@kernel.org> (raw)
In-Reply-To: <20261125-glymur-v12-6-5c34dfd73fc2@oss.qualcomm.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] media: iris: premature core_id pinning in
  iris_vpu36_check_core_load()
--

commit 808d193eb38505ae4527a210592f86b63f734489
Author: Vishnu Reddy <busanna.reddy@oss.qualcomm.com>

media: iris: Add support to select core for dual core platforms

This commit adds core selection and per-core load and frequency tracking
for dual-core VPU36 video codec platforms, sending the selected core to
firmware via HFI_PROP_CORE_ID at stream-on time.

> diff --git a/drivers/media/platform/qcom/iris/iris_vpu3x.c b/drivers/media/platform/qcom/iris/iris_vpu3x.c
> index fe0c91af3301d..0a211506d12d7 100644
> --- a/drivers/media/platform/qcom/iris/iris_vpu3x.c
> +++ b/drivers/media/platform/qcom/iris/iris_vpu3x.c
> @@ -339,6 +339,70 @@ static void iris_vpu36_program_bootup_registers(struct iris_core *core)
>  	writel(0x0, core->reg_base + CPU_CS_SCIACMDARG3);
>  }
>  
> +static int iris_vpu36_check_core_load(struct iris_inst *inst, bool mbpf)
> +{
> +	const struct iris_platform_data *platform_data = inst->core->iris_platform_data;
> +	u32 max_load = mbpf ? platform_data->max_core_mbpf : platform_data->max_core_mbps;
> +	u32 max_session_cnt = platform_data->max_session_count;
> +	u32 core0_session_cnt = 0, core1_session_cnt = 0;
> +	u32 core0_load = 0, core1_load = 0;
> +	bool select_core0, select_core1;
> +	struct iris_inst *instance;
> +	u32 load, new_load;
> +
> +	list_for_each_entry(instance, &inst->core->instances, list) {
> +		load = mbpf ? iris_get_mbpf(instance) : iris_get_mbps(instance);
> +
> +		if (instance->core_id == IRIS_VCODEC0) {
> +			core0_load += load;
> +			core0_session_cnt++;
> +		} else if (instance->core_id == IRIS_VCODEC1) {
> +			core1_load += load;
> +			core1_session_cnt++;
> +		}
> +	}
> +
> +	if (inst->core_id == IRIS_VCODEC0)
> +		return core0_load <= max_load ? 0 : -ENOMEM;
> +	else if (inst->core_id == IRIS_VCODEC1)
> +		return core1_load <= max_load ? 0 : -ENOMEM;

[Severity: Medium]
Does pinning inst->core_id during iris_vb2_queue_setup() and summing load
across all instances with a matching core_id cause sessions to fail with
-ENOMEM?

iris_check_session_supported() -> iris_check_core_mbpf() runs during both
VIDIOC_REQBUFS and VIDIOC_STREAMON.  If VIDIOC_REQBUFS runs on the CAPTURE
queue while inst->fmt_src still holds the default 320x240 format (or before
VIDIOC_REQBUFS(0) and a later VIDIOC_S_FMT), inst->core_id is locked in
before HFI_PROP_CORE_ID is ever sent to firmware.  When the actual larger
resolution is later set on inst->fmt_src, this early return refuses to pick
the other core even if that core has enough capacity.

In addition, if a later step in iris_vb2_queue_setup() or
iris_vb2_start_streaming() fails (putting the instance into
IRIS_INST_ERROR), or if an instance with an assigned core_id sets an
oversized format via VIDIOC_S_FMT, inst->core_id is not cleared and the
loop above still includes that instance's load in core0_load or core1_load,
causing other sessions on the same core to fail their load checks with
-ENOMEM until the file descriptor is closed.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261125-glymur-v12-0-5c34dfd73fc2@oss.qualcomm.com?part=6

  reply	other threads:[~2026-11-25  3:47 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-25  3:24 [PATCH v12 0/9] media: iris: Add support for glymur platform Vishnu Reddy
2026-11-25  3:24 ` [PATCH v12 1/9] dt-bindings: media: qcom,glymur-iris: Add glymur video codec Vishnu Reddy
2026-11-25  3:24 ` [PATCH v12 2/9] media: iris: Enable Secure PAS support with IOMMU managed by Linux Vishnu Reddy
2026-11-25  3:24 ` [PATCH v12 3/9] media: iris: Replace enum-indexed clock and power domain tables with per-block structures Vishnu Reddy
2026-11-25  3:24 ` [PATCH v12 4/9] media: iris: Add power sequence for glymur Vishnu Reddy
2026-11-25  3:38   ` sashiko-bot
2026-11-25  3:24 ` [PATCH v12 5/9] media: iris: Handle CPU_CS_SCIACMDARG3 register write via program bootup registers hook Vishnu Reddy
2026-11-25  3:24 ` [PATCH v12 6/9] media: iris: Add support to select core for dual core platforms Vishnu Reddy
2026-11-25  3:47   ` sashiko-bot [this message]
2026-11-25  3:24 ` [PATCH v12 7/9] media: iris: Add platform data for glymur Vishnu Reddy
2026-11-25  3:24 ` [PATCH v12 8/9] arm64: dts: qcom: glymur: Add iris video node Vishnu Reddy
2026-11-25  3:24 ` [PATCH v12 9/9] arm64: dts: qcom: glymur-crd: Enable iris video codec node Vishnu Reddy

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=sashiko-outbox-232501@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=busanna.reddy@oss.qualcomm.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=media-ci@linuxtv.org \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@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;
as well as URLs for NNTP newsgroup(s).