Skip to content

Commit bc64ddd

Browse files
rgushchinintel-lab-lkp
authored andcommitted
kernel BUG at mm/huge_memory.c:2613!
Hi! I was consistently hitting a VM_BUG_ON_PAGE() in split_huge_page_to_list() when running vanilla 5.8-rc1 on my desktop. It was happening on every boot during the system start. I haven't seen this issue on 5.7. It looks like split_huge_page() expects the page to be locked, but it hasn't been changed from 5.7. I do not see any suspicious commits around the call side either. I've tried the following patch: -- From 4af38fb Mon Sep 17 00:00:00 2001 From: Roman Gushchin <[email protected]> Date: Thu, 18 Jun 2020 16:33:47 -0700 Subject: [PATCH] iommu/dma: lock page before calling split_huge_page() split_huge_page() expects a locked page. The following stacktrace is generated if debug is on. Fix this by locking the page before passing it to split_huge_page(). [ 24.861385] page:ffffef044fb1fa00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 head:ffffef044fb1fa00 order:2 compound_mapcount:0 compound_pincount:0 [ 24.861389] flags: 0x17ffffc0010000(head) [ 24.861393] raw: 0017ffffc0010000 dead000000000100 dead000000000122 0000000000000000 [ 24.861395] raw: 0000000000000000 0000000000000000 00000001ffffffff 0000000000000000 [ 24.861396] page dumped because: VM_BUG_ON_PAGE(!PageLocked(head)) [ 24.861411] ------------[ cut here ]------------ [ 24.861413] kernel BUG at mm/huge_memory.c:2613! [ 24.861428] invalid opcode: 0000 [#1] SMP NOPTI [ 24.861432] CPU: 10 PID: 1505 Comm: pulseaudio Not tainted 5.8.0-rc1+ torvalds#689 [ 24.861433] Hardware name: Gigabyte Technology Co., Ltd. AB350-Gaming/AB350-Gaming-CF, BIOS F25 01/16/2019 [ 24.861441] RIP: 0010:split_huge_page_to_list+0x731/0xae0 [ 24.861444] Code: 44 00 00 8b 47 34 85 c0 0f 84 b4 02 00 00 f0 ff 4f 34 75 c2 e8 e0 12 f7 ff eb bb 48 c7 c6 d0 16 39 ba 4c 89 c7 e8 ef 85 f9 ff <0f> 0b 48 c7 44 24 10 ff ff ff ff 31 db e9 bb fa ff ff 48 8b 7c 24 [ 24.861446] RSP: 0018:ffffc1030254bb50 EFLAGS: 00010286 [ 24.861449] RAX: 0000000000000000 RBX: 0000000000000002 RCX: ffff9b54cee98d08 [ 24.861451] RDX: 00000000ffffffd8 RSI: 0000000000000000 RDI: ffff9b54cee98d00 [ 24.861452] RBP: ffffef044fb1fa00 R08: 0000000000000547 R09: 0000000000000003 [ 24.861454] R10: 0000000000000000 R11: 0000000000000001 R12: ffff9b54df37f188 [ 24.861455] R13: ffff9b54df355000 R14: ffffef044fb1fa00 R15: ffffef044fb1fa00 [ 24.861458] FS: 00007fd2dc132880(0000) GS:ffff9b54cee80000(0000) knlGS:0000000000000000 [ 24.861460] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 24.861461] CR2: 00007fd2cb100000 CR3: 00000003feb16000 CR4: 00000000003406e0 [ 24.861464] Call Trace: [ 24.861473] ? __mod_lruvec_state+0x41/0xf0 [ 24.861478] ? __alloc_pages_nodemask+0x15c/0x320 [ 24.861483] iommu_dma_alloc+0x316/0x580 [ 24.861496] snd_dma_alloc_pages+0xdf/0x160 [snd_pcm] [ 24.861508] snd_dma_alloc_pages_fallback+0x5d/0x80 [snd_pcm] [ 24.861516] snd_malloc_sgbuf_pages+0x166/0x380 [snd_pcm] [ 24.861523] ? snd_pcm_hw_refine+0x29d/0x310 [snd_pcm] [ 24.861529] ? _cond_resched+0x16/0x40 [ 24.861535] snd_dma_alloc_pages+0x64/0x160 [snd_pcm] [ 24.861542] snd_pcm_lib_malloc_pages+0x136/0x1d0 [snd_pcm] [ 24.861550] ? snd_pcm_lib_ioctl+0x167/0x210 [snd_pcm] [ 24.861556] snd_pcm_hw_params+0x3c0/0x490 [snd_pcm] [ 24.861563] snd_pcm_common_ioctl+0x1c5/0x1110 [snd_pcm] [ 24.861571] ? snd_pcm_info_user+0x64/0x80 [snd_pcm] [ 24.861578] snd_pcm_ioctl+0x23/0x30 [snd_pcm] [ 24.861583] ksys_ioctl+0x82/0xc0 [ 24.861587] __x64_sys_ioctl+0x16/0x20 [ 24.861593] do_syscall_64+0x4d/0x90 [ 24.861597] entry_SYSCALL_64_after_hwframe+0x44/0xa9 Signed-off-by: Roman Gushchin <[email protected]>
1 parent 672cf6d commit bc64ddd

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

drivers/iommu/dma-iommu.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include <linux/scatterlist.h>
2525
#include <linux/vmalloc.h>
2626
#include <linux/crash_dump.h>
27+
#include <linux/pagemap.h>
2728

2829
struct iommu_dma_msi_page {
2930
struct list_head list;
@@ -549,8 +550,15 @@ static struct page **__iommu_dma_alloc_pages(struct device *dev,
549550
if (!PageCompound(page)) {
550551
split_page(page, order);
551552
break;
552-
} else if (!split_huge_page(page)) {
553-
break;
553+
} else {
554+
int err;
555+
556+
lock_page(page);
557+
err = split_huge_page(page);
558+
unlock_page(page);
559+
560+
if (!err)
561+
break;
554562
}
555563
__free_pages(page, order);
556564
}

0 commit comments

Comments
 (0)