mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Robert Mader <robert.mader@collabora.com>
To: "Kasireddy, Vivek" <vivek.kasireddy@intel.com>,
	"dri-devel@lists.freedesktop.org"
	<dri-devel@lists.freedesktop.org>
Cc: "Gerd Hoffmann" <kraxel@redhat.com>,
	"Sumit Semwal" <sumit.semwal@linaro.org>,
	"Christian König" <christian.koenig@amd.com>,
	"linux-media@vger.kernel.org" <linux-media@vger.kernel.org>,
	"linaro-mm-sig@lists.linaro.org" <linaro-mm-sig@lists.linaro.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v1] dma-buf/udmabuf: Disable the size limit by default
Date: Wed, 22 Jul 2026 13:03:04 +0200	[thread overview]
Message-ID: <f6a78f00-ae95-40d2-a8c3-12d31ac7a75a@collabora.com> (raw)
In-Reply-To: <IA0PR11MB718505780A8DBCAC7C9EC0E2F8C12@IA0PR11MB7185.namprd11.prod.outlook.com>

Hi Vivek,

On 22.07.26 08:03, Kasireddy, Vivek wrote:
> Hi Robert,
>
>> Subject: [PATCH v1] dma-buf/udmabuf: Disable the size limit by default
>>
>> As udmabuf increasingly enjoys popularity - being used in projects like
>> libcamera, Gstreamer, Mesa, KWin and Weston - users more frequently
>> encounter cases where the current default size limit of 64MB is too low.
>> Examples include allocating video buffers at a 8K resolution - and even 4K
>> is affected when using non-subsampled video formats and high bit depths.
>>
>> In its current form the size limit for individual buffers does not seem to
>> provide any additional level of protection - such as limiting the amount of
>> memory a process can pin - as the later can just allocate multiple buffers.
>> If additional guardrails are desired, they would likely require some kind
>> accounting not limited to individual buffers.
>>
>> Therefor let's disable the size limit by default. Use the special value
>> of zero to do so, which prevously could be used to effectively disable the
>> interface. Using other means, such as file permissions, appears to be a
>> much better fit for that purpose.
>>
>> Signed-off-by: Robert Mader <robert.mader@collabora.com>
>>
>> ---
>>
>> Please let me know if changing the meaning of the parameter value of zero
>> is considered a breaking change / not acceptable. In that case INT_MAX
>> might be a better option.
> Yeah, I think using INT_MAX might be better.
did that in v2, thanks!
>
> Thanks,
> Vivek
>
>> See
>> https://lore.kernel.org/dri-devel/20260711144814.8205-1-
>> robert.mader@collabora.com/
>> for a previous attempt to make the value configurable via kconfig - and
>> in particular
>> https://lore.kernel.org/dri-devel/6764ca6f-b4d8-4baa-9d27-
>> 2ca867ac2d41@amd.com/
>> for the suggestion and discussion to remove the default limit.
>> ---
>>   drivers/dma-buf/udmabuf.c | 6 +++---
>>   1 file changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/dma-buf/udmabuf.c b/drivers/dma-buf/udmabuf.c
>> index bced421c0d65..3509b690d8e2 100644
>> --- a/drivers/dma-buf/udmabuf.c
>> +++ b/drivers/dma-buf/udmabuf.c
>> @@ -20,9 +20,9 @@ static int list_limit = 1024;
>>   module_param(list_limit, int, 0644);
>>   MODULE_PARM_DESC(list_limit, "udmabuf_create_list->count limit.
>> Default is 1024.");
>>
>> -static int size_limit_mb = 64;
>> +static int size_limit_mb = 0;
>>   module_param(size_limit_mb, int, 0644);
>> -MODULE_PARM_DESC(size_limit_mb, "Max size of a dmabuf, in
>> megabytes. Default is 64.");
>> +MODULE_PARM_DESC(size_limit_mb, "Max size of a dmabuf, in
>> megabytes. Setting 0 disables the limit. Default is 0.");
>>
>>   struct udmabuf {
>>   	pgoff_t pagecount;
>> @@ -373,7 +373,7 @@ static long udmabuf_create(struct miscdevice
>> *device,
>>
>>   		subpgcnt = list[i].size >> PAGE_SHIFT;
>>   		pgcnt += subpgcnt;
>> -		if (pgcnt > pglimit)
>> +		if (pglimit && pglimit < pgcnt)
>>   			goto err_noinit;
>>
>>   		max_nr_folios = max_t(unsigned long, subpgcnt,
>> max_nr_folios);
>> --
>> 2.55.0

-- 
Robert Mader
Consultant Software Developer

Collabora Ltd.
Platinum Building, St John's Innovation Park, Cambridge CB4 0DS, UK
Registered in England & Wales, no. 5513718


      reply	other threads:[~2026-07-22 11:03 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-17 12:57 Robert Mader
2026-07-22  6:03 ` Kasireddy, Vivek
2026-07-22 11:03   ` Robert Mader [this message]

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=f6a78f00-ae95-40d2-a8c3-12d31ac7a75a@collabora.com \
    --to=robert.mader@collabora.com \
    --cc=christian.koenig@amd.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=kraxel@redhat.com \
    --cc=linaro-mm-sig@lists.linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=sumit.semwal@linaro.org \
    --cc=vivek.kasireddy@intel.com \
    /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

all inboxes | Powered by JetHome®