resource: Use list_head to link sibling resource
Subsystems (21)
v6 cover resource: Use list_head to link sibling resource
This patchset is doing:
1) Replace struct resource's sibling list from singly linked list to list_head. Clearing out those pointer operation within singly linked list for better code readability.
2) Based on list_head replacement, add a new function walk_system_ram_res_rev() which can does reversed iteration on iomem_resource's siblings.
3) Change kexec_file loading to search system RAM top down for kernel loadin, using walk_system_ram_res_rev().
Note:
This patchset only passed testing on x86_64 arch with network enabling. The thing we need pay attetion to is that a root resource's child member need be initialized specifically with LIST_HEAD_INIT() if statically defined or INIT_LIST_HEAD() for dynamically definition. Here Just like we do for iomem_resource/ioport_resource, or the change in get_pci_domain_busn_res().
v5:
http://lkml.kernel.org/r/20180612032831.29747-1-bhe-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org
v4:
http://lkml.kernel.org/r/20180507063224.24229-1-bhe-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org
v3:
http://lkml.kernel.org/r/20180419001848.3041-1-bhe-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org
v2:
http://lkml.kernel.org/r/20180408024724.16812-1-bhe-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org
v1:
http://lkml.kernel.org/r/20180322033722.9279-1-bhe-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org
Changelog:v5->v6:
Fix code style problems in reparent_resources() and use existing error codes, according to Andy's suggestion.
Fix bugs test robot reported.
v4->v5:
Add new patch 0001 to move duplicated reparent_resources() to kernel/resource.c to make it be shared by different ARCH-es.
Fix several code bugs reported by test robot on ARCH powerpc and microblaze.v3->v4:
Fix several bugs test robot reported. Rewrite cover letter and patch log according to reviewer's comment.
v2->v3:
Rename resource functions first_child() and sibling() to resource_first_chils() and resource_sibling(). Dan suggested this.
Move resource_first_chils() and resource_sibling() to linux/ioport.h and make them as inline function. Rob suggested this. Accordingly add linux/list.h including in linux/ioport.h, please help review if this bring efficiency degradation or code redundancy.
The change on struct resource {} bring two pointers of size increase, mention this in git log to make it more specifically, Rob suggested this.
v1->v2:
Use list_head instead to link resource siblings. This is suggested by Andrew.
Rewrite walk_system_ram_res_rev() after list_head is taken to link resouce siblings.
Baoquan He (4):
resource: Move reparent_resources() to kernel/resource.c and make it
public
resource: Use list_head to link sibling resource
resource: add walk_system_ram_res_rev()
kexec_file: Load kernel at top of system RAM if required
arch/arm/plat-samsung/pm-check.c | 6 +- arch/microblaze/pci/pci-common.c | 41 +---- arch/powerpc/kernel/pci-common.c | 39 +---- arch/sparc/kernel/ioport.c | 2 +- arch/xtensa/include/asm/pci-bridge.h | 4 +- drivers/eisa/eisa-bus.c | 2 + drivers/gpu/drm/drm_memory.c | 3 +- drivers/gpu/drm/gma500/gtt.c | 5 +- drivers/hv/vmbus_drv.c | 52 +++--- drivers/input/joystick/iforce/iforce-main.c | 4 +- drivers/nvdimm/namespace_devs.c | 6 +- drivers/nvdimm/nd.h | 5 +- drivers/of/address.c | 4 +- drivers/parisc/lba_pci.c | 4 +- drivers/pci/controller/vmd.c | 8 +- drivers/pci/probe.c | 2 + drivers/pci/setup-bus.c | 2 +- include/linux/ioport.h | 21 ++- kernel/kexec_file.c | 2 + kernel/resource.c | 263 ++++++++++++++++++---------- 20 files changed, 248 insertions(+), 227 deletions(-)
Signature · 1 line
2.13.6
PATCH v6 1/4 resource: Move reparent_resources() to kernel/resource.c and make it public
reparent_resources() is duplicated in arch/microblaze/pci/pci-common.c and arch/powerpc/kernel/pci-common.c, so move it to kernel/resource.c so that it's shared.
--- arch/microblaze/pci/pci-common.c | 37 ------------------------------------- arch/powerpc/kernel/pci-common.c | 35 ----------------------------------- include/linux/ioport.h | 1 + kernel/resource.c | 39 +++++++++++++++++++++++++++++++++++++++ 4 files changed, 40 insertions(+), 72 deletions(-)
arch/microblaze/pci/pci-common.c +0 -37
@@ -619,43 +619,6 @@ int pcibios_add_device(struct pci_dev *dev)EXPORT_SYMBOL (pcibios_add_device);/* -* Reparent resource children of pr that conflict with res -* under res, and make res replace those children. -*/ -static int __init reparent_resources (struct resource *parent, -struct resource *res) -{ -struct resource *p, **pp; -struct resource **firstpp =NULL ; - -for (pp = &parent->child; (p = *pp) !=NULL ; pp = &p->sibling) { -if (p->end < res->start) -continue ; -if (res->end < p->start) -break ; -if (p->start < res->start || p->end > res->end) -return -1 ;/* not completely contained */ -if (firstpp ==NULL ) - firstpp = pp; - } -if (firstpp ==NULL ) -return -1 ;/* didn't find any conflicting entries? */ - res->parent = parent; - res->child = *firstpp; - res->sibling = *pp; - *firstpp = res; - *pp =NULL ; -for (p = res->child; p !=NULL ; p = p->sibling) { - p->parent = res; -pr_debug ("PCI: Reparented %s [%llx..%llx] under %s\n" , - p->name, - (unsigned long long )p->start, - (unsigned long long )p->end, res->name); - } -return 0 ; -} - -/* * Handle resources of PCI devices. If the world were perfect, we could * just allocate all the resource regions and do nothing more. It isn't. * On the other hand, we cannot just re-allocate all devices, as it would
arch/powerpc/kernel/pci-common.c +0 -35
@@ -1088,41 +1088,6 @@ resource_size_t pcibios_align_resource(void *data, const struct resource *res,EXPORT_SYMBOL (pcibios_align_resource);/* -* Reparent resource children of pr that conflict with res -* under res, and make res replace those children. -*/ -static int reparent_resources (struct resource *parent, -struct resource *res) -{ -struct resource *p, **pp; -struct resource **firstpp =NULL ; - -for (pp = &parent->child; (p = *pp) !=NULL ; pp = &p->sibling) { -if (p->end < res->start) -continue ; -if (res->end < p->start) -break ; -if (p->start < res->start || p->end > res->end) -return -1 ;/* not completely contained */ -if (firstpp ==NULL ) - firstpp = pp; - } -if (firstpp ==NULL ) -return -1 ;/* didn't find any conflicting entries? */ - res->parent = parent; - res->child = *firstpp; - res->sibling = *pp; - *firstpp = res; - *pp =NULL ; -for (p = res->child; p !=NULL ; p = p->sibling) { - p->parent = res; -pr_debug ("PCI: Reparented %s %pR under %s\n" , - p->name, p, res->name); - } -return 0 ; -} - -/* * Handle resources of PCI devices. If the world were perfect, we could * just allocate all the resource regions and do nothing more. It isn't. * On the other hand, we cannot just re-allocate all devices, as it would
include/linux/ioport.h +1 -0
@@ -192,6 +192,7 @@ extern int allocate_resource(struct resource *root, struct resource *new,struct resource *lookup_resource (struct resource *root,resource_size_t start);int adjust_resource (struct resource *res,resource_size_t start,resource_size_t size); +int reparent_resources (struct resource *parent,struct resource *res);resource_size_t resource_alignment (struct resource *res);static inline resource_size_t resource_size (const struct resource *res) {
kernel/resource.c +39 -0
@@ -983,6 +983,45 @@ int adjust_resource(struct resource *res, resource_size_t start, }EXPORT_SYMBOL (adjust_resource); +/* +* reparent_resources - reparent resource children of parent that res covers +* @parent: parent resource descriptor +* @res: resource descriptor desired by caller +* +* Reparent resource children of 'parent' that conflict with 'res' +* under 'res', and make 'res' replace those children. +*/ +int reparent_resources (struct resource *parent,struct resource *res) +{ +struct resource *p, **pp; +struct resource **firstpp =NULL ; + +for (pp = &parent->child; (p = *pp) !=NULL ; pp = &p->sibling) { +if (p->end < res->start) +continue ; +if (res->end < p->start) +break ; +if (p->start < res->start || p->end > res->end) +return -ENOTSUPP ;/* not completely contained */ +if (firstpp ==NULL ) + firstpp = pp; + } +if (firstpp ==NULL ) +return -ECANCELED ;/* didn't find any conflicting entries? */ + res->parent = parent; + res->child = *firstpp; + res->sibling = *pp; + *firstpp = res; + *pp =NULL ; +for (p = res->child; p !=NULL ; p = p->sibling) { + p->parent = res; +pr_debug ("PCI: Reparented %s %pR under %s\n" , + p->name, p, res->name); + } +return 0 ; +} +EXPORT_SYMBOL (reparent_resources); +static void __init __reserve_region_with_split (struct resource *root,resource_size_t start,resource_size_t end,const char *name)
Signature · 1 line
2.13.6
Re: [PATCH v6 1/4] resource: Move reparent_resources() to kernel/resource.c and make it public
Quoted 3 lines · Baoquan He
reparent_resources()is duplicated inarch/microblaze/pci/pci-common.candarch/powerpc/kernel/pci-common.c, so move it tokernel/resource.cso that it's shared.
With couple of comments below,
P.S. In some commit message in this series you used 'likt' instead of 'like'.
Quoted 120 lines
Signed-off-by Baoquan He <[email protected]>--- arch/microblaze/pci/pci-common.c | 37 ------------------------------------- arch/powerpc/kernel/pci-common.c | 35 ----------------------------------- include/linux/ioport.h | 1 + kernel/resource.c | 39 +++++++++++++++++++++++++++++++++++++++ 4 files changed, 40 insertions(+), 72 deletions(-)arch/microblaze/pci/pci-common.c +0
-37@@ -619,43 +619,6 @@ int pcibios_add_device(struct pci_dev *dev)EXPORT_SYMBOL (pcibios_add_device);/* -* Reparent resource children of pr that conflict with res -* under res, and make res replace those children. -*/ -static int __init reparent_resources (struct resource *parent, -struct resource *res) -{ -struct resource *p, **pp; -struct resource **firstpp =NULL ; - -for (pp = &parent->child; (p = *pp) !=NULL ; pp = &p->sibling) { -if (p->end < res->start) -continue ; -if (res->end < p->start) -break ; -if (p->start < res->start || p->end > res->end) -return -1 ;/* not completely contained */ -if (firstpp ==NULL ) - firstpp = pp; - } -if (firstpp ==NULL ) -return -1 ;/* didn't find any conflicting entries? */ - res->parent = parent; - res->child = *firstpp; - res->sibling = *pp; - *firstpp = res; - *pp =NULL ; -for (p = res->child; p !=NULL ; p = p->sibling) { - p->parent = res; -pr_debug ("PCI: Reparented %s [%llx..%llx] under %s\n" , - p->name, - (unsigned long long )p->start, - (unsigned long long )p->end, res->name); - } -return 0 ; -} - -/* * Handle resources of PCI devices. If the world were perfect, we could * just allocate all the resource regions and do nothing more. It isn't. * On the other hand, we cannot just re-allocate all devices, as it would arch/powerpc/kernel/pci-common.c +0
-35@@ -1088,41 +1088,6 @@ resource_size_t pcibios_align_resource(void *data, const struct resource *res,EXPORT_SYMBOL (pcibios_align_resource);/* -* Reparent resource children of pr that conflict with res -* under res, and make res replace those children. -*/ -static int reparent_resources (struct resource *parent, -struct resource *res) -{ -struct resource *p, **pp; -struct resource **firstpp =NULL ; - -for (pp = &parent->child; (p = *pp) !=NULL ; pp = &p->sibling) { -if (p->end < res->start) -continue ; -if (res->end < p->start) -break ; -if (p->start < res->start || p->end > res->end) -return -1 ;/* not completely contained */ -if (firstpp ==NULL ) - firstpp = pp; - } -if (firstpp ==NULL ) -return -1 ;/* didn't find any conflicting entries? */ - res->parent = parent; - res->child = *firstpp; - res->sibling = *pp; - *firstpp = res; - *pp =NULL ; -for (p = res->child; p !=NULL ; p = p->sibling) { - p->parent = res; -pr_debug ("PCI: Reparented %s %pR under %s\n" , - p->name, p, res->name); - } -return 0 ; -} - -/* * Handle resources of PCI devices. If the world were perfect, we could * just allocate all the resource regions and do nothing more. It isn't. * On the other hand, we cannot just re-allocate all devices, as it would include/linux/ioport.h +1
-0@@ -192,6 +192,7 @@ extern int allocate_resource(struct resource *root, struct resource *new,struct resource *lookup_resource (struct resource *root,resource_size_t start);int adjust_resource (struct resource *res,resource_size_t start,resource_size_t size); +int reparent_resources (struct resource *parent,struct resource *res);resource_size_t resource_alignment (struct resource *res);static inline resource_size_t resource_size (const struct resource *res) {kernel/resource.c +0
-0
kernel/resource.c int adjust_resource(struct resource *res, resource_size_t start, · line 986
Quoted 4 lines
kernel/resource.c +1
-0@@ -983,6 +983,45 @@ int adjust_resource(struct resource *res, resource_size_t start, }EXPORT_SYMBOL (adjust_resource); +/*
/** ?
kernel/resource.c int adjust_resource(struct resource *res, resource_size_t start, · line 992
Quoted 6 lines
kernel/resource.c +6
-0+* reparent_resources - reparent resource children of parent that res covers +* @parent: parent resource descriptor +* @res: resource descriptor desired by caller +* +* Reparent resource children of 'parent' that conflict with 'res' +* under 'res', and make 'res' replace those children.
Describe error codes, please.
Quoted 38 lines
kernel/resource.c +32
-1+*/ +int reparent_resources (struct resource *parent,struct resource *res) +{ +struct resource *p, **pp; +struct resource **firstpp =NULL ; + +for (pp = &parent->child; (p = *pp) !=NULL ; pp = &p->sibling) { +if (p->end < res->start) +continue ; +if (res->end < p->start) +break ; +if (p->start < res->start || p->end > res->end) +return -ENOTSUPP ;/* not completely contained */ +if (firstpp ==NULL ) + firstpp = pp; + } +if (firstpp ==NULL ) +return -ECANCELED ;/* didn't find any conflicting entries? */ + res->parent = parent; + res->child = *firstpp; + res->sibling = *pp; + *firstpp = res; + *pp =NULL ; +for (p = res->child; p !=NULL ; p = p->sibling) { + p->parent = res; +pr_debug ("PCI: Reparented %s %pR under %s\n" , + p->name, p, res->name); + } +return 0 ; +} +EXPORT_SYMBOL (reparent_resources); +static void __init __reserve_region_with_split (struct resource *root,resource_size_t start,resource_size_t end,const char *name) --2.13.6
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [PATCH v6 1/4] resource: Move reparent_resources() to kernel/resource.c and make it public
Quoted 6 lines · Andy Shevchenko
Quoted 3 lines · Baoquan He
reparent_resources()is duplicated inarch/microblaze/pci/pci-common.candarch/powerpc/kernel/pci-common.c, so move it tokernel/resource.cso that it's shared.With couple of comments below,
Sure, will fix these and repost with your reviewed-by, thanks. Should be after I reproduce and fix those issues reported by test robot.
Quoted 185 lines
Reviewed-by Andy Shevchenko <[email protected]>
P.S. In some commit message in this series you used 'likt' instead of 'like'.Quoted 120 lines
Signed-off-by Baoquan He <[email protected]>--- arch/microblaze/pci/pci-common.c | 37 ------------------------------------- arch/powerpc/kernel/pci-common.c | 35 ----------------------------------- include/linux/ioport.h | 1 + kernel/resource.c | 39 +++++++++++++++++++++++++++++++++++++++ 4 files changed, 40 insertions(+), 72 deletions(-)arch/microblaze/pci/pci-common.c +0
-37@@ -619,43 +619,6 @@ int pcibios_add_device(struct pci_dev *dev)EXPORT_SYMBOL (pcibios_add_device);/* -* Reparent resource children of pr that conflict with res -* under res, and make res replace those children. -*/ -static int __init reparent_resources (struct resource *parent, -struct resource *res) -{ -struct resource *p, **pp; -struct resource **firstpp =NULL ; - -for (pp = &parent->child; (p = *pp) !=NULL ; pp = &p->sibling) { -if (p->end < res->start) -continue ; -if (res->end < p->start) -break ; -if (p->start < res->start || p->end > res->end) -return -1 ;/* not completely contained */ -if (firstpp ==NULL ) - firstpp = pp; - } -if (firstpp ==NULL ) -return -1 ;/* didn't find any conflicting entries? */ - res->parent = parent; - res->child = *firstpp; - res->sibling = *pp; - *firstpp = res; - *pp =NULL ; -for (p = res->child; p !=NULL ; p = p->sibling) { - p->parent = res; -pr_debug ("PCI: Reparented %s [%llx..%llx] under %s\n" , - p->name, - (unsigned long long )p->start, - (unsigned long long )p->end, res->name); - } -return 0 ; -} - -/* * Handle resources of PCI devices. If the world were perfect, we could * just allocate all the resource regions and do nothing more. It isn't. * On the other hand, we cannot just re-allocate all devices, as it would arch/powerpc/kernel/pci-common.c +0
-35@@ -1088,41 +1088,6 @@ resource_size_t pcibios_align_resource(void *data, const struct resource *res,EXPORT_SYMBOL (pcibios_align_resource);/* -* Reparent resource children of pr that conflict with res -* under res, and make res replace those children. -*/ -static int reparent_resources (struct resource *parent, -struct resource *res) -{ -struct resource *p, **pp; -struct resource **firstpp =NULL ; - -for (pp = &parent->child; (p = *pp) !=NULL ; pp = &p->sibling) { -if (p->end < res->start) -continue ; -if (res->end < p->start) -break ; -if (p->start < res->start || p->end > res->end) -return -1 ;/* not completely contained */ -if (firstpp ==NULL ) - firstpp = pp; - } -if (firstpp ==NULL ) -return -1 ;/* didn't find any conflicting entries? */ - res->parent = parent; - res->child = *firstpp; - res->sibling = *pp; - *firstpp = res; - *pp =NULL ; -for (p = res->child; p !=NULL ; p = p->sibling) { - p->parent = res; -pr_debug ("PCI: Reparented %s %pR under %s\n" , - p->name, p, res->name); - } -return 0 ; -} - -/* * Handle resources of PCI devices. If the world were perfect, we could * just allocate all the resource regions and do nothing more. It isn't. * On the other hand, we cannot just re-allocate all devices, as it would include/linux/ioport.h +1
-0@@ -192,6 +192,7 @@ extern int allocate_resource(struct resource *root, struct resource *new,struct resource *lookup_resource (struct resource *root,resource_size_t start);int adjust_resource (struct resource *res,resource_size_t start,resource_size_t size); +int reparent_resources (struct resource *parent,struct resource *res);resource_size_t resource_alignment (struct resource *res);static inline resource_size_t resource_size (const struct resource *res) {kernel/resource.c +0
-0kernel/resource.c int adjust_resource(struct resource *res, resource_size_t start, · line 986
Quoted 4 lines
kernel/resource.c +1
-0@@ -983,6 +983,45 @@ int adjust_resource(struct resource *res, resource_size_t start, }EXPORT_SYMBOL (adjust_resource); +/* /** ?
kernel/resource.c int adjust_resource(struct resource *res, resource_size_t start, · line 992
Quoted 6 lines
kernel/resource.c +6
-0+* reparent_resources - reparent resource children of parent that res covers +* @parent: parent resource descriptor +* @res: resource descriptor desired by caller +* +* Reparent resource children of 'parent' that conflict with 'res' +* under 'res', and make 'res' replace those children. Describe error codes, please.
Quoted 38 lines
kernel/resource.c +32
-1+*/ +int reparent_resources (struct resource *parent,struct resource *res) +{ +struct resource *p, **pp; +struct resource **firstpp =NULL ; + +for (pp = &parent->child; (p = *pp) !=NULL ; pp = &p->sibling) { +if (p->end < res->start) +continue ; +if (res->end < p->start) +break ; +if (p->start < res->start || p->end > res->end) +return -ENOTSUPP ;/* not completely contained */ +if (firstpp ==NULL ) + firstpp = pp; + } +if (firstpp ==NULL ) +return -ECANCELED ;/* didn't find any conflicting entries? */ + res->parent = parent; + res->child = *firstpp; + res->sibling = *pp; + *firstpp = res; + *pp =NULL ; +for (p = res->child; p !=NULL ; p = p->sibling) { + p->parent = res; +pr_debug ("PCI: Reparented %s %pR under %s\n" , + p->name, p, res->name); + } +return 0 ; +} +EXPORT_SYMBOL (reparent_resources); +static void __init __reserve_region_with_split (struct resource *root,resource_size_t start,resource_size_t end,const char *name) --2.13.6
Signature · 2 lines
With Best Regards, Andy Shevchenko
PATCH v6 2/4 resource: Use list_head to link sibling resource
In reply to Baoquan HeThe struct resource uses singly linked list to link siblings, implemented by pointer operation. Replace it with list_head for better code readability.
Based on this list_head replacement, it will be very easy to do reverse iteration on iomem_resource's sibling list in later patch.
Besides, type of member variables of struct resource, sibling and child, are changed from 'struct resource *' to 'struct list_head'. This brings two pointers of size increase.
--- arch/arm/plat-samsung/pm-check.c | 6 +- arch/microblaze/pci/pci-common.c | 4 +- arch/powerpc/kernel/pci-common.c | 4 +- arch/sparc/kernel/ioport.c | 2 +- arch/xtensa/include/asm/pci-bridge.h | 4 +- drivers/eisa/eisa-bus.c | 2 + drivers/gpu/drm/drm_memory.c | 3 +- drivers/gpu/drm/gma500/gtt.c | 5 +- drivers/hv/vmbus_drv.c | 52 +++---- drivers/input/joystick/iforce/iforce-main.c | 4 +- drivers/nvdimm/namespace_devs.c | 6 +- drivers/nvdimm/nd.h | 5 +- drivers/of/address.c | 4 +- drivers/parisc/lba_pci.c | 4 +- drivers/pci/controller/vmd.c | 8 +- drivers/pci/probe.c | 2 + drivers/pci/setup-bus.c | 2 +- include/linux/ioport.h | 17 ++- kernel/resource.c | 208 ++++++++++++++-------------- 19 files changed, 175 insertions(+), 167 deletions(-)
arch/arm/plat-samsung/pm-check.c +3 -3
@@ -46,8 +46,8 @@ typedef u32 *(run_fn_t)(struct resource *ptr, u32 *arg);static void s3c_pm_run_res (struct resource *ptr,run_fn_t fn,u32 *arg) {while (ptr !=NULL ) { -if (ptr->child !=NULL ) -s3c_pm_run_res (ptr->child, fn, arg); +if (!list_empty (&ptr->child)) +s3c_pm_run_res (resource_first_child (&ptr->child), fn, arg);if ((ptr->flags &IORESOURCE_SYSTEM_RAM ) ==IORESOURCE_SYSTEM_RAM ) {
@@ -57,7 +57,7 @@ static void s3c_pm_run_res(struct resource *ptr, run_fn_t fn, u32 *arg) arg = (fn)(ptr, arg); } - ptr = ptr->sibling; + ptr =resource_sibling (ptr); } }
arch/microblaze/pci/pci-common.c +3 -1
@@ -533,7 +533,9 @@ void pci_process_bridge_OF_ranges(struct pci_controller *hose, res->flags = range.flags; res->start = range.cpu_addr; res->end = range.cpu_addr + range.size -1 ; - res->parent = res->child = res->sibling =NULL ; + res->parent =NULL ; +INIT_LIST_HEAD (&res->child); +INIT_LIST_HEAD (&res->sibling); } }
arch/powerpc/kernel/pci-common.c +3 -1
@@ -761,7 +761,9 @@ void pci_process_bridge_OF_ranges(struct pci_controller *hose, res->flags = range.flags; res->start = range.cpu_addr; res->end = range.cpu_addr + range.size -1 ; - res->parent = res->child = res->sibling =NULL ; + res->parent =NULL ; +INIT_LIST_HEAD (&res->child); +INIT_LIST_HEAD (&res->sibling); } } }
arch/sparc/kernel/ioport.c +1 -1
@@ -669,7 +669,7 @@ static int sparc_io_proc_show(struct seq_file *m, void *v)struct resource *root = m->private, *r;const char *nm; -for (r = root->child; r !=NULL ; r = r->sibling) { +list_for_each_entry (r, &root->child, sibling) {if ((nm = r->name) ==NULL ) nm ="???" ; seq_printf(m, "%016llx-%016llx: %s\n", (unsigned long long)r->start,
arch/xtensa/include/asm/pci-bridge.h +2 -2
@@ -71,8 +71,8 @@ static inline void pcibios_init_resource(struct resource *res, res->flags = flags; res->name = name; res->parent =NULL ; - res->sibling =NULL ; - res->child =NULL ; +INIT_LIST_HEAD (&res->child); +INIT_LIST_HEAD (&res->sibling); }
drivers/eisa/eisa-bus.c +2 -0
@@ -408,6 +408,8 @@ static struct resource eisa_root_res = { .start = 0, .end = 0xffffffff, .flags = IORESOURCE_IO, + .sibling = LIST_HEAD_INIT(eisa_root_res.sibling), + .child = LIST_HEAD_INIT(eisa_root_res.child), };static int eisa_bus_count;
drivers/gpu/drm/drm_memory.c +1 -2
@@ -155,9 +155,8 @@ u64 drm_get_max_iomem(void)struct resource *tmp;resource_size_t max_iomem =0 ; -for (tmp = iomem_resource.child; tmp; tmp = tmp->sibling) { +list_for_each_entry (tmp, &iomem_resource.child, sibling) max_iomem =max (max_iomem, tmp->end); - }return max_iomem; }
drivers/gpu/drm/gma500/gtt.c +2 -3
@@ -565,7 +565,7 @@ int psb_gtt_init(struct drm_device *dev, int resume)int psb_gtt_restore (struct drm_device *dev) {struct drm_psb_private *dev_priv = dev->dev_private; -struct resource *r = dev_priv->gtt_mem->child; +struct resource *r;struct gtt_range *range;unsigned int restored =0 , total =0 , size =0 ;
@@ -573,14 +573,13 @@ int psb_gtt_restore(struct drm_device *dev)mutex_lock (&dev_priv->gtt_mutex);psb_gtt_init (dev,1 ); -while (r !=NULL ) { +list_for_each_entry (r, &dev_priv->gtt_mem->child, sibling) { range = container_of(r, struct gtt_range, resource);if (range->pages) {psb_gtt_insert (dev, range,1 ); size += range->resource.end - range->resource.start; restored++; } - r = r->sibling; total++; }mutex_unlock (&dev_priv->gtt_mutex);
drivers/hv/vmbus_drv.c +22 -30
99 lines not on this page · raw message
drivers/input/joystick/iforce/iforce-main.c +2 -2
@@ -305,8 +305,8 @@ int iforce_init_device(struct iforce *iforce) iforce->device_memory.end =200 ; iforce->device_memory.flags =IORESOURCE_MEM ; iforce->device_memory.parent =NULL ; - iforce->device_memory.child =NULL ; - iforce->device_memory.sibling =NULL ; +INIT_LIST_HEAD (&iforce->device_memory.child); +INIT_LIST_HEAD (&iforce->device_memory.sibling);/* * Wait until device ready - until it sends its first response.
drivers/nvdimm/namespace_devs.c +3 -3
@@ -637,7 +637,7 @@ static resource_size_t scan_allocate(struct nd_region *nd_region, retry: first =0 ;for_each_dpa_resource (ndd, res) { -struct resource *next = res->sibling, *new_res =NULL ; +struct resource *next =resource_sibling (res), *new_res =NULL ;resource_size_t allocate, available =0 ;enum alloc_loc loc =ALLOC_ERR ;const char *action;
@@ -763,7 +763,7 @@ static resource_size_t scan_allocate(struct nd_region *nd_region,* an initial "pmem-reserve pass". Only do an initial BLK allocation * when none of the DPA space is reserved. */ -if ((is_pmem || !ndd->dpa.child) && n == to_allocate) +if ((is_pmem ||list_empty (&ndd->dpa.child)) && n == to_allocate)return init_dpa_allocation (label_id, nd_region, nd_mapping, n);return n; }
@@ -779,7 +779,7 @@ static int merge_dpa(struct nd_region *nd_region, retry:for_each_dpa_resource (ndd, res) {int rc; -struct resource *next = res->sibling; +struct resource *next =resource_sibling (res);resource_size_t end = res->start +resource_size (res); if (!next || strcmp(res->name, label_id->id) != 0
drivers/nvdimm/nd.h +2 -3
@@ -102,11 +102,10 @@ unsigned sizeof_namespace_label(struct nvdimm_drvdata *ndd); (unsigned long long) (res ? res->start : 0), ##arg)#define for_each_dpa_resource (ndd, res) \ - for (res = (ndd)->dpa.child; res; res = res->sibling) + list_for_each_entry(res, &(ndd)->dpa.child, sibling)#define for_each_dpa_resource_safe (ndd, res, next) \ - for (res = (ndd)->dpa.child, next = res ? res->sibling : NULL; \ - res; res = next, next = next ? next->sibling : NULL) + list_for_each_entry_safe(res, next, &(ndd)->dpa.child, sibling)struct nd_percpu_lane {int count;
drivers/of/address.c +3 -1
@@ -330,7 +330,9 @@ int of_pci_range_to_resource(struct of_pci_range *range, {int err; res->flags = range->flags; - res->parent = res->child = res->sibling =NULL ; + res->parent =NULL ; +INIT_LIST_HEAD (&res->child); +INIT_LIST_HEAD (&res->sibling); res->name = np->full_name;if (res->flags &IORESOURCE_IO ) {
drivers/parisc/lba_pci.c +2 -2
@@ -170,8 +170,8 @@ lba_dump_res(struct resource *r, int d)for (i = d; i ; --i)printk (" " );printk (KERN_DEBUG "%p [%lx,%lx]/%lx\n" , r, (long )r->start, (long )r->end, r->flags); -lba_dump_res (r->child, d+2 ); -lba_dump_res (r->sibling, d); +lba_dump_res (resource_first_child (&r->child), d+2 ); +lba_dump_res (resource_sibling (r), d); }
drivers/pci/controller/vmd.c +4 -4
@@ -542,14 +542,14 @@ static struct pci_ops vmd_ops = {static void vmd_attach_resources (struct vmd_dev *vmd) { - vmd->dev->resource[VMD_MEMBAR1 ].child = &vmd->resources[1 ]; - vmd->dev->resource[VMD_MEMBAR2 ].child = &vmd->resources[2 ]; +list_add (&vmd->resources[1 ].sibling, &vmd->dev->resource[VMD_MEMBAR1 ].child); +list_add (&vmd->resources[2 ].sibling, &vmd->dev->resource[VMD_MEMBAR2 ].child); }static void vmd_detach_resources (struct vmd_dev *vmd) { - vmd->dev->resource[VMD_MEMBAR1 ].child =NULL ; - vmd->dev->resource[VMD_MEMBAR2 ].child =NULL ; +INIT_LIST_HEAD (&vmd->dev->resource[VMD_MEMBAR1 ].child); +INIT_LIST_HEAD (&vmd->dev->resource[VMD_MEMBAR2 ].child); }/*
drivers/pci/probe.c +2 -0
@@ -59,6 +59,8 @@ static struct resource *get_pci_domain_busn_res(int domain_nr) r->res.start =0 ; r->res.end =0xff ; r->res.flags =IORESOURCE_BUS |IORESOURCE_PCI_FIXED ; +INIT_LIST_HEAD (&r->res.child); +INIT_LIST_HEAD (&r->res.sibling);list_add_tail (&r->list, &pci_domain_busn_res_list);
drivers/pci/setup-bus.c +1 -1
@@ -2107,7 +2107,7 @@ int pci_reassign_bridge_resources(struct pci_dev *bridge, unsigned long type)continue ;/* Ignore BARs which are still in use */ -if (res->child) +if (!list_empty (&res->child))continue ; ret =add_to_list (&saved, bridge, res,0 ,0 );
include/linux/ioport.h +15 -2
@@ -12,6 +12,7 @@#ifndef __ASSEMBLY__#include <linux/compiler.h> #include <linux/types.h> +#include <linux/list.h> /* * Resources are tree-like, allowing * nesting etc..
@@ -22,7 +23,8 @@ struct resource {const char *name;unsigned long flags;unsigned long desc; -struct resource *parent, *sibling, *child; +struct list_head child, sibling; +struct resource *parent; };/*
@@ -216,7 +218,6 @@ static inline bool resource_contains(struct resource *r1, struct resource *r2)return r1->start <= r2->start && r1->end >= r2->end; } -/* Convenience shorthand with allocation */ #define request_region (start,n,name) __request_region(&ioport_resource, (start), (n), (name), 0)#define request_muxed_region (start,n,name) __request_region(&ioport_resource, (start), (n), (name), IORESOURCE_MUXED)
@@ -287,6 +288,18 @@ static inline bool resource_overlaps(struct resource *r1, struct resource *r2)return (r1->start <= r2->end && r1->end >= r2->start); } +static inline struct resource *resource_sibling (struct resource *res) +{ +if (res->parent && !list_is_last (&res->sibling, &res->parent->child)) +return list_next_entry (res, sibling); +return NULL ; +} + +static inline struct resource *resource_first_child (struct list_head *head) +{ + return list_first_entry_or_null(head, struct resource, sibling); +} +#endif /* __ASSEMBLY__ */ #endif /* _LINUX_IOPORT_H */
kernel/resource.c +102 -106
478 lines not on this page · raw message
Signature · 6 lines
2.13.6 _______________________________________________ Linux-nvdimm mailing list [email protected] https://lists.01.org/mailman/listinfo/linux-nvdimm
kbuild test robot
build botI love your patch! Yet something to improve:
Hi Baoquan,
I love your patch! Yet something to improve:
[auto build test ERROR on linus/master]
[also build test ERROR on v4.18-rc3 next-20180704]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Baoquan-He/resource-Use-list_head-to-link-sibling-resource/20180704-121402
config: ia64-allnoconfig (attached as .config)
compiler: ia64-linux-gcc (GCC) 8.1.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
GCC_VERSION=8.1.0 make.cross ARCH=ia64
All errors (new ones prefixed by >>):
arch/ia64/sn/kernel/io_init.c: In function 'sn_io_slot_fixup':
>> arch/ia64/sn/kernel/io_init.c:195:19: error: invalid operands to binary && (have 'int' and 'struct list_head')
if (res->parent && res->parent->child)
~~~~~~~~~~~ ^~ ~~~~~~~~~~~~~~~~~~vim +195 arch/ia64/sn/kernel/io_init.c
^1da177e Linus Torvalds 2005-04-16 142
3ec829b6 John Keller 2005-11-29 143 /*
6f09a925 John Keller 2007-01-30 144 * sn_io_slot_fixup() - We are not running with an ACPI capable PROM,
8ea6091f John Keller 2006-10-04 145 * and need to convert the pci_dev->resource
8ea6091f John Keller 2006-10-04 146 * 'start' and 'end' addresses to mapped addresses,
8ea6091f John Keller 2006-10-04 147 * and setup the pci_controller->window array entries.
^1da177e Linus Torvalds 2005-04-16 148 */
8ea6091f John Keller 2006-10-04 149 void
6f09a925 John Keller 2007-01-30 150 sn_io_slot_fixup(struct pci_dev *dev)
^1da177e Linus Torvalds 2005-04-16 151 {
^1da177e Linus Torvalds 2005-04-16 152 int idx;
ab97b8cc Bjorn Helgaas 2016-03-02 153 struct resource *res;
18c25526 Matt Fleming 2016-05-04 154 unsigned long size;
6f09a925 John Keller 2007-01-30 155 struct pcidev_info *pcidev_info;
6f09a925 John Keller 2007-01-30 156 struct sn_irq_info *sn_irq_info;
6f09a925 John Keller 2007-01-30 157 int status;
6f09a925 John Keller 2007-01-30 158
6f09a925 John Keller 2007-01-30 159 pcidev_info = kzalloc(sizeof(struct pcidev_info), GFP_KERNEL);
6f09a925 John Keller 2007-01-30 160 if (!pcidev_info)
d4ed8084 Harvey Harrison 2008-03-04 161 panic("%s: Unable to alloc memory for pcidev_info", __func__);
6f09a925 John Keller 2007-01-30 162
6f09a925 John Keller 2007-01-30 163 sn_irq_info = kzalloc(sizeof(struct sn_irq_info), GFP_KERNEL);
6f09a925 John Keller 2007-01-30 164 if (!sn_irq_info)
d4ed8084 Harvey Harrison 2008-03-04 165 panic("%s: Unable to alloc memory for sn_irq_info", __func__);
6f09a925 John Keller 2007-01-30 166
6f09a925 John Keller 2007-01-30 167 /* Call to retrieve pci device information needed by kernel. */
6f09a925 John Keller 2007-01-30 168 status = sal_get_pcidev_info((u64) pci_domain_nr(dev),
6f09a925 John Keller 2007-01-30 169 (u64) dev->bus->number,
6f09a925 John Keller 2007-01-30 170 dev->devfn,
6f09a925 John Keller 2007-01-30 171 (u64) __pa(pcidev_info),
6f09a925 John Keller 2007-01-30 172 (u64) __pa(sn_irq_info));
6f09a925 John Keller 2007-01-30 173
80a03e29 Stoyan Gaydarov 2009-03-10 174 BUG_ON(status); /* Cannot get platform pci device information */
6f09a925 John Keller 2007-01-30 175
3ec829b6 John Keller 2005-11-29 176
^1da177e Linus Torvalds 2005-04-16 177 /* Copy over PIO Mapped Addresses */
^1da177e Linus Torvalds 2005-04-16 178 for (idx = 0; idx <= PCI_ROM_RESOURCE; idx++) {
ab97b8cc Bjorn Helgaas 2016-03-02 179 if (!pcidev_info->pdi_pio_mapped_addr[idx])
^1da177e Linus Torvalds 2005-04-16 180 continue;
^1da177e Linus Torvalds 2005-04-16 181
ab97b8cc Bjorn Helgaas 2016-03-02 182 res = &dev->resource[idx];
ab97b8cc Bjorn Helgaas 2016-03-02 183
ab97b8cc Bjorn Helgaas 2016-03-02 184 size = res->end - res->start;
ab97b8cc Bjorn Helgaas 2016-03-02 185 if (size == 0)
3ec829b6 John Keller 2005-11-29 186 continue;
ab97b8cc Bjorn Helgaas 2016-03-02 187
240504ad Bjorn Helgaas 2016-03-02 188 res->start = pcidev_info->pdi_pio_mapped_addr[idx];
18c25526 Matt Fleming 2016-05-04 189 res->end = res->start + size;
64715725 Bernhard Walle 2007-03-18 190
64715725 Bernhard Walle 2007-03-18 191 /*
64715725 Bernhard Walle 2007-03-18 192 * if it's already in the device structure, remove it before
64715725 Bernhard Walle 2007-03-18 193 * inserting
64715725 Bernhard Walle 2007-03-18 194 */
ab97b8cc Bjorn Helgaas 2016-03-02 @195 if (res->parent && res->parent->child)
ab97b8cc Bjorn Helgaas 2016-03-02 196 release_resource(res);
64715725 Bernhard Walle 2007-03-18 197
ab97b8cc Bjorn Helgaas 2016-03-02 198 if (res->flags & IORESOURCE_IO)
ab97b8cc Bjorn Helgaas 2016-03-02 199 insert_resource(&ioport_resource, res);
^1da177e Linus Torvalds 2005-04-16 200 else
ab97b8cc Bjorn Helgaas 2016-03-02 201 insert_resource(&iomem_resource, res);
d7ad2254 John Keller 2007-07-09 202 /*
240504ad Bjorn Helgaas 2016-03-02 203 * If ROM, mark as shadowed in PROM.
d7ad2254 John Keller 2007-07-09 204 */
d7ad2254 John Keller 2007-07-09 205 if (idx == PCI_ROM_RESOURCE) {
240504ad Bjorn Helgaas 2016-03-02 206 pci_disable_rom(dev);
240504ad Bjorn Helgaas 2016-03-02 207 res->flags = IORESOURCE_MEM | IORESOURCE_ROM_SHADOW |
240504ad Bjorn Helgaas 2016-03-02 208 IORESOURCE_PCI_FIXED;
d7ad2254 John Keller 2007-07-09 209 }
^1da177e Linus Torvalds 2005-04-16 210 }
6f09a925 John Keller 2007-01-30 211
6f09a925 John Keller 2007-01-30 212 sn_pci_fixup_slot(dev, pcidev_info, sn_irq_info);
^1da177e Linus Torvalds 2005-04-16 213 }
6f09a925 John Keller 2007-01-30 214 EXPORT_SYMBOL(sn_io_slot_fixup);
6f09a925 John Keller 2007-01-30 215 :::::: The code at line 195 was first introduced by commit
:::::: ab97b8cc560eabfd8139dd97924a09e46a3c9632 ia64/PCI: Use temporary struct resource * to avoid repetition
:::::: TO: Bjorn Helgaas <[email protected]> :::::: CC: Bjorn Helgaas <[email protected]>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
kbuild test robot
build botI love your patch! Yet something to improve:
Hi Baoquan,
I love your patch! Yet something to improve:
[auto build test ERROR on linus/master]
[also build test ERROR on v4.18-rc3 next-20180704]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Baoquan-He/resource-Use-list_head-to-link-sibling-resource/20180704-121402
config: mips-rb532_defconfig (attached as .config)
compiler: mipsel-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
GCC_VERSION=7.2.0 make.cross ARCH=mips
All error/warnings (new ones prefixed by >>):
>> arch/mips/pci/pci-rc32434.c:57:11: error: initialization from incompatible pointer type [-Werror=incompatible-pointer-types]
.child = &rc32434_res_pci_mem2
^
arch/mips/pci/pci-rc32434.c:57:11: note: (near initialization for 'rc32434_res_pci_mem1.child.next')
>> arch/mips/pci/pci-rc32434.c:51:47: warning: missing braces around initializer [-Wmissing-braces]
static struct resource rc32434_res_pci_mem1 = {
^
arch/mips/pci/pci-rc32434.c:60:47: warning: missing braces around initializer [-Wmissing-braces]
static struct resource rc32434_res_pci_mem2 = {
^cc1: some warnings being treated as errors
vim +57 arch/mips/pci/pci-rc32434.c
73b4390f Ralf Baechle 2008-07-16 50
73b4390f Ralf Baechle 2008-07-16 @51 static struct resource rc32434_res_pci_mem1 = {
73b4390f Ralf Baechle 2008-07-16 52 .name = "PCI MEM1",
73b4390f Ralf Baechle 2008-07-16 53 .start = 0x50000000,
73b4390f Ralf Baechle 2008-07-16 54 .end = 0x5FFFFFFF,
73b4390f Ralf Baechle 2008-07-16 55 .flags = IORESOURCE_MEM,
73b4390f Ralf Baechle 2008-07-16 56 .sibling = NULL,
73b4390f Ralf Baechle 2008-07-16 @57 .child = &rc32434_res_pci_mem2
73b4390f Ralf Baechle 2008-07-16 58 };73b4390f Ralf Baechle 2008-07-16 59
:::::: The code at line 57 was first introduced by commit
:::::: 73b4390fb23456964201abda79f1210fe337d01a [MIPS] Routerboard 532: Support for base system
:::::: TO: Ralf Baechle <[email protected]> :::::: CC: Ralf Baechle <[email protected]>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
Hi,
Quoted 7 lines · kbuild test robot
Hi Baoquan,
I love your patch! Yet something to improve:
[auto build test ERROR on linus/master]
[also build test ERROR on v4.18-rc3 next-20180704]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
Thanks for telling.
I cloned 0day-ci/linut to my local pc.
https://github.com/0day-ci/linux.git
However, I didn't find below branch. And tried to open it in web broswer, also failed.
Quoted 8 lines
url: https://github.com/0day-ci/linux/commits/Baoquan-He/resource-Use-list_head-to-link-sibling-resource/20180704-121402
config: mips-rb532_defconfig (attached as .config)
compiler: mipsel-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
GCC_VERSION=7.2.0 make.cross ARCH=mips
I did find a old one which is for the old version 5 post.
[bhe@linux]$ git remote -v 0day-ci https://github.com/0day-ci/linux.git (fetch) 0day-ci https://github.com/0day-ci/linux.git (push) [bhe@dhcp-128-28 linux]$ git branch -a| grep Baoquan| grep resource remotes/0day-ci/Baoquan-He/resource-Use-list_head-to-link-sibling-resource/20180612-113600
Could you help have a look at this?
Thanks
Baoquan
Quoted 37 lines
All error/warnings (new ones prefixed by >>):
Quoted 1 line
Quoted 1 line
arch/mips/pci/pci-rc32434.c:57:11: error: initialization from incompatible pointer type [-Werror=incompatible-pointer-types].child = &rc32434_res_pci_mem2 ^
arch/mips/pci/pci-rc32434.c:57:11: note: (near initialization for 'rc32434_res_pci_mem1.child.next')Quoted 1 line
Quoted 1 line
arch/mips/pci/pci-rc32434.c:51:47: warning: missing braces around initializer [-Wmissing-braces]static struct resource rc32434_res_pci_mem1 = { ^ arch/mips/pci/pci-rc32434.c:60:47: warning: missing braces around initializer [-Wmissing-braces] static struct resource rc32434_res_pci_mem2 = { ^cc1: some warnings being treated as errors
vim +57
arch/mips/pci/pci-rc32434.c
73b4390fRalf Baechle 2008-07-16 5073b4390f Ralf Baechle 2008-07-16 @51 static struct resource rc32434_res_pci_mem1 = { 73b4390f Ralf Baechle 2008-07-16 52 .name = "PCI MEM1", 73b4390f Ralf Baechle 2008-07-16 53 .start = 0x50000000, 73b4390f Ralf Baechle 2008-07-16 54 .end = 0x5FFFFFFF, 73b4390f Ralf Baechle 2008-07-16 55 .flags = IORESOURCE_MEM, 73b4390f Ralf Baechle 2008-07-16 56 .sibling = NULL, 73b4390f Ralf Baechle 2008-07-16 @57 .child = &rc32434_res_pci_mem2 73b4390f Ralf Baechle 2008-07-16 58 };
73b4390fRalf Baechle 2008-07-16 59:::::: The code at line 57 was first introduced by commit
::::::73b4390fb23456964201abda79f1210fe337d01a[MIPS] Routerboard 532: Support for base system:::::: TO: Ralf Baechle <ralf-6z/[email protected]> :::::: CC: Ralf Baechle <ralf-6z/[email protected]>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
Quoted 4 lines · Baoquan He
On 07/05/18 at 01:00am, kbuild test robot wrote:
However, I didn't find below branch. And tried to open it in web broswer, also failed.
While this is kinda valid point...
Quoted 1 line
Could you help have a look at this?
...isn't obvious that you didn't change the file mentioned in a report? Just take latest linux-next and you will see.
Quoted 38 lines
Quoted 36 lines
All error/warnings (new ones prefixed by >>):
Quoted 1 line
Quoted 1 line
arch/mips/pci/pci-rc32434.c:57:11: error: initialization from incompatible pointer type [-Werror=incompatible-pointer-types].child = &rc32434_res_pci_mem2 ^
arch/mips/pci/pci-rc32434.c:57:11: note: (near initialization for 'rc32434_res_pci_mem1.child.next')Quoted 1 line
Quoted 1 line
arch/mips/pci/pci-rc32434.c:51:47: warning: missing braces around initializer [-Wmissing-braces]static struct resource rc32434_res_pci_mem1 = { ^ arch/mips/pci/pci-rc32434.c:60:47: warning: missing braces around initializer [-Wmissing-braces] static struct resource rc32434_res_pci_mem2 = { ^cc1: some warnings being treated as errors
vim +57
arch/mips/pci/pci-rc32434.c
73b4390fRalf Baechle 2008-07-16 5073b4390fRalf Baechle 2008-07-16 @51 static struct resourcerc32434_res_pci_mem1= {73b4390f Ralf Baechle 2008-07-16 52 .name = "PCI MEM1", 73b4390f Ralf Baechle 2008-07-16 53 .start = 0x50000000, 73b4390f Ralf Baechle 2008-07-16 54 .end = 0x5FFFFFFF, 73b4390f Ralf Baechle 2008-07-16 55 .flags = IORESOURCE_MEM, 73b4390f Ralf Baechle 2008-07-16 56 .sibling = NULL, 73b4390f Ralf Baechle 2008-07-16 @57 .child = &rc32434_res_pci_mem2
73b4390fRalf Baechle 2008-07-16 58 };73b4390fRalf Baechle 2008-07-16 59:::::: The code at line 57 was first introduced by commit
::::::73b4390fb23456964201abda79f1210fe337d01a[MIPS] Routerboard 532: Support for base system:::::: TO: Ralf Baechle <[email protected]>
:::::: CC: Ralf Baechle <[email protected]>---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
Signature · 2 lines
With Best Regards, Andy Shevchenko
Quoted 6 lines · Andy Shevchenko
Quoted 4 lines · Baoquan He
On 07/05/18 at 01:00am, kbuild test robot wrote:
However, I didn't find below branch. And tried to open it in web broswer, also failed.
Quoted 6 lines
While this is kinda valid point...
Quoted 1 line
Could you help have a look at this?
...isn't obvious that you didn't change the file mentioned in a report? Just take latest linux-next and you will see.
Yes, it's clear to me. Just want to use the way to cross compile them on ia64 and mips, hope I can find out all missed places on these ARCHes. Now I think I can apply patches on linux-next, and use the config attached to compile. Thanks.
Quoted 46 lines
Quoted 40 lines
Quoted 38 lines
All error/warnings (new ones prefixed by >>):
Quoted 1 line
Quoted 1 line
arch/mips/pci/pci-rc32434.c:57:11: error: initialization from incompatible pointer type [-Werror=incompatible-pointer-types].child = &rc32434_res_pci_mem2 ^
arch/mips/pci/pci-rc32434.c:57:11: note: (near initialization for 'rc32434_res_pci_mem1.child.next')Quoted 1 line
Quoted 1 line
arch/mips/pci/pci-rc32434.c:51:47: warning: missing braces around initializer [-Wmissing-braces]static struct resource rc32434_res_pci_mem1 = { ^ arch/mips/pci/pci-rc32434.c:60:47: warning: missing braces around initializer [-Wmissing-braces] static struct resource rc32434_res_pci_mem2 = { ^cc1: some warnings being treated as errors
vim +57
arch/mips/pci/pci-rc32434.c
73b4390fRalf Baechle 2008-07-16 5073b4390fRalf Baechle 2008-07-16 @51 static struct resourcerc32434_res_pci_mem1= {73b4390f Ralf Baechle 2008-07-16 52 .name = "PCI MEM1", 73b4390f Ralf Baechle 2008-07-16 53 .start = 0x50000000, 73b4390f Ralf Baechle 2008-07-16 54 .end = 0x5FFFFFFF, 73b4390f Ralf Baechle 2008-07-16 55 .flags = IORESOURCE_MEM, 73b4390f Ralf Baechle 2008-07-16 56 .sibling = NULL, 73b4390f Ralf Baechle 2008-07-16 @57 .child = &rc32434_res_pci_mem2
73b4390fRalf Baechle 2008-07-16 58 };73b4390fRalf Baechle 2008-07-16 59:::::: The code at line 57 was first introduced by commit
::::::73b4390fb23456964201abda79f1210fe337d01a[MIPS] Routerboard 532: Support for base system:::::: TO: Ralf Baechle <ralf-6z/[email protected]> :::::: CC: Ralf Baechle <ralf-6z/[email protected]>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel CorporationSignature · 2 lines
With Best Regards, Andy Shevchenko
Hi,
Quoted 11 lines · Baoquan He
Hi,
Quoted 7 lines · kbuild test robot
Hi Baoquan,
I love your patch! Yet something to improve:
[auto build test ERROR on linus/master]
[also build test ERROR on v4.18-rc3 next-20180704]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
Quoted 8 lines
Thanks for telling.
I cloned 0day-ci/linut to my local pc.
https://github.com/0day-ci/linux.gitHowever, I didn't find below branch. And tried to open it in web broswer, also failed.
Sorry for the inconvenience, 0day bot didn't push the branch to github successfully, Just push it manually, you can have a try again.
Thanks,
Xiaolong
Quoted 66 lines
Quoted 9 lines
url: https://github.com/0day-ci/linux/commits/Baoquan-He/resource-Use-list_head-to-link-sibling-resource/20180704-121402
config: mips-rb532_defconfig (attached as .config)
compiler: mipsel-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
GCC_VERSION=7.2.0 make.cross ARCH=mipsI did find a old one which is for the old version 5 post.
[bhe@linux]$ git remote -v 0day-ci https://github.com/0day-ci/linux.git (fetch) 0day-ci https://github.com/0day-ci/linux.git (push) [bhe@dhcp-128-28 linux]$ git branch -a| grep Baoquan| grep resource remotes/0day-ci/Baoquan-He/resource-Use-list_head-to-link-sibling-resource/20180612-113600Could you help have a look at this?
Thanks
BaoquanQuoted 31 lines
All error/warnings (new ones prefixed by >>):
Quoted 1 line
Quoted 1 line
arch/mips/pci/pci-rc32434.c:57:11: error: initialization from incompatible pointer type [-Werror=incompatible-pointer-types].child = &rc32434_res_pci_mem2 ^
arch/mips/pci/pci-rc32434.c:57:11: note: (near initialization for 'rc32434_res_pci_mem1.child.next')Quoted 1 line
Quoted 1 line
arch/mips/pci/pci-rc32434.c:51:47: warning: missing braces around initializer [-Wmissing-braces]static struct resource rc32434_res_pci_mem1 = { ^ arch/mips/pci/pci-rc32434.c:60:47: warning: missing braces around initializer [-Wmissing-braces] static struct resource rc32434_res_pci_mem2 = { ^cc1: some warnings being treated as errors
vim +57
arch/mips/pci/pci-rc32434.c
73b4390fRalf Baechle 2008-07-16 5073b4390f Ralf Baechle 2008-07-16 @51 static struct resource rc32434_res_pci_mem1 = { 73b4390f Ralf Baechle 2008-07-16 52 .name = "PCI MEM1", 73b4390f Ralf Baechle 2008-07-16 53 .start = 0x50000000, 73b4390f Ralf Baechle 2008-07-16 54 .end = 0x5FFFFFFF, 73b4390f Ralf Baechle 2008-07-16 55 .flags = IORESOURCE_MEM, 73b4390f Ralf Baechle 2008-07-16 56 .sibling = NULL, 73b4390f Ralf Baechle 2008-07-16 @57 .child = &rc32434_res_pci_mem2 73b4390f Ralf Baechle 2008-07-16 58 };
73b4390fRalf Baechle 2008-07-16 59:::::: The code at line 57 was first introduced by commit
::::::73b4390fb23456964201abda79f1210fe337d01a[MIPS] Routerboard 532: Support for base systemQuoted 6 lines
:::::: TO: Ralf Baechle <ralf-6z/[email protected]> :::::: CC: Ralf Baechle <ralf-6z/[email protected]>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation_______________________________________________
kbuild-all mailing list [email protected]
https://lists.01.org/mailman/listinfo/kbuild-all
Quoted 19 lines · Ye Xiaolong
Hi,
Quoted 16 lines · Baoquan He
Hi,
Quoted 7 lines · kbuild test robot
Hi Baoquan,
I love your patch! Yet something to improve:
[auto build test ERROR on linus/master]
[also build test ERROR on v4.18-rc3 next-20180704]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]Thanks for telling.
I cloned 0day-ci/linut to my local pc.
https://github.com/0day-ci/linux.git
Quoted 6 lines
Quoted 3 lines
However, I didn't find below branch. And tried to open it in web broswer, also failed.
Sorry for the inconvenience, 0day bot didn't push the branch to github successfully, Just push it manually, you can have a try again.
Thanks, Xiaolong, I have applied them on top of linux-next/master, and copy the config file attached, and run the command to reproduce as suggested. Now I have fixed all those issues reported, will repost.
Quoted 67 lines
Quoted 67 lines
Quoted 10 lines
url: https://github.com/0day-ci/linux/commits/Baoquan-He/resource-Use-list_head-to-link-sibling-resource/20180704-121402
config: mips-rb532_defconfig (attached as .config)
compiler: mipsel-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
GCC_VERSION=7.2.0 make.cross ARCH=mipsI did find a old one which is for the old version 5 post.
[bhe@linux]$ git remote -v 0day-ci https://github.com/0day-ci/linux.git (fetch) 0day-ci https://github.com/0day-ci/linux.git (push) [bhe@dhcp-128-28 linux]$ git branch -a| grep Baoquan| grep resource remotes/0day-ci/Baoquan-He/resource-Use-list_head-to-link-sibling-resource/20180612-113600Could you help have a look at this?
Thanks
BaoquanQuoted 31 lines
All error/warnings (new ones prefixed by >>):
Quoted 1 line
Quoted 1 line
arch/mips/pci/pci-rc32434.c:57:11: error: initialization from incompatible pointer type [-Werror=incompatible-pointer-types].child = &rc32434_res_pci_mem2 ^
arch/mips/pci/pci-rc32434.c:57:11: note: (near initialization for 'rc32434_res_pci_mem1.child.next')Quoted 1 line
Quoted 1 line
arch/mips/pci/pci-rc32434.c:51:47: warning: missing braces around initializer [-Wmissing-braces]static struct resource rc32434_res_pci_mem1 = { ^ arch/mips/pci/pci-rc32434.c:60:47: warning: missing braces around initializer [-Wmissing-braces] static struct resource rc32434_res_pci_mem2 = { ^cc1: some warnings being treated as errors
vim +57
arch/mips/pci/pci-rc32434.c
73b4390fRalf Baechle 2008-07-16 5073b4390f Ralf Baechle 2008-07-16 @51 static struct resource rc32434_res_pci_mem1 = { 73b4390f Ralf Baechle 2008-07-16 52 .name = "PCI MEM1", 73b4390f Ralf Baechle 2008-07-16 53 .start = 0x50000000, 73b4390f Ralf Baechle 2008-07-16 54 .end = 0x5FFFFFFF, 73b4390f Ralf Baechle 2008-07-16 55 .flags = IORESOURCE_MEM, 73b4390f Ralf Baechle 2008-07-16 56 .sibling = NULL, 73b4390f Ralf Baechle 2008-07-16 @57 .child = &rc32434_res_pci_mem2 73b4390f Ralf Baechle 2008-07-16 58 };
73b4390fRalf Baechle 2008-07-16 59:::::: The code at line 57 was first introduced by commit
::::::73b4390fb23456964201abda79f1210fe337d01a[MIPS] Routerboard 532: Support for base systemQuoted 6 lines
:::::: TO: Ralf Baechle <ralf-6z/[email protected]> :::::: CC: Ralf Baechle <ralf-6z/[email protected]>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation_______________________________________________
kbuild-all mailing list [email protected]
https://lists.01.org/mailman/listinfo/kbuild-all
PATCH v6 3/4 resource: add walk_system_ram_res_rev()
In reply to Baoquan HeThis 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.
--- include/linux/ioport.h | 3 +++ kernel/resource.c | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+)
include/linux/ioport.h +3 -0
@@ -279,6 +279,9 @@ extern int walk_system_ram_res(u64 start, u64 end, void *arg, int (*func)(struct resource *, void *));extern int +walk_system_ram_res_rev (u64 start,u64 end,void *arg, +int (*func)(struct resource *,void *)); +extern int walk_iomem_res_desc (unsigned long desc,unsigned long flags,u64 start,u64 end,void *arg,int (*func)(struct resource *,void *));
kernel/resource.c +40 -0
@@ -23,6 +23,8 @@#include <linux/pfn.h> #include <linux/mm.h> #include <linux/resource_ext.h> +#include <linux/string.h> +#include <linux/vmalloc.h> #include <asm/io.h>
@@ -443,6 +445,44 @@ int walk_system_ram_res(u64 start, u64 end, void *arg, }/* +* 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) { +if (start >= end) +break ; +if ((res->flags & flags) != flags) +continue ; +if (res->desc !=IORES_DESC_NONE ) +continue ; +if (res->end < start) +break ; + +if ((res->end >= start) && (res->start < end)) { + ret = (*func)(res, arg); +if (ret) +break ; + } + end = res->start -1 ; + + } +read_unlock (&resource_lock); +return ret; +} + +/* * This function calls the @func callback against all memory ranges, which * are ranges marked as IORESOURCE_MEM and IORESOUCE_BUSY. */
Signature · 6 lines
2.13.6 _______________________________________________ Linux-nvdimm mailing list [email protected] https://lists.01.org/mailman/listinfo/linux-nvdimm
PATCH v6 4/4 kexec_file: Load kernel at top of system RAM if required
In reply to Baoquan HeFor kexec_file loading, if kexec_buf.top_down is 'true', the memory which is used to load kernel/initrd/purgatory is supposed to be allocated from top to down. This is what we have been doing all along in the old kexec loading interface and the kexec loading is still default setting in some distributions. However, the current kexec_file loading interface doesn't do likt this. The function arch_kexec_walk_mem() it calls ignores checking kexec_buf.top_down, but calls walk_system_ram_res() directly to go through all resources of System RAM from bottom to up, to try to find memory region which can contain the specific kexec buffer, then call locate_mem_hole_callback() to allocate memory in that found memory region from top to down. This brings confusion especially when KASLR is widely supported , users have to make clear why kexec/kdump kernel loading position is different between these two interfaces in order to exclude unnecessary noises. Hence these two interfaces need be unified on behaviour.
Here add checking if kexec_buf.top_down is 'true' in arch_kexec_walk_mem(), if yes, call the newly added walk_system_ram_res_rev() to find memory region from top to down to load kernel.
--- kernel/kexec_file.c | 2 ++ 1 file changed, 2 insertions(+)
kernel/kexec_file.c +2 -0
@@ -518,6 +518,8 @@ int __weak arch_kexec_walk_mem(struct kexec_buf *kbuf,IORESOURCE_SYSTEM_RAM |IORESOURCE_BUSY , crashk_res.start, crashk_res.end, kbuf, func); + else if (kbuf->top_down) + return walk_system_ram_res_rev(0, ULONG_MAX, kbuf, func); else return walk_system_ram_res(0, ULONG_MAX, kbuf, func); }
Signature · 1 line
2.13.6