linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Evgeny Baskakov <ebaskakov@nvidia.com>
To: Jerome Glisse <jglisse@redhat.com>
Cc: "akpm@linux-foundation.org" <akpm@linux-foundation.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>,
	John Hubbard <jhubbard@nvidia.com>,
	David Nellans <dnellans@nvidia.com>,
	Mark Hairgrove <mhairgrove@nvidia.com>,
	Sherry Cheung <SCheung@nvidia.com>,
	Subhash Gutti <sgutti@nvidia.com>
Subject: Re: [HMM 12/15] mm/migrate: new memory migration helper for use with device memory v4
Date: Mon, 10 Jul 2017 16:44:38 -0700	[thread overview]
Message-ID: <ff6cb2b9-b930-afad-1a1f-1c437eced3cf@nvidia.com> (raw)
In-Reply-To: <20170701005749.GA7232@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 2526 bytes --]

On 6/30/17 5:57 PM, Jerome Glisse wrote:

...

Hi Jerome,

I am working on a sporadic data corruption seen in highly contented use 
cases. So far, I've been able to re-create a sporadic hang that happens 
when multiple threads compete to migrate the same page to and from 
device memory. The reproducer uses only the dummy driver from hmm-next.

Please find attached. This is how it hangs on my 12-core Intel i7-5930K 
SMT system:

&&& 2 migrate threads, 2 read threads: STARTING
(EE:84) hmm_buffer_mirror_read error -1
&&& 2 migrate threads, 2 read threads: PASSED
&&& 2 migrate threads, 3 read threads: STARTING
&&& 2 migrate threads, 3 read threads: PASSED
&&& 2 migrate threads, 4 read threads: STARTING
&&& 2 migrate threads, 4 read threads: PASSED
&&& 3 migrate threads, 2 read threads: STARTING

The kernel log (also attached) shows multiple threads blocked in 
hmm_vma_fault() and migrate_vma():

[  139.054907] sanity_rmem004  D13528  3997   3818 0x00000000
[  139.054912] Call Trace:
[  139.054914]  __schedule+0x20b/0x6c0
[  139.054916]  schedule+0x36/0x80
[  139.054920]  io_schedule+0x16/0x40
[  139.054923]  __lock_page+0xf2/0x130
[  139.054929]  migrate_vma+0x48a/0xee0
[  139.054933]  dummy_migrate.isra.10+0xd9/0x110 [hmm_dmirror]
[  139.054945]  dummy_fops_unlocked_ioctl+0x1e8/0x330 [hmm_dmirror]
[  139.054954]  do_vfs_ioctl+0x96/0x5a0
[  139.054957]  SyS_ioctl+0x79/0x90
[  139.054960]  entry_SYSCALL_64_fastpath+0x13/0x94
...
[  139.055067] sanity_rmem004  D13136  3999   3818 0x00000000
[  139.055072] Call Trace:
[  139.055074]  __schedule+0x20b/0x6c0
[  139.055076]  schedule+0x36/0x80
[  139.055079]  io_schedule+0x16/0x40
[  139.055083]  wait_on_page_bit+0xee/0x120
[  139.055089]  __migration_entry_wait+0xe8/0x190
[  139.055091]  migration_entry_wait+0x5f/0x70
[  139.055094]  do_swap_page+0x4c7/0x4e0
[  139.055096]  __handle_mm_fault+0x347/0x9d0
[  139.055099]  handle_mm_fault+0x88/0x150
[  139.055103]  hmm_vma_walk_clear+0x8f/0xd0
[  139.055105]  hmm_vma_walk_pmd+0x1ba/0x250
[  139.055109]  __walk_page_range+0x1e8/0x420
[  139.055112]  walk_page_range+0x73/0xf0
[  139.055114]  hmm_vma_fault+0x180/0x260
[  139.055121]  dummy_fault+0xda/0x1f0 [hmm_dmirror]
[  139.055138]  dummy_fops_unlocked_ioctl+0x12c/0x330 [hmm_dmirror]
[  139.055142]  do_vfs_ioctl+0x96/0x5a0
[  139.055145]  SyS_ioctl+0x79/0x90
[  139.055148]  entry_SYSCALL_64_fastpath+0x13/0x94

