Skip to content

xen: avoid module usage in non-modular code

Paul Gortmaker linux-arm-kernel lkml xen-devel 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest5 patches 10 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/5xen: audit usages of module.h ; remove unnecessary instancesarch/arm/include/asm/xen/hypercall.h drivers/xen/events/events_2l.c drivers/xen/events/events_base.c +9 more+7 -112 replies
2/5drivers/xen: make [xen-]ballon explicitly non-modulardrivers/xen/balloon.c drivers/xen/xen-balloon.c+3 -150 replies
2/5drivers/xen: make [xen-]ballon explicitly non-modulardrivers/xen/balloon.c drivers/xen/xen-balloon.c+3 -152 replies
3/5drivers/xen: make xenbus_dev_[front/back]end explicitly non-modulardrivers/xen/xenbus/xenbus_dev_backend.c drivers/xen/xenbus/xenbus_dev_frontend.c+4 -220 replies
3/5drivers/xen: make xenbus_dev_[front/back]end explicitly non-modulardrivers/xen/xenbus/xenbus_dev_backend.c drivers/xen/xenbus/xenbus_dev_frontend.c+4 -222 replies
4/5drivers/xen: make sys-hypervisor.c explicitly non-modulardrivers/xen/sys-hypervisor.c+4 -272 replies
5/5drivers/xen: make platform-pci.c explicitly non-modulardrivers/xen/platform-pci.c+6 -100 replies
5/5drivers/xen: make platform-pci.c explicitly non-modulardrivers/xen/platform-pci.c+6 -102 replies

Reviews trailers per patch

5 of 8 patches have a Reviewed-by or Acked-by.

PatchStefano Stabellini
1/5R-b R-b
2/5R-b R-b
2/5R-b R-b
3/5R-b R-b
3/5R-b R-b
4/5
5/5
5/5

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 0/5] xen: avoid module usage in non-modular code

This series of commits is a part of a larger project to ensure people don't reference modular support functions in non-modular code. Overall there was roughly 5k lines of dead code in the kernel due to this. So far we've fixed several areas, like tty, x86, net, ... and we continue to work on other areas.

There are several reasons to not use module support for code that can never be built as a module, but the big ones are:

(1) it is easy to accidentally write unused module_exit and remove code
(2) it can be misleading when reading the source, thinking it can be modular when the Makefile and/or Kconfig prohibit it
(3) it requires the include of the module.h header file which in turn includes nearly everything else.
(4) it gets copied/replicated into other code and spreads like weeds.

For the xen subsystem, there are just five commits:

First, we get rid of "include <linux/module.h>" instances that are completely unnecessary.

Then #2 and #3 and #5 are basically trivial remapping to the appropriate non-modular counterparts, meaning that there is no runtime change here either.

The fourth hypervisor commit is similar, but also has removal of some dead code associated with the module_exit function that will never be called. So the runtime should be the same, but the object file will be different (reduced in size).

Patches created on linux-next and build tested for x86-64 and ARM64 allmodconfig.

---

Cc Boris Ostrovsky <[email protected]>
Cc David Vrabel <[email protected]>
Cc Konrad Rzeszutek Wilk <[email protected]>
Cc linux-arm-kernel at lists.infradead.org
Cc Russell King <[email protected]>
Cc Stefano Stabellini <[email protected]>
Cc xen-devel at lists.xenproject.org

Paul Gortmaker (5):
xen: audit usages of module.h ; remove unnecessary instances drivers/xen: make [xen-]ballon explicitly non-modular drivers/xen: make xenbus_dev_[front/back]end explicitly non-modular drivers/xen: make sys-hypervisor.c explicitly non-modular drivers/xen: make platform-pci.c explicitly non-modular

 arch/arm/include/asm/xen/hypercall.h     |  2 ++
 drivers/xen/balloon.c                    |  4 ----
 drivers/xen/events/events_2l.c           |  1 -
 drivers/xen/events/events_base.c         |  2 +-
 drivers/xen/events/events_fifo.c         |  1 -
 drivers/xen/features.c                   |  2 +-
 drivers/xen/grant-table.c                |  1 -
 drivers/xen/platform-pci.c               | 16 ++++++----------
 drivers/xen/sys-hypervisor.c             | 31 ++++---------------------------
 drivers/xen/xen-balloon.c                | 14 +++-----------
 drivers/xen/xen-pciback/conf_space.c     |  2 +-
 drivers/xen/xen-pciback/pciback_ops.c    |  2 +-
 drivers/xen/xen-pciback/xenbus.c         |  2 +-
 drivers/xen/xen-selfballoon.c            |  1 -
 drivers/xen/xenbus/xenbus_dev_backend.c  | 13 ++-----------
 drivers/xen/xenbus/xenbus_dev_frontend.c | 13 ++-----------
 drivers/xen/xenbus/xenbus_xs.c           |  1 -
 drivers/xen/xenfs/xensyms.c              |  1 -
 18 files changed, 24 insertions(+), 85 deletions(-)
Signature · 1 line
2.6.1