All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Revert "x86/mm: implement free pmd/pte page interfaces"
@ 2018-04-26 15:14 Joerg Roedel
  2018-04-26 15:27 ` Greg KH
  2018-04-26 16:29 ` Kani, Toshi
  0 siblings, 2 replies; 6+ messages in thread
From: Joerg Roedel @ 2018-04-26 15:14 UTC (permalink / raw)
  To: Thomas Gleixner, Ingo Molnar
  Cc: hpa, Michal Hocko, Borislav Petkov, Matthew Wilcox, stable,
	Andrew Morton, linux-kernel, x86, Toshi Kani, Joerg Roedel

From: Joerg Roedel <jroedel@suse.de>

This reverts commit 28ee90fe6048fa7b7ceaeb8831c0e4e454a4cf89.

This commit is broken for x86, as it unmaps the PTE and PMD
pages and immediatly frees them without doing a TLB flush.

Further this lacks synchronization with other page-tables in
the system when the PMD pages are not shared between
mm_structs.

On x86-32 with PAE and PTI patches on-top this patch
triggers the BUG_ON in vmalloc_sync_one() because the kernel
and the process page-table were not synchronized.

Signed-off-by: Joerg Roedel <jroedel@suse.de>
---
 arch/x86/mm/pgtable.c | 28 ++--------------------------
 1 file changed, 2 insertions(+), 26 deletions(-)

diff --git a/arch/x86/mm/pgtable.c b/arch/x86/mm/pgtable.c
index ae98d4c5e32a..fd02a537a80f 100644
--- a/arch/x86/mm/pgtable.c
+++ b/arch/x86/mm/pgtable.c
@@ -787,22 +787,7 @@ int pmd_clear_huge(pmd_t *pmd)
  */
 int pud_free_pmd_page(pud_t *pud)
 {
-	pmd_t *pmd;
-	int i;
-
-	if (pud_none(*pud))
-		return 1;
-
-	pmd = (pmd_t *)pud_page_vaddr(*pud);
-
-	for (i = 0; i < PTRS_PER_PMD; i++)
-		if (!pmd_free_pte_page(&pmd[i]))
-			return 0;
-
-	pud_clear(pud);
-	free_page((unsigned long)pmd);
-
-	return 1;
+	return pud_none(*pud);
 }
 
 /**
@@ -814,15 +799,6 @@ int pud_free_pmd_page(pud_t *pud)
  */
 int pmd_free_pte_page(pmd_t *pmd)
 {
-	pte_t *pte;
-
-	if (pmd_none(*pmd))
-		return 1;
-
-	pte = (pte_t *)pmd_page_vaddr(*pmd);
-	pmd_clear(pmd);
-	free_page((unsigned long)pte);
-
-	return 1;
+	return pmd_none(*pmd);
 }
 #endif	/* CONFIG_HAVE_ARCH_HUGE_VMAP */
-- 
2.13.6

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] Revert "x86/mm: implement free pmd/pte page interfaces"
  2018-04-26 15:14 [PATCH] Revert "x86/mm: implement free pmd/pte page interfaces" Joerg Roedel
@ 2018-04-26 15:27 ` Greg KH
  2018-04-26 15:31   ` Joerg Roedel
  2018-04-26 16:29 ` Kani, Toshi
  1 sibling, 1 reply; 6+ messages in thread
From: Greg KH @ 2018-04-26 15:27 UTC (permalink / raw)
  To: Joerg Roedel
  Cc: Thomas Gleixner, Ingo Molnar, hpa, Michal Hocko, Borislav Petkov,
	Matthew Wilcox, stable, Andrew Morton, linux-kernel, x86,
	Toshi Kani, Joerg Roedel

On Thu, Apr 26, 2018 at 05:14:07PM +0200, Joerg Roedel wrote:
> From: Joerg Roedel <jroedel@suse.de>
> 
> This reverts commit 28ee90fe6048fa7b7ceaeb8831c0e4e454a4cf89.
> 
> This commit is broken for x86, as it unmaps the PTE and PMD
> pages and immediatly frees them without doing a TLB flush.
> 
> Further this lacks synchronization with other page-tables in
> the system when the PMD pages are not shared between
> mm_structs.
> 
> On x86-32 with PAE and PTI patches on-top this patch
> triggers the BUG_ON in vmalloc_sync_one() because the kernel
> and the process page-table were not synchronized.
> 
> Signed-off-by: Joerg Roedel <jroedel@suse.de>
> ---
>  arch/x86/mm/pgtable.c | 28 ++--------------------------
>  1 file changed, 2 insertions(+), 26 deletions(-)

<formletter>

This is not the correct way to submit patches for inclusion in the
stable kernel tree.  Please read:
    https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html
for how to do this properly.

</formletter>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Revert "x86/mm: implement free pmd/pte page interfaces"
  2018-04-26 15:27 ` Greg KH
@ 2018-04-26 15:31   ` Joerg Roedel
  0 siblings, 0 replies; 6+ messages in thread
From: Joerg Roedel @ 2018-04-26 15:31 UTC (permalink / raw)
  To: Greg KH
  Cc: Joerg Roedel, Thomas Gleixner, Ingo Molnar, hpa, Michal Hocko,
	Borislav Petkov, Matthew Wilcox, stable, Andrew Morton,
	linux-kernel, x86, Toshi Kani

On Thu, Apr 26, 2018 at 05:27:12PM +0200, Greg KH wrote:
> <formletter>
> 
> This is not the correct way to submit patches for inclusion in the
> stable kernel tree.  Please read:
>     https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html
> for how to do this properly.
> 
> </formletter>

That is fine, as this is an upstream-first submission. When this commit
gets accepted it can also be applied to stable, given the original
commit was applied there too (didn't check that).

I just cc'ed stable because it was cc'ed on the original patch.


Thanks,

	Joerg

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Revert "x86/mm: implement free pmd/pte page interfaces"
  2018-04-26 15:14 [PATCH] Revert "x86/mm: implement free pmd/pte page interfaces" Joerg Roedel
  2018-04-26 15:27 ` Greg KH