Please compile and run the attached program this way:

$ ./build.sh
$ sudo ./kload.sh
$ sudo ./run.sh

Thanks!

Evgeny Baskakov
NVIDIA


[-- Attachment #2: sanity_rmem004_repeated_faults_threaded.tgz --]
[-- Type: application/x-gzip, Size: 5265 bytes --]

[-- Attachment #3: kernel.log --]
[-- Type: text/plain, Size: 8482 bytes --]

[  107.703099] hmm_dmirror loaded THIS IS A DANGEROUS MODULE !!!
[  114.236862] DEVICE PAGE 20400 20400 (0)
[  114.845967] DEVICE PAGE 53323 53323 (0)
[  115.536446] DEVICE PAGE 87401 87401 (0)
[  139.054579] sysrq: SysRq : Show Blocked State
[  139.054658]   task                        PC stack   pid father
[  139.054661] rcu_sched       D15024     8      2 0x00000000
[  139.054669] Call Trace:
[  139.054676]  __schedule+0x20b/0x6c0
[  139.054679]  schedule+0x36/0x80
[  139.054687]  rcu_gp_kthread+0x74/0x770
[  139.054693]  kthread+0x109/0x140
[  139.054697]  ? force_qs_rnp+0x180/0x180
[  139.054700]  ? kthread_park+0x60/0x60
[  139.054705]  ret_from_fork+0x22/0x30
[  139.054707] rcu_bh          D15424     9      2 0x00000000
[  139.054713] Call Trace:
[  139.054716]  __schedule+0x20b/0x6c0
[  139.054718]  schedule+0x36/0x80
[  139.054721]  rcu_gp_kthread+0x74/0x770
[  139.054725]  kthread+0x109/0x140
[  139.054728]  ? force_qs_rnp+0x180/0x180
[  139.054731]  ? kthread_park+0x60/0x60
[  139.054734]  ret_from_fork+0x22/0x30
[  139.054762] sanity_rmem004  D13528  3995   3818 0x00000000
[  139.054767] Call Trace:
[  139.054769]  __schedule+0x20b/0x6c0
[  139.054776]  ? wake_up_q+0x80/0x80
[  139.054778]  schedule+0x36/0x80
[  139.054782]  io_schedule+0x16/0x40
[  139.054789]  __lock_page+0xf2/0x130
[  139.054792]  ? page_cache_tree_insert+0x90/0x90
[  139.054798]  migrate_vma+0x48a/0xee0
[  139.054803]  dummy_migrate.isra.10+0xd9/0x110 [hmm_dmirror]
[  139.054812]  dummy_fops_unlocked_ioctl+0x1e8/0x330 [hmm_dmirror]
[  139.054814]  ? _cond_resched+0x19/0x30
[  139.054819]  ? selinux_file_ioctl+0x114/0x1e0
[  139.054823]  do_vfs_ioctl+0x96/0x5a0
[  139.054826]  SyS_ioctl+0x79/0x90
[  139.054830]  entry_SYSCALL_64_fastpath+0x13/0x94
[  139.054832] RIP: 0033:0x7fc07add61e7
[  139.054834] RSP: 002b:00007fc078cdfd78 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
[  139.054836] RAX: ffffffffffffffda RBX: 00007fc078cdfdf0 RCX: 00007fc07add61e7
[  139.054837] RDX: 00007fc078cdfdf0 RSI: 00000000c0104802 RDI: 0000000000000003
[  139.054839] RBP: 00007ffde7ffd470 R08: 0000000000000000 R09: 00007fc078ce0700
[  139.054840] R10: 00007fc078ce09d0 R11: 0000000000000246 R12: 00007fc078cdfdf8
[  139.054841] R13: 0000000000000000 R14: 0000000000000010 R15: 00007fc078ce0700
[  139.054843] sanity_rmem004  D13304  3996   3818 0x00000000
[  139.054848] Call Trace:
[  139.054851]  __schedule+0x20b/0x6c0
[  139.054853]  schedule+0x36/0x80
[  139.054856]  io_schedule+0x16/0x40
[  139.054860]  __lock_page+0xf2/0x130
[  139.054863]  ? page_cache_tree_insert+0x90/0x90
[  139.054866]  migrate_vma+0x48a/0xee0
[  139.054870]  dummy_migrate.isra.10+0xd9/0x110 [hmm_dmirror]
[  139.054877]  ? avc_has_extended_perms+0xda/0x480
[  139.054881]  dummy_fops_unlocked_ioctl+0x1e8/0x330 [hmm_dmirror]
[  139.054883]  ? _cond_resched+0x19/0x30
[  139.054887]  ? selinux_file_ioctl+0x114/0x1e0
[  139.054890]  do_vfs_ioctl+0x96/0x5a0
[  139.054893]  SyS_ioctl+0x79/0x90
[  139.054896]  entry_SYSCALL_64_fastpath+0x13/0x94
[  139.054897] RIP: 0033:0x7fc07add61e7
[  139.054898] RSP: 002b:00007fc0794e0d78 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
[  139.054901] RAX: ffffffffffffffda RBX: 00007fc0794e0df0 RCX: 00007fc07add61e7
[  139.054902] RDX: 00007fc0794e0df0 RSI: 00000000c0104802 RDI: 0000000000000003
[  139.054903] RBP: 00007ffde7ffd470 R08: 0000000000000000 R09: 00007fc0794e1700
[  139.054904] R10: 00007fc0794e19d0 R11: 0000000000000246 R12: 00007fc0794e0df8
[  139.054905] R13: 0000000000000000 R14: 0000000000000010 R15: 00007fc0794e1700
[  139.054907] sanity_rmem004  D13528  3997   3818 0x00000000
[  139.054912] Call Trace:
[  139.054914]  __schedule+0x20b/0x6c0
[  139.054916]  schedule+0x36/0x80
[  139.054920]  io_schedule+0x16/0x40
[  139.054923]  __lock_page+0xf2/0x130
[  139.054927]  ? page_cache_tree_insert+0x90/0x90
[  139.054929]  migrate_vma+0x48a/0xee0
[  139.054933]  dummy_migrate.isra.10+0xd9/0x110 [hmm_dmirror]
[  139.054942]  ? copy_user_enhanced_fast_string+0x7/0x10
[  139.054945]  dummy_fops_unlocked_ioctl+0x1e8/0x330 [hmm_dmirror]
[  139.054947]  ? _cond_resched+0x19/0x30
[  139.054951]  ? selinux_file_ioctl+0x114/0x1e0
[  139.054954]  do_vfs_ioctl+0x96/0x5a0
[  139.054957]  SyS_ioctl+0x79/0x90
[  139.054960]  entry_SYSCALL_64_fastpath+0x13/0x94
[  139.054961] RIP: 0033:0x7fc07add61e7
[  139.054962] RSP: 002b:00007fc079ce1d78 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
[  139.054964] RAX: ffffffffffffffda RBX: 00007fc079ce1df0 RCX: 00007fc07add61e7
[  139.054965] RDX: 00007fc079ce1df0 RSI: 00000000c0104802 RDI: 0000000000000003
[  139.054966] RBP: 00007ffde7ffd470 R08: 0000000000000000 R09: 00007fc079ce2700
[  139.054968] R10: 00007fc079ce29d0 R11: 0000000000000246 R12: 00007fc079ce1df8
[  139.054969] R13: 0000000000000000 R14: 0000000000000010 R15: 00007fc079ce2700
[  139.054971] sanity_rmem004  D13136  3998   3818 0x00000000
[  139.054975] Call Trace:
[  139.054977]  __schedule+0x20b/0x6c0
[  139.054979]  schedule+0x36/0x80
[  139.054983]  io_schedule+0x16/0x40
[  139.054986]  wait_on_page_bit+0xee/0x120
[  139.054990]  ? page_cache_tree_insert+0x90/0x90
[  139.054993]  __migration_entry_wait+0xe8/0x190
[  139.054995]  migration_entry_wait+0x5f/0x70
[  139.054998]  do_swap_page+0x4c7/0x4e0
[  139.055001]  __handle_mm_fault+0x347/0x9d0
[  139.055004]  handle_mm_fault+0x88/0x150
[  139.055008]  hmm_vma_walk_clear+0x8f/0xd0
[  139.055010]  hmm_vma_walk_pmd+0x1ba/0x250
[  139.055015]  __walk_page_range+0x1e8/0x420
[  139.055018]  walk_page_range+0x73/0xf0
[  139.055020]  hmm_vma_fault+0x180/0x260
[  139.055023]  ? hmm_vma_walk_hole+0xd0/0xd0
[  139.055024]  ? hmm_vma_get_pfns+0x1b0/0x1b0
[  139.055028]  dummy_fault+0xda/0x1f0 [hmm_dmirror]
[  139.055033]  ? __kernel_map_pages+0x70/0xe0
[  139.055038]  ? __alloc_pages_nodemask+0x11b/0x240
[  139.055041]  ? dummy_pt_walk+0x209/0x2f0 [hmm_dmirror]
[  139.055044]  ? dummy_update+0x60/0x60 [hmm_dmirror]
[  139.055047]  dummy_fops_unlocked_ioctl+0x12c/0x330 [hmm_dmirror]
[  139.055050]  do_vfs_ioctl+0x96/0x5a0
[  139.055054]  SyS_ioctl+0x79/0x90
[  139.055057]  entry_SYSCALL_64_fastpath+0x13/0x94
[  139.055058] RIP: 0033:0x7fc07add61e7
[  139.055059] RSP: 002b:00007fc07ace3c38 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
[  139.055061] RAX: ffffffffffffffda RBX: 00007fc07ace4700 RCX: 00007fc07add61e7
[  139.055062] RDX: 00007fc07ace3cd0 RSI: 00000000c0284800 RDI: 0000000000000003
[  139.055063] RBP: 00007ffde7ffd3b0 R08: 00007fc07ace3ef0 R09: 00007fc07ace4700
[  139.055064] R10: 00007ffde7ffd470 R11: 0000000000000246 R12: 0000000000000000
[  139.055066] R13: 0000000000000000 R14: 00007fc07ace49c0 R15: 00007fc07ace4700
[  139.055067] sanity_rmem004  D13136  3999   3818 0x00000000
[  139.055072] Call Trace:
[  139.055074]  __schedule+0x20b/0x6c0
[  139.055076]  schedule+0x36/0x80
[  139.055079]  io_schedule+0x16/0x40
[  139.055083]  wait_on_page_bit+0xee/0x120
[  139.055086]  ? page_cache_tree_insert+0x90/0x90
[  139.055089]  __migration_entry_wait+0xe8/0x190
[  139.055091]  migration_entry_wait+0x5f/0x70
[  139.055094]  do_swap_page+0x4c7/0x4e0
[  139.055096]  __handle_mm_fault+0x347/0x9d0
[  139.055099]  handle_mm_fault+0x88/0x150
[  139.055103]  hmm_vma_walk_clear+0x8f/0xd0
[  139.055105]  hmm_vma_walk_pmd+0x1ba/0x250
[  139.055109]  __walk_page_range+0x1e8/0x420
[  139.055112]  walk_page_range+0x73/0xf0
[  139.055114]  hmm_vma_fault+0x180/0x260
[  139.055116]  ? hmm_vma_walk_hole+0xd0/0xd0
[  139.055118]  ? hmm_vma_get_pfns+0x1b0/0x1b0
[  139.055121]  dummy_fault+0xda/0x1f0 [hmm_dmirror]
[  139.055125]  ? __kernel_map_pages+0x70/0xe0
[  139.055129]  ? __alloc_pages_nodemask+0x11b/0x240
[  139.055133]  ? dummy_pt_walk+0x209/0x2f0 [hmm_dmirror]
[  139.055135]  ? dummy_update+0x60/0x60 [hmm_dmirror]
[  139.055138]  dummy_fops_unlocked_ioctl+0x12c/0x330 [hmm_dmirror]
[  139.055142]  do_vfs_ioctl+0x96/0x5a0
[  139.055145]  SyS_ioctl+0x79/0x90
[  139.055148]  entry_SYSCALL_64_fastpath+0x13/0x94
[  139.055149] RIP: 0033:0x7fc07add61e7
[  139.055150] RSP: 002b:00007fc07a4e2c38 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
[  139.055152] RAX: ffffffffffffffda RBX: 00007fc07a4e3700 RCX: 00007fc07add61e7
[  139.055153] RDX: 00007fc07a4e2cd0 RSI: 00000000c0284800 RDI: 0000000000000003
[  139.055154] RBP: 00007ffde7ffd3b0 R08: 00007fc07a4e2ef0 R09: 00007fc07a4e3700
[  139.055155] R10: 00007ffde7ffd470 R11: 0000000000000246 R12: 0000000000000000
[  139.055156] R13: 0000000000000000 R14: 00007fc07a4e39c0 R15: 00007fc07a4e3700

  parent reply	other threads:[~2017-07-10 23:44 UTC|newest]

Thread overview: 66+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-22 16:51 [HMM 00/15] HMM (Heterogeneous Memory Management) v22 Jérôme Glisse
2017-05-22 16:51 ` [HMM 01/15] hmm: heterogeneous memory management documentation Jérôme Glisse
2017-05-22 16:51 ` [HMM 02/15] mm/hmm: heterogeneous memory management (HMM for short) v3 Jérôme Glisse
2017-05-22 16:51 ` [HMM 03/15] mm/hmm/mirror: mirror process address space on device with HMM helpers v3 Jérôme Glisse
2017-05-22 16:51 ` [HMM 04/15] mm/hmm/mirror: helper to snapshot CPU page table v3 Jérôme Glisse
2017-05-22 16:51 ` [HMM 05/15] mm/hmm/mirror: device page fault handler Jérôme Glisse
2017-05-22 16:51 ` [HMM 06/15] mm/memory_hotplug: introduce add_pages Jérôme Glisse
2017-05-22 16:51 ` [HMM 07/15] mm/ZONE_DEVICE: new type of ZONE_DEVICE for unaddressable memory v2 Jérôme Glisse
2017-05-22 21:17   ` Dan Williams
2017-05-23 21:36     ` [HMM 07/18] mm/ZONE_DEVICE: new type of ZONE_DEVICE for unaddressable memory v3 Jérôme Glisse
2017-05-23  8:36   ` [HMM 07/15] mm/ZONE_DEVICE: new type of ZONE_DEVICE for unaddressable memory v2 kbuild test robot
2017-05-22 16:51 ` [HMM 08/15] mm/ZONE_DEVICE: special case put_page() for device private pages Jérôme Glisse
2017-05-22 19:29   ` Dan Williams
2017-05-22 20:14     ` Jerome Glisse
2017-05-22 20:19       ` Dan Williams
2017-05-22 21:14         ` Jerome Glisse
2017-05-22 20:22       ` Hugh Dickins
2017-05-22 21:17         ` Jerome Glisse
2017-05-23  9:34   ` kbuild test robot
2017-05-23 13:23   ` Kirill A. Shutemov
2017-05-23 21:37     ` [HMM 08/18] mm/ZONE_DEVICE: special case put_page() for device private pages v2 Jérôme Glisse
2017-05-22 16:52 ` [HMM 09/15] mm/hmm/devmem: device memory hotplug using ZONE_DEVICE v4 Jérôme Glisse
2017-05-23 21:37   ` [HMM 09/18] mm/hmm/devmem: device memory hotplug using ZONE_DEVICE v5 Jérôme Glisse
2017-05-22 16:52 ` [HMM 10/15] mm/hmm/devmem: dummy HMM device for ZONE_DEVICE memory v3 Jérôme Glisse
2017-05-22 16:52 ` [HMM 11/15] mm/migrate: new migrate mode MIGRATE_SYNC_NO_COPY Jérôme Glisse
2017-05-22 16:52 ` [HMM 12/15] mm/migrate: new memory migration helper for use with device memory v4 Jérôme Glisse
2017-05-23 18:07   ` Reza Arbab
2017-06-27  0:07   ` Evgeny Baskakov
2017-06-30 23:19     ` Evgeny Baskakov
2017-07-01  0:57       ` Jerome Glisse
2017-07-01  2:06         ` Evgeny Baskakov
2017-07-10 22:59         ` Evgeny Baskakov
2017-07-10 23:43           ` Jerome Glisse
2017-07-11  0:17             ` Evgeny Baskakov
2017-07-11  0:54               ` Jerome Glisse
2017-07-20 21:05                 ` Evgeny Baskakov
2017-07-10 23:44         ` Evgeny Baskakov [this message]
2017-07-11 18:29           ` Jerome Glisse
2017-07-11 18:42             ` Evgeny Baskakov
2017-07-11 18:49               ` Jerome Glisse
2017-07-11 19:35                 ` Evgeny Baskakov
2017-07-13 20:16                   ` Jerome Glisse
2017-07-14  5:32                     ` Evgeny Baskakov
2017-07-14 19:43                     ` Evgeny Baskakov
2017-07-15  0:55                       ` Jerome Glisse
2017-07-15  5:04                         ` Evgeny Baskakov
2017-07-21  1:00                         ` Evgeny Baskakov
2017-07-21  1:33                           ` Jerome Glisse
2017-07-21 22:01                             ` Evgeny Baskakov
2017-07-25 22:45                             ` Evgeny Baskakov
2017-07-26 19:14                               ` Jerome Glisse
2017-05-22 16:52 ` [HMM 13/15] mm/migrate: migrate_vma() unmap page from vma while collecting pages Jérôme Glisse
2017-05-22 16:52 ` [HMM 14/15] mm/migrate: support un-addressable ZONE_DEVICE page in migration v2 Jérôme Glisse
2017-05-22 16:52 ` [HMM 15/15] mm/migrate: allow migrate_vma() to alloc new page on empty entry v2 Jérôme Glisse
2017-05-23 22:02 ` [HMM 00/15] HMM (Heterogeneous Memory Management) v22 Jerome Glisse
2017-05-23 22:05   ` Andrew Morton
2017-05-24  1:55 ` Balbir Singh
2017-05-24 17:53   ` Jerome Glisse
2017-06-01  2:04     ` Balbir Singh
2017-06-01 22:38       ` Jerome Glisse
2017-06-03  9:18         ` Balbir Singh
2017-05-24 17:20 [HMM 00/15] HMM (Heterogeneous Memory Management) v23 Jérôme Glisse
2017-05-24 17:20 ` [HMM 12/15] mm/migrate: new memory migration helper for use with device memory v4 Jérôme Glisse
2017-05-31  3:59   ` Balbir Singh
2017-06-01 22:35     ` Jerome Glisse
2017-06-07  9:02       ` Balbir Singh
2017-06-07 14:06         ` Jerome Glisse

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=ff6cb2b9-b930-afad-1a1f-1c437eced3cf@nvidia.com \
    --to=ebaskakov@nvidia.com \
    --cc=SCheung@nvidia.com \
    --cc=akpm@linux-foundation.org \
    --cc=dnellans@nvidia.com \
    --cc=jglisse@redhat.com \
    --cc=jhubbard@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhairgrove@nvidia.com \
    --cc=sgutti@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;
as well as URLs for NNTP newsgroup(s).