From: Linus Walleij <linus.walleij@linaro.org>
To: Jason Gunthorpe <jgg@ziepe.ca>
Cc: Andrew Morton <akpm@linux-foundation.org>, linux-mm@kvack.org
Subject: Re: [PATCH 4/5] mm: gup: Pass a pointer to virt_to_page()
Date: Fri, 1 Jul 2022 11:11:36 +0200 [thread overview]
Message-ID: <CACRpkdZre3fWy+FXASGLkk3z66LK=uu8K_ZL7SW4PMgVdF9Mxw@mail.gmail.com> (raw)
In-Reply-To: <20220701002904.GX23621@ziepe.ca>
On Fri, Jul 1, 2022 at 2:29 AM Jason Gunthorpe <jgg@ziepe.ca> wrote:
> On Thu, Jun 30, 2022 at 10:41:23AM +0200, Linus Walleij wrote:
> > Functions that work on a pointer to virtual memory such as
> > virt_to_pfn() and users of that function such as
> > virt_to_page() are supposed to pass a pointer to virtual
> > memory, ideally a (void *) or other pointer. However since
> > many architectures implement virt_to_pfn() as a macro,
> > this function becomes polymorphic and accepts both a
> > (unsigned long) and a (void *).
>
> I wonder if there is merit to convert x86 to use an inline after this
> goes in to prevent this polymorphic mistake?
I have a patch like that, x86 uses the asm generic version IIUC:
https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-integrator.git/patch/?id=ed4befbf783c06820e9d4620c7fd254a36d608fe
There was also Xen:
https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-integrator.git/patch/?id=43ab4e5d6738273055dca21031e23b53b3721889
The plan is to trickle in a few of those after I fixed up all the mm
and drivers that were doing this with unsigned longs.
I managed to convert all architectures except one to use
static inlines for virt_to_pfn.
I was actually a bit surprised how few sites there were.
Yours,
Linus Walleij
next prev parent reply other threads:[~2022-07-01 9:11 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-30 8:41 [PATCH 0/5] mm: Pass pointers to page accessors Linus Walleij
2022-06-30 8:41 ` [PATCH 1/5] lib/test_free_pages.c: Pass a pointer to virt_to_page() Linus Walleij
2022-06-30 8:41 ` [PATCH 2/5] mm/highmem: " Linus Walleij
2022-06-30 8:41 ` [PATCH 3/5] mm: kfence: " Linus Walleij
2022-06-30 9:23 ` Marco Elver
2022-06-30 8:41 ` [PATCH 4/5] mm: gup: " Linus Walleij
2022-07-01 0:29 ` Jason Gunthorpe
2022-07-01 9:11 ` Linus Walleij [this message]
2022-06-30 8:41 ` [PATCH 5/5] mm: nommu: " Linus Walleij
2022-07-01 23:00 ` [PATCH 0/5] mm: Pass pointers to page accessors Andrew Morton
2022-07-03 13:28 ` Linus Walleij
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='CACRpkdZre3fWy+FXASGLkk3z66LK=uu8K_ZL7SW4PMgVdF9Mxw@mail.gmail.com' \
--to=linus.walleij@linaro.org \
--cc=akpm@linux-foundation.org \
--cc=jgg@ziepe.ca \
--cc=linux-mm@kvack.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