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

Baoquan He bhe at redhat.com
Mon Jan 27 03:55:26 EST 2014


On 01/27/14 at 01:03pm, HATAYAMA Daisuke wrote:
> (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.

Hi Both,

I understand your finding. How about put the pfn checking back to
set_bitmap_cyclic(). Maybe this is simpler and safer. Otherwise each
case need be taken care and adding the pfn checking.


> 
> > @@ -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
> 
> 
> _______________________________________________
> kexec mailing list
> kexec at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/kexec



More information about the kexec mailing list