From: "Danilo Krummrich" <dakr@kernel.org>
To: "Brendan Shephard" <bshephar@bne-home.net>
Cc: <acourbot@nvidia.com>, <aliceryhl@google.com>,
<joelagnelf@nvidia.com>, <airlied@redhat.com>,
<rust-for-linux@vger.kernel.org>
Subject: Re: [PATCH v5] drm/nova: Align GEM memory allocation to system page size
Date: Tue, 23 Dec 2025 21:11:36 +0100 [thread overview]
Message-ID: <DF5VBOI4LSTZ.5O2XJRIFMK3S@kernel.org> (raw)
In-Reply-To: <20251223135902.35767-1-bshephar@bne-home.net>
On Tue Dec 23, 2025 at 2:59 PM CET, Brendan Shephard wrote:
> diff --git a/drivers/gpu/drm/nova/gem.rs b/drivers/gpu/drm/nova/gem.rs
> index a07e922e25ef..e1b57609b8f7 100644
> --- a/drivers/gpu/drm/nova/gem.rs
> +++ b/drivers/gpu/drm/nova/gem.rs
> @@ -3,10 +3,7 @@
> use kernel::{
> drm,
> drm::{gem, gem::BaseObject},
> - page::{
> - page_align,
> - PAGE_SIZE, //
> - },
> + page::page_align,
> prelude::*,
> sync::aref::ARef,
> };
> @@ -31,14 +28,12 @@ fn new(_dev: &NovaDevice, _size: usize) -> impl PinInit<Self, Error> {
> impl NovaObject {
> /// Create a new DRM GEM object.
> pub(crate) fn new(dev: &NovaDevice, size: usize) -> Result<ARef<gem::Object<Self>>> {
> - // Check for 0 size or potential usize overflow before calling page_align
> - if size == 0 || size > usize::MAX - PAGE_SIZE + 1 {
> + if size == 0 {
> return Err(EINVAL);
> }
> -
> - let aligned_size = page_align(size);
> -
> - gem::Object::new(dev, aligned_size)
> + page_align(size)
> + .ok_or(EINVAL)
> + .and_then(|size| gem::Object::new(dev, size))
> }
>
> /// Look up a GEM object handle for a `File` and return an `ObjectRef` for it.
>
> base-commit: b927546677c876e26eba308550207c2ddf812a43
> prerequisite-patch-id: 7154ef17c3e40275152c90eff07bffcb5ef5e5cb
This looks like this is an incremental patch on top of some previous version of
this one.
However, in this case I don't think there is a need to resend, since I prefer v4
over this one. Eventually we will need to use size (or aligned_size) outside of
the closure for further calculations.
I will pick up v4 of this patch, no need to resend, thanks!
next prev parent reply other threads:[~2025-12-23 20:11 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-23 13:59 [PATCH v5] drm/nova: Align GEM memory allocation to system page size Brendan Shephard
2025-12-23 20:11 ` Danilo Krummrich [this message]
2025-12-24 1:58 ` Brendan Shephard
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=DF5VBOI4LSTZ.5O2XJRIFMK3S@kernel.org \
--to=dakr@kernel.org \
--cc=acourbot@nvidia.com \
--cc=airlied@redhat.com \
--cc=aliceryhl@google.com \
--cc=bshephar@bne-home.net \
--cc=joelagnelf@nvidia.com \
--cc=rust-for-linux@vger.kernel.org \
/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