linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Zi Yan <ziy@nvidia.com>
To: Jann Horn <jannh@google.com>
Cc: David Hildenbrand <david@redhat.com>,
	"Kirill A. Shutemov" <kirill@shutemov.name>,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	syzbot+7d917f67c05066cec295@syzkaller.appspotmail.com,
	Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH v1] mm/pagewalk: fix usage of pmd_leaf()/pud_leaf() without present check
Date: Tue, 15 Oct 2024 11:45:14 -0400	[thread overview]
Message-ID: <9D9A6A63-8B74-47FA-B50E-C4A993258944@nvidia.com> (raw)
In-Reply-To: <CAG48ez1Sf04jfwWM3J7XFQ2Y_ZP0CT75ASQHuFkgJLdQf2reYw@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1504 bytes --]

On 15 Oct 2024, at 10:43, Jann Horn wrote:

> On Tue, Oct 15, 2024 at 4:40 PM David Hildenbrand <david@redhat.com> wrote:
>> On 15.10.24 16:32, Kirill A. Shutemov wrote:
>>> On Tue, Oct 15, 2024 at 01:12:36PM +0200, David Hildenbrand wrote:
>>>> pmd_leaf()/pud_leaf() only implies a pmd_present()/pud_present() check on
>>>> some architectures.
>>>
>>> Should we clarify what behaviour we actually want from arch code?
>>
>> We probably should document somewhere that things like pmd_special(),
>> pmd_leaf() ... should only be used when we know that the PMD is present.
>>
>> I wonder if we should even add ways to detect mis-use
>>
>> Jann also raised that recently in a private message, that it is rather
>> unclear (well, and repeatedly leads to issues) when pmd_leaf() is valid
>> to be called.
>
> I think one place where that should probably be addressed is in
> Documentation/mm/arch_pgtable_helpers.rst - that is supposed to be an
> overview of these helper functions and what they mean, but the only
> thing it currently says about pmd_leaf() is "Tests a leaf mapped PMD",
> which doesn't really tell you much more than the function name. It
> would be nice if that table contained information about the conditions
> under which these helpers may be used.

I find the related documentation in include/linux/pgtable.h [1], but it is
not an easy find.


[1] https://elixir.bootlin.com/linux/v6.11.3/source/include/linux/pgtable.h#L1865

Best Regards,
Yan, Zi

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 854 bytes --]

      reply	other threads:[~2024-10-15 15:45 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-15 11:12 David Hildenbrand
2024-10-15 13:13 ` David Hildenbrand
2024-10-16 10:58   ` Qi Zheng
2024-10-16 11:05     ` David Hildenbrand
2024-10-16 22:44       ` Andrew Morton
2024-10-15 14:32 ` Kirill A. Shutemov
2024-10-15 14:40   ` David Hildenbrand
2024-10-15 14:43     ` Jann Horn
2024-10-15 15:45       ` Zi Yan [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=9D9A6A63-8B74-47FA-B50E-C4A993258944@nvidia.com \
    --to=ziy@nvidia.com \
    --cc=akpm@linux-foundation.org \
    --cc=david@redhat.com \
    --cc=jannh@google.com \
    --cc=kirill@shutemov.name \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=syzbot+7d917f67c05066cec295@syzkaller.appspotmail.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