[PATCH v3 0/2] fix wrong usage of memory allocation APIs under PREEMPT_RT in arm64

Yeoreum Yun posted 2 patches 1 month, 2 weeks ago
There is a newer version of this series
arch/arm64/mm/mmu.c | 254 ++++++++++++++++++++++++++++++++++----------
1 file changed, 197 insertions(+), 57 deletions(-)
[PATCH v3 0/2] fix wrong usage of memory allocation APIs under PREEMPT_RT in arm64
Posted by Yeoreum Yun 1 month, 2 weeks ago
Under PREEMPT_RT, calling generic memory allocation/free APIs
(e.x) __get_free_pages(), pgtable_alloc(), free_pages() and etc
with preemption disabled is not allowed, but allow only nolock() APIs series
because it may acquire a spin lock that becomes sleepable on RT,
potentially causing a sleep during page allocation
(See Documentation/core-api/real-time/differences.rst, Memory allocation section).

However, In arm64, __linear_map_split_to_ptes() and
__kpti_install_ng_mappings() called by stopper thread via stop_machine()
use generic memory allocation/free APIs.

This patchset fixes this problem and based on v6.19-rc1

Patch History
==============
from v2 to v3:
  - remove split-mode and split_args.
    pass proper function pointer while spliting.
  - rename function name.
  - https://lore.kernel.org/all/20251217182007.2345700-1-yeoreum.yun@arm.com/

from v1 to v2:
  - drop pagetable_alloc_nolock()
  - following @Ryan Roberts suggestion.
  - https://lore.kernel.org/all/20251212161832.2067134-1-yeoreum.yun@arm.com/


*** BLURB HERE ***

Yeoreum Yun (2):
  arm64: mmu: avoid allocating pages while splitting the linear mapping
  arm64: mmu: avoid allocating pages while installing ng-mapping for
    KPTI

 arch/arm64/mm/mmu.c | 254 ++++++++++++++++++++++++++++++++++----------
 1 file changed, 197 insertions(+), 57 deletions(-)

--
LEVI:{C3F47F37-75D8-414A-A8BA-3980EC8A46D7}
Re: [PATCH v3 0/2] fix wrong usage of memory allocation APIs under PREEMPT_RT in arm64
Posted by Yeoreum Yun 1 month, 1 week ago
Gentle ping in case of forgotten.

On Thu, Dec 18, 2025 at 07:47:48PM +0000, Yeoreum Yun wrote:
> Under PREEMPT_RT, calling generic memory allocation/free APIs
> (e.x) __get_free_pages(), pgtable_alloc(), free_pages() and etc
> with preemption disabled is not allowed, but allow only nolock() APIs series
> because it may acquire a spin lock that becomes sleepable on RT,
> potentially causing a sleep during page allocation
> (See Documentation/core-api/real-time/differences.rst, Memory allocation section).
>
> However, In arm64, __linear_map_split_to_ptes() and
> __kpti_install_ng_mappings() called by stopper thread via stop_machine()
> use generic memory allocation/free APIs.
>
> This patchset fixes this problem and based on v6.19-rc1
>
> Patch History
> ==============
> from v2 to v3:
>   - remove split-mode and split_args.
>     pass proper function pointer while spliting.
>   - rename function name.
>   - https://lore.kernel.org/all/20251217182007.2345700-1-yeoreum.yun@arm.com/
>
> from v1 to v2:
>   - drop pagetable_alloc_nolock()
>   - following @Ryan Roberts suggestion.
>   - https://lore.kernel.org/all/20251212161832.2067134-1-yeoreum.yun@arm.com/
>
>
> *** BLURB HERE ***
>
> Yeoreum Yun (2):
>   arm64: mmu: avoid allocating pages while splitting the linear mapping
>   arm64: mmu: avoid allocating pages while installing ng-mapping for
>     KPTI
>
>  arch/arm64/mm/mmu.c | 254 ++++++++++++++++++++++++++++++++++----------
>  1 file changed, 197 insertions(+), 57 deletions(-)
>
> --
> LEVI:{C3F47F37-75D8-414A-A8BA-3980EC8A46D7}
>

--
Sincerely,
Yeoreum Yun
Re: [PATCH v3 0/2] fix wrong usage of memory allocation APIs under PREEMPT_RT in arm64
Posted by David Hildenbrand (Red Hat) 1 month, 1 week ago
On 12/31/25 11:07, Yeoreum Yun wrote:
> Gentle ping in case of forgotten.

A lot of people (including me, wait, why am I reading mails ;) ) are 
currently out, and will likely be out for the remainder of the week.

I'd assume people will look into it next week.

-- 
Cheers

David