From: Max Zhen <max.zhen@amd.com>
To: Lizhi Hou <lizhi.hou@amd.com>, <ogabbay@kernel.org>,
<quic_jhugo@quicinc.com>, <mario.limonciello@amd.com>,
<karol.wachowski@linux.intel.com>,
<dri-devel@lists.freedesktop.org>
Cc: <linux-kernel@vger.kernel.org>, <sonal.santan@amd.com>
Subject: Re: [PATCH V1] accel/amdxdna: Fully initialize map structure before registering notifier
Date: Fri, 11 Sep 2026 10:11:00 -0700 [thread overview]
Message-ID: <e8e52df0-c0b5-4823-b5c7-58ef3d341818@amd.com> (raw)
In-Reply-To: <20260911163907.1193852-1-lizhi.hou@amd.com>
On 9/11/2026 Fri 09:39, Lizhi Hou wrote:
> The map structure is currently only partially initialized when the
> notifier is registered. Although holding mmap_write_lock() prevents
> the notifier callback from running before the remaining initialization
> is complete, the ordering can be confusing during code review.
>
> Fully initialize the map structure before registering the notifier so
> that the structure is completely constructed before it is published.
>
> Signed-off-by: Lizhi Hou <lizhi.hou@amd.com>
Reviewed-by: Max Zhen <max.zhen@amd.com>
> ---
> drivers/accel/amdxdna/amdxdna_gem.c | 18 +++++++++---------
> 1 file changed, 9 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/accel/amdxdna/amdxdna_gem.c b/drivers/accel/amdxdna/amdxdna_gem.c
> index 5a1a2ee261b7..e861db6f9369 100644
> --- a/drivers/accel/amdxdna/amdxdna_gem.c
> +++ b/drivers/accel/amdxdna/amdxdna_gem.c
> @@ -415,6 +415,15 @@ static int amdxdna_hmm_register(struct amdxdna_gem_obj *abo,
> goto free_map;
> }
>
> + mapp->range.notifier = &mapp->notifier;
> + mapp->range.start = vma->vm_start;
> + mapp->range.end = vma->vm_end;
> + mapp->range.default_flags = HMM_PFN_REQ_FAULT;
> + mapp->abo = abo;
> + kref_init(&mapp->refcnt);
> +
> + INIT_WORK(&mapp->hmm_unreg_work, amdxdna_hmm_unreg_work);
> +
> ret = mmu_interval_notifier_insert_locked(&mapp->notifier,
> current->mm,
> addr,
> @@ -425,15 +434,6 @@ static int amdxdna_hmm_register(struct amdxdna_gem_obj *abo,
> goto free_pfns;
> }
>
> - mapp->range.notifier = &mapp->notifier;
> - mapp->range.start = vma->vm_start;
> - mapp->range.end = vma->vm_end;
> - mapp->range.default_flags = HMM_PFN_REQ_FAULT;
> - mapp->abo = abo;
> - kref_init(&mapp->refcnt);
> -
> - INIT_WORK(&mapp->hmm_unreg_work, amdxdna_hmm_unreg_work);
> -
> down_write(&xdna->notifier_lock);
> if (list_empty(&abo->mem.umap_list))
> abo->mem.uva = addr;
next prev parent reply other threads:[~2026-09-11 17:11 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-11 16:39 Lizhi Hou
2026-09-11 17:11 ` Max Zhen [this message]
2026-09-17 16:14 ` Lizhi Hou
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=e8e52df0-c0b5-4823-b5c7-58ef3d341818@amd.com \
--to=max.zhen@amd.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=karol.wachowski@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lizhi.hou@amd.com \
--cc=mario.limonciello@amd.com \
--cc=ogabbay@kernel.org \
--cc=quic_jhugo@quicinc.com \
--cc=sonal.santan@amd.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®