@ 2018-04-26 16:29 ` Kani, Toshi
  2018-04-27  6:28   ` Ingo Molnar
  1 sibling, 1 reply; 6+ messages in thread
From: Kani, Toshi @ 2018-04-26 16:29 UTC (permalink / raw)
  To: tglx, joro, mingo
  Cc: linux-kernel, bp, willy, stable, x86, akpm, hpa, Hocko, Michal, jroedel

On Thu, 2018-04-26 at 17:14 +0200, Joerg Roedel wrote:
> From: Joerg Roedel <jroedel@suse.de>
> 
> This reverts commit 28ee90fe6048fa7b7ceaeb8831c0e4e454a4cf89.
> 
> This commit is broken for x86, as it unmaps the PTE and PMD
> pages and immediatly frees them without doing a TLB flush.
> 
> Further this lacks synchronization with other page-tables in
> the system when the PMD pages are not shared between
> mm_structs.
> 
> On x86-32 with PAE and PTI patches on-top this patch
> triggers the BUG_ON in vmalloc_sync_one() because the kernel
> and the process page-table were not synchronized.
> 
> Signed-off-by: Joerg Roedel <jroedel@suse.de>

I do not agree with the comments and this revert.  Let's discuss further
on the original thread.

Thanks,
-Toshi

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Revert "x86/mm: implement free pmd/pte page interfaces"
  2018-04-26 16:29 ` Kani, Toshi
@ 2018-04-27  6:28   ` Ingo Molnar
  2018-04-27 19:49     ` Kani, Toshi
  0 siblings, 1 reply; 6+ messages in thread
From: Ingo Molnar @ 2018-04-27  6:28 UTC (permalink / raw)
  To: Kani, Toshi
  Cc: tglx, joro, mingo, linux-kernel, bp, willy, stable, x86, akpm,
	hpa, Hocko, Michal, jroedel


* Kani, Toshi <toshi.kani@hpe.com> wrote:

> On Thu, 2018-04-26 at 17:14 +0200, Joerg Roedel wrote:
> > From: Joerg Roedel <jroedel@suse.de>
> > 
> > This reverts commit 28ee90fe6048fa7b7ceaeb8831c0e4e454a4cf89.
> > 
> > This commit is broken for x86, as it unmaps the PTE and PMD
> > pages and immediatly frees them without doing a TLB flush.
> > 
> > Further this lacks synchronization with other page-tables in
> > the system when the PMD pages are not shared between
> > mm_structs.
> > 
> > On x86-32 with PAE and PTI patches on-top this patch
> > triggers the BUG_ON in vmalloc_sync_one() because the kernel
> > and the process page-table were not synchronized.
> > 
> > Signed-off-by: Joerg Roedel <jroedel@suse.de>
> 
> I do not agree with the comments and this revert.  Let's discuss further
> on the original thread.

The original patch is totally broken (it's based on a misunderstanding), so unless 
you have a fix the revert is justified.

Thanks,

	Ingo

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Revert "x86/mm: implement free pmd/pte page interfaces"
  2018-04-27  6:28   ` Ingo Molnar
@ 2018-04-27 19:49     ` Kani, Toshi
  0 siblings, 0 replies; 6+ messages in thread
From: Kani, Toshi @ 2018-04-27 19:49 UTC (permalink / raw)
  To: mingo
  Cc: linux-kernel, bp, tglx, willy, stable, joro, x86, akpm, hpa,
	mingo, Hocko, Michal, jroedel

On Fri, 2018-04-27 at 08:28 +0200, Ingo Molnar wrote:
> * Kani, Toshi <toshi.kani@hpe.com> wrote:
> 
> > On Thu, 2018-04-26 at 17:14 +0200, Joerg Roedel wrote:
> > > From: Joerg Roedel <jroedel@suse.de>
> > > 
> > > This reverts commit 28ee90fe6048fa7b7ceaeb8831c0e4e454a4cf89.
> > > 
> > > This commit is broken for x86, as it unmaps the PTE and PMD
> > > pages and immediatly frees them without doing a TLB flush.
> > > 
> > > Further this lacks synchronization with other page-tables in
> > > the system when the PMD pages are not shared between
> > > mm_structs.
> > > 
> > > On x86-32 with PAE and PTI patches on-top this patch
> > > triggers the BUG_ON in vmalloc_sync_one() because the kernel
> > > and the process page-table were not synchronized.
> > > 
> > > Signed-off-by: Joerg Roedel <jroedel@suse.de>
> > 
> > I do not agree with the comments and this revert.  Let's discuss further
> > on the original thread.
> 
> The original patch is totally broken (it's based on a misunderstanding), so unless 
> you have a fix the revert is justified.

I am working on a fix on top of this patch.

Thanks,
-Toshi

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2018-04-27 19:49 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-26 15:14 [PATCH] Revert "x86/mm: implement free pmd/pte page interfaces" Joerg Roedel
2018-04-26 15:27 ` Greg KH
2018-04-26 15:31   ` Joerg Roedel
2018-04-26 16:29 ` Kani, Toshi
2018-04-27  6:28   ` Ingo Molnar
2018-04-27 19:49     ` Kani, Toshi

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.