LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Jiri Slaby <jirislaby@gmail.com>
To: Jan Beulich <jbeulich@novell.com>
Cc: Jeremy Fitzhardinge <jeremy@xensource.com>,
	Ingo Molnar <mingo@elte.hu>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] adjust/fix LDT handling for Xen
Date: Fri, 11 Jan 2008 10:39:37 +0100	[thread overview]
Message-ID: <47873959.3000102@gmail.com> (raw)
In-Reply-To: <4787436E.76E4.0078.0@novell.com>

On 01/11/2008 10:22 AM, Jan Beulich wrote:
> Don't rely on kmalloc(PAGE_SIZE) returning PAGE_SIZE aligned memory
> (Xen requires GDT *and* LDT to be page-aligned). Using the page
> allocator interface also removes the (albeit small) slab allocator
> overhead. The same change being done for 64-bits for consistency.
> 
> Further, the Xen hypercall interface expects the LDT address to be
> virtual, not machine.
> 
> Signed-off-by: Jan Beulich <jbeulich@novell.com>
> Cc: Ingo Molnar <mingo@elte.hu>
> 
> ---
>  arch/x86/kernel/ldt_32.c |    7 +++----
>  arch/x86/kernel/ldt_64.c |    7 +++----
>  arch/x86/xen/enlighten.c |    9 +--------
>  3 files changed, 7 insertions(+), 16 deletions(-)
> 
> --- linux-2.6.24-rc7/arch/x86/kernel/ldt_32.c	2008-01-10 16:53:54.000000000 +0100
> +++ 2.6.24-rc7-x86-xen-ldt/arch/x86/kernel/ldt_32.c	2008-01-09 13:59:50.000000000 +0100
[...]
> @@ -73,7 +72,7 @@ static int alloc_ldt(mm_context_t *pc, u
>  		if (oldsize*LDT_ENTRY_SIZE > PAGE_SIZE)
>  			vfree(oldldt);
>  		else
> -			kfree(oldldt);
> +			put_page(virt_to_page(oldldt));
>  	}
>  	return 0;
>  }
> @@ -117,7 +116,7 @@ void destroy_context(struct mm_struct *m
>  		if ((unsigned)mm->context.size*LDT_ENTRY_SIZE > PAGE_SIZE)
>  			vfree(mm->context.ldt);
>  		else
> -			kfree(mm->context.ldt);
> +			put_page(virt_to_page(mm->context.ldt));

why not free_page() with all those checks if it is correct virt address which it 
brings?

regards,
-- 
Jiri Slaby
Faculty of Informatics, Masaryk University
Suse Labs

  reply	other threads:[~2008-01-11  9:39 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-11  9:22 [PATCH] adjust/fix LDT handling for Xen Jan Beulich
2008-01-11  9:39 ` Jiri Slaby [this message]
2008-01-11 10:08   ` Jan Beulich
2008-01-11 17:28 ` Jeremy Fitzhardinge
2008-01-14  8:22   ` Jan Beulich
2008-01-14 15:48 ` Ingo Molnar
2008-01-14 16:06   ` Jan Beulich
2008-01-14 17:04     ` Jeremy Fitzhardinge
2008-01-15 13:24       ` Ingo Molnar
2008-01-15 21:47         ` Jeremy Fitzhardinge

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=47873959.3000102@gmail.com \
    --to=jirislaby@gmail.com \
    --cc=jbeulich@novell.com \
    --cc=jeremy@xensource.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    /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).