[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [v3][PATCH 08/16] hvmloader/e820: construct guest e820 table



> From: Chen, Tiejun
> Sent: Friday, June 12, 2015 4:19 PM
> >
> >> +     *
> >> +     * #3. High memory region if it exists
> >> +     */
> >> +    for ( i = 0; i < memory_map.nr_map; i++ )
> >>       {
> >> -        e820[nr].addr = ((uint64_t)1 << 32);
> >> -        e820[nr].size =
> >> -            ((uint64_t)hvm_info->high_mem_pgend << PAGE_SHIFT) -
> e820[nr].addr;
> >> -        e820[nr].type = E820_RAM;
> >> +        e820[nr] = memory_map.map[i];
> >>           nr++;
> >>       }
> >>
> >> +    /* Low RAM goes here. Reserve space for special pages. */
> >> +    BUG_ON(low_mem_pgend < (2u << 20));
> >> +    /*
> >> +     * We may need to adjust real lowmem end since we may
> >> +     * populate RAM to get enough MMIO previously.
> >> +     */
> >> +    for ( i = 0; i < memory_map.nr_map; i++ )
> >
> > since you already translate memory map into e820 earlier, here
> > you should use 'nr' instead of memory_map.nr_map.
> >
> 
> As we're saying in the code comment above, we're just handling the
> lowmem entry, so I think memory_map.nr_map is enough.
> 

OK

> >> +    {
> >> +        uint64_t end = e820[i].addr + e820[i].size;
> >> +        if ( e820[i].type == E820_RAM &&
> >> +             low_mem_pgend > e820[i].addr && low_mem_pgend < end )
> >> +            e820[i].size = low_mem_pgend - e820[i].addr;
> >> +    }
> >
> > Sorry I may miss the code but could you elaborate where the
> > low_mem_pgend is changed after memory map is created? If
> > it happens within hvmloader, suppose the amount of reduced
> > memory from original E820_RAM entry should be added to
> > another E820_RAM entry for highmem, right?
> 
> You're right so I really should compensate this in highmem entry,
> 
>      add_high_mem = end - low_mem_end;
> 
>      /*
>       * And then we also need to adjust highmem.
>       */
>      if ( add_high_mem )
>      {
>          for ( i = 0; i < memory_map.nr_map; i++ )
>          {
>              if ( e820[i].type == E820_RAM &&
>                   e820[i].addr > (1ull << 32))
>                  e820[i].size += add_high_mem;
>          }
>      }
> 
> 

Need to see more code in next version.

Thanks
Kevin

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.