linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] x86/xen: Free bootmem in free_p2m_page() during early boot
@ 2015-01-07 14:08 Boris Ostrovsky
  2015-01-07 14:23 ` Juergen Gross
  2015-01-07 15:10 ` [Xen-devel] " David Vrabel
  0 siblings, 2 replies; 4+ messages in thread
From: Boris Ostrovsky @ 2015-01-07 14:08 UTC (permalink / raw)
  To: david.vrabel, konrad.wilk, jgross
  Cc: xen-devel, linux-kernel, boris.ostrovsky

With recent changes in p2m we now have legitimate cases when
p2m memory needs to be freed during early boot (i.e. before
slab is initialized).

Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
---
 arch/x86/xen/p2m.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/arch/x86/xen/p2m.c b/arch/x86/xen/p2m.c
index edbc7a6..df8acb4 100644
--- a/arch/x86/xen/p2m.c
+++ b/arch/x86/xen/p2m.c
@@ -167,10 +167,13 @@ static void * __ref alloc_p2m_page(void)
 	return (void *)__get_free_page(GFP_KERNEL | __GFP_REPEAT);
 }
 
-/* Only to be called in case of a race for a page just allocated! */
 static void free_p2m_page(void *p)
 {
-	BUG_ON(!slab_is_available());
+	if (unlikely(!slab_is_available())) {
+		free_bootmem((unsigned long)p, PAGE_SIZE);
+		return;
+	}
+
 	free_page((unsigned long)p);
 }
 
-- 
1.9.3


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

* Re: [PATCH] x86/xen: Free bootmem in free_p2m_page() during early boot
  2015-01-07 14:08 [PATCH] x86/xen: Free bootmem in free_p2m_page() during early boot Boris Ostrovsky
@ 2015-01-07 14:23 ` Juergen Gross
  2015-01-07 15:10 ` [Xen-devel] " David Vrabel
  1 sibling, 0 replies; 4+ messages in thread
From: Juergen Gross @ 2015-01-07 14:23 UTC (permalink / raw)
  To: Boris Ostrovsky, david.vrabel, konrad.wilk; +Cc: xen-devel, linux-kernel

On 01/07/2015 03:08 PM, Boris Ostrovsky wrote:
> With recent changes in p2m we now have legitimate cases when
> p2m memory needs to be freed during early boot (i.e. before
> slab is initialized).
>
> Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>

Reviewed-by: Juergen Gross <jgross@suse.com>

> ---
>   arch/x86/xen/p2m.c | 7 +++++--
>   1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/arch/x86/xen/p2m.c b/arch/x86/xen/p2m.c
> index edbc7a6..df8acb4 100644
> --- a/arch/x86/xen/p2m.c
> +++ b/arch/x86/xen/p2m.c
> @@ -167,10 +167,13 @@ static void * __ref alloc_p2m_page(void)
>   	return (void *)__get_free_page(GFP_KERNEL | __GFP_REPEAT);
>   }
>
> -/* Only to be called in case of a race for a page just allocated! */
>   static void free_p2m_page(void *p)
>   {
> -	BUG_ON(!slab_is_available());
> +	if (unlikely(!slab_is_available())) {
> +		free_bootmem((unsigned long)p, PAGE_SIZE);
> +		return;
> +	}
> +
>   	free_page((unsigned long)p);
>   }
>
>


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

* Re: [Xen-devel] [PATCH] x86/xen: Free bootmem in free_p2m_page() during early boot
  2015-01-07 14:08 [PATCH] x86/xen: Free bootmem in free_p2m_page() during early boot Boris Ostrovsky
  2015-01-07 14:23 ` Juergen Gross
@ 2015-01-07 15:10 ` David Vrabel
  2015-01-07 15:18   ` Boris Ostrovsky
  1 sibling, 1 reply; 4+ messages in thread
From: David Vrabel @ 2015-01-07 15:10 UTC (permalink / raw)
  To: Boris Ostrovsky, david.vrabel, konrad.wilk, jgross
  Cc: xen-devel, linux-kernel

On 07/01/15 14:08, Boris Ostrovsky wrote:
> With recent changes in p2m we now have legitimate cases when
> p2m memory needs to be freed during early boot (i.e. before
> slab is initialized).
> 
> Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>

Applied to to stable/for-linus-3.19, thanks.

If I understand correctly this didn't fully fix your 32-bit dom0 crashes?

David

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

* Re: [Xen-devel] [PATCH] x86/xen: Free bootmem in free_p2m_page() during early boot
  2015-01-07 15:10 ` [Xen-devel] " David Vrabel
@ 2015-01-07 15:18   ` Boris Ostrovsky
  0 siblings, 0 replies; 4+ messages in thread
From: Boris Ostrovsky @ 2015-01-07 15:18 UTC (permalink / raw)
  To: David Vrabel, konrad.wilk, jgross; +Cc: xen-devel, linux-kernel

On 01/07/2015 10:10 AM, David Vrabel wrote:
> On 07/01/15 14:08, Boris Ostrovsky wrote:
>> With recent changes in p2m we now have legitimate cases when
>> p2m memory needs to be freed during early boot (i.e. before
>> slab is initialized).
>>
>> Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
> Applied to to stable/for-linus-3.19, thanks.
>
> If I understand correctly this didn't fully fix your 32-bit dom0 crashes?

No, this only allowed me to be alive for a few more microseconds ;-)

-boris

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

end of thread, other threads:[~2015-01-07 15:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-07 14:08 [PATCH] x86/xen: Free bootmem in free_p2m_page() during early boot Boris Ostrovsky
2015-01-07 14:23 ` Juergen Gross
2015-01-07 15:10 ` [Xen-devel] " David Vrabel
2015-01-07 15:18   ` Boris Ostrovsky

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).