Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1598879 > unrolled thread
| Started by | "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com> |
|---|---|
| First post | 2017-03-13 07:00 +0100 |
| Last post | 2017-03-13 08:30 +0100 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[PATCH 22/26] x86/mm: add sync_global_pgds() for configuration with 5-level paging "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com> - 2017-03-13 07:00 +0100
Re: [PATCH 22/26] x86/mm: add sync_global_pgds() for configuration with 5-level paging Ingo Molnar <mingo@kernel.org> - 2017-03-13 08:30 +0100
| From | "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com> |
|---|---|
| Date | 2017-03-13 07:00 +0100 |
| Subject | [PATCH 22/26] x86/mm: add sync_global_pgds() for configuration with 5-level paging |
| Message-ID | <tkrbt-4j8-47@gated-at.bofh.it> |
This basically restores slightly modified version of original
sync_global_pgds() which we had before foldedl p4d was introduced.
The only modification is protection against 'address' overflow.
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
---
arch/x86/mm/init_64.c | 37 +++++++++++++++++++++++++++++++++++++
1 file changed, 37 insertions(+)
diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
index 7bdda6f1d135..5ba99090dc3c 100644
--- a/arch/x86/mm/init_64.c
+++ b/arch/x86/mm/init_64.c
@@ -92,6 +92,42 @@ __setup("noexec32=", nonx32_setup);
* When memory was added make sure all the processes MM have
* suitable PGD entries in the local PGD level page.
*/
+#ifdef CONFIG_X86_5LEVEL
+void sync_global_pgds(unsigned long start, unsigned long end)
+{
+ unsigned long address;
+
+ for (address = start; address <= end && address >= start;
+ address += PGDIR_SIZE) {
+ const pgd_t *pgd_ref = pgd_offset_k(address);
+ struct page *page;
+
+ if (pgd_none(*pgd_ref))
+ continue;
+
+ spin_lock(&pgd_lock);
+ list_for_each_entry(page, &pgd_list, lru) {
+ pgd_t *pgd;
+ spinlock_t *pgt_lock;
+
+ pgd = (pgd_t *)page_address(page) + pgd_index(address);
+ /* the pgt_lock only for Xen */
+ pgt_lock = &pgd_page_get_mm(page)->page_table_lock;
+ spin_lock(pgt_lock);
+
+ if (!pgd_none(*pgd_ref) && !pgd_none(*pgd))
+ BUG_ON(pgd_page_vaddr(*pgd)
+ != pgd_page_vaddr(*pgd_ref));
+
+ if (pgd_none(*pgd))
+ set_pgd(pgd, *pgd_ref);
+
+ spin_unlock(pgt_lock);
+ }
+ spin_unlock(&pgd_lock);
+ }
+}
+#else
void sync_global_pgds(unsigned long start, unsigned long end)
{
unsigned long address;
@@ -135,6 +171,7 @@ void sync_global_pgds(unsigned long start, unsigned long end)
spin_unlock(&pgd_lock);
}
}
+#endif
/*
* NOTE: This function is marked __ref because it calls __init function
--
2.11.0
[toc] | [next] | [standalone]
| From | Ingo Molnar <mingo@kernel.org> |
|---|---|
| Date | 2017-03-13 08:30 +0100 |
| Subject | Re: [PATCH 22/26] x86/mm: add sync_global_pgds() for configuration with 5-level paging |
| Message-ID | <tksAx-5ue-1@gated-at.bofh.it> |
| In reply to | #1598879 |
* Kirill A. Shutemov <kirill.shutemov@linux.intel.com> wrote:
> This basically restores slightly modified version of original
> sync_global_pgds() which we had before foldedl p4d was introduced.
Please read your changelogs, I saw several typos/grammar mistakes in earlier
patches. The one here is:
s/foldedl/folded
> + for (address = start; address <= end && address >= start;
> + address += PGDIR_SIZE) {
Please don't address col80 checkpatch warnings by breaking the line in such an
ugly way! Find another method, or just leave it slightly longer than 80 cols.
This one could probably be solved by:
s/address/addr
... which is the canonical variable name for such iterations anyway.
> + /* the pgt_lock only for Xen */
Please use whole sentences in comments, and please capitalize them properly.
I.e. here:
/* We acquire the pgt_lock only for Xen: */
> + BUG_ON(pgd_page_vaddr(*pgd)
> + != pgd_page_vaddr(*pgd_ref));
Ugly col80 artifact ...
Please review the rest of the series for similar patterns as well, and please only
post 5-10 patches in the next submission - we'll review and apply them step by
step.
Thanks,
Ingo
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web