linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Kefeng Wang <wangkefeng.wang@huawei.com>
To: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	David Hildenbrand <david@redhat.com>,
	Oscar Salvador <osalvador@suse.de>,
	Muchun Song <muchun.song@linux.dev>, <linux-mm@kvack.org>,
	<sidhartha.kumar@oracle.com>, <jane.chu@oracle.com>,
	Zi Yan <ziy@nvidia.com>, Vlastimil Babka <vbabka@suse.cz>,
	Brendan Jackman <jackmanb@google.com>,
	Johannes Weiner <hannes@cmpxchg.org>,
	Matthew Wilcox <willy@infradead.org>
Subject: Re: [PATCH v5 5/6] mm: cma: add cma_alloc_frozen{_compound}()
Date: Thu, 8 Jan 2026 14:57:20 +0800	[thread overview]
Message-ID: <fe460dca-82db-478d-8fcb-b212ab34ead1@huawei.com> (raw)
In-Reply-To: <aV8wOx_O5Esy5fni@umbar.lan>



On 2026/1/8 12:19, Dmitry Baryshkov wrote:
> On Tue, Dec 30, 2025 at 03:24:21PM +0800, Kefeng Wang wrote:
>> Introduce cma_alloc_frozen{_compound}() helper to alloc pages without
>> incrementing their refcount, then convert hugetlb cma to use the
>> cma_alloc_frozen_compound() and cma_release_frozen() and remove the
>> unused cma_{alloc,free}_folio(), also move the cma_validate_zones()
>> into mm/internal.h since no outside user.
>>
>> The set_pages_refcounted() is only called to set non-compound pages
>> after above changes, so remove the processing about PageHead.
>>
>> Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
>> ---
>>   include/linux/cma.h |  26 +++--------
>>   mm/cma.c            | 107 +++++++++++++++++++++++++++++---------------
>>   mm/hugetlb_cma.c    |  24 +++++-----
>>   mm/internal.h       |  10 ++---
>>   4 files changed, 97 insertions(+), 70 deletions(-)
>>
> 
> This breaks booting of Qualcomm RB3 Gen2:

Thanks for your report, sorry for the regression, Zi has post a fix [1],
could you try it? I will do more test and resend a new version.

[1] 
https://lore.kernel.org/linux-mm/7253A444-97D1-4256-9AD9-BCFF66437510@nvidia.com/

