[v2 2/3] makedumpfile: use struct cycle to update cyclic region and clean up

HATAYAMA Daisuke d.hatayama at jp.fujitsu.com
Sun Jan 26 23:03:02 EST 2014


(2014/01/23 18:47), Baoquan He wrote:

> @@ -3301,18 +3301,15 @@ set_bitmap(struct dump_bitmap *bitmap, unsigned long long pfn,
>   }
>   
>   int
> -set_bitmap_cyclic(char *bitmap, unsigned long long pfn, int val)
> +set_bitmap_cyclic(char *bitmap, unsigned long long pfn, int val, struct cycle *cycle)
>   {
>   	int byte, bit;
>   
> -	if (pfn < info->cyclic_start_pfn || info->cyclic_end_pfn <= pfn)
> -		return FALSE;
> -

Removing this check changes behaviour, not just clean up, so should be separated into another patch.

Further, this change seems buggy because, in addition to Kumaga-san's comment, memory outside of
cycle region can be passed to here. Please look at the below.

> @@ -4782,10 +4780,10 @@ exclude_unnecessary_pages_cyclic(void)
>   			if (mmd->mem_map == NOT_MEMMAP_ADDR)
>   				continue;
>   
> -			if (mmd->pfn_end >= info->cyclic_start_pfn &&
> -			    mmd->pfn_start <= info->cyclic_end_pfn) {
> +			if (mmd->pfn_end >= cycle->start_pfn &&
> +			    mmd->pfn_start <= cycle->end_pfn) {
>   				if (!__exclude_unnecessary_pages(mmd->mem_map,
> -								 mmd->pfn_start, mmd->pfn_end))
> +								 mmd->pfn_start, mmd->pfn_end, cycle))
>   					return FALSE;
>   			}
>   		}

After this clean up, __exclude_unnecessary_pages() processes memory within cycle region only.
So, it's necessary to pass adjusted range, like:

if (MAX(mmd->pfn_start, cycle->start_pfn) < MIN(mmd->pfn_end, cycle->end_pfn))
  __exclude_unnecessary_pages(mmd->mem_map, MAX(mmd->pfn_start, cycle->start_pfn), MIN(mmd->pfn_end, cycle->end_pfn))

-- 
Thanks.
HATAYAMA, Daisuke




More information about the kexec mailing list