* [PATCH] domain builder: Fix sp_extents allocation
@ 2008-07-31 11:12 Samuel Thibault
2008-07-31 11:19 ` Keir Fraser
0 siblings, 1 reply; 4+ messages in thread
From: Samuel Thibault @ 2008-07-31 11:12 UTC (permalink / raw)
To: xen-devel
domain builder: Fix sp_extents allocation
We do not need more than count elements in the sp_extents array.
diff -r e355f9dce939 tools/libxc/xc_hvm_build.c
--- a/tools/libxc/xc_hvm_build.c Wed Jul 30 17:20:25 2008 +0100
+++ b/tools/libxc/xc_hvm_build.c Thu Jul 31 11:43:36 2008 +0100
@@ -229,7 +229,7 @@ static int setup_guest(int xc_handle,
if ( ((count | cur_pages) & (SUPERPAGE_NR_PFNS - 1)) == 0 )
{
long done;
- xen_pfn_t sp_extents[2048 >> SUPERPAGE_PFN_SHIFT];
+ xen_pfn_t sp_extents[count >> SUPERPAGE_PFN_SHIFT];
struct xen_memory_reservation sp_req = {
.nr_extents = count >> SUPERPAGE_PFN_SHIFT,
.extent_order = SUPERPAGE_PFN_SHIFT,
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] domain builder: Fix sp_extents allocation
2008-07-31 11:12 [PATCH] domain builder: Fix sp_extents allocation Samuel Thibault
@ 2008-07-31 11:19 ` Keir Fraser
2008-07-31 11:29 ` Samuel Thibault
0 siblings, 1 reply; 4+ messages in thread
From: Keir Fraser @ 2008-07-31 11:19 UTC (permalink / raw)
To: Samuel Thibault, xen-devel
Doesn't this turn the array allocation into a dynamic allocation? I feel a
bit dubious about that.
-- Keir
On 31/7/08 12:12, "Samuel Thibault" <samuel.thibault@eu.citrix.com> wrote:
> domain builder: Fix sp_extents allocation
>
> We do not need more than count elements in the sp_extents array.
>
> diff -r e355f9dce939 tools/libxc/xc_hvm_build.c
> --- a/tools/libxc/xc_hvm_build.c Wed Jul 30 17:20:25 2008 +0100
> +++ b/tools/libxc/xc_hvm_build.c Thu Jul 31 11:43:36 2008 +0100
> @@ -229,7 +229,7 @@ static int setup_guest(int xc_handle,
> if ( ((count | cur_pages) & (SUPERPAGE_NR_PFNS - 1)) == 0 )
> {
> long done;
> - xen_pfn_t sp_extents[2048 >> SUPERPAGE_PFN_SHIFT];
> + xen_pfn_t sp_extents[count >> SUPERPAGE_PFN_SHIFT];
> struct xen_memory_reservation sp_req = {
> .nr_extents = count >> SUPERPAGE_PFN_SHIFT,
> .extent_order = SUPERPAGE_PFN_SHIFT,
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xensource.com
> http://lists.xensource.com/xen-devel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] domain builder: Fix sp_extents allocation
2008-07-31 11:19 ` Keir Fraser
@ 2008-07-31 11:29 ` Samuel Thibault
2008-07-31 11:39 ` Keir Fraser
0 siblings, 1 reply; 4+ messages in thread
From: Samuel Thibault @ 2008-07-31 11:29 UTC (permalink / raw)
To: Keir Fraser; +Cc: xen-devel
Keir Fraser, le Thu 31 Jul 2008 12:19:18 +0100, a écrit :
> Doesn't this turn the array allocation into a dynamic allocation? I feel a
> bit dubious about that.
> > {
> > long done;
> > - xen_pfn_t sp_extents[2048 >> SUPERPAGE_PFN_SHIFT];
> > + xen_pfn_t sp_extents[count >> SUPERPAGE_PFN_SHIFT];
> > struct xen_memory_reservation sp_req = {
Err, I'd think that it just turns a
sub (2048>>SUPERPAGE_PFN_SHIFT) * sizeof(xen_pfn_t), %esp
into a
mov count, %eax
shr SUPERPAGE_PFN_SHIFT - log2(sizeof(xen_pfn_t)), %eax
sub %eax, %esp
Samuel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] domain builder: Fix sp_extents allocation
2008-07-31 11:29 ` Samuel Thibault
@ 2008-07-31 11:39 ` Keir Fraser
0 siblings, 0 replies; 4+ messages in thread
From: Keir Fraser @ 2008-07-31 11:39 UTC (permalink / raw)
To: Samuel Thibault; +Cc: xen-devel
On 31/7/08 12:29, "Samuel Thibault" <samuel.thibault@eu.citrix.com> wrote:
> Keir Fraser, le Thu 31 Jul 2008 12:19:18 +0100, a écrit :
>> Doesn't this turn the array allocation into a dynamic allocation? I feel a
>> bit dubious about that.
>
>>> {
>>> long done;
>>> - xen_pfn_t sp_extents[2048 >> SUPERPAGE_PFN_SHIFT];
>>> + xen_pfn_t sp_extents[count >> SUPERPAGE_PFN_SHIFT];
>>> struct xen_memory_reservation sp_req = {
>
> Err, I'd think that it just turns a
>
> sub (2048>>SUPERPAGE_PFN_SHIFT) * sizeof(xen_pfn_t), %esp
>
> into a
>
> mov count, %eax
> shr SUPERPAGE_PFN_SHIFT - log2(sizeof(xen_pfn_t)), %eax
> sub %eax, %esp
Yes, good point!
-- Keir
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2008-07-31 11:39 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-31 11:12 [PATCH] domain builder: Fix sp_extents allocation Samuel Thibault
2008-07-31 11:19 ` Keir Fraser
2008-07-31 11:29 ` Samuel Thibault
2008-07-31 11:39 ` Keir Fraser
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.