[PATCH 6/8] Handle Xen4 heap pages

Trapp, Norbert norbert.trapp at ts.fujitsu.com
Thu Aug 9 11:45:21 EDT 2012


Hello Petr et al,

When trying out your patches I noticed that the size of
the produced file with xen and dom0 pages was larger
than when using my own patches. When adding counters
for the different page types to your patches it turned
out that the free pages and the xen heap pages were
not recognized. The reason seems to be that the count_info
variable in the Xen page_info structure is of size unsigned long
for Xen4. Yeah, it was already unsigned long for Xen3.4, but
before that it was unsigned int. And the Xen4 PGC_... symbols
seem to expect unsigned long variables. So the count_info
variable in exclude_xen_user_domain should be of size
unsigned long for Xen4 and so on, shouldn't it?

With kind regards
Norbert

> -----Original Message-----
> From: kexec-bounces at lists.infradead.org [mailto:kexec-bounces at lists.infradead.org] On Behalf Of ptesarik at suse.cz
> Sent: Monday, July 23, 2012 1:33 PM
> To: kexec at lists.infradead.org
> Cc: Petr Tesarik
> Subject: [PATCH 6/8] Handle Xen4 heap pages
> 
> In Xen3, heap pages were allocated in a fixed range, so they could be
> recognized by their address. This is no longer the case with Xen4. Instead, we
> have to look at the page flags and check if PGC_xen_heap is set.
> 
> Signed-off-by: Petr Tesarik <ptesarik at suse.cz>
> 
> ---
>  arch/ia64.c    |   36 +++++++++++++++++-------------------
>  arch/x86_64.c  |   18 ++++++++----------
>  makedumpfile.c |    6 +++++-
>  makedumpfile.h |    1 +
>  4 files changed, 31 insertions(+), 30 deletions(-)
> 
> --- a/arch/ia64.c
> +++ b/arch/ia64.c
> @@ -335,26 +335,24 @@ get_xen_basic_info_ia64(void)
> 
>  	info->frame_table_vaddr = VIRT_FRAME_TABLE_ADDR; /* "frame_table" is same value */
> 
> -	if (SYMBOL(xenheap_phys_end) == NOT_FOUND_SYMBOL) {
> -		ERRMSG("Can't get the symbol of xenheap_phys_end.\n");
> -		return FALSE;
> +	if (SYMBOL(xenheap_phys_end) != NOT_FOUND_SYMBOL) {
> +		if (!readmem(VADDR_XEN, SYMBOL(xenheap_phys_end), &xen_end,
> +		      sizeof(xen_end))) {
> +			ERRMSG("Can't get the value of xenheap_phys_end.\n");
> +			return FALSE;
> +		}
> +		if (SYMBOL(xen_pstart) == NOT_FOUND_SYMBOL) {
> +			ERRMSG("Can't get the symbol of xen_pstart.\n");
> +			return FALSE;
> +		}
> +		if (!readmem(VADDR_XEN, SYMBOL(xen_pstart), &xen_start,
> +		    sizeof(xen_start))) {
> +			ERRMSG("Can't get the value of xen_pstart.\n");
> +			return FALSE;
> +		}
> +		info->xen_heap_start = paddr_to_pfn(xen_start);
> +		info->xen_heap_end   = paddr_to_pfn(xen_end);
>  	}
> -	if (!readmem(VADDR_XEN, SYMBOL(xenheap_phys_end), &xen_end,
> -	      sizeof(xen_end))) {
> -		ERRMSG("Can't get the value of xenheap_phys_end.\n");
> -		return FALSE;
> -	}
> -	if (SYMBOL(xen_pstart) == NOT_FOUND_SYMBOL) {
> -		ERRMSG("Can't get the symbol of xen_pstart.\n");
> -		return FALSE;
> -	}
> -	if (!readmem(VADDR_XEN, SYMBOL(xen_pstart), &xen_start,
> -	    sizeof(xen_start))) {
> -		ERRMSG("Can't get the value of xen_pstart.\n");
> -		return FALSE;
> -	}
> -	info->xen_heap_start = paddr_to_pfn(xen_start);
> -	info->xen_heap_end   = paddr_to_pfn(xen_end);
> 
>  	return TRUE;
>  }
> --- a/arch/x86_64.c
> +++ b/arch/x86_64.c
> @@ -385,17 +385,15 @@ int get_xen_basic_info_x86_64(void)
>  	}
>  	info->frame_table_vaddr = frame_table_vaddr;
> 
> -	if (SYMBOL(xenheap_phys_end) == NOT_FOUND_SYMBOL) {
> -		ERRMSG("Can't get the symbol of xenheap_phys_end.\n");
> -		return FALSE;
> +	if (SYMBOL(xenheap_phys_end) != NOT_FOUND_SYMBOL) {
> +		if (!readmem(VADDR_XEN, SYMBOL(xenheap_phys_end), &xen_end,
> +		    sizeof(xen_end))) {
> +			ERRMSG("Can't get the value of xenheap_phys_end.\n");
> +			return FALSE;
> +		}
> +		info->xen_heap_start = 0;
> +		info->xen_heap_end   = paddr_to_pfn(xen_end);
>  	}
> -	if (!readmem(VADDR_XEN, SYMBOL(xenheap_phys_end), &xen_end,
> -	    sizeof(xen_end))) {
> -		ERRMSG("Can't get the value of xenheap_phys_end.\n");
> -		return FALSE;
> -	}
> -	info->xen_heap_start = 0;
> -	info->xen_heap_end   = paddr_to_pfn(xen_end);
> 
>  	return TRUE;
>  }
> --- a/makedumpfile.c
> +++ b/makedumpfile.c
> @@ -5715,7 +5715,11 @@ exclude_xen_user_domain(void)
>  			 */
>  			if (_domain == 0)
>  				continue;
> -			if (info->xen_heap_start <= pfn && pfn < info->xen_heap_end)
> +			if (!info->xen_heap_end) {
> +				if (count_info & PGC_xen_heap)
> +					continue;
> +			} else if (info->xen_heap_start <= pfn &&
> +				   pfn < info->xen_heap_end)
>  				continue;
>  			if ((count_info & 0xffff) && is_select_domain(_domain))
>  				continue;
> --- a/makedumpfile.h
> +++ b/makedumpfile.h
> @@ -82,6 +82,7 @@ int get_mem_type(void);
>   */
>  #define PG_shift(idx)	(BITS_PER_LONG - (idx))
>  #define PG_mask(x, idx)	(x ## UL << PG_shift(idx))
> +#define PGC_xen_heap        PG_mask(1, 2)
> 
>  /*
>   * Memory flags
> 
> 
> 
> _______________________________________________
> kexec mailing list
> kexec at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/kexec

Norbert Trapp
PDG ES&S SWE OS 6

FUJITSU
Fujitsu Technology Solutions GmbH
Domagkstraße 28, D-80807 München, Germany
E-mail: Norbert.Trapp at ts.fujitsu.com
Web: ts.fujitsu.com
Company details: ts.fujitsu.com/imprint
Please be advised that neither Fujitsu, its affiliates, its employees or agents accept liability for any errors, omissions or damages caused by delays of receipt or by any virus infection in this message or its attachments, or which may otherwise arise as a result of this e-mail transmission.



More information about the kexec mailing list