x86/gdt: Drop write-only, xalloc()'d array from set_gdt()
PATCH 1/1 x86/gdt: Drop write-only, xalloc()'d array from set_gdt()
It is not used, and can cause a spurious failure of the set_gdt() hypercall in low memory situations.
---
CC: Jan Beulich <[email protected]>
--- xen/arch/x86/mm.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-)
xen/arch/x86/mm.c +1 -8
@@ -4439,20 +4439,15 @@ long set_gdt(struct vcpu *v,l1_pgentry_t *pl1e;/* NB. There are 512 8-byte entries per GDT page. */ int i, nr_pages = (entries +511 ) /512 ; -unsigned long *pfns;if ( entries >FIRST_RESERVED_GDT_ENTRY )return -EINVAL ; - pfns = xmalloc_array(unsigned long, nr_pages); -if ( !pfns ) -return -ENOMEM ; -/* Check the pages in the new GDT. */ for ( i =0 ; i < nr_pages; i++ ) {struct page_info *page; - pfns[i] = frames[i]; + page =get_page_from_gfn (d, frames[i],NULL ,P2M_ALLOC );if ( !page ) goto fail;
@@ -4476,7 +4471,6 @@ long set_gdt(struct vcpu *v,l1e_write (&pl1e[i],l1e_from_pfn (frames[i], __PAGE_HYPERVISOR_RW)); } -xfree (pfns);return 0 ; fail:
@@ -4484,7 +4478,6 @@ long set_gdt(struct vcpu *v, {put_page_and_type (mfn_to_page (frames[i])); } -xfree (pfns);return -EINVAL ; }
Signature · 1 line
1.7.10.4
Quoted 7 lines · Andrew Cooper
It is not used, and can cause a spurious failure of the
set_gdt()hypercall in low memory situations.Signed-off-by Andrew Cooper <[email protected]>---
CC: Jan Beulich <[email protected]>
---
This array does appear to be write-only and never gets read.
FWIW
It's obviously correct and fixes a problem, so it can be applied to 4.6 tree.
Quoted 47 lines
xen/arch/x86/mm.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-)xen/arch/x86/mm.c +1
-8@@ -4439,20 +4439,15 @@ long set_gdt(struct vcpu *v,l1_pgentry_t *pl1e;/* NB. There are 512 8-byte entries per GDT page. */ int i, nr_pages = (entries +511 ) /512 ; -unsigned long *pfns;if ( entries >FIRST_RESERVED_GDT_ENTRY )return -EINVAL ; - pfns = xmalloc_array(unsigned long, nr_pages); -if ( !pfns ) -return -ENOMEM ; -/* Check the pages in the new GDT. */ for ( i =0 ; i < nr_pages; i++ ) {struct page_info *page; - pfns[i] = frames[i]; + page =get_page_from_gfn (d, frames[i],NULL ,P2M_ALLOC );if ( !page ) goto fail;@@ -4476,7 +4471,6 @@ long set_gdt(struct vcpu *v,l1e_write (&pl1e[i],l1e_from_pfn (frames[i], __PAGE_HYPERVISOR_RW)); } -xfree (pfns);return 0 ; fail:@@ -4484,7 +4478,6 @@ long set_gdt(struct vcpu *v, {put_page_and_type (mfn_to_page (frames[i])); } -xfree (pfns);return -EINVAL ; }Signature · 1 line
1.7.10.4
Ian Campbell
Acked-by Tim DeeganQuoted 10 lines · Wei Liu
Quoted 8 lines · Andrew Cooper
It is not used, and can cause a spurious failure of the
set_gdt()hypercall in
low memory situations.Signed-off-by Andrew Cooper <[email protected]>---
CC: Jan Beulich <[email protected]>
---
Quoted 5 lines
This array does appear to be write-only and never gets read.
FWIW
Reviewed-by Wei Liu <[email protected]>
The use was removed by:
commit 5889a3e1d123bdad4a3d150310d647db55459966
Author: Tim Deegan <[email protected]> Date: Thu May 17 10:24:54 2012 +0100
x86/mm: Use get_page_from_gfn() instead of get_gfn()/put_gfn.
after it was introduced by:
commit 51032ca058e43fbd37ea1f7c7c003496f6451340
Author: Andres Lagar-Cavilla <[email protected]> Date: Fri Nov 11 18:11:34 2011 +0000
Modify naming of queries into the p2m
Quoted 2 lines
It's obviously correct and fixes a problem, so it can be applied to 4.6 tree.
FWIW I think so too, but I'm hesitant to apply without a maintainer(/Jan)'s ack. I think this can probably wait until next week?
Quoted 1 line
Quoted 1 line
xen/arch/x86/mm.c | 9 +--------
George is the current "X86 MEMORY MANAGEMENT" maintainer, which is xen/arch/x86/mm/*, should xen/arch/x86/mm.c be included there too?
Quoted 45 lines
Quoted 45 lines
1 file changed, 1 insertion(+), 8 deletions(-)xen/arch/x86/mm.c +1
-7@@ -4439,20 +4439,15 @@ long set_gdt(struct vcpu *v,l1_pgentry_t *pl1e;/* NB. There are 512 8-byte entries per GDT page. */ int i, nr_pages = (entries +511 ) /512 ; -unsigned long *pfns;if ( entries >FIRST_RESERVED_GDT_ENTRY )return -EINVAL ; - pfns = xmalloc_array(unsigned long, nr_pages); -if ( !pfns ) -return -ENOMEM ; -/* Check the pages in the new GDT. */ for ( i =0 ; i < nr_pages; i++ ) {struct page_info *page; - pfns[i] = frames[i]; + page =get_page_from_gfn (d, frames[i],NULL ,P2M_ALLOC );if ( !page ) goto fail;@@ -4476,7 +4471,6 @@ long set_gdt(struct vcpu *v,l1e_write (&pl1e[i],l1e_from_pfn (frames[i], __PAGE_HYPERVISOR_RW)); } -xfree (pfns);return 0 ;fail:
xen/arch/x86/mm.c +0
-1@@ -4484,7 +4478,6 @@ long set_gdt(struct vcpu *v, {put_page_and_type (mfn_to_page (frames[i])); } -xfree (pfns);return -EINVAL ; }
Quoted 38 lines · Ian Campbell
Quoted 9 lines · Wei Liu
Quoted 8 lines · Andrew Cooper
It is not used, and can cause a spurious failure of the
set_gdt()hypercall in
low memory situations.Signed-off-by Andrew Cooper <[email protected]>---
CC: Jan Beulich <[email protected]>
---Quoted 5 lines
This array does appear to be write-only and never gets read.
FWIW
Reviewed-by Wei Liu <[email protected]>The use was removed by:
commit
5889a3e1d123bdad4a3d150310d647db55459966Author: Tim Deegan <[email protected]> Date: Thu May 17 10:24:54 2012 +0100x86/mm: Use
get_page_from_gfn()instead of get_gfn()/put_gfn.Signed-off-by Tim Deegan <[email protected]>Signed-off-by Andres Lagar-Cavilla <[email protected]>after it was introduced by:
commit
51032ca058e43fbd37ea1f7c7c003496f6451340Author: Andres Lagar-Cavilla <[email protected]> Date: Fri Nov 11 18:11:34 2011 +0000Modify naming of queries into the p2m
[...]Signed-off-by Andres Lagar-Cavilla <[email protected]>Acked-by Tim Deegan <[email protected]>Committed-by Keir Fraser <[email protected]>
Quoted 8 lines
Quoted 2 lines
It's obviously correct and fixes a problem, so it can be applied to 4.6 tree.
FWIW I think so too, but I'm hesitant to apply without a maintainer(/Jan)'s ack. I think this can probably wait until next week?
Quoted 1 line
Quoted 1 line
xen/arch/x86/mm.c | 9 +--------George is the current "X86 MEMORY MANAGEMENT" maintainer, which is xen/arch/x86/mm/*, should
xen/arch/x86/mm.cbe included there too?
Oops - I hadn't even twigged.
Despite being in mm.c, this really isn't memory management and is just general x86 behaviour, which is covered by my maintership role.
Not that I expect anyone (maintainer or not) to have a problem with this change.
FWIW, following the Linux LDT thread, I have a bucket load of changes to do with GDT and LDT handling for PV guests. While most of that is definitely 4.7 material, I felt that this fix alone should be fixed in 4.6
~Andrew
Quoted 19 lines · Ian Campbell
Quoted 10 lines · Wei Liu
Quoted 8 lines · Andrew Cooper
It is not used, and can cause a spurious failure of the
set_gdt()hypercall in
low memory situations.Signed-off-by Andrew Cooper <[email protected]>---
CC: Jan Beulich <[email protected]>
---Quoted 5 lines
This array does appear to be write-only and never gets read.
FWIW
Reviewed-by Wei Liu <[email protected]>The use was removed by:
Quoted 8 lines
commit
5889a3e1d123bdad4a3d150310d647db55459966Author: Tim Deegan <[email protected]> Date: Thu May 17 10:24:54 2012 +0100x86/mm: Use
get_page_from_gfn()instead of get_gfn()/put_gfn.Signed-off-by Tim Deegan <[email protected]>Signed-off-by Andres Lagar-Cavilla <[email protected]>
Yep, clearly an oversight in this patch.
Quoted 14 lines
after it was introduced by:
commit
51032ca058e43fbd37ea1f7c7c003496f6451340Author: Andres Lagar-Cavilla <[email protected]> Date: Fri Nov 11 18:11:34 2011 +0000Modify naming of queries into the p2m
[...]Signed-off-by Andres Lagar-Cavilla <[email protected]>Acked-by Tim Deegan <[email protected]>Committed-by Keir Fraser <[email protected]>Quoted 2 lines
It's obviously correct and fixes a problem, so it can be applied to 4.6 tree.
+1, FWIW.
Cheers,
Tim.
Quoted 32 lines
Quoted 1 line
Quoted 1 line · On 04.08.15 at 15:59, <[email protected]> wrote:
Quoted 10 lines · Wei Liu
Quoted 8 lines · Andrew Cooper
It is not used, and can cause a spurious failure of the
set_gdt()hypercall in
low memory situations.Signed-off-by Andrew Cooper <[email protected]>---
CC: Jan Beulich <[email protected]>
---Quoted 5 lines
This array does appear to be write-only and never gets read.
FWIW
Reviewed-by Wei Liu <[email protected]>The use was removed by:
commit
5889a3e1d123bdad4a3d150310d647db55459966Author: Tim Deegan <[email protected]> Date: Thu May 17 10:24:54 2012 +0100x86/mm: Use
get_page_from_gfn()instead of get_gfn()/put_gfn.Signed-off-by Tim Deegan <[email protected]>Signed-off-by Andres Lagar-Cavilla <[email protected]>after it was introduced by:
commit
51032ca058e43fbd37ea1f7c7c003496f6451340
Quoted 8 lines
Author: Andres Lagar-Cavilla <[email protected]> Date: Fri Nov 11 18:11:34 2011 +0000Modify naming of queries into the p2m
[...]Signed-off-by Andres Lagar-Cavilla <[email protected]>Acked-by Tim Deegan <[email protected]>Committed-by Keir Fraser <[email protected]>
Indeed pointing out the commit that introduced the unused array right in the commit message would have helped both in review and in determination whether (and to which branches) to backport.
Jan
Quoted 4 lines · Andrew Cooper
It is not used, and can cause a spurious failure of the
set_gdt()hypercall in low memory situations.Signed-off-by Andrew Cooper <[email protected]>
Quoted 56 lines
---
CC: Jan Beulich <[email protected]>--- xen/arch/x86/mm.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-)xen/arch/x86/mm.c +1
-9@@ -4439,20 +4439,15 @@ long set_gdt(struct vcpu *v,l1_pgentry_t *pl1e;/* NB. There are 512 8-byte entries per GDT page. */ int i, nr_pages = (entries +511 ) /512 ; -unsigned long *pfns;if ( entries >FIRST_RESERVED_GDT_ENTRY )return -EINVAL ; - pfns = xmalloc_array(unsigned long, nr_pages); -if ( !pfns ) -return -ENOMEM ; -/* Check the pages in the new GDT. */ for ( i =0 ; i < nr_pages; i++ ) {struct page_info *page; - pfns[i] = frames[i]; + page =get_page_from_gfn (d, frames[i],NULL ,P2M_ALLOC );if ( !page ) goto fail;@@ -4476,7 +4471,6 @@ long set_gdt(struct vcpu *v,l1e_write (&pl1e[i],l1e_from_pfn (frames[i], __PAGE_HYPERVISOR_RW)); } -xfree (pfns);return 0 ; fail:@@ -4484,7 +4478,6 @@ long set_gdt(struct vcpu *v, {put_page_and_type (mfn_to_page (frames[i])); } -xfree (pfns);return -EINVAL ; } --1.7.10.4
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 9 lines · George Dunlap
Quoted 5 lines · Andrew Cooper
It is not used, and can cause a spurious failure of the
set_gdt()hypercall in
low memory situations.Signed-off-by Andrew Cooper <[email protected]>Reviewed-by George Dunlap <[email protected]>
It's unclear from MAINTAINERS if this is formally enough for the patch to be applied but under the circumstances (pretty obvious patch, Reviewed-by more than one person, including the X86 MEMORY MANAGEMENT maintainer even if mm.c isn't strictly under that for some reason) I've added my own Revieed-by and applied, hopefully that is ok.
Perhaps there should be a patch to MAINTAINERS to add arch/x86/mm.c to the relevant subsection? (Or maybe the file is just horribly named?)
Ian.
Quoted 3 lines
Quoted 1 line
Quoted 1 line · On 05.08.15 at 11:58, <[email protected]> wrote:
Perhaps there should be a patch to
MAINTAINERSto addarch/x86/mm.cto the relevant subsection? (Or maybe the file is just horribly named?)
Yeah, the file, while mostly about (PV) memory management, holds more than just that; mm/ otoh is pretty properly limited to (mostly HVM) memory management. I think a nice cleanup item would be to split mm.c and move much of it into mm/, which would then eliminate the need for the adjustment you name.
Jan