From: Nick Child <nnac123@gmail.com>
To: linuxppc-dev@lists.ozlabs.org
Cc: Nick Child <nick.child@ibm.com>, dja@axtens.net
Subject: [PATCH 00/20] powerpc: Define eligible functions as __init
Date: Wed, 15 Dec 2021 11:12:23 -0500 [thread overview]
Message-ID: <20211215161243.16396-1-nick.child@ibm.com> (raw)
Hello all,
This patchset focuses on redefining/declaring functions that could be
labeled with the macro `__init`. From my understanding, an initialization
function is one which is only needed during the initial phases of booting,
after which it's resources can be freed. I figure that any function which is
only called by other initialization functions may also be labeled as an
initialization function. There are several (mostly static) functions which
can and should be labeled as `__init`. I created some scripts to help
identify these functions. It scans all functions defined in `arch/powerpc`
and, if it is only called by functions with the `__init` attribute, it will
go on to adjust the prototype and definition to include the `__init`
declaration.
Some notes about the scripts:
1. Trying to handle things like functions assigned to macros and function
pointers proved to be a bit too complicated to track. I ended up just
halting the investigation of these functions. In the future, I would
like to be able to attempt to `__init` them but for now we leave them
alone.
2. The proper syntax for adding the `__init` macro is followed as it is
defined in `include/linux/init.h`.
3. There are some odd looking functions that look something like:
`char *__init foo(...`. I have found that this happens in many other
places in the kernel source prior to running the scripts. Additionally,
after running the scripts. I have successfully built all powerpc
defconfigs without error. For these reasons, I assume the odd syntax is
valid but I am interested in other opinions on this.
5. I have run my scripts on the 12/3/2021 `merge` branch (specifically
78e00acdd35c)
After running my script for 3 rounds, they have identified about 250
functions so I tried to break the patches up into related platforms and
subdirectories. There are only two functions with a prototype outside of
`arch/powerpc`, these are `find_via_cuda` and `find_via_pmu`. I put those in
their own patch.
Other than building all the ppc defconfigs, I have tested the changes by
building kernels with and without the patches using defconfigs ppc64le_guest,
powernv and pseries_le. There were no size differences reported in the boot
logs. However, when using `readelf -t` we see the following differences in
the size of the .text section:
ppc64le_guest -> .text decreased in size by 12.8k, init.text unchanged
powernv -> .text decreased in size by 7.7k, init.text unchanged
pseries_le -> .text decreased in size by 9.6k, init.text increased 65.5k
I figured the size differences (or lack of) in .init.text might have something
to do with the requirement that the .init.text "section ends on a page
boundary", as described in `arch/powerpc/kernel/vmlinux.lds.S`.
I am excited to say this is my first attempt at kernel development. I know
this patchset is in no way important but I figured it was a good starting
point. Please let me know if there is anything I am doing wrong or if I can
do anything to help meet the kernel contribution guidelines.
Special thanks to Daniel Axtens for mentoring me and helping me get my first
patchset out!
Nick Child (20):
powerpc/kernel: Add __init attribute to eligible functions
powerpc/lib: Add __init attribute to eligible functions
powerpc/mm: Add __init attribute to eligible functions
powerpc/perf: Add __init attribute to eligible functions
powerpc/sysdev: Add __init attribute to eligible functions
powerpc/xmon: Add __init attribute to eligible functions
powerpc/cell: Add __init attribute to eligible functions
powerpc/chrp: Add __init attribute to eligible functions
powerpc/pasemi: Add __init attribute to eligible functions
powerpc/powermac: Add __init attribute to eligible functions
powerpc/powernv: Add __init attribute to eligible functions
powerpc/pseries: Add __init attribute to eligible functions
powerpc/ps3: Add __init attribute to eligible functions
powerpc/4xx: Add __init attribute to eligible functions
powerpc/44x: Add __init attribute to eligible functions
powerpc/embedded6xx: Add __init attribute to eligible functions
powerpc/83xx: Add __init attribute to eligible functions
powerpc/85xx: Add __init attribute to eligible functions
powerpc/512x: Add __init attribute to eligible functions
cuda/pmu: Make find_via_cuda/pmu init functions
arch/powerpc/include/asm/book3s/64/mmu.h | 2 +-
arch/powerpc/include/asm/btext.h | 10 ++--
arch/powerpc/include/asm/cpm2.h | 6 +--
arch/powerpc/include/asm/cpuidle.h | 2 +-
arch/powerpc/include/asm/eeh.h | 2 +-
arch/powerpc/include/asm/fadump-internal.h | 6 +--
arch/powerpc/include/asm/hugetlb.h | 2 +-
arch/powerpc/include/asm/i8259.h | 2 +-
arch/powerpc/include/asm/iommu.h | 2 +-
arch/powerpc/include/asm/ipic.h | 2 +-
arch/powerpc/include/asm/kexec.h | 2 +-
arch/powerpc/include/asm/kvm_guest.h | 2 +-
arch/powerpc/include/asm/mmu_context.h | 2 +-
arch/powerpc/include/asm/mpic.h | 2 +-
arch/powerpc/include/asm/opal.h | 2 +-
arch/powerpc/include/asm/pci.h | 2 +-
arch/powerpc/include/asm/perf_event_server.h | 2 +-
arch/powerpc/include/asm/setup.h | 8 +--
arch/powerpc/include/asm/smu.h | 2 +-
arch/powerpc/include/asm/udbg.h | 10 ++--
arch/powerpc/include/asm/xics.h | 4 +-
arch/powerpc/include/asm/xmon.h | 2 +-
arch/powerpc/kernel/btext.c | 12 ++---
arch/powerpc/kernel/dt_cpu_ftrs.c | 2 +-
arch/powerpc/kernel/eeh_cache.c | 2 +-
arch/powerpc/kernel/fadump.c | 18 +++----
arch/powerpc/kernel/nvram_64.c | 6 +--
arch/powerpc/kernel/pci-common.c | 2 +-
arch/powerpc/kernel/pci_32.c | 4 +-
arch/powerpc/kernel/prom.c | 4 +-
arch/powerpc/kernel/prom_init.c | 12 ++---
arch/powerpc/kernel/rtasd.c | 6 +--
arch/powerpc/kernel/security.c | 4 +-
arch/powerpc/kernel/setup_64.c | 2 +-
arch/powerpc/kernel/smp.c | 4 +-
arch/powerpc/kernel/sysfs.c | 10 ++--
arch/powerpc/kernel/udbg_16550.c | 10 ++--
arch/powerpc/kexec/core.c | 2 +-
arch/powerpc/lib/code-patching.c | 2 +-
arch/powerpc/lib/feature-fixups.c | 26 +++++-----
arch/powerpc/mm/book3s32/mmu.c | 2 +-
arch/powerpc/mm/book3s64/hash_hugetlbpage.c | 2 +-
arch/powerpc/mm/book3s64/hash_utils.c | 6 +--
arch/powerpc/mm/book3s64/mmu_context.c | 2 +-
arch/powerpc/mm/book3s64/pkeys.c | 2 +-
arch/powerpc/mm/book3s64/radix_pgtable.c | 4 +-
arch/powerpc/mm/nohash/44x.c | 4 +-
arch/powerpc/mm/nohash/fsl_book3e.c | 2 +-
arch/powerpc/mm/nohash/tlb.c | 4 +-
arch/powerpc/mm/numa.c | 6 +--
arch/powerpc/mm/ptdump/ptdump.c | 2 +-
arch/powerpc/perf/core-book3s.c | 2 +-
arch/powerpc/perf/generic-compat-pmu.c | 2 +-
arch/powerpc/perf/internal.h | 18 +++----
arch/powerpc/perf/power10-pmu.c | 2 +-
arch/powerpc/perf/power5+-pmu.c | 2 +-
arch/powerpc/perf/power5-pmu.c | 2 +-
arch/powerpc/perf/power6-pmu.c | 2 +-
arch/powerpc/perf/power7-pmu.c | 2 +-
arch/powerpc/perf/power8-pmu.c | 2 +-
arch/powerpc/perf/power9-pmu.c | 2 +-
arch/powerpc/perf/ppc970-pmu.c | 2 +-
arch/powerpc/platforms/44x/fsp2.c | 4 +-
arch/powerpc/platforms/4xx/cpm.c | 4 +-
arch/powerpc/platforms/4xx/pci.c | 2 +-
arch/powerpc/platforms/512x/clock-commonclk.c | 52 +++++++++----------
arch/powerpc/platforms/512x/mpc512x.h | 4 +-
arch/powerpc/platforms/512x/mpc512x_shared.c | 4 +-
arch/powerpc/platforms/83xx/km83xx.c | 2 +-
arch/powerpc/platforms/83xx/mpc834x_mds.c | 2 +-
arch/powerpc/platforms/83xx/mpc837x_mds.c | 2 +-
arch/powerpc/platforms/83xx/mpc837x_rdb.c | 2 +-
arch/powerpc/platforms/83xx/mpc83xx.h | 6 +--
arch/powerpc/platforms/83xx/usb.c | 6 +--
arch/powerpc/platforms/85xx/ge_imp3a.c | 2 +-
arch/powerpc/platforms/85xx/mpc85xx_cds.c | 2 +-
.../platforms/85xx/socrates_fpga_pic.c | 2 +-
.../platforms/85xx/socrates_fpga_pic.h | 2 +-
arch/powerpc/platforms/85xx/xes_mpc85xx.c | 4 +-
arch/powerpc/platforms/cell/cbe_regs.c | 2 +-
arch/powerpc/platforms/cell/iommu.c | 14 ++---
arch/powerpc/platforms/cell/spu_base.c | 6 +--
arch/powerpc/platforms/cell/spu_manage.c | 16 +++---
arch/powerpc/platforms/cell/spufs/inode.c | 2 +-
arch/powerpc/platforms/chrp/pegasos_eth.c | 2 +-
arch/powerpc/platforms/embedded6xx/hlwd-pic.c | 4 +-
arch/powerpc/platforms/embedded6xx/hlwd-pic.h | 2 +-
arch/powerpc/platforms/embedded6xx/holly.c | 2 +-
.../platforms/embedded6xx/usbgecko_udbg.c | 4 +-
arch/powerpc/platforms/embedded6xx/wii.c | 2 +-
arch/powerpc/platforms/pasemi/msi.c | 2 +-
arch/powerpc/platforms/pasemi/pasemi.h | 2 +-
arch/powerpc/platforms/pasemi/pci.c | 2 +-
arch/powerpc/platforms/pasemi/setup.c | 2 +-
arch/powerpc/platforms/powermac/feature.c | 2 +-
arch/powerpc/platforms/powermac/nvram.c | 2 +-
arch/powerpc/platforms/powermac/pfunc_base.c | 6 +--
arch/powerpc/platforms/powermac/setup.c | 6 +--
arch/powerpc/platforms/powermac/smp.c | 4 +-
arch/powerpc/platforms/powermac/udbg_scc.c | 2 +-
arch/powerpc/platforms/powernv/idle.c | 6 +--
arch/powerpc/platforms/powernv/opal-core.c | 6 +--
arch/powerpc/platforms/powernv/opal-fadump.c | 2 +-
arch/powerpc/platforms/powernv/opal-msglog.c | 4 +-
arch/powerpc/platforms/powernv/opal-power.c | 2 +-
.../powerpc/platforms/powernv/opal-powercap.c | 2 +-
arch/powerpc/platforms/powernv/opal-rtc.c | 2 +-
.../platforms/powernv/opal-sensor-groups.c | 4 +-
arch/powerpc/platforms/powernv/opal.c | 8 +--
arch/powerpc/platforms/powernv/pci-ioda.c | 4 +-
arch/powerpc/platforms/powernv/powernv.h | 4 +-
arch/powerpc/platforms/powernv/rng.c | 2 +-
arch/powerpc/platforms/powernv/setup.c | 6 +--
arch/powerpc/platforms/ps3/gelic_udbg.c | 2 +-
arch/powerpc/platforms/ps3/mm.c | 4 +-
arch/powerpc/platforms/ps3/os-area.c | 4 +-
arch/powerpc/platforms/ps3/platform.h | 14 ++---
arch/powerpc/platforms/ps3/repository.c | 20 +++----
arch/powerpc/platforms/ps3/smp.c | 2 +-
arch/powerpc/platforms/ps3/spu.c | 2 +-
.../powerpc/platforms/pseries/event_sources.c | 2 +-
arch/powerpc/platforms/pseries/iommu.c | 2 +-
arch/powerpc/platforms/pseries/lpar.c | 6 +--
arch/powerpc/platforms/pseries/pseries.h | 2 +-
arch/powerpc/platforms/pseries/rtas-fadump.c | 6 +--
arch/powerpc/platforms/pseries/setup.c | 4 +-
arch/powerpc/platforms/pseries/vas.c | 2 +-
arch/powerpc/platforms/pseries/vio.c | 6 +--
arch/powerpc/sysdev/cpm2.c | 6 +--
arch/powerpc/sysdev/dart_iommu.c | 2 +-
arch/powerpc/sysdev/fsl_mpic_err.c | 4 +-
arch/powerpc/sysdev/fsl_pci.c | 2 +-
arch/powerpc/sysdev/fsl_pci.h | 2 +-
arch/powerpc/sysdev/i8259.c | 2 +-
arch/powerpc/sysdev/ipic.c | 2 +-
arch/powerpc/sysdev/mpic.c | 2 +-
arch/powerpc/sysdev/mpic.h | 10 ++--
arch/powerpc/sysdev/mpic_msi.c | 6 +--
arch/powerpc/sysdev/mpic_timer.c | 6 +--
arch/powerpc/sysdev/mpic_u3msi.c | 2 +-
arch/powerpc/sysdev/tsi108_pci.c | 2 +-
arch/powerpc/sysdev/udbg_memcons.c | 2 +-
arch/powerpc/sysdev/xics/icp-hv.c | 2 +-
arch/powerpc/sysdev/xics/icp-opal.c | 2 +-
arch/powerpc/sysdev/xics/xics-common.c | 2 +-
arch/powerpc/sysdev/xive/native.c | 4 +-
arch/powerpc/sysdev/xive/spapr.c | 6 +--
arch/powerpc/xmon/xmon.c | 2 +-
include/linux/cuda.h | 2 +-
include/linux/pmu.h | 2 +-
150 files changed, 334 insertions(+), 334 deletions(-)
--
2.25.1
next reply other threads:[~2021-12-16 8:11 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-15 16:12 Nick Child [this message]
2021-12-15 16:12 ` [PATCH 01/20] powerpc/kernel: Add __init attribute to eligible functions Nick Child
2021-12-15 16:12 ` [PATCH 02/20] powerpc/lib: " Nick Child
2021-12-15 16:12 ` [PATCH 03/20] powerpc/mm: " Nick Child
2021-12-15 16:12 ` [PATCH 04/20] powerpc/perf: " Nick Child
2021-12-15 16:12 ` [PATCH 05/20] powerpc/sysdev: " Nick Child
2021-12-15 16:12 ` [PATCH 06/20] powerpc/xmon: " Nick Child
2021-12-15 16:12 ` [PATCH 07/20] powerpc/cell: " Nick Child
2021-12-15 16:12 ` [PATCH 08/20] powerpc/chrp: " Nick Child
2021-12-15 16:12 ` [PATCH 09/20] powerpc/pasemi: " Nick Child
2021-12-15 16:12 ` [PATCH 10/20] powerpc/powermac: " Nick Child
2021-12-15 16:12 ` [PATCH 11/20] powerpc/powernv: " Nick Child
2021-12-15 16:12 ` [PATCH 12/20] powerpc/pseries: " Nick Child
2021-12-15 16:12 ` [PATCH 13/20] powerpc/ps3: " Nick Child
2021-12-15 16:12 ` [PATCH 14/20] powerpc/4xx: " Nick Child
2021-12-15 16:12 ` [PATCH 15/20] powerpc/44x: " Nick Child
2021-12-15 16:12 ` [PATCH 16/20] powerpc/embedded6xx: " Nick Child
2021-12-15 16:12 ` [PATCH 17/20] powerpc/83xx: " Nick Child
2021-12-15 16:12 ` [PATCH 18/20] powerpc/85xx: " Nick Child
2021-12-15 16:12 ` [PATCH 19/20] powerpc/512x: " Nick Child
2021-12-15 16:12 ` [PATCH 20/20] cuda/pmu: Make find_via_cuda/pmu init functions Nick Child
2021-12-16 9:44 ` [PATCH 00/20] powerpc: Define eligible functions as __init Christophe Leroy
2021-12-16 9:47 ` Christophe Leroy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211215161243.16396-1-nick.child@ibm.com \
--to=nnac123@gmail.com \
--cc=dja@axtens.net \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=nick.child@ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox