Re: [PATCH V6 2/2] firmware: qcom: scm: Add wait-queue handling logic

From: Guru Das Srinagesh
Date: Tue Jan 10 2023 - 02:58:20 EST


On Dec 08 2022 16:11, Bjorn Andersson wrote:
> On Thu, Dec 08, 2022 at 12:10:31PM +0530, Sibi Sankar wrote:

...

> > +
> > + err = idr_alloc_u32(&scm->waitq.idr, wq, &wq_ctx_idr,
> > + U32_MAX, GFP_ATOMIC);
>
> PS. Thinking about it further, imagine the firmware people deciding to
> be funny and allocating the wq_ctx in a cyclic fashion. The idr will
> consume all your ram after a while...

Even if wq_ctx is allocated cyclically, say, from 1 to N, only N idrs would
ever be allocated as subsequently there would only be lookups. Could you
elaborate on how we would run out of RAM?

Thank you.

Guru Das.