From: Joao Martins <joao.m.martins@oracle.com>
To: Dan Williams <dan.j.williams@intel.com>
Cc: Linux MM <linux-mm@kvack.org>,
Vishal Verma <vishal.l.verma@intel.com>,
Dave Jiang <dave.jiang@intel.com>,
Naoya Horiguchi <naoya.horiguchi@nec.com>,
Matthew Wilcox <willy@infradead.org>,
Jason Gunthorpe <jgg@ziepe.ca>,
John Hubbard <jhubbard@nvidia.com>,
Jane Chu <jane.chu@oracle.com>,
Muchun Song <songmuchun@bytedance.com>,
Mike Kravetz <mike.kravetz@oracle.com>,
Andrew Morton <akpm@linux-foundation.org>,
Jonathan Corbet <corbet@lwn.net>,
Linux NVDIMM <nvdimm@lists.linux.dev>,
Linux Doc Mailing List <linux-doc@vger.kernel.org>
Subject: Re: [PATCH v3 11/14] device-dax: ensure dev_dax->pgmap is valid for dynamic devices
Date: Fri, 6 Aug 2021 13:28:51 +0100 [thread overview]
Message-ID: <21b65b9d-fa76-727d-6db5-02b0c19f2124@oracle.com> (raw)
In-Reply-To: <9e361442-f8e9-cdac-ce7d-94c0bcc6cb0a@oracle.com>
On 7/28/21 4:56 PM, Joao Martins wrote:
> On 7/28/21 8:30 AM, Dan Williams wrote:
>> On Wed, Jul 14, 2021 at 12:36 PM Joao Martins <joao.m.martins@oracle.com> wrote:
>>>
>>> Right now, only static dax regions have a valid @pgmap pointer in its
>>> struct dev_dax. Dynamic dax case however, do not.
>>>
>>> In preparation for device-dax compound pagemap support, make sure that
>>> dev_dax pgmap field is set after it has been allocated and initialized.
>>
>> I think this is ok to fold into the patch that needs it.
>
> OK, I've squashed that in.
>
I am wondering now whether I should un-squash this into a separate patch.
It regresses one of the test suites from ndctl for dynamic dax regions. memremap_pages()
calls (from a dynamic region) starts hitting rather random splats (below) on the 'root'
device (not the dax device children aiui). This fixes it but I am yet 100% if should be
this way:
diff --git a/drivers/dax/bus.c b/drivers/dax/bus.c
index 6cc4da4c713d..2a3a70e62d89 100644
--- a/drivers/dax/bus.c
+++ b/drivers/dax/bus.c
@@ -363,6 +363,9 @@ void kill_dev_dax(struct dev_dax *dev_dax)
kill_dax(dax_dev);
unmap_mapping_range(inode->i_mapping, 0, 0, 1);
+
+ if (!is_static(dev_dax->region))
+ dev_dax->pgmap = NULL;
}
EXPORT_SYMBOL_GPL(kill_dev_dax);
stacktraces:
[ 834.884765] ------------[ cut here ]------------
[ 834.885887] nr_range must be specified
[ 834.886461] WARNING: CPU: 3 PID: 3148 at mm/memremap.c:347 memremap_pages+0x54f/0x610
[ 834.887578] Modules linked in:
[ 834.887993] CPU: 3 PID: 3148 Comm: lt-daxctl Not tainted 5.14.0-rc3-next-20210729+ #201
[ 834.889131] RIP: 0010:memremap_pages+0x54f/0x610
[ 834.889886] Code: e1 97 00 0f 0b e9 14 fc ff ff 80 3d 11 99 79 01 00 0f 85 3e fc ff ff
48 c7 c7 e8 78 5e 82 c6 05 fd 98 79 01 01 e8 f8 e0 97 00 <0f> 0b 48 c7 c0 ea ff ff ff e9
2f fb ff ff 48 c7 c7 b0 a7 d1 82 e8
[ 834.892491] RSP: 0018:ffffc90008fb3b40 EFLAGS: 00010286
[ 834.893249] RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000027
[ 834.894250] RDX: 0000000000000000 RSI: ffff88900fcd7610 RDI: ffff88900fcd7618
[ 834.895283] RBP: ffffc90008fb3b98 R08: 0000000000000000 R09: c0000000ffffefff
[ 834.896286] R10: ffffc90008fb3930 R11: ffffc90008fb3928 R12: 8000000000000063
[ 834.897279] R13: ffff889042856430 R14: 0000000000000001 R15: ffff889042856400
[ 834.898279] FS: 00007f83ddfd8780(0000) GS:ffff88900fcc0000(0000) knlGS:0000000000000000
[ 834.899423] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 834.900194] CR2: 00007ffdb895c148 CR3: 0000000106bfc006 CR4: 0000000000170ee0
[ 834.901195] Call Trace:
[ 834.901651] devm_memremap_pages+0x22/0x70
[ 834.902244] dev_dax_probe+0x175/0x2b0
[ 834.902797] dax_bus_probe+0x73/0xa0
[ 834.903285] really_probe+0xcf/0x3a0
[ 834.903801] __driver_probe_device+0xb3/0x130
[ 834.904363] driver_probe_device+0x24/0x90
[ 834.904967] __driver_attach+0xa1/0x170
[ 834.905525] ? __device_attach_driver+0xe0/0xe0
[ 834.906164] ? __device_attach_driver+0xe0/0xe0
[ 834.906818] bus_for_each_dev+0x74/0xb0
[ 834.907321] driver_attach+0x1e/0x20
[ 834.907875] do_id_store+0x1db/0x210
[ 834.908352] new_id_store+0x13/0x20
[ 834.908865] drv_attr_store+0x27/0x40
[ 834.909398] sysfs_kf_write+0x3b/0x50
[ 834.909968] kernfs_fop_write_iter+0x128/0x1b0
[ 834.910635] new_sync_write+0x117/0x1b0
[ 834.911139] vfs_write+0x181/0x250
[ 834.911644] ? do_sys_openat2+0x1d7/0x300
[ 834.912216] ksys_write+0x61/0xe0
[ 834.912698] __x64_sys_write+0x1a/0x20
[ 834.913242] do_syscall_64+0x3a/0x80
[ 834.913772] entry_SYSCALL_64_after_hwframe+0x44/0xae
[ 834.914491] RIP: 0033:0x7f83dd4cda00
[ 834.915010] Code: 73 01 c3 48 8b 0d 70 74 2d 00 f7 d8 64 89 01 48 83 c8 ff c3 66 0f 1f
44 00 00 83 3d bd d5 2d 00 00 75 10 b8 01 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 31 c3 48
83 ec 08 e8 7e cc 01 00 48 89 04 24
[ 834.917543] RSP: 002b:00007ffdb895f308 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
[ 834.918627] RAX: ffffffffffffffda RBX: 0000000000000004 RCX: 00007f83dd4cda00
[ 834.919650] RDX: 0000000000000007 RSI: 00000000020c639d RDI: 0000000000000004
[ 834.920658] RBP: 00000000020c639d R08: 0000000000000000 R09: 00000000020c45c0
[ 834.921649] R10: 2f7861645f656369 R11: 0000000000000246 R12: 0000000000000007
[ 834.922670] R13: 0000000000000001 R14: 00000000020c71b0 R15: 00000000020cc2e0
[ 834.923650] ---[ end trace 61ea8560dbeb3a89 ]---
[ 835.941573] Hotplug memory [0x0-0x0] exceeds maximum addressable range [0x0-0x3fffffffffff]
[ 835.944269] ------------[ cut here ]------------
[ 835.945412] kernel BUG at mm/memory_hotplug.c:316!
[ 835.946574] invalid opcode: 0000 [#1] SMP PTI
[ 835.947622] CPU: 6 PID: 3593 Comm: lt-daxctl Tainted: G W
5.14.0-rc3-next-20210729+ #201
[ 835.949845] RIP: 0010:__add_pages+0x100/0x150
[ 835.950899] Code: ba 89 55 d4 e8 4d 32 00 00 8b 55 d4 48 83 c4 08 89 d0 5b 41 5c 41 5d
41 5e 41 5f 5d c3 31 d2 eb e0 0f 0b ba ea ff ff ff eb e2 <0f> 0b 80 3d e6 43 dc 00 00 ba
ea ff ff ff 75 d2 48 c7 c7 b8 35 5e
[ 835.953662] RSP: 0018:ffffc900094bbab0 EFLAGS: 00010246
[ 835.954336] RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000000
[ 835.955276] RDX: 0000000000000000 RSI: ffff88900fd97610 RDI: ffff88900fd97610
[ 835.956251] RBP: ffffc900094bbae0 R08: 0000000000000000 R09: c0000000ffffefff
[ 835.957214] R10: ffffc900094bb888 R11: ffffc900094bb880 R12: 0000000000000000
[ 835.958154] R13: 0000000000000000 R14: ffffc900094bbb50 R15: 0000000000000000
[ 835.959097] FS: 00007fd63c55e780(0000) GS:ffff88900fd80000(0000) knlGS:0000000000000000
[ 835.960163] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 835.960960] CR2: 00007fffc4d7abd8 CR3: 00000001126f2001 CR4: 0000000000170ee0
[ 835.961903] Call Trace:
[ 835.962220] add_pages+0x17/0x70
[ 835.962696] arch_add_memory+0x45/0x50
[ 835.963175] memremap_pages+0x2a8/0x610
[ 835.963726] devm_memremap_pages+0x22/0x70
[ 835.964223] dev_dax_probe+0x175/0x2b0
[ 835.964778] dax_bus_probe+0x73/0xa0
[ 835.965215] really_probe+0xcf/0x3a0
[ 835.965717] __driver_probe_device+0xb3/0x130
[ 835.966248] driver_probe_device+0x24/0x90
[ 835.966835] __driver_attach+0xa1/0x170
[ 835.967340] ? __device_attach_driver+0xe0/0xe0
[ 835.967956] ? __device_attach_driver+0xe0/0xe0
[ 835.968589] bus_for_each_dev+0x74/0xb0
[ 835.969090] driver_attach+0x1e/0x20
[ 835.969605] do_id_store+0x1db/0x210
[ 835.970057] new_id_store+0x13/0x20
[ 835.970536] drv_attr_store+0x27/0x40
[ 835.971023] sysfs_kf_write+0x3b/0x50
[ 835.971529] kernfs_fop_write_iter+0x128/0x1b0
[ 835.972141] new_sync_write+0x117/0x1b0
[ 835.972697] vfs_write+0x181/0x250
[ 835.973130] ? do_sys_openat2+0x1d7/0x300
[ 835.973698] ksys_write+0x61/0xe0
[ 835.974117] __x64_sys_write+0x1a/0x20
[ 835.974654] do_syscall_64+0x3a/0x80
[ 835.975105] entry_SYSCALL_64_after_hwframe+0x44/0xae
[ 835.975802] RIP: 0033:0x7fd63ba53a00
[ 835.976257] Code: 73 01 c3 48 8b 0d 70 74 2d 00 f7 d8 64 89 01 48 83 c8 ff c3 66 0f 1f
44 00 00 83 3d bd d5 2d 00 00 75 10 b8 01 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 31 c3 48
83 ec 08 e8 7e cc 01 00 48 89 04 24
[ 835.978754] RSP: 002b:00007fffc4d7dd98 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
[ 835.979765] RAX: ffffffffffffffda RBX: 0000000000000004 RCX: 00007fd63ba53a00
[ 835.980761] RDX: 0000000000000007 RSI: 000000000081939d RDI: 0000000000000004
[ 835.981714] RBP: 000000000081939d R08: 0000000000000000 R09: 00000000008175c0
[ 835.982671] R10: 2f7861645f656369 R11: 0000000000000246 R12: 0000000000000007
[ 835.983647] R13: 0000000000000001 R14: 000000000081a1b0 R15: 000000000081f2e0
[ 835.984593] Modules linked in:
[ 835.985041] ---[ end trace 61ea8560dbeb3a8a ]---
[ 835.985789] RIP: 0010:__add_pages+0x100/0x150
next prev parent reply other threads:[~2021-08-06 12:29 UTC|newest]
Thread overview: 78+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-14 19:35 [PATCH v3 00/14] mm, sparse-vmemmap: Introduce compound pagemaps Joao Martins
2021-07-14 19:35 ` [PATCH v3 01/14] memory-failure: fetch compound_head after pgmap_pfn_valid() Joao Martins
2021-07-15 0:17 ` Dan Williams
2021-07-15 2:51 ` [External] " Muchun Song
2021-07-15 6:40 ` Christoph Hellwig
2021-07-15 9:19 ` Muchun Song
2021-07-15 13:17 ` Joao Martins
2021-07-14 19:35 ` [PATCH v3 02/14] mm/page_alloc: split prep_compound_page into head and tail subparts Joao Martins
2021-07-15 0:19 ` Dan Williams
2021-07-15 2:53 ` [External] " Muchun Song
2021-07-15 13:17 ` Joao Martins
2021-07-14 19:35 ` [PATCH v3 03/14] mm/page_alloc: refactor memmap_init_zone_device() page init Joao Martins
2021-07-15 0:20 ` Dan Williams
2021-07-14 19:35 ` [PATCH v3 04/14] mm/memremap: add ZONE_DEVICE support for compound pages Joao Martins
2021-07-15 1:08 ` Dan Williams
2021-07-15 12:52 ` Joao Martins
2021-07-15 13:06 ` Joao Martins
2021-07-15 19:48 ` Dan Williams
2021-07-30 16:13 ` Joao Martins
2021-07-22 0:38 ` Jane Chu
2021-07-22 10:56 ` Joao Martins
2021-07-15 12:59 ` Christoph Hellwig
2021-07-15 13:15 ` Joao Martins
2021-07-15 6:48 ` Christoph Hellwig
2021-07-15 13:15 ` Joao Martins
2021-07-14 19:35 ` [PATCH v3 05/14] mm/sparse-vmemmap: add a pgmap argument to section activation Joao Martins
2021-07-28 5:56 ` Dan Williams
2021-07-28 9:43 ` Joao Martins
2021-07-14 19:35 ` [PATCH v3 06/14] mm/sparse-vmemmap: refactor core of vmemmap_populate_basepages() to helper Joao Martins
2021-07-28 6:04 ` Dan Williams
2021-07-28 10:48 ` Joao Martins
2021-07-14 19:35 ` [PATCH v3 07/14] mm/hugetlb_vmemmap: move comment block to Documentation/vm Joao Martins
2021-07-15 2:47 ` [External] " Muchun Song
2021-07-15 13:16 ` Joao Martins
2021-07-28 6:09 ` Dan Williams
2021-07-14 19:35 ` [PATCH v3 08/14] mm/sparse-vmemmap: populate compound pagemaps Joao Martins
2021-07-28 6:55 ` Dan Williams
2021-07-28 15:35 ` Joao Martins
2021-07-28 18:03 ` Dan Williams
2021-07-28 18:54 ` Joao Martins
2021-07-28 20:04 ` Joao Martins
2021-07-14 19:35 ` [PATCH v3 09/14] mm/page_alloc: reuse tail struct pages for " Joao Martins
2021-07-28 7:28 ` Dan Williams
2021-07-28 15:56 ` Joao Martins
2021-07-28 16:08 ` Dan Williams
2021-07-28 16:12 ` Joao Martins
2021-07-14 19:35 ` [PATCH v3 10/14] device-dax: use ALIGN() for determining pgoff Joao Martins
2021-07-28 7:29 ` Dan Williams
2021-07-28 15:56 ` Joao Martins
2021-07-14 19:35 ` [PATCH v3 11/14] device-dax: ensure dev_dax->pgmap is valid for dynamic devices Joao Martins
2021-07-28 7:30 ` Dan Williams
2021-07-28 15:56 ` Joao Martins
2021-08-06 12:28 ` Joao Martins [this message]
2021-07-14 19:35 ` [PATCH v3 12/14] device-dax: compound pagemap support Joao Martins
2021-07-14 23:36 ` Dan Williams
2021-07-15 12:00 ` Joao Martins
2021-07-27 23:51 ` Dan Williams
2021-07-28 9:36 ` Joao Martins
2021-07-28 18:51 ` Dan Williams
2021-07-28 18:59 ` Joao Martins
2021-07-28 19:03 ` Dan Williams
2021-07-14 19:35 ` [PATCH v3 13/14] mm/gup: grab head page refcount once for group of subpages Joao Martins
2021-07-28 19:55 ` Dan Williams
2021-07-28 20:07 ` Joao Martins
2021-07-28 20:23 ` Dan Williams
2021-08-25 19:10 ` Joao Martins
2021-08-25 19:15 ` Matthew Wilcox
2021-08-25 19:26 ` Joao Martins
2021-07-14 19:35 ` [PATCH v3 14/14] mm/sparse-vmemmap: improve memory savings for compound pud geometry Joao Martins
2021-07-28 20:03 ` Dan Williams
2021-07-28 20:08 ` Joao Martins
2021-07-14 21:48 ` [PATCH v3 00/14] mm, sparse-vmemmap: Introduce compound pagemaps Andrew Morton
2021-07-14 23:47 ` Dan Williams
2021-07-22 2:24 ` Matthew Wilcox
2021-07-22 10:53 ` Joao Martins
2021-07-27 23:23 ` Dan Williams
2021-08-02 10:40 ` Joao Martins
2021-08-02 14:06 ` Dan Williams
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=21b65b9d-fa76-727d-6db5-02b0c19f2124@oracle.com \
--to=joao.m.martins@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=corbet@lwn.net \
--cc=dan.j.williams@intel.com \
--cc=dave.jiang@intel.com \
--cc=jane.chu@oracle.com \
--cc=jgg@ziepe.ca \
--cc=jhubbard@nvidia.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mike.kravetz@oracle.com \
--cc=naoya.horiguchi@nec.com \
--cc=nvdimm@lists.linux.dev \
--cc=songmuchun@bytedance.com \
--cc=vishal.l.verma@intel.com \
--cc=willy@infradead.org \
/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).