All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Shivank Garg" <shivankg@amd.com>,
	"Andrew Morton" <akpm@linux-foundation.org>,
	"David Hildenbrand" <david@kernel.org>,
	"Lorenzo Stoakes" <ljs@kernel.org>,
	"Liam R. Howlett" <liam@infradead.org>,
	"Vlastimil Babka" <vbabka@kernel.org>,
	"Mike Rapoport" <rppt@kernel.org>,
	"Suren Baghdasaryan" <surenb@google.com>,
	"Michal Hocko" <mhocko@suse.com>, "Dev Jain" <dev.jain@arm.com>,
	"Zi Yan" <ziy@nvidia.com>,
	"Baolin Wang" <baolin.wang@linux.alibaba.com>,
	"Nico Pache" <nico.pache@linux.dev>,
	"Ryan Roberts" <ryan.roberts@arm.com>,
	"Barry Song" <baohua@kernel.org>,
	"Lance Yang" <lance.yang@linux.dev>,
	"Usama Arif" <usama.arif@linux.dev>,
	"Kiryl Shutsemau" <kas@kernel.org>,
	"Peter Xu" <peterx@redhat.com>, "Shuah Khan" <shuah@kernel.org>,
	"Michał Mirosław" <emmir@google.com>,
	"Andrei Vagin" <avagin@gmail.com>,
	"Paul Gofman" <pgofman@codeweavers.com>,
	"Bharata B Rao" <bharata@amd.com>,
	"Daniel Wade" <danjwade95@gmail.com>,
	"Yin Tirui" <yintirui@gmail.com>,
	"Muhammad Usama Anjum" <usama.anjum@arm.com>
Cc: linux-mm@kvack.org
Subject: Re: [PATCH 1/3] mm: move the soft-dirty fallbacks up in pgtable.h
Date: Thu, 26 Nov 2026 13:34:06 +0000	[thread overview]
Message-ID: <sashiko-outbox-235616@kernel.org> (raw)
In-Reply-To: <20261125-b4-mm-soft-dirty-fixes-v1-1-538e3cdb618c@amd.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [High] mm: moving soft-dirty fallbacks inside CONFIG_MMU breaks
  !CONFIG_MMU build
--

commit 9116ecffa5341d7e3fa2c316d20e584781fb40ea
Author: Shivank Garg <shivankg@amd.com>

mm: move the soft-dirty fallbacks up in pgtable.h

This commit moves pgtable_supports_soft_dirty() and the soft-dirty PTE/PMD
fallback helpers up in include/linux/pgtable.h so they precede
modify_prot_start_ptes().

> diff --git a/include/linux/pgtable.h b/include/linux/pgtable.h
> index 66d369870a740..b1db7aec5362f 100644
> --- a/include/linux/pgtable.h
> +++ b/include/linux/pgtable.h
> @@ -194,6 +194,97 @@ static inline int pmd_dirty(pmd_t pmd)
>  }
>  #endif
>  
> +/*
> + * Some platforms can customize the PTE soft-dirty bit making it unavailable
> + * even if the architecture provides the resource.
> + * Adding this API allows architectures to add their own checks for the
> + * devices on which the kernel is running.
> + * Note: When overriding it, please make sure the CONFIG_MEM_SOFT_DIRTY
> + * is part of this macro.
> + */
> +#ifndef pgtable_supports_soft_dirty
> +#define pgtable_supports_soft_dirty()	IS_ENABLED(CONFIG_MEM_SOFT_DIRTY)
> +#endif
> +
> +#ifdef CONFIG_HAVE_ARCH_SOFT_DIRTY
> +#ifndef CONFIG_ARCH_HAS_PMD_SOFTLEAVES
> +static inline pmd_t pmd_swp_mksoft_dirty(pmd_t pmd)
> +{
> +	return pmd;
> +}
> +
> +static inline int pmd_swp_soft_dirty(pmd_t pmd)
> +{
> +	return 0;
> +}
> +
> +static inline pmd_t pmd_swp_clear_soft_dirty(pmd_t pmd)
> +{
> +	return pmd;
> +}
> +#endif
> +#else /* !CONFIG_HAVE_ARCH_SOFT_DIRTY */
> +static inline int pte_soft_dirty(pte_t pte)
> +{
> +	return 0;
> +}
> +
> +static inline int pmd_soft_dirty(pmd_t pmd)
> +{
> +	return 0;
> +}

[Severity: High]
Does moving pgtable_supports_soft_dirty() and the soft-dirty fallbacks here
break !CONFIG_MMU builds?

These definitions were previously located after the #endif /* CONFIG_MMU */
guard near the bottom of include/linux/pgtable.h, and moving them here
places them inside the #ifdef CONFIG_MMU block.  However, callers compiled
on !CONFIG_MMU, such as vm_flags_init() in include/linux/mm.h (called by
do_mmap() in mm/nommu.c) and vma_soft_dirty_enabled(),
pmd_needs_soft_dirty_wp() and pte_needs_soft_dirty_wp() in mm/internal.h,
still reference pgtable_supports_soft_dirty(), pmd_soft_dirty() and
pte_soft_dirty() unconditionally.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261125-b4-mm-soft-dirty-fixes-v1-0-538e3cdb618c@amd.com?part=1


  parent reply	other threads:[~2026-11-26 13:34 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-25 13:32 [PATCH 0/3] mm: fix soft-dirty false positives in mprotect() of large folios Shivank Garg
2026-11-25 13:32 ` [PATCH 1/3] mm: move the soft-dirty fallbacks up in pgtable.h Shivank Garg
2026-11-25 16:44   ` kernel test robot
2026-11-25 16:44   ` kernel test robot
2026-11-26 13:34   ` sashiko-bot [this message]
2026-11-25 13:32 ` [PATCH 2/3] mm: don't let modify_prot_start_ptes() set soft-dirty on clean PTEs Shivank Garg
2026-11-25 13:32 ` [PATCH 3/3] selftests/mm: soft-dirty: check that mprotect() keeps PTE-mapped THPs clean Shivank Garg
2026-11-25 13:43 ` [PATCH 0/3] mm: fix soft-dirty false positives in mprotect() of large folios David Hildenbrand (Arm)
2026-11-25 14:16   ` Garg, Shivank
2026-11-25 15:42   ` Paul Gofman
2026-11-25 16:11     ` Garg, Shivank

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=sashiko-outbox-235616@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=avagin@gmail.com \
    --cc=baohua@kernel.org \
    --cc=baolin.wang@linux.alibaba.com \
    --cc=bharata@amd.com \
    --cc=danjwade95@gmail.com \
    --cc=david@kernel.org \
    --cc=dev.jain@arm.com \
    --cc=emmir@google.com \
    --cc=kas@kernel.org \
    --cc=lance.yang@linux.dev \
    --cc=liam@infradead.org \
    --cc=linux-mm@kvack.org \
    --cc=ljs@kernel.org \
    --cc=mhocko@suse.com \
    --cc=nico.pache@linux.dev \
    --cc=peterx@redhat.com \
    --cc=pgofman@codeweavers.com \
    --cc=rppt@kernel.org \
    --cc=ryan.roberts@arm.com \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=shivankg@amd.com \
    --cc=shuah@kernel.org \
    --cc=surenb@google.com \
    --cc=usama.anjum@arm.com \
    --cc=usama.arif@linux.dev \
    --cc=vbabka@kernel.org \
    --cc=yintirui@gmail.com \
    --cc=ziy@nvidia.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.