Messages in this thread | | | Date | Thu, 19 Apr 2018 12:07:45 +0200 | From | Borislav Petkov <> | Subject | Re: [PATCH v3 2/3] resource: add walk_system_ram_res_rev() |
| |
On Thu, Apr 19, 2018 at 08:18:47AM +0800, Baoquan He wrote: > This function, being a variant of walk_system_ram_res() introduced in > commit 8c86e70acead ("resource: provide new functions to walk through > resources"), walks through a list of all the resources of System RAM > in reversed order, i.e., from higher to lower. > > It will be used in kexec_file code.
Of course, what is missing is the big *WHY* you need this to happen this way...
> /* > + * This function, being a variant of walk_system_ram_res(), calls the @func > + * callback against all memory ranges of type System RAM which are marked as > + * IORESOURCE_SYSTEM_RAM and IORESOUCE_BUSY in reversed order, i.e., from > + * higher to lower. > + */ > +int walk_system_ram_res_rev(u64 start, u64 end, void *arg, > + int (*func)(struct resource *, void *)) > +{ > + unsigned long flags; > + struct resource *res; > + int ret = -1; > + > + flags = IORESOURCE_SYSTEM_RAM | IORESOURCE_BUSY; > + > + read_lock(&resource_lock); > + list_for_each_entry_reverse(res, &iomem_resource.child, sibling) {
... and the other thing that I'm not clear on is why are you slapping this function just like that instead of extending __walk_iomem_res_desc() to do reverse direction too?
-- Regards/Gruss, Boris.
SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nürnberg) --
| |