[PATCH OLK-5.10] arm64: mm: add mc support for __buffer_migrate_page

hulk inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/IB0OV7 -------------------------------- During our test, panic happens when kernel try to read a user page in __buffer_migrate_page with the following trace: Internal error: synchronous external abort: ffffffff96000410 [#1] SMP pstate: 00401009 (nzcv daif +PAN -UAO -TCO BTYPE=--) pc : copy_page+0x40/0xbc lr : copy_highpage+0x3c/0x60 sp : ffff8040de1caec0 Call trace: copy_page+0x40/0xbc migrate_page_copy+0x44/0xd0 __buffer_migrate_page.part.0+0x288/0x3f0 buffer_migrate_page+0x28/0x60 move_to_new_page+0x68/0x274 __unmap_and_move+0x424/0x574 unmap_and_move+0x84/0x67c migrate_pages+0x160/0x540 compact_zone+0x1d8/0x5b4 compact_zone_order+0xa4/0xfc try_to_compact_pages+0xb0/0x2a0 __alloc_pages_direct_compact+0x9c/0x210 __alloc_pages+0x844/0x1214 alloc_pages_vma+0x388/0x3e0 do_huge_pmd_anonymous_page+0x170/0x574 __handle_mm_fault+0x374/0x3ac handle_mm_fault+0xf4/0x260 __get_user_pages+0x218/0x42c __gup_longterm_locked+0x94/0x2c0 internal_get_user_pages_fast+0x140/0x240 pin_user_pages_fast+0x24/0x50 __ib_umem_get.part.0+0x22c/0x4e0 [ib_uverbs] ib_umem_get+0x90/0xc0 [ib_uverbs] hns_roce_mtr_create+0x78/0x334 [hns_roce_hw_v2] alloc_mr_pbl+0xe4/0x18c [hns_roce_hw_v2] hns_roce_reg_user_mr+0xf4/0x1a0 [hns_roce_hw_v2] ib_uverbs_reg_mr+0x120/0x2c0 [ib_uverbs] ib_uverbs_handler_UVERBS_METHOD_INVOKE_WRITE+0xe4/0x180 [ib_uverbs] ib_uverbs_run_method+0x33c/0x3d4 [ib_uverbs] ib_uverbs_cmd_verbs+0x128/0x1dc [ib_uverbs] ib_uverbs_ioctl+0xfc/0x1d0 [ib_uverbs] __arm64_sys_ioctl+0xb0/0x110 invoke_syscall+0x50/0x134 el0_svc_common.constprop.0+0x10c/0x12c do_el0_svc+0x34/0xe0 el0_svc+0x20/0x30 el0_sync_handler+0xb8/0xc0 el0_sync+0x160/0x180 Code: 91020021 f2402c1f d503201f a8300c02 (a9400c22) ---[ end trace ccd629679fc3e8d1 ]--- To fix this, Use migrate_page_mc_extra to replace migrate_page_copy in __buffer_migrate_page to add mc support for this function. Signed-off-by: Wupeng Ma <mawupeng1@huawei.com> --- mm/migrate.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/mm/migrate.c b/mm/migrate.c index cf8c05ea821e..0d79382f9697 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -820,6 +820,7 @@ static int __buffer_migrate_page(struct address_space *mapping, struct buffer_head *bh, *head; int rc; int expected_count; + bool copy_done = false; if (!page_has_buffers(page)) return migrate_page(mapping, newpage, page, mode); @@ -860,7 +861,13 @@ static int __buffer_migrate_page(struct address_space *mapping, } } - rc = migrate_page_move_mapping(mapping, newpage, page, 0); + if (IS_ENABLED(CONFIG_ARM64) && IS_ENABLED(CONFIG_ARCH_HAS_COPY_MC) && + (mode != MIGRATE_SYNC_NO_COPY)) { + rc = migrate_page_mc_extra(mapping, newpage, page, mode, 0); + copy_done = true; + } else { + rc = migrate_page_move_mapping(mapping, newpage, page, 0); + } if (rc != MIGRATEPAGE_SUCCESS) goto unlock_buffers; @@ -873,6 +880,9 @@ static int __buffer_migrate_page(struct address_space *mapping, } while (bh != head); + if (copy_done) + goto unlock_buffers; + if (mode != MIGRATE_SYNC_NO_COPY) migrate_page_copy(newpage, page); else -- 2.43.0

反馈: 您发送到kernel@openeuler.org的补丁/补丁集,已成功转换为PR! PR链接地址: https://gitee.com/openeuler/kernel/pulls/15669 邮件列表地址:https://mailweb.openeuler.org/archives/list/kernel@openeuler.org/message/MF7... FeedBack: The patch(es) which you have sent to kernel@openeuler.org mailing list has been converted to a pull request successfully! Pull request link: https://gitee.com/openeuler/kernel/pulls/15669 Mailing list address: https://mailweb.openeuler.org/archives/list/kernel@openeuler.org/message/MF7...
participants (2)
-
patchwork bot
-
Wupeng Ma