> 
> [    9.500774] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000008
> [    9.509862] Mem abort info:
> [    9.512745]   ESR = 0x0000000096000004
> [    9.516597]   EC = 0x25: DABT (current EL), IL = 32 bits
> [    9.522050]   SET = 0, FnV = 0
> [    9.525194]   EA = 0, S1PTW = 0
> [    9.528429]   FSC = 0x04: level 0 translation fault
> [    9.533440] Data abort info:
> [    9.536400]   ISV = 0, ISS = 0x00000004, ISS2 = 0x00000000
> [    9.542030]   CM = 0, WnR = 0, TnD = 0, TagAccess = 0
> [    9.547224]   GCS = 0, Overlay = 0, DirtyBit = 0, Xs = 0
> [    9.552684] [0000000000000008] user address but active_mm is swapper
> [    9.559237] Internal error: Oops: 0000000096000004 [#1]  SMP
> [    9.565054] Modules linked in:
> [    9.568202] CPU: 7 UID: 0 PID: 59 Comm: kworker/u32:1 Not tainted 6.19.0-rc3-00212-gfb9a328d3040 #4016 PREEMPT
> [    9.578552] Hardware name: Qualcomm Technologies, Inc. Robotics RB3gen2 (DT)
> [    9.585792] Workqueue: events_unbound deferred_probe_work_func
> [    9.591791] pstate: 204000c5 (nzCv daIF +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
> [    9.598941] pc : __get_pfnblock_flags_mask.isra.0+0x30/0x60
> [    9.604669] lr : free_pcppages_bulk+0x120/0x274
> [    9.609327] sp : ffff8000808ab610
> [    9.612741] x29: ffff8000808ab610 x28: 0000000000000001 x27: ffff0001797fa380
> [    9.620071] x26: ffffa5ded75b3800 x25: 0000000000000004 x24: ffff0001797fa390
> [    9.627399] x23: ffffa5ded7850ea0 x22: 0000000000000001 x21: 000000000000003a
> [    9.634728] x20: ffff00017f41b020 x19: ffff0001797fa3f0 x18: ffff000080a2a9e8
> [    9.642057] x17: ffff000080a2a9e8 x16: ffff0000803c1b50 x15: 0000000000000003
> [    9.649385] x14: 0000000000000028 x13: 0000000000006aa1 x12: 0000000000000000
> [    9.656707] x11: 0000000000000001 x10: 0000000000000000 x9 : fffffdffc1f8c000
> [    9.664037] x8 : ffff00017f41b028 x7 : ffff00017f41ae00 x6 : fffffdffc1f8c008
> [    9.671364] x5 : fffffc08070506c0 x4 : 000001fffff8100e x3 : 0001fffff8100e0a
> [    9.678693] x2 : 0000000000000000 x1 : 0000000000000017 x0 : fffffc08070506c0
> [    9.686021] Call trace:
> [    9.688537]  __get_pfnblock_flags_mask.isra.0+0x30/0x60 (P)
> [    9.694257]  free_frozen_page_commit.isra.0+0x1a8/0x478
> [    9.699628]  __free_frozen_pages+0x240/0x5c0
> [    9.704013]  free_contig_frozen_range+0xc8/0x110
> [    9.708764]  __cma_release_frozen+0x54/0x188
> [    9.713159]  cma_release+0x4c/0x78
> [    9.716661]  dma_free_contiguous+0x2c/0x74
> [    9.720870]  dma_direct_free+0xf4/0x188
> [    9.724814]  dma_free_attrs+0xa8/0x1d8
> [    9.728666]  qcom_scm_pas_init_image+0x178/0x18c
> [    9.733414]  qcom_mdt_pas_init+0x130/0x23c
> [    9.737623]  qcom_mdt_load+0x44/0xa0
> [    9.741299]  venus_boot+0x14c/0x2e8
> [    9.744891]  venus_probe+0x32c/0x5d8
> [    9.748567]  platform_probe+0x5c/0xa4
> [    9.752332]  really_probe+0xbc/0x2c0
> [    9.756009]  __driver_probe_device+0x78/0x120
> [    9.760483]  driver_probe_device+0x3c/0x160
> [    9.764779]  __device_attach_driver+0xb8/0x140
> [    9.769347]  bus_for_each_drv+0x88/0xe8
> [    9.773290]  __device_attach+0xa0/0x198
> [    9.777232]  device_initial_probe+0x50/0x54
> [    9.781527]  bus_probe_device+0x38/0xac
> [    9.785468]  deferred_probe_work_func+0x90/0xcc
> [    9.790130]  process_one_work+0x214/0x64c
> [    9.794251]  worker_thread+0x1bc/0x360
> [    9.798103]  kthread+0x14c/0x220
> [    9.801424]  ret_from_fork+0x10/0x20
> [    9.805103] Code: f8647842 f100005f 8b231043 9a821062 (f9400442)
> [    9.811358] ---[ end trace 0000000000000000 ]---
> 



  reply	other threads:[~2026-01-08  6:57 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-30  7:24 [PATCH v5 mm-new 0/6] mm: hugetlb: allocate frozen gigantic folio Kefeng Wang
2025-12-30  7:24 ` [PATCH v5 1/6] mm: debug_vm_pgtable: add debug_vm_pgtable_free_huge_page() Kefeng Wang
2026-01-02 18:51   ` Sid Kumar
2025-12-30  7:24 ` [PATCH v5 2/6] mm: page_alloc: add __split_page() Kefeng Wang
2026-01-02 18:55   ` Sid Kumar
2025-12-30  7:24 ` [PATCH v5 3/6] mm: cma: kill cma_pages_valid() Kefeng Wang
2025-12-30  7:24 ` [PATCH v5 4/6] mm: page_alloc: add alloc_contig_frozen_{range,pages}() Kefeng Wang
2025-12-31  2:57   ` Zi Yan
2026-01-02 21:05   ` Sid Kumar
2025-12-30  7:24 ` [PATCH v5 5/6] mm: cma: add cma_alloc_frozen{_compound}() Kefeng Wang
2025-12-31  2:59   ` Zi Yan
2026-01-08  4:19   ` Dmitry Baryshkov
2026-01-08  6:57     ` Kefeng Wang [this message]
2025-12-30  7:24 ` [PATCH v5 6/6] mm: hugetlb: allocate frozen pages for gigantic allocation Kefeng Wang
2025-12-31  2:50   ` Muchun Song
2025-12-31  3:00   ` Zi Yan
2025-12-30 18:17 ` [PATCH v5 mm-new 0/6] mm: hugetlb: allocate frozen gigantic folio Andrew Morton
2026-01-07 17:31 ` Claudiu Beznea
2026-01-07 18:25   ` Andrew Morton
2026-01-07 18:26   ` Zi Yan
2026-01-07 18:39   ` Mark Brown
2026-01-07 18:50     ` Andrew Morton
2026-01-07 19:38     ` Zi Yan
     [not found]       ` <CGME20260107225819eucas1p2de678d4e810fdbde87192b83033a814c@eucas1p2.samsung.com>
2026-01-07 22:58         ` Marek Szyprowski
2026-01-08  1:05       ` Kefeng Wang
2026-01-08  1:53         ` Kefeng Wang
2026-01-08  3:25           ` Zi Yan
2026-01-08  7:10             ` Kefeng Wang
2026-01-08  9:00       ` Claudiu Beznea
2026-01-08  9:14       ` Konrad Dybcio

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=fe460dca-82db-478d-8fcb-b212ab34ead1@huawei.com \
    --to=wangkefeng.wang@huawei.com \
    --cc=akpm@linux-foundation.org \
    --cc=david@redhat.com \
    --cc=dmitry.baryshkov@oss.qualcomm.com \
    --cc=hannes@cmpxchg.org \
    --cc=jackmanb@google.com \
    --cc=jane.chu@oracle.com \
    --cc=linux-mm@kvack.org \
    --cc=muchun.song@linux.dev \
    --cc=osalvador@suse.de \
    --cc=sidhartha.kumar@oracle.com \
    --cc=vbabka@suse.cz \
    --cc=willy@infradead.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox