xen/arm: Move in/out code to/from init section
cover xen/arm: Move in/out code to/from init section
Hello,
This small series add/remove __init on different functions. This allow Xen to free around 8Kb more of memory after it has finished to boot.
Xen size in memory before to free init section: 1029Kb Freed memory init: 288Kb
Regards,
Julien Grall (6):
arm/setup: Add missing __init to add_boot_module
xen/arm: domain_build: Move all DOM0 building code in init section xen/arm: kernel: Move kernel loading code in init section xen/arm: device: Move device_type in init section
xen/arm: platforms: Move init_time and specific_mapping in init
section
xen/arm: SMP: Move out of the init section the code to bring up a CPU
xen/arch/arm/arm32/smpboot.c | 4 +-- xen/arch/arm/device.c | 2 +- xen/arch/arm/domain_build.c | 66 ++++++++++++++++++------------------ xen/arch/arm/kernel.c | 30 ++++++++-------- xen/arch/arm/kernel.h | 4 +-- xen/arch/arm/platform.c | 2 +- xen/arch/arm/platforms/exynos5.c | 4 +-- xen/arch/arm/platforms/omap5.c | 4 +-- xen/arch/arm/platforms/xgene-storm.c | 16 ++++----- xen/arch/arm/setup.c | 6 ++-- xen/arch/arm/smpboot.c | 2 +- xen/include/asm-arm/device.h | 2 +- xen/include/asm-arm/setup.h | 10 +++--- xen/include/asm-arm/smp.h | 2 +- 14 files changed, 77 insertions(+), 77 deletions(-)
Signature · 1 line
2.1.4
PATCH 1/6 arm/setup: Add missing __init to add_boot_module
add_boot_module is calling a function which lies in the init section. Furthermore, it's only used during Xen boot.
--- xen/arch/arm/setup.c | 6 +++--- xen/include/asm-arm/setup.h | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-)
xen/arch/arm/setup.c +3 -3
@@ -185,9 +185,9 @@ static void dt_unreserved_regions(paddr_t s, paddr_t e,cb (s, e); } -struct bootmodule *add_boot_module (bootmodule_kind kind, -paddr_t start,paddr_t size, -const char *cmdline) +struct bootmodule __init *add_boot_module (bootmodule_kind kind, +paddr_t start,paddr_t size, +const char *cmdline) {struct bootmodules *mods = &bootinfo.modules;struct bootmodule *mod;
xen/include/asm-arm/setup.h +4 -4
@@ -60,10 +60,10 @@ void discard_initial_modules(void);size_t __init boot_fdt_info (const void *fdt,paddr_t paddr);const char __init *boot_fdt_cmdline (const void *fdt); -struct bootmodule *add_boot_module (bootmodule_kind kind, -paddr_t start,paddr_t size, -const char *cmdline); -struct bootmodule *boot_module_find_by_kind (bootmodule_kind kind); +struct bootmodule __init *add_boot_module (bootmodule_kind kind, +paddr_t start,paddr_t size, +const char *cmdline); +struct bootmodule __init *boot_module_find_by_kind (bootmodule_kind kind);const char *__init boot_module_kind_as_string (bootmodule_kind kind);#endif
Signature · 1 line
2.1.4
Re: [PATCH 1/6] arm/setup: Add missing __init to add_boot_module
Quoted 14 lines · Julien Grall
add_boot_moduleis calling a function which lies in the init section. Furthermore, it's only used during Xen boot.Signed-off-by Julien Grall <[email protected]>--- xen/arch/arm/setup.c | 6 +++--- xen/include/asm-arm/setup.h | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-)xen/arch/arm/setup.c +0
-0
xen/arch/arm/setup.c static void dt_unreserved_regions(paddr_t s, paddr_t e, · line 188
Quoted 7 lines
xen/arch/arm/setup.c +1
-3@@ -185,9 +185,9 @@ static void dt_unreserved_regions(paddr_t s, paddr_t e,cb (s, e); } -struct bootmodule *add_boot_module (bootmodule_kind kind, -paddr_t start,paddr_t size, -const char *cmdline) +struct bootmodule __init *add_boot_module(bootmodule_kind kind,
__init should be after the type, rather than spliced into the middle of it.
"struct bootmodule * __init add_boot_module(...)" should work.
However, only static functions should be annotated at the definition. non-static functions can get their annotation from the declaration alone.
Quoted 24 lines
xen/arch/arm/setup.c +2
-0+ paddr_t start, paddr_t size, + const char *cmdline) { struct bootmodules *mods = &bootinfo.modules;struct bootmodule *mod;xen/include/asm-arm/setup.h +4
-4@@ -60,10 +60,10 @@ void discard_initial_modules(void);size_t __init boot_fdt_info (const void *fdt,paddr_t paddr);const char __init *boot_fdt_cmdline (const void *fdt); -struct bootmodule *add_boot_module (bootmodule_kind kind, -paddr_t start,paddr_t size, -const char *cmdline); -struct bootmodule *boot_module_find_by_kind (bootmodule_kind kind); +struct bootmodule __init *add_boot_module (bootmodule_kind kind, +paddr_t start,paddr_t size, +const char *cmdline); +struct bootmodule __init *boot_module_find_by_kind (bootmodule_kind kind);const char *__init boot_module_kind_as_string (bootmodule_kind kind);#endif
Re: [PATCH 1/6] arm/setup: Add missing __init to add_boot_module
Quoted 18 lines · Andrew Cooper
Quoted 17 lines · Julien Grall
add_boot_moduleis calling a function which lies in the init section. Furthermore, it's only used during Xen boot.Signed-off-by Julien Grall <[email protected]>--- xen/arch/arm/setup.c | 6 +++--- xen/include/asm-arm/setup.h | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-)xen/arch/arm/setup.c +0
-0@@ -185,9 +185,9 @@ static void dt_unreserved_regions(paddr_t s, paddr_t e,cb (s, e); }
Quoted 6 lines
xen/arch/arm/setup.c static void dt_unreserved_regions(paddr_t s, paddr_t e, · line 188
Quoted 4 lines
xen/arch/arm/setup.c +1
-3-struct bootmodule *add_boot_module (bootmodule_kind kind, -paddr_t start,paddr_t size, -const char *cmdline) +struct bootmodule __init *add_boot_module(bootmodule_kind kind,
__initshould be after the type, rather than spliced into the middle of it.
Ok.
Quoted 4 lines
"struct bootmodule *
__initadd_boot_module(...)" should work.However, only static functions should be annotated at the definition. non-static functions can get their annotation from the declaration alone.
It's useful for documentation purpose... You directly know this function should be only used during Xen boot time.
Regards,
Signature · 1 line
Julien Grall
PATCH 2/6 xen/arm: domain_build: Move all DOM0 building code in init section
In reply to Julien GrallThe code to build DOM0 is only used during Xen boot.
--- xen/arch/arm/domain_build.c | 66 ++++++++++++++++++++++----------------------- xen/include/asm-arm/setup.h | 2 +- 2 files changed, 34 insertions(+), 34 deletions(-)
xen/arch/arm/domain_build.c +33 -33
@@ -76,7 +76,7 @@ struct vcpu *__init alloc_dom0_vcpu0(struct domain *dom0)return alloc_vcpu (dom0,0 ,0 ); } -static unsigned int get_11_allocation_size (paddr_t size) +static unsigned int __init get_11_allocation_size (paddr_t size) {/* * get_order_from_bytes returns the order greater than or equal to
@@ -94,10 +94,10 @@ static unsigned int get_11_allocation_size(paddr_t size)* Returns false if the memory would be below bank 0 or we have run * out of banks. In this case it will free the pages. */ -static bool_t insert_11_bank (struct domain *d, -struct kernel_info *kinfo, -struct page_info *pg, -unsigned int order) +static bool_t __init insert_11_bank (struct domain *d, +struct kernel_info *kinfo, +struct page_info *pg, +unsigned int order) {int res, i;paddr_t spfn;
@@ -240,7 +240,8 @@ fail:* (as described above) we allow higher allocations and continue until * that runs out (or we have allocated sufficient dom0 memory). */ -static void allocate_memory_11 (struct domain *d,struct kernel_info *kinfo) +static void __init allocate_memory_11 (struct domain *d, +struct kernel_info *kinfo) {const unsigned int min_low_order =get_order_from_bytes (min_t (paddr_t, dom0_mem,MB (128 )));
@@ -348,7 +349,7 @@ static void allocate_memory_11(struct domain *d, struct kernel_info *kinfo) } } -static void allocate_memory (struct domain *d,struct kernel_info *kinfo) +static void __init allocate_memory (struct domain *d,struct kernel_info *kinfo) {struct dt_device_node *memory =NULL ;
@@ -398,8 +399,8 @@ static void allocate_memory(struct domain *d, struct kernel_info *kinfo) } } -static int write_properties (struct domain *d,struct kernel_info *kinfo, -const struct dt_device_node *node) +static int __init write_properties (struct domain *d,struct kernel_info *kinfo, +const struct dt_device_node *node) {const char *bootargs =NULL ;const struct dt_property *prop;
@@ -504,8 +505,8 @@ static int write_properties(struct domain *d, struct kernel_info *kinfo,typedef __be32 gic_interrupt_t [3 ]; -static void set_interrupt_ppi (gic_interrupt_t interrupt,unsigned int irq, -unsigned int cpumask,unsigned int level) +static void __init set_interrupt_ppi (gic_interrupt_t interrupt,unsigned int irq, +unsigned int cpumask,unsigned int level) {__be32 *cells = interrupt;
@@ -523,8 +524,8 @@ static void set_interrupt_ppi(gic_interrupt_t interrupt, unsigned int irq,* "interrupts": contains the list of interrupts * "interrupt-parent": link to the GIC */ -static int fdt_property_interrupts (void *fdt,gic_interrupt_t *intr, -unsigned num_irq) +static int __init fdt_property_interrupts (void *fdt,gic_interrupt_t *intr, +unsigned num_irq) {int res;
@@ -538,10 +539,9 @@ static int fdt_property_interrupts(void *fdt, gic_interrupt_t *intr,return res; } -static int make_memory_node (const struct domain *d, -void *fdt, -const struct dt_device_node *parent, -const struct kernel_info *kinfo) +static int __init make_memory_node (const struct domain *d,void *fdt, +const struct dt_device_node *parent, +const struct kernel_info *kinfo) {int res, i;int reg_size =dt_n_addr_cells (parent) +dt_n_size_cells (parent);
@@ -581,8 +581,8 @@ static int make_memory_node(const struct domain *d,return res; } -static int make_hypervisor_node (struct domain *d, -void *fdt,const struct dt_device_node *parent) +static int __init make_hypervisor_node (struct domain *d,void *fdt, +const struct dt_device_node *parent) {const char compat[] = "xen,xen-"__stringify(XEN_VERSION)"."__stringify(XEN_SUBVERSION)"\0"
@@ -646,7 +646,7 @@ static int make_hypervisor_node(struct domain *d,return res; } -static int make_psci_node (void *fdt,const struct dt_device_node *parent) +static int __init make_psci_node (void *fdt,const struct dt_device_node *parent) {int res; const char compat[] =
@@ -681,8 +681,8 @@ static int make_psci_node(void *fdt, const struct dt_device_node *parent)return res; } -static int make_cpus_node (const struct domain *d,void *fdt, -const struct dt_device_node *parent) +static int __init make_cpus_node (const struct domain *d,void *fdt, +const struct dt_device_node *parent) {int res;const struct dt_device_node *cpus =dt_find_node_by_path ("/cpus" );
@@ -785,8 +785,8 @@ static int make_cpus_node(const struct domain *d, void *fdt,return res; } -static int make_gic_node (const struct domain *d,void *fdt, -const struct dt_device_node *node) +static int __init make_gic_node (const struct domain *d,void *fdt, +const struct dt_device_node *node) {const struct dt_device_node *gic = dt_interrupt_controller;int res =0 ;
@@ -834,8 +834,8 @@ static int make_gic_node(const struct domain *d, void *fdt,return res; } -static int make_timer_node (const struct domain *d,void *fdt, -const struct dt_device_node *node) +static int __init make_timer_node (const struct domain *d,void *fdt, +const struct dt_device_node *node) {static const struct dt_device_match timer_ids[]__initconst = {
@@ -910,7 +910,7 @@ static int make_timer_node(const struct domain *d, void *fdt, }/* Map the device in the domain */ -static int map_device (struct domain *d,struct dt_device_node *dev) +static int __init map_device (struct domain *d,struct dt_device_node *dev) {unsigned int nirq;unsigned int naddr;
@@ -1020,8 +1020,8 @@ static int map_device(struct domain *d, struct dt_device_node *dev)return 0 ; } -static int handle_node (struct domain *d,struct kernel_info *kinfo, -struct dt_device_node *node) +static int __init handle_node (struct domain *d,struct kernel_info *kinfo, +struct dt_device_node *node) {static const struct dt_device_match skip_matches[]__initconst = {
@@ -1155,7 +1155,7 @@ static int handle_node(struct domain *d, struct kernel_info *kinfo,return res; } -static int prepare_dtb (struct domain *d,struct kernel_info *kinfo) +static int __init prepare_dtb (struct domain *d,struct kernel_info *kinfo) {const void *fdt;int new_size;
@@ -1192,7 +1192,7 @@ static int prepare_dtb(struct domain *d, struct kernel_info *kinfo)return -EINVAL ; } -static void dtb_load (struct kernel_info *kinfo) +static void __init dtb_load (struct kernel_info *kinfo) {void *__user dtb_virt = (void *__user )(register_t )kinfo->dtb_paddr;unsigned long left;
@@ -1207,7 +1207,7 @@ static void dtb_load(struct kernel_info *kinfo)xfree (kinfo->fdt); } -static void initrd_load (struct kernel_info *kinfo) +static void __init initrd_load (struct kernel_info *kinfo) {const struct bootmodule *mod = kinfo->initrd_bootmodule;paddr_t load_addr = kinfo->initrd_paddr;
@@ -1271,7 +1271,7 @@ static void initrd_load(struct kernel_info *kinfo) } } -int construct_dom0 (struct domain *d) +int __init construct_dom0 (struct domain *d) {struct kernel_info kinfo = {};struct vcpu *saved_current;
xen/include/asm-arm/setup.h +1 -1
@@ -53,7 +53,7 @@ void copy_from_paddr(void *dst, paddr_t paddr, unsigned long len);void arch_get_xen_caps (xen_capabilities_info_t *info); -int construct_dom0 (struct domain *d); +int __init construct_dom0 (struct domain *d);void discard_initial_modules (void );
Signature · 1 line
2.1.4
PATCH 3/6 xen/arm: kernel: Move kernel loading code in init section
In reply to Julien GrallThe code to load the kernel is only used when Xen builds dom0. It happens during the boot.
--- xen/arch/arm/kernel.c | 30 +++++++++++++++--------------- xen/arch/arm/kernel.h | 4 ++-- 2 files changed, 17 insertions(+), 17 deletions(-)
xen/arch/arm/kernel.c +15 -15
@@ -67,8 +67,8 @@ void copy_from_paddr(void *dst, paddr_t paddr, unsigned long len)clear_fixmap (FIXMAP_MISC ); } -static void place_modules (struct kernel_info *info, -paddr_t kernbase,paddr_t kernend) +static void __init place_modules (struct kernel_info *info, +paddr_t kernbase,paddr_t kernend) {/* Align DTB and initrd size to 2Mb. Linux only requires 4 byte alignment */ const struct bootmodule *mod = info->initrd_bootmodule;
@@ -121,7 +121,7 @@ static void place_modules(struct kernel_info *info, info->initrd_paddr = info->dtb_paddr + dtb_len; } -static paddr_t kernel_zimage_place (struct kernel_info *info) +static paddr_t __init kernel_zimage_place (struct kernel_info *info) {paddr_t load_addr;
@@ -153,7 +153,7 @@ static paddr_t kernel_zimage_place(struct kernel_info *info)return load_addr; } -static void kernel_zimage_load (struct kernel_info *info) +static void __init kernel_zimage_load (struct kernel_info *info) {paddr_t load_addr =kernel_zimage_place (info);paddr_t paddr = info->zimage.kernel_addr;
@@ -200,8 +200,8 @@ static void kernel_zimage_load(struct kernel_info *info)/* * Check if the image is a uImage and setup kernel_info */ -static int kernel_uimage_probe (struct kernel_info *info, -paddr_t addr,paddr_t size) +static int __init kernel_uimage_probe (struct kernel_info *info, +paddr_t addr,paddr_t size) {struct {__be32 magic;/* Image Header Magic Number */
@@ -261,8 +261,8 @@ static int kernel_uimage_probe(struct kernel_info *info,/* * Check if the image is a 64-bit Image. */ -static int kernel_zimage64_probe (struct kernel_info *info, -paddr_t addr,paddr_t size) +static int __init kernel_zimage64_probe (struct kernel_info *info, +paddr_t addr,paddr_t size) {/* linux/Documentation/arm64/booting.txt */ struct {
@@ -315,8 +315,8 @@ static int kernel_zimage64_probe(struct kernel_info *info,/* * Check if the image is a 32-bit zImage and setup kernel_info */ -static int kernel_zimage32_probe (struct kernel_info *info, -paddr_t addr,paddr_t size) +static int __init kernel_zimage32_probe (struct kernel_info *info, +paddr_t addr,paddr_t size) {uint32_t zimage[ZIMAGE32_HEADER_LEN /4 ];uint32_t start, end;
@@ -364,7 +364,7 @@ static int kernel_zimage32_probe(struct kernel_info *info,return 0 ; } -static void kernel_elf_load (struct kernel_info *info) +static void __init kernel_elf_load (struct kernel_info *info) {/* * TODO: can the ELF header be used to find the physical address
@@ -387,8 +387,8 @@ static void kernel_elf_load(struct kernel_info *info)free_xenheap_pages (info->elf.kernel_img, info->elf.kernel_order); } -static int kernel_elf_probe (struct kernel_info *info, -paddr_t addr,paddr_t size) +static int __init kernel_elf_probe (struct kernel_info *info, +paddr_t addr,paddr_t size) {int rc;
@@ -439,7 +439,7 @@ err:return rc; } -int kernel_probe (struct kernel_info *info) +int __init kernel_probe (struct kernel_info *info) {struct bootmodule *mod =boot_module_find_by_kind (BOOTMOD_KERNEL );int rc;
@@ -476,7 +476,7 @@ int kernel_probe(struct kernel_info *info)return rc; } -void kernel_load (struct kernel_info *info) +void __init kernel_load (struct kernel_info *info) { info->load (info); }
xen/arch/arm/kernel.h +2 -2
@@ -56,7 +56,7 @@ struct kernel_info {* ->type * ->load hook, and sets loader specific variables ->{zimage,elf} */ -int kernel_probe (struct kernel_info *info); +int __init kernel_probe (struct kernel_info *info);/* * Loads the kernel into guest RAM.
@@ -70,7 +70,7 @@ int kernel_probe(struct kernel_info *info);* ->dtb_paddr * ->initrd_paddr */ -void kernel_load (struct kernel_info *info); +void __init kernel_load (struct kernel_info *info);#endif /* #ifdef __ARCH_ARM_KERNEL_H__ */
Signature · 1 line
2.1.4
Re: [PATCH 3/6] xen/arm: kernel: Move kernel loading code in init section
Quoted 2 lines · Julien Grall
The code to load the kernel is only used when Xen builds dom0. It happens during the boot.
I suppose we don't have dom0 kexec for ARM now or this code is not (won't be) required?
Signature · 1 line
Vitaly
Re: [PATCH 3/6] xen/arm: kernel: Move kernel loading code in init section
Hello,
Quoted 7 lines · Vitaly Kuznetsov
Quoted 2 lines · Julien Grall
The code to load the kernel is only used when Xen builds dom0. It happens during the boot.
I suppose we don't have dom0 kexec for ARM now or this code is not (won't be) required?
We don't have support for DOM0 Kexec and this code is only able to load kernel from the physical RAM (not from a guest memory).
Regards,
Signature · 1 line
Julien Grall
Re: [PATCH 3/6] xen/arm: kernel: Move kernel loading code in init section
Quoted 5 lines · Julien Grall
Hello,
Quoted 2 lines · Vitaly Kuznetsov
Julien Grall <[email protected]> writes:
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
The code to load the kernel is only used when Xen builds dom0. It happens during the boot.
I suppose we don't have dom0 kexec for ARM now or this code is not (won't be) required?
We don't have support for DOM0 Kexec and this code is only able to load kernel from the physical RAM (not from a guest memory).
I don't think you would want to rerun any of this sort of thing again for kexec anyway, it is somewhat like a bootloader, which kexec doesn't rely on AFAIK.
Ian.
PATCH 4/6 xen/arm: device: Move device_type in init section
In reply to Julien GrallThe function is calling device_is_compatible which lies in init section and is only called during Xen boot.
--- xen/arch/arm/device.c | 2 +- xen/include/asm-arm/device.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
xen/arch/arm/device.c +1 -1
@@ -67,7 +67,7 @@ int __init device_init(struct dt_device_node *dev, enum device_type type,return -EBADF ; } -enum device_type device_get_type (const struct dt_device_node *dev) +enum device_type __init device_get_type (const struct dt_device_node *dev) {const struct device_desc *desc;
xen/include/asm-arm/device.h +1 -1
@@ -41,7 +41,7 @@ int __init device_init(struct dt_device_node *dev, enum device_type type,* * Return the device type on success or DEVICE_ANY on failure */ -enum device_type device_get_type (const struct dt_device_node *dev); +enum device_type __init device_get_type (const struct dt_device_node *dev);#define DT_DEVICE_START (_name, _namestr, _type) \ static const struct device_desc __dev_desc_##_name __used \
Signature · 1 line
2.1.4
PATCH 5/6 xen/arm: platforms: Move init_time and specific_mapping in init section
In reply to Julien GrallThe callbacks init_time and specific_mapping are respectively used during timer initialization and DOM0 building. These 2 taks only happen during Xen boot.
--- xen/arch/arm/platforms/exynos5.c | 4 ++-- xen/arch/arm/platforms/omap5.c | 4 ++-- xen/arch/arm/platforms/xgene-storm.c | 16 ++++++++-------- 3 files changed, 12 insertions(+), 12 deletions(-)
xen/arch/arm/platforms/exynos5.c +2 -2
@@ -37,7 +37,7 @@ static bool_t secure_firmware;#define SMC_CMD_CPU1BOOT (-4) -static int exynos5_init_time (void ) +static int __init exynos5_init_time (void ) {uint32_t reg;void __iomem *mct;
@@ -80,7 +80,7 @@ static int exynos5_init_time(void) }/* Additional mappings for dom0 (Not in the DTS) */ -static int exynos5250_specific_mapping (struct domain *d) +static int __init exynos5250_specific_mapping (struct domain *d) {/* Map the chip ID */ map_mmio_regions(d, paddr_to_pfn(EXYNOS5_PA_CHIPID), 1,
xen/arch/arm/platforms/omap5.c +2 -2
@@ -45,7 +45,7 @@ static uint16_t num_den[8][2] = {* clocks, adjusting the increment per clock in hardware accordingly to * maintain a constant count rate. */ -static int omap5_init_time (void ) +static int __init omap5_init_time (void ) {void __iomem *ckgen_prm_base;void __iomem *rt_ct_base;
@@ -99,7 +99,7 @@ static int omap5_init_time(void) }/* Additional mappings for dom0 (not in the DTS) */ -static int omap5_specific_mapping (struct domain *d) +static int __init omap5_specific_mapping (struct domain *d) {/* Map the PRM module */ map_mmio_regions(d, paddr_to_pfn(OMAP5_PRM_BASE), 2,
xen/arch/arm/platforms/xgene-storm.c +8 -8
@@ -40,7 +40,7 @@ static uint32_t xgene_storm_quirks(void)return PLATFORM_QUIRK_GIC_64K_STRIDE |PLATFORM_QUIRK_GUEST_PIRQ_NEED_EOI ; } -static int map_one_mmio (struct domain *d,const char *what, +static int __init map_one_mmio (struct domain *d,const char *what,unsigned long start,unsigned long end) {int ret;
@@ -54,8 +54,8 @@ static int map_one_mmio(struct domain *d, const char *what,return ret; } -static int map_one_spi (struct domain *d,const char *what, -unsigned int spi,unsigned int type) +static int __init map_one_spi (struct domain *d,const char *what, +unsigned int spi,unsigned int type) {unsigned int irq;int ret;
@@ -79,10 +79,10 @@ static int map_one_spi(struct domain *d, const char *what, }/* Creates MMIO mappings base..end as well as 4 SPIs from the given base. */ -static int xgene_storm_pcie_specific_mapping (struct domain *d, -const struct dt_device_node *node, -paddr_t base,paddr_t end, -int base_spi) +static int __init xgene_storm_pcie_specific_mapping (struct domain *d, +const struct dt_device_node *node, +paddr_t base,paddr_t end, +int base_spi) {int ret;
@@ -121,7 +121,7 @@ err:* "interrupt-map" properties to domain 0). Instead for now map the * necessary resources manually. */ -static int xgene_storm_specific_mapping (struct domain *d) +static int __init xgene_storm_specific_mapping (struct domain *d) {struct dt_device_node *node =NULL ;int ret;
Signature · 1 line
2.1.4
PATCH 6/6 xen/arm: SMP: Move out of the init section the code to bring up a CPU
In reply to Julien GrallWhen CPU hotplug will be supported, it will require to bring up a CPU.
---
I'm not sure if we should flag these functions with __cpuinit. The define doesn't do anything.
--- xen/arch/arm/arm32/smpboot.c | 4 ++-- xen/arch/arm/platform.c | 2 +- xen/arch/arm/smpboot.c | 2 +- xen/include/asm-arm/smp.h | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-)
xen/arch/arm/arm32/smpboot.c +2 -2
@@ -8,7 +8,7 @@ int __init arch_smp_init(void)return platform_smp_init (); } -int __init arch_cpu_init (int cpu,struct dt_device_node *dn) +int arch_cpu_init (int cpu,struct dt_device_node *dn) {/* Not needed on ARM32, as there is no relevant information in * the CPU device tree node for ARMv7 CPUs.
@@ -16,7 +16,7 @@ int __init arch_cpu_init(int cpu, struct dt_device_node *dn)return 0 ; } -int __init arch_cpu_up (int cpu) +int arch_cpu_up (int cpu) {return platform_cpu_up (cpu); }
xen/arch/arm/platform.c +1 -1
@@ -108,7 +108,7 @@ int __init platform_specific_mapping(struct domain *d) }#ifdef CONFIG_ARM_32 -int __init platform_cpu_up (int cpu) +int platform_cpu_up (int cpu) {if ( psci_ver )return call_psci_cpu_on (cpu);
xen/arch/arm/smpboot.c +1 -1
@@ -343,7 +343,7 @@ void stop_cpu(void)wfi (); } -int __init cpu_up_send_sgi (int cpu) +int cpu_up_send_sgi (int cpu) {/* We don't know the GIC ID of the CPU until it has woken up, so just * signal everyone and rely on our own smp_up_cpu gate to ensure only
xen/include/asm-arm/smp.h +1 -1
@@ -17,7 +17,7 @@ DECLARE_PER_CPU(cpumask_var_t, cpu_core_mask);extern void noreturnstop_cpu (void ); -extern int arch_smp_init (void ); +extern int __init arch_smp_init (void );extern int arch_cpu_init (int cpu,struct dt_device_node *dn);extern int arch_cpu_up (int cpu);
Signature · 1 line
2.1.4
Hello,
Ping? Any more review for this version of this series?
Regards,
Quoted 35 lines · Julien Grall
Hello,
This small series add/remove
__initon different functions. This allow Xen to free around 8Kb more of memory after it has finished to boot.Xen size in memory before to free init section: 1029Kb Freed memory init: 288Kb
Regards,
Julien Grall (6):
arm/setup: Add missing__inittoadd_boot_module
xen/arm:domain_build: Move all DOM0 building code in init section xen/arm: kernel: Move kernel loading code in init section xen/arm: device: Movedevice_typein init section
xen/arm: platforms: Moveinit_timeandspecific_mappingin init
section
xen/arm: SMP: Move out of the init section the code to bring up a CPUxen/arch/arm/arm32/smpboot.c | 4 +-- xen/arch/arm/device.c | 2 +- xen/arch/arm/domain_build.c | 66 ++++++++++++++++++------------------ xen/arch/arm/kernel.c | 30 ++++++++-------- xen/arch/arm/kernel.h | 4 +-- xen/arch/arm/platform.c | 2 +- xen/arch/arm/platforms/exynos5.c | 4 +-- xen/arch/arm/platforms/omap5.c | 4 +-- xen/arch/arm/platforms/xgene-storm.c | 16 ++++----- xen/arch/arm/setup.c | 6 ++-- xen/arch/arm/smpboot.c | 2 +- xen/include/asm-arm/device.h | 2 +- xen/include/asm-arm/setup.h | 10 +++--- xen/include/asm-arm/smp.h | 2 +- 14 files changed, 77 insertions(+), 77 deletions(-)
Signature · 1 line
Julien Grall
Quoted 3 lines · Julien Grall
Hello,
Ping? Any more review for this version of this series?
I was awaiting a version with the declarations in the right places as pointed out by Andy (including his point about definition vs. prototype I'm afraid, which is the style we use).
Quoted 41 lines
Regards,
Quoted 35 lines · Julien Grall
Hello,
This small series add/remove
__initon different functions. This allow Xen to free around 8Kb more of memory after it has finished to boot.Xen size in memory before to free init section: 1029Kb Freed memory init: 288Kb
Regards,
Julien Grall (6):
arm/setup: Add missing__inittoadd_boot_module
xen/arm:domain_build: Move all DOM0 building code in init section xen/arm: kernel: Move kernel loading code in init section xen/arm: device: Movedevice_typein init section
xen/arm: platforms: Moveinit_timeandspecific_mappingin init
section
xen/arm: SMP: Move out of the init section the code to bring up a CPUxen/arch/arm/arm32/smpboot.c | 4 +-- xen/arch/arm/device.c | 2 +- xen/arch/arm/domain_build.c | 66 ++++++++++++++++++------------------ xen/arch/arm/kernel.c | 30 ++++++++-------- xen/arch/arm/kernel.h | 4 +-- xen/arch/arm/platform.c | 2 +- xen/arch/arm/platforms/exynos5.c | 4 +-- xen/arch/arm/platforms/omap5.c | 4 +-- xen/arch/arm/platforms/xgene-storm.c | 16 ++++----- xen/arch/arm/setup.c | 6 ++-- xen/arch/arm/smpboot.c | 2 +- xen/include/asm-arm/device.h | 2 +- xen/include/asm-arm/setup.h | 10 +++--- xen/include/asm-arm/smp.h | 2 +- 14 files changed, 77 insertions(+), 77 deletions(-)
Hi Ian,
Quoted 8 lines · Ian Campbell
Quoted 3 lines · Julien Grall
Hello,
Ping? Any more review for this version of this series?
I was awaiting a version with the declarations in the right places as pointed out by Andy (including his point about definition vs. prototype I'm afraid, which is the style we use).
I'm not convince about your last point. We have many places (if not all on ARM) where __init is used in the header.
Some of them was even added by you ;). So I would prefer if we keep them, it's more readable. FWIW Linux does it too.
Regards,
Signature · 1 line
Julien Grall
Quoted 6 lines · Julien Grall
Hi Ian,
Quoted 3 lines · Ian Campbell
Quoted 2 lines · Julien Grall
Hello,
Quoted 8 lines
Quoted 5 lines
Quoted 1 line
Ping? Any more review for this version of this series?
I was awaiting a version with the declarations in the right places as pointed out by Andy (including his point about definition vs. prototype I'm afraid, which is the style we use).
I'm not convince about your last point. We have many places (if not all on ARM) where
__initis used in the header.
Those are mistakes, it seems.
Quoted 2 lines
Some of them was even added by you ;). So I would prefer if we keep them, it's more readable. FWIW Linux does it too.
I personally don't particularly care where these things go, but other hypervisor maintainers seem to and we should aim for the code base to be consistent where possible.
If we want to change this coding style then we should do that directly and explicitly, not through the backdoor by just ignoring the policy.
Ian.
Quoted 20 lines
Quoted 1 line
Quoted 1 line · On 02.02.15 at 11:58, <[email protected]> wrote:
Quoted 4 lines · Julien Grall
Quoted 3 lines · Ian Campbell
Quoted 2 lines · Julien Grall
Hello,
Quoted 8 lines
Quoted 5 lines
Quoted 1 line
Ping? Any more review for this version of this series?
I was awaiting a version with the declarations in the right places as pointed out by Andy (including his point about definition vs. prototype I'm afraid, which is the style we use).
I'm not convince about your last point. We have many places (if not all on ARM) where
__initis used in the header.Those are mistakes, it seems.
Quoted 2 lines
Some of them was even added by you ;). So I would prefer if we keep them, it's more readable. FWIW Linux does it too.
Quoted 6 lines
I personally don't particularly care where these things go, but other hypervisor maintainers seem to and we should aim for the code base to be consistent where possible.
If we want to change this coding style then we should do that directly and explicitly, not through the backdoor by just ignoring the policy.
And I think we should strive to keep pointless redundancy down:
There's no point in repeating attributes - either they belong on the declaration (when producer and consumers care), or they belong on the definition (when only the producer cares). Repeating them on the definition when the declaration already has them only results in needless churn when such an attribute later gets changed/ removed, and having producer-relevant attributes on declarations means needless extra work by the compiler (however little that may be - it adds up).
Jan
Quoted 27 lines · Jan Beulich
Quoted 20 lines
Quoted 1 line
Quoted 1 line · On 02.02.15 at 11:58, <[email protected]> wrote:
Quoted 4 lines · Julien Grall
Quoted 3 lines · Ian Campbell
Quoted 2 lines · Julien Grall
Hello,
Quoted 8 lines
Quoted 5 lines
Quoted 1 line
Ping? Any more review for this version of this series?
I was awaiting a version with the declarations in the right places as pointed out by Andy (including his point about definition vs. prototype I'm afraid, which is the style we use).
I'm not convince about your last point. We have many places (if not all on ARM) where
__initis used in the header.Those are mistakes, it seems.
Quoted 2 lines
Some of them was even added by you ;). So I would prefer if we keep them, it's more readable. FWIW Linux does it too.
Quoted 6 lines
I personally don't particularly care where these things go, but other hypervisor maintainers seem to and we should aim for the code base to be consistent where possible.
If we want to change this coding style then we should do that directly and explicitly, not through the backdoor by just ignoring the policy.
Quoted 9 lines
And I think we should strive to keep pointless redundancy down:
There's no point in repeating attributes - either they belong on the declaration (when producer and consumers care), or they belong on the definition (when only the producer cares). Repeating them on the definition when the declaration already has them only results in needless churn when such an attribute later gets changed/ removed, and having producer-relevant attributes on declarations means needless extra work by the compiler (however little that may be - it adds up).
I think we should allow the annotation in both place. When a developer is looking for the prototype of the function, it will likely look at the headers and not the implementation itself.
This may lead to call an init function in code running after the boot. I don't think we can catch it easily during review.
Regards,
Signature · 1 line
Julien Grall
Quoted 39 lines
Quoted 1 line
Quoted 1 line · On 02.02.15 at 13:52, <[email protected]> wrote:
Quoted 27 lines · Jan Beulich
Quoted 20 lines
Quoted 1 line
Quoted 1 line · On 02.02.15 at 11:58, <[email protected]> wrote:
Quoted 4 lines · Julien Grall
Quoted 3 lines · Ian Campbell
Quoted 2 lines · Julien Grall
Hello,
Quoted 8 lines
Quoted 5 lines
Quoted 1 line
Ping? Any more review for this version of this series?
I was awaiting a version with the declarations in the right places as pointed out by Andy (including his point about definition vs. prototype I'm afraid, which is the style we use).
I'm not convince about your last point. We have many places (if not all on ARM) where
__initis used in the header.Those are mistakes, it seems.
Quoted 2 lines
Some of them was even added by you ;). So I would prefer if we keep them, it's more readable. FWIW Linux does it too.
Quoted 6 lines
I personally don't particularly care where these things go, but other hypervisor maintainers seem to and we should aim for the code base to be consistent where possible.
If we want to change this coding style then we should do that directly and explicitly, not through the backdoor by just ignoring the policy.
Quoted 9 lines
And I think we should strive to keep pointless redundancy down:
There's no point in repeating attributes - either they belong on the declaration (when producer and consumers care), or they belong on the definition (when only the producer cares). Repeating them on the definition when the declaration already has them only results in needless churn when such an attribute later gets changed/ removed, and having producer-relevant attributes on declarations means needless extra work by the compiler (however little that may be - it adds up).
Quoted 6 lines
I think we should allow the annotation in both place. When a developer is looking for the prototype of the function, it will likely look at the headers and not the implementation itself.
This may lead to call an init function in code running after the boot. I don't think we can catch it easily during review.
This example in particular makes clear that looking at just the declaration is insufficient in certain cases. Whoever is looking for specific properties of a functions needs to know which ones (s)he cares about, and then look in the appropriate place. Unless a rule gets put in place overriding my personal opinion on this, I'm not going to ack or otherwise accept needless code duplication. If the ARM maintainers feel differently, so be it.
Jan
Quoted 4 lines · Jan Beulich
This example in particular makes clear that looking at just the declaration is insufficient in certain cases.Whoever is looking for specific properties of a functions needs to know which ones (s)he cares about, and then look in the appropriate place.
__init is common attribute that should be looking by anyone calling a function. You can't guess about it.
Quoted 1 line
Unless a rule gets put in place overriding my personal opinion on
this, I'm
Quoted 1 line
not going to ack or otherwise accept needless code duplication.
It may be needless for the compiler but not for some of the developers.
Quoted 1 line
If the ARM maintainers feel differently, so be it.
If you look a the ARM headers (asm-arm) we use __init on the prototype. But x86 and common code is not using it.
The point of this discussion is there is no written rules... It happened because an x86 maintainer shout about inconsistency on the ARM headers on my first patch.
If this is going to be the standard on every headers, this should be written somewhere and not letting the developer guess how the maintainer will feel about it.
Regards,
Signature · 1 line
Julien Grall
Quoted 21 lines · Ian Campbell
Quoted 6 lines · Julien Grall
Hi Ian,
Quoted 3 lines · Ian Campbell
Quoted 2 lines · Julien Grall
Hello,
Quoted 8 lines
Quoted 5 lines
Quoted 1 line
Ping? Any more review for this version of this series?
I was awaiting a version with the declarations in the right places as pointed out by Andy (including his point about definition vs. prototype I'm afraid, which is the style we use).
I'm not convince about your last point. We have many places (if not all on ARM) where
__initis used in the header.Those are mistakes, it seems.
Quoted 2 lines
Some of them was even added by you ;). So I would prefer if we keep them, it's more readable. FWIW Linux does it too.
Quoted 6 lines
I personally don't particularly care where these things go, but other hypervisor maintainers seem to and we should aim for the code base to be consistent where possible.
If we want to change this coding style then we should do that directly and explicitly, not through the backdoor by just ignoring the policy.
Which policy are you talking about? AFAICT, this seems to be an unwritten rule. It is let to the appreciation of the person who review the patches...
Actually, it doesn't seem to have a consensus between maintainers. ARM people seems to allow attributes on prototype and not x86 people.
Regards,
Signature · 1 line
Julien Grall
Quoted 26 lines · Julien Grall
Quoted 25 lines · Ian Campbell
Quoted 6 lines · Julien Grall
Hi Ian,
Quoted 3 lines · Ian Campbell
Quoted 2 lines · Julien Grall
Hello,
Quoted 8 lines
Quoted 5 lines
Quoted 1 line
Ping? Any more review for this version of this series?
I was awaiting a version with the declarations in the right places as pointed out by Andy (including his point about definition vs. prototype I'm afraid, which is the style we use).
I'm not convince about your last point. We have many places (if not all on ARM) where
__initis used in the header.Those are mistakes, it seems.
Quoted 2 lines
Some of them was even added by you ;). So I would prefer if we keep them, it's more readable. FWIW Linux does it too.
I personally don't particularly care where these things go, but other hypervisor maintainers seem to and we should aim for the code base to be consistent where possible.
Quoted 6 lines
Quoted 2 lines
If we want to change this coding style then we should do that directly and explicitly, not through the backdoor by just ignoring the policy.
Which policy are you talking about? AFAICT, this seems to be an unwritten rule. It is let to the appreciation of the person who review the patches...
Regardless of whether it is currently written down it is something which Jan has been consistent about requesting for ages.
We should probably add it to some sort of coding style document though.
Quoted 2 lines
Actually, it doesn't seem to have a consensus between maintainers. ARM people seems to allow attributes on prototype and not x86 people.
This ARM person cares more about consistency with common code and other arches than his own personal feelings on the matter, which are "meh".
Ian.