linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Linus Torvalds <torvalds@linux-foundation.org>
To: Andrew Morton <akpm@linux-foundation.org>,
	Ankit Agrawal <ankita@nvidia.com>,
	 Alex Williamson <alex@shazbot.org>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	 mm-commits@vger.kernel.org
Subject: Re: [GIT PULL] MM updates for 6.19-rc1
Date: Fri, 5 Dec 2025 13:56:17 -0800	[thread overview]
Message-ID: <CAHk-=wj1aw7p-JkWdcJOkQQ279qgppG7_1kxFQAqaak7fEQAjw@mail.gmail.com> (raw)
In-Reply-To: <20251203212918.82f1c9d3947940aeae263878@linux-foundation.org>

On Wed, 3 Dec 2025 at 21:29, Andrew Morton <akpm@linux-foundation.org> wrote:
>
> Ankit Agrawal:
>       vfio/nvgrace-gpu: register device memory for poison handling

So I had to look at this one because there was a conflict ("int ret"
had been removed by another commit), and after looking at it I ended
up deciding to revert this patch entirely.

I may be wrong, but that patch looks *COMPETELY* broken.

It did

  nvgrace_gpu_mmap() ->
    nvgrace_gpu_vfio_pci_register_pfn_range() ->
      register_pfn_address_space()

using &nvdev->resmem/usemem, and honestly, that looks mis-designed
from beginning to end.

If somebody maps the same BAR of that device twice, the second call to
nvgrace_gpu_vfio_pci_register_pfn_range() will randomly overwrite a
node (that "region->pfn_address_space.node") that has already been
registered and inserted into the pfn_space_itree interval tree.

You can't *do* things like this!

Maybe I'm  misreading this, and somebody should correct me, but it
really looks like completely broken code to me. It basically seems to
assume that those two bar regions are mapped exactly once, and I don't
see why that would ever be true except by pure accident because you
only have one user.

That may be a common case, but that doesn't make any of this correct.

Again - maybe I'm missing something. If so, that commit can be re-done
with explanations of why it's all correct.

           Linus


  reply	other threads:[~2025-12-05 21:56 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-04  5:29 Andrew Morton
2025-12-05 21:56 ` Linus Torvalds [this message]
2025-12-06  2:54   ` Jason Gunthorpe
2025-12-06  3:43     ` Linus Torvalds
2025-12-05 22:14 ` pr-tracker-bot

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='CAHk-=wj1aw7p-JkWdcJOkQQ279qgppG7_1kxFQAqaak7fEQAjw@mail.gmail.com' \
    --to=torvalds@linux-foundation.org \
    --cc=akpm@linux-foundation.org \
    --cc=alex@shazbot.org \
    --cc=ankita@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mm-commits@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