Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1216762 > unrolled thread
| Started by | "Jan Beulich" <JBeulich@suse.com> |
|---|---|
| First post | 2015-09-01 12:50 +0200 |
| Last post | 2015-09-02 09:00 +0200 |
| Articles | 3 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH] x86: fix small LDT allocation for Xen "Jan Beulich" <JBeulich@suse.com> - 2015-09-01 12:50 +0200
Re: [PATCH] x86: fix small LDT allocation for Xen Andy Lutomirski <luto@amacapital.net> - 2015-09-01 21:40 +0200
Re: [PATCH] x86: fix small LDT allocation for Xen "Jan Beulich" <JBeulich@suse.com> - 2015-09-02 09:00 +0200
| From | "Jan Beulich" <JBeulich@suse.com> |
|---|---|
| Date | 2015-09-01 12:50 +0200 |
| Subject | [PATCH] x86: fix small LDT allocation for Xen |
| Message-ID | <q3Riy-49v-19@gated-at.bofh.it> |
While commit 37868fe113 ("x86/ldt: Make modify_ldt synchronous") added
a nice comment explaining that Xen needs page-aligned whole page chunks
for guest descriptor tables, it then nevertheless used kzalloc() on the
small size path. As I'm unaware of guarantees for kmalloc(PAGE_SIZE, )
to return page-aligned memory blocks, I believe this needs to be
switched back to __get_free_page().
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Cc: David Vrabel <david.vrabel@citrix.com>
Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
---
arch/x86/kernel/ldt.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- 4.2/arch/x86/kernel/ldt.c
+++ 4.2-x86-LDT-alloc/arch/x86/kernel/ldt.c
@@ -58,7 +58,7 @@ static struct ldt_struct *alloc_ldt_stru
if (alloc_size > PAGE_SIZE)
new_ldt->entries = vzalloc(alloc_size);
else
- new_ldt->entries = kzalloc(PAGE_SIZE, GFP_KERNEL);
+ new_ldt->entries = (void *)__get_free_page(GFP_KERNEL|__GFP_ZERO);
if (!new_ldt->entries) {
kfree(new_ldt);
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [next] | [standalone]
| From | Andy Lutomirski <luto@amacapital.net> |
|---|---|
| Date | 2015-09-01 21:40 +0200 |
| Message-ID | <q3Zzr-7B3-11@gated-at.bofh.it> |
| In reply to | #1216762 |
On Tue, Sep 1, 2015 at 3:48 AM, Jan Beulich <JBeulich@suse.com> wrote:
> While commit 37868fe113 ("x86/ldt: Make modify_ldt synchronous") added
> a nice comment explaining that Xen needs page-aligned whole page chunks
> for guest descriptor tables, it then nevertheless used kzalloc() on the
> small size path. As I'm unaware of guarantees for kmalloc(PAGE_SIZE, )
> to return page-aligned memory blocks, I believe this needs to be
> switched back to __get_free_page().
>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>
> Cc: Andy Lutomirski <luto@kernel.org>
> Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
> Cc: David Vrabel <david.vrabel@citrix.com>
> Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> ---
> arch/x86/kernel/ldt.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> --- 4.2/arch/x86/kernel/ldt.c
> +++ 4.2-x86-LDT-alloc/arch/x86/kernel/ldt.c
> @@ -58,7 +58,7 @@ static struct ldt_struct *alloc_ldt_stru
> if (alloc_size > PAGE_SIZE)
> new_ldt->entries = vzalloc(alloc_size);
> else
> - new_ldt->entries = kzalloc(PAGE_SIZE, GFP_KERNEL);
> + new_ldt->entries = (void *)__get_free_page(GFP_KERNEL|__GFP_ZERO);
This would need a corresponding change to the kfree path, right?
--Andy
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | "Jan Beulich" <JBeulich@suse.com> |
|---|---|
| Date | 2015-09-02 09:00 +0200 |
| Message-ID | <q4abx-5U4-23@gated-at.bofh.it> |
| In reply to | #1217042 |
>>> On 01.09.15 at 21:37, <luto@amacapital.net> wrote:
> On Tue, Sep 1, 2015 at 3:48 AM, Jan Beulich <JBeulich@suse.com> wrote:
>> While commit 37868fe113 ("x86/ldt: Make modify_ldt synchronous") added
>> a nice comment explaining that Xen needs page-aligned whole page chunks
>> for guest descriptor tables, it then nevertheless used kzalloc() on the
>> small size path. As I'm unaware of guarantees for kmalloc(PAGE_SIZE, )
>> to return page-aligned memory blocks, I believe this needs to be
>> switched back to __get_free_page().
>>
>> Signed-off-by: Jan Beulich <jbeulich@suse.com>
>> Cc: Andy Lutomirski <luto@kernel.org>
>> Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
>> Cc: David Vrabel <david.vrabel@citrix.com>
>> Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
>> ---
>> arch/x86/kernel/ldt.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> --- 4.2/arch/x86/kernel/ldt.c
>> +++ 4.2-x86-LDT-alloc/arch/x86/kernel/ldt.c
>> @@ -58,7 +58,7 @@ static struct ldt_struct *alloc_ldt_stru
>> if (alloc_size > PAGE_SIZE)
>> new_ldt->entries = vzalloc(alloc_size);
>> else
>> - new_ldt->entries = kzalloc(PAGE_SIZE, GFP_KERNEL);
>> + new_ldt->entries = (void *)__get_free_page(GFP_KERNEL|__GFP_ZERO);
>
> This would need a corresponding change to the kfree path, right?
Oops - yes of course.
Jan
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web