Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1442964 > unrolled thread

[PATCH 0/8] x86: audit and remove needless module.h includes

Started byPaul Gortmaker <paul.gortmaker@windriver.com>
First post2016-07-14 02:30 +0200
Last post2016-07-14 21:00 +0200
Articles 9 — 4 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH 0/8] x86: audit and remove needless module.h includes Paul Gortmaker <paul.gortmaker@windriver.com> - 2016-07-14 02:30 +0200
    [PATCH 6/8] x86: xen: audit and remove any unnecessary uses of module.h Paul Gortmaker <paul.gortmaker@windriver.com> - 2016-07-14 02:30 +0200
      Re: [PATCH 6/8] x86: xen: audit and remove any unnecessary uses of  module.h Juergen Gross <jgross@suse.com> - 2016-07-14 06:00 +0200
      [tip:x86/headers] x86/xen: Audit and remove any unnecessary uses of  module.h tip-bot for Paul Gortmaker <tipbot@zytor.com> - 2016-07-14 20:50 +0200
    Re: [PATCH 0/8] x86: audit and remove needless module.h includes Ingo Molnar <mingo@kernel.org> - 2016-07-14 15:10 +0200
      Re: [PATCH 0/8] x86: audit and remove needless module.h includes Paul Gortmaker <paul.gortmaker@windriver.com> - 2016-07-14 17:20 +0200
        Re: [PATCH 0/8] x86: audit and remove needless module.h includes Ingo Molnar <mingo@kernel.org> - 2016-07-14 20:40 +0200
          Re: [PATCH 0/8] x86: audit and remove needless module.h includes Paul Gortmaker <paul.gortmaker@windriver.com> - 2016-07-14 20:50 +0200
            Re: [PATCH 0/8] x86: audit and remove needless module.h includes Ingo Molnar <mingo@kernel.org> - 2016-07-14 21:00 +0200

#1442964 — [PATCH 0/8] x86: audit and remove needless module.h includes

FromPaul Gortmaker <paul.gortmaker@windriver.com>
Date2016-07-14 02:30 +0200
Subject[PATCH 0/8] x86: audit and remove needless module.h includes
Message-ID<rUCHn-24M-5@gated-at.bofh.it>
Originally module.h provided support for both what was modular code and
what was providing support to modules via EXPORT_SYMBOL and friends.

That changed when we forked out support for the latter into the export.h
header; roughly five years ago[1].

We dealt with the immediate fallout of that change back then, but we
did not go through and "downgrade" all the non-modular module.h users
to export.h, once the merge of that change enabled us to do so.

This means we should be able to reduce the usage of module.h in code
that is obj-y Makefile or bool Kconfig.  In the case of some of these
which are modular, we can extend that to also include files that are
building basic support functionality but not related to loading or
registering the final module; such files also have no need whatsoever
for module.h

The advantage in removing such instances is that module.h itself
sources about 15 other headers; adding significantly to what we feed
cpp, and it can obscure what headers we are effectively using.

Consider the following pseudo patch to introduce a no-op source
that just includes module.h:

    diff --git a/init/Makefile b/init/Makefile
    --- a/init/Makefile
    +++ b/init/Makefile
    @@ -2,7 +2,7 @@

    -obj-y                          := main.o version.o mounts.o
    +obj-y                          := main.o version.o mounts.o foo.o

    diff --git a/init/foo.c b/init/foo.c
    new file mode 100644
    --- /dev/null
    +++ b/init/foo.c
    @@ -0,0 +1 @@
    +#include <linux/module.h>

With that in place, we then can see the impact with this:

   paul@builder:~/git/linux-head$ make O=../x86_64-build/ init/foo.i
   make[1]: Entering directory '/home/paul/git/x86_64-build'
     CPP     init/foo.i

   paul@builder:~/git/linux-head$ ls -lh ../x86_64-build/init/foo.i 
   -rw-rw-r-- 1 paul paul 754K Jul 12 20:04 ../x86_64-build/init/foo.i

So, with every module.h include, we guarantee a minimum of 3/4 of a MB
of text output from cpp as the baseline of header preamble to process.

Repeating the same experiment with <linux/init.h> and the result is less
than 12kB; with <linux/export.h> it is only about 1/2kB; with both it
still is less than 12kB.

In this series we manage to remove about 120 includes of module.h that
just simply don't need to exist anymore in arch/x86.

Since module.h might be the implicit source for init.h (for __init)
and for export.h (for EXPORT_SYMBOL) we consider each instance for the
requirement of either and replace as needed.  Some additional implicit
include issues were also fixed up as they appeared during build
coverage.

The series was done on a per directory level for the larger dirs and
then we tackle the remainder in the final commit.  This seemed like
a better solution than one giant commit, since it covers some distinct
subsystems like kvm and xen for ease of review for those folks.

There is no urgency to get this in tree, it can easily wait three
weeks.  That said, the risk here is entirely on introducing build
failures -- there is no changes to generated code, so if build
coverage is exhaustive, the risk should be zero.

To that end, I have done allmodconfig, allyesconfig and allnoconfig
for both 32 bit and 64 bit x86 with these changes on the linux-next
from today, which presumably has an up to date copy of tip in it.

Paul.

[1] https://lwn.net/Articles/453517/

---

Cc: Arjan van de Ven <arjan@linux.intel.com>
Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Cc: David Vrabel <david.vrabel@citrix.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Juergen Gross <jgross@suse.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: "Radim Krčmář" <rkrcmar@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: kvm@vger.kernel.org
Cc: x86@kernel.org
Cc: xen-devel@lists.xenproject.org

Paul Gortmaker (8):
  x86: don't use module.h just for AUTHOR / LICENSE tags
  x86: mm: audit and remove any unnecessary uses of module.h
  x86: kernel: audit and remove any unnecessary uses of module.h
  x86: lib: audit and remove any unnecessary uses of module.h
  x86: platform: audit and remove any unnecessary uses of module.h
  x86: xen: audit and remove any unnecessary uses of module.h
  x86: kvm: audit and remove any unnecessary uses of module.h
  x86: audit and remove any remaining unnecessary uses of module.h

 arch/x86/crypto/glue_helper.c           | 4 +---
 arch/x86/events/amd/ibs.c               | 3 ++-
 arch/x86/events/amd/iommu.c             | 2 +-
 arch/x86/events/core.c                  | 3 ++-
 arch/x86/events/intel/uncore.c          | 2 ++
 arch/x86/events/intel/uncore.h          | 1 -
 arch/x86/include/asm/livepatch.h        | 1 -
 arch/x86/include/asm/topology.h         | 1 +
 arch/x86/kernel/acpi/boot.c             | 2 +-
 arch/x86/kernel/acpi/cstate.c           | 2 +-
 arch/x86/kernel/amd_gart_64.c           | 1 -
 arch/x86/kernel/amd_nb.c                | 2 +-
 arch/x86/kernel/apic/apic.c             | 2 +-
 arch/x86/kernel/apic/apic_flat_64.c     | 2 +-
 arch/x86/kernel/apic/apic_noop.c        | 1 -
 arch/x86/kernel/apic/hw_nmi.c           | 2 +-
 arch/x86/kernel/apic/io_apic.c          | 2 +-
 arch/x86/kernel/apic/ipi.c              | 1 -
 arch/x86/kernel/apic/probe_32.c         | 2 +-
 arch/x86/kernel/apic/probe_64.c         | 2 +-
 arch/x86/kernel/apic/x2apic_uv_x.c      | 2 +-
 arch/x86/kernel/cpu/common.c            | 2 +-
 arch/x86/kernel/cpu/hypervisor.c        | 3 ++-
 arch/x86/kernel/cpu/intel.c             | 2 +-
 arch/x86/kernel/cpu/match.c             | 2 +-
 arch/x86/kernel/cpu/mshyperv.c          | 3 ++-
 arch/x86/kernel/cpu/mtrr/cleanup.c      | 1 -
 arch/x86/kernel/cpu/mtrr/generic.c      | 2 +-
 arch/x86/kernel/cpu/mtrr/if.c           | 1 -
 arch/x86/kernel/cpu/mtrr/main.c         | 2 +-
 arch/x86/kernel/cpu/perfctr-watchdog.c  | 2 +-
 arch/x86/kernel/cpu/vmware.c            | 3 ++-
 arch/x86/kernel/crash.c                 | 2 +-
 arch/x86/kernel/dumpstack.c             | 3 ++-
 arch/x86/kernel/dumpstack_32.c          | 2 +-
 arch/x86/kernel/dumpstack_64.c          | 2 +-
 arch/x86/kernel/hw_breakpoint.c         | 3 ++-
 arch/x86/kernel/i386_ksyms_32.c         | 2 +-
 arch/x86/kernel/i8253.c                 | 2 +-
 arch/x86/kernel/io_delay.c              | 2 +-
 arch/x86/kernel/irq_32.c                | 1 -
 arch/x86/kernel/irq_64.c                | 1 -
 arch/x86/kernel/kdebugfs.c              | 2 +-
 arch/x86/kernel/kvm.c                   | 2 +-
 arch/x86/kernel/mpparse.c               | 1 -
 arch/x86/kernel/paravirt-spinlocks.c    | 2 +-
 arch/x86/kernel/paravirt.c              | 3 ++-
 arch/x86/kernel/pci-swiotlb.c           | 2 +-
 arch/x86/kernel/pmem.c                  | 2 +-
 arch/x86/kernel/process.c               | 3 ++-
 arch/x86/kernel/process_32.c            | 2 +-
 arch/x86/kernel/process_64.c            | 2 +-
 arch/x86/kernel/reboot.c                | 2 +-
 arch/x86/kernel/setup.c                 | 2 +-
 arch/x86/kernel/setup_percpu.c          | 2 +-
 arch/x86/kernel/smpboot.c               | 2 +-
 arch/x86/kernel/stacktrace.c            | 2 +-
 arch/x86/kernel/test_rodata.c           | 5 -----
 arch/x86/kernel/traps.c                 | 2 +-
 arch/x86/kernel/tsc.c                   | 2 +-
 arch/x86/kernel/x8664_ksyms_64.c        | 2 +-
 arch/x86/kernel/x86_init.c              | 2 +-
 arch/x86/kvm/cpuid.c                    | 2 +-
 arch/x86/kvm/emulate.c                  | 1 -
 arch/x86/kvm/iommu.c                    | 2 +-
 arch/x86/kvm/irq.c                      | 2 +-
 arch/x86/kvm/lapic.c                    | 2 +-
 arch/x86/kvm/mmu.c                      | 3 ++-
 arch/x86/kvm/x86.c                      | 3 ++-
 arch/x86/lib/cache-smp.c                | 2 +-
 arch/x86/lib/cpu.c                      | 3 ++-
 arch/x86/lib/csum-partial_64.c          | 2 +-
 arch/x86/lib/csum-wrappers_64.c         | 2 +-
 arch/x86/lib/delay.c                    | 2 +-
 arch/x86/lib/memcpy_32.c                | 2 +-
 arch/x86/lib/mmx_32.c                   | 2 +-
 arch/x86/lib/msr-reg-export.c           | 2 +-
 arch/x86/lib/msr-smp.c                  | 2 +-
 arch/x86/lib/msr.c                      | 2 +-
 arch/x86/lib/string_32.c                | 2 +-
 arch/x86/lib/usercopy.c                 | 2 +-
 arch/x86/lib/usercopy_32.c              | 2 +-
 arch/x86/lib/usercopy_64.c              | 2 +-
 arch/x86/mm/amdtopology.c               | 1 -
 arch/x86/mm/dump_pagetables.c           | 6 +-----
 arch/x86/mm/highmem_32.c                | 2 +-
 arch/x86/mm/init_32.c                   | 1 -
 arch/x86/mm/init_64.c                   | 1 -
 arch/x86/mm/iomap_32.c                  | 2 +-
 arch/x86/mm/ioremap.c                   | 1 -
 arch/x86/mm/kmemcheck/kmemcheck.c       | 1 -
 arch/x86/mm/kmemcheck/shadow.c          | 2 +-
 arch/x86/mm/kmmio.c                     | 2 +-
 arch/x86/mm/mmio-mod.c                  | 2 +-
 arch/x86/mm/numa.c                      | 1 -
 arch/x86/mm/numa_32.c                   | 2 +-
 arch/x86/mm/pat.c                       | 1 -
 arch/x86/mm/pat_rbtree.c                | 1 -
 arch/x86/mm/pf_in.c                     | 1 -
 arch/x86/mm/pgtable_32.c                | 1 -
 arch/x86/mm/physaddr.c                  | 2 +-
 arch/x86/mm/srat.c                      | 2 +-
 arch/x86/mm/tlb.c                       | 2 +-
 arch/x86/pci/xen.c                      | 2 +-
 arch/x86/platform/ce4100/ce4100.c       | 2 +-
 arch/x86/platform/efi/efi_64.c          | 2 +-
 arch/x86/platform/intel-mid/intel-mid.c | 2 +-
 arch/x86/platform/intel-mid/pwr.c       | 4 +---
 arch/x86/platform/intel-mid/sfi.c       | 2 +-
 arch/x86/platform/olpc/olpc.c           | 2 +-
 arch/x86/platform/olpc/olpc_ofw.c       | 2 +-
 arch/x86/platform/ts5500/ts5500.c       | 2 +-
 arch/x86/platform/uv/uv_irq.c           | 2 +-
 arch/x86/platform/uv/uv_nmi.c           | 2 +-
 arch/x86/um/delay.c                     | 2 +-
 arch/x86/xen/debugfs.c                  | 1 -
 arch/x86/xen/enlighten.c                | 2 +-
 arch/x86/xen/mmu.c                      | 3 ++-
 arch/x86/xen/p2m.c                      | 2 +-
 arch/x86/xen/platform-pci-unplug.c      | 2 +-
 arch/x86/xen/setup.c                    | 2 +-
 121 files changed, 112 insertions(+), 131 deletions(-)

-- 
2.8.4

Paul Gortmaker (8):
  x86: don't use module.h just for AUTHOR / LICENSE tags
  x86: mm: audit and remove any unnecessary uses of module.h
  x86: kernel: audit and remove any unnecessary uses of module.h
  x86: lib: audit and remove any unnecessary uses of module.h
  x86: platform: audit and remove any unnecessary uses of module.h
  x86: xen: audit and remove any unnecessary uses of module.h
  x86: kvm: audit and remove any unnecessary uses of module.h
  x86: audit and remove any remaining unnecessary uses of module.h

 arch/x86/crypto/glue_helper.c           | 4 +---
 arch/x86/events/amd/ibs.c               | 3 ++-
 arch/x86/events/amd/iommu.c             | 2 +-
 arch/x86/events/core.c                  | 3 ++-
 arch/x86/events/intel/uncore.c          | 2 ++
 arch/x86/events/intel/uncore.h          | 1 -
 arch/x86/include/asm/livepatch.h        | 1 -
 arch/x86/include/asm/topology.h         | 1 +
 arch/x86/kernel/acpi/boot.c             | 2 +-
 arch/x86/kernel/acpi/cstate.c           | 2 +-
 arch/x86/kernel/amd_gart_64.c           | 1 -
 arch/x86/kernel/amd_nb.c                | 2 +-
 arch/x86/kernel/apic/apic.c             | 2 +-
 arch/x86/kernel/apic/apic_flat_64.c     | 2 +-
 arch/x86/kernel/apic/apic_noop.c        | 1 -
 arch/x86/kernel/apic/hw_nmi.c           | 2 +-
 arch/x86/kernel/apic/io_apic.c          | 2 +-
 arch/x86/kernel/apic/ipi.c              | 1 -
 arch/x86/kernel/apic/probe_32.c         | 2 +-
 arch/x86/kernel/apic/probe_64.c         | 2 +-
 arch/x86/kernel/apic/x2apic_uv_x.c      | 2 +-
 arch/x86/kernel/cpu/common.c            | 2 +-
 arch/x86/kernel/cpu/hypervisor.c        | 3 ++-
 arch/x86/kernel/cpu/intel.c             | 2 +-
 arch/x86/kernel/cpu/match.c             | 2 +-
 arch/x86/kernel/cpu/mshyperv.c          | 3 ++-
 arch/x86/kernel/cpu/mtrr/cleanup.c      | 1 -
 arch/x86/kernel/cpu/mtrr/generic.c      | 2 +-
 arch/x86/kernel/cpu/mtrr/if.c           | 1 -
 arch/x86/kernel/cpu/mtrr/main.c         | 2 +-
 arch/x86/kernel/cpu/perfctr-watchdog.c  | 2 +-
 arch/x86/kernel/cpu/vmware.c            | 3 ++-
 arch/x86/kernel/crash.c                 | 2 +-
 arch/x86/kernel/dumpstack_32.c          | 2 +-
 arch/x86/kernel/dumpstack_64.c          | 2 +-
 arch/x86/kernel/hw_breakpoint.c         | 3 ++-
 arch/x86/kernel/i386_ksyms_32.c         | 3 ++-
 arch/x86/kernel/i8253.c                 | 2 +-
 arch/x86/kernel/io_delay.c              | 2 +-
 arch/x86/kernel/irq_32.c                | 1 -
 arch/x86/kernel/irq_64.c                | 1 -
 arch/x86/kernel/kdebugfs.c              | 2 +-
 arch/x86/kernel/kvm.c                   | 2 +-
 arch/x86/kernel/mpparse.c               | 1 -
 arch/x86/kernel/paravirt-spinlocks.c    | 2 +-
 arch/x86/kernel/paravirt.c              | 3 ++-
 arch/x86/kernel/pci-swiotlb.c           | 2 +-
 arch/x86/kernel/pmem.c                  | 2 +-
 arch/x86/kernel/process.c               | 3 ++-
 arch/x86/kernel/process_32.c            | 2 +-
 arch/x86/kernel/process_64.c            | 2 +-
 arch/x86/kernel/reboot.c                | 2 +-
 arch/x86/kernel/setup.c                 | 2 +-
 arch/x86/kernel/setup_percpu.c          | 2 +-
 arch/x86/kernel/smpboot.c               | 2 +-
 arch/x86/kernel/stacktrace.c            | 2 +-
 arch/x86/kernel/test_rodata.c           | 5 -----
 arch/x86/kernel/traps.c                 | 2 +-
 arch/x86/kernel/tsc.c                   | 2 +-
 arch/x86/kernel/x8664_ksyms_64.c        | 2 +-
 arch/x86/kernel/x86_init.c              | 2 +-
 arch/x86/kvm/cpuid.c                    | 2 +-
 arch/x86/kvm/emulate.c                  | 1 -
 arch/x86/kvm/iommu.c                    | 2 +-
 arch/x86/kvm/irq.c                      | 2 +-
 arch/x86/kvm/lapic.c                    | 2 +-
 arch/x86/kvm/mmu.c                      | 3 ++-
 arch/x86/kvm/x86.c                      | 3 ++-
 arch/x86/lib/cache-smp.c                | 2 +-
 arch/x86/lib/cpu.c                      | 3 ++-
 arch/x86/lib/csum-partial_64.c          | 2 +-
 arch/x86/lib/csum-wrappers_64.c         | 2 +-
 arch/x86/lib/delay.c                    | 2 +-
 arch/x86/lib/memcpy_32.c                | 2 +-
 arch/x86/lib/mmx_32.c                   | 2 +-
 arch/x86/lib/msr-reg-export.c           | 2 +-
 arch/x86/lib/msr-smp.c                  | 2 +-
 arch/x86/lib/msr.c                      | 3 ++-
 arch/x86/lib/string_32.c                | 2 +-
 arch/x86/lib/usercopy.c                 | 2 +-
 arch/x86/lib/usercopy_32.c              | 2 +-
 arch/x86/lib/usercopy_64.c              | 2 +-
 arch/x86/mm/amdtopology.c               | 1 -
 arch/x86/mm/dump_pagetables.c           | 6 +-----
 arch/x86/mm/highmem_32.c                | 2 +-
 arch/x86/mm/init_32.c                   | 1 -
 arch/x86/mm/init_64.c                   | 1 -
 arch/x86/mm/iomap_32.c                  | 2 +-
 arch/x86/mm/ioremap.c                   | 1 -
 arch/x86/mm/kmemcheck/kmemcheck.c       | 1 -
 arch/x86/mm/kmemcheck/shadow.c          | 2 +-
 arch/x86/mm/kmmio.c                     | 2 +-
 arch/x86/mm/mmio-mod.c                  | 2 +-
 arch/x86/mm/numa.c                      | 1 -
 arch/x86/mm/numa_32.c                   | 2 +-
 arch/x86/mm/pat.c                       | 1 -
 arch/x86/mm/pat_rbtree.c                | 1 -
 arch/x86/mm/pf_in.c                     | 1 -
 arch/x86/mm/pgtable_32.c                | 1 -
 arch/x86/mm/physaddr.c                  | 2 +-
 arch/x86/mm/srat.c                      | 2 +-
 arch/x86/mm/tlb.c                       | 2 +-
 arch/x86/pci/xen.c                      | 2 +-
 arch/x86/platform/ce4100/ce4100.c       | 2 +-
 arch/x86/platform/efi/efi_64.c          | 2 +-
 arch/x86/platform/intel-mid/intel-mid.c | 2 +-
 arch/x86/platform/intel-mid/pwr.c       | 4 +---
 arch/x86/platform/intel-mid/sfi.c       | 2 +-
 arch/x86/platform/olpc/olpc.c           | 2 +-
 arch/x86/platform/olpc/olpc_ofw.c       | 5 ++++-
 arch/x86/platform/ts5500/ts5500.c       | 2 +-
 arch/x86/platform/uv/uv_irq.c           | 2 +-
 arch/x86/platform/uv/uv_nmi.c           | 2 +-
 arch/x86/um/delay.c                     | 2 +-
 arch/x86/xen/debugfs.c                  | 1 -
 arch/x86/xen/enlighten.c                | 2 +-
 arch/x86/xen/mmu.c                      | 3 ++-
 arch/x86/xen/p2m.c                      | 2 +-
 arch/x86/xen/platform-pci-unplug.c      | 2 +-
 arch/x86/xen/setup.c                    | 2 +-
 120 files changed, 115 insertions(+), 130 deletions(-)

-- 
2.8.4

[toc] | [next] | [standalone]


#1442965 — [PATCH 6/8] x86: xen: audit and remove any unnecessary uses of module.h

FromPaul Gortmaker <paul.gortmaker@windriver.com>
Date2016-07-14 02:30 +0200
Subject[PATCH 6/8] x86: xen: audit and remove any unnecessary uses of module.h
Message-ID<rUCHo-24M-29@gated-at.bofh.it>
In reply to#1442964
Historically a lot of these existed because we did not have
a distinction between what was modular code and what was providing
support to modules via EXPORT_SYMBOL and friends.  That changed
when we forked out support for the latter into the export.h file.

This means we should be able to reduce the usage of module.h
in code that is obj-y Makefile or bool Kconfig.  The advantage
in doing so is that module.h itself sources about 15 other headers;
adding significantly to what we feed cpp, and it can obscure what
headers we are effectively using.

Since module.h was the source for init.h (for __init) and for
export.h (for EXPORT_SYMBOL) we consider each obj-y/bool instance
for the presence of either and replace as needed.

Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Cc: David Vrabel <david.vrabel@citrix.com>
Cc: Juergen Gross <jgross@suse.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: x86@kernel.org
Cc: xen-devel@lists.xenproject.org
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
 arch/x86/xen/debugfs.c             | 1 -
 arch/x86/xen/enlighten.c           | 2 +-
 arch/x86/xen/mmu.c                 | 3 ++-
 arch/x86/xen/p2m.c                 | 2 +-
 arch/x86/xen/platform-pci-unplug.c | 2 +-
 arch/x86/xen/setup.c               | 2 +-
 6 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/arch/x86/xen/debugfs.c b/arch/x86/xen/debugfs.c
index c8377fb26cdf..1daff5545c0a 100644
--- a/arch/x86/xen/debugfs.c
+++ b/arch/x86/xen/debugfs.c
@@ -1,7 +1,6 @@
 #include <linux/init.h>
 #include <linux/debugfs.h>
 #include <linux/slab.h>
-#include <linux/module.h>
 
 #include "debugfs.h"
 
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index 575cea4bab94..88845bb50b7b 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -23,7 +23,7 @@
 #include <linux/sched.h>
 #include <linux/kprobes.h>
 #include <linux/bootmem.h>
-#include <linux/module.h>
+#include <linux/export.h>
 #include <linux/mm.h>
 #include <linux/page-flags.h>
 #include <linux/highmem.h>
diff --git a/arch/x86/xen/mmu.c b/arch/x86/xen/mmu.c
index 67433714b791..7d5afdb417cc 100644
--- a/arch/x86/xen/mmu.c
+++ b/arch/x86/xen/mmu.c
@@ -43,7 +43,8 @@
 #include <linux/debugfs.h>
 #include <linux/bug.h>
 #include <linux/vmalloc.h>
-#include <linux/module.h>
+#include <linux/export.h>
+#include <linux/init.h>
 #include <linux/gfp.h>
 #include <linux/memblock.h>
 #include <linux/seq_file.h>
diff --git a/arch/x86/xen/p2m.c b/arch/x86/xen/p2m.c
index dd2a49a8aacc..37129db76d33 100644
--- a/arch/x86/xen/p2m.c
+++ b/arch/x86/xen/p2m.c
@@ -60,7 +60,7 @@
  */
 
 #include <linux/init.h>
-#include <linux/module.h>
+#include <linux/export.h>
 #include <linux/list.h>
 #include <linux/hash.h>
 #include <linux/sched.h>
diff --git a/arch/x86/xen/platform-pci-unplug.c b/arch/x86/xen/platform-pci-unplug.c
index 9586ff32810c..d37a0c7f82cb 100644
--- a/arch/x86/xen/platform-pci-unplug.c
+++ b/arch/x86/xen/platform-pci-unplug.c
@@ -21,7 +21,7 @@
 
 #include <linux/init.h>
 #include <linux/io.h>
-#include <linux/module.h>
+#include <linux/export.h>
 
 #include <xen/platform_pci.h>
 #include "xen-ops.h"
diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c
index e345891450c3..176425233e4d 100644
--- a/arch/x86/xen/setup.c
+++ b/arch/x86/xen/setup.c
@@ -4,7 +4,7 @@
  * Jeremy Fitzhardinge <jeremy@xensource.com>, XenSource Inc, 2007
  */
 
-#include <linux/module.h>
+#include <linux/init.h>
 #include <linux/sched.h>
 #include <linux/mm.h>
 #include <linux/pm.h>
-- 
2.8.4

[toc] | [prev] | [next] | [standalone]


#1443060 — Re: [PATCH 6/8] x86: xen: audit and remove any unnecessary uses of module.h

FromJuergen Gross <jgross@suse.com>
Date2016-07-14 06:00 +0200
SubjectRe: [PATCH 6/8] x86: xen: audit and remove any unnecessary uses of module.h
Message-ID<rUFYC-4bn-3@gated-at.bofh.it>
In reply to#1442965
On 14/07/16 02:18, Paul Gortmaker wrote:
> Historically a lot of these existed because we did not have
> a distinction between what was modular code and what was providing
> support to modules via EXPORT_SYMBOL and friends.  That changed
> when we forked out support for the latter into the export.h file.
> 
> This means we should be able to reduce the usage of module.h
> in code that is obj-y Makefile or bool Kconfig.  The advantage
> in doing so is that module.h itself sources about 15 other headers;
> adding significantly to what we feed cpp, and it can obscure what
> headers we are effectively using.
> 
> Since module.h was the source for init.h (for __init) and for
> export.h (for EXPORT_SYMBOL) we consider each obj-y/bool instance
> for the presence of either and replace as needed.
> 
> Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
> Cc: David Vrabel <david.vrabel@citrix.com>
> Cc: Juergen Gross <jgross@suse.com>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: Ingo Molnar <mingo@redhat.com>
> Cc: "H. Peter Anvin" <hpa@zytor.com>
> Cc: x86@kernel.org
> Cc: xen-devel@lists.xenproject.org
> Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>

Acked-by: Juergen Gross <jgross@suse.com>

Juergen

[toc] | [prev] | [next] | [standalone]


#1443686 — [tip:x86/headers] x86/xen: Audit and remove any unnecessary uses of module.h

Fromtip-bot for Paul Gortmaker <tipbot@zytor.com>
Date2016-07-14 20:50 +0200
Subject[tip:x86/headers] x86/xen: Audit and remove any unnecessary uses of module.h
Message-ID<rUTRU-4Q7-13@gated-at.bofh.it>
In reply to#1442965
Commit-ID:  7a2463dcacee3f2f36c78418c201756372eeea6b
Gitweb:     http://git.kernel.org/tip/7a2463dcacee3f2f36c78418c201756372eeea6b
Author:     Paul Gortmaker <paul.gortmaker@windriver.com>
AuthorDate: Wed, 13 Jul 2016 20:18:59 -0400
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Thu, 14 Jul 2016 15:06:59 +0200

x86/xen: Audit and remove any unnecessary uses of module.h

Historically a lot of these existed because we did not have
a distinction between what was modular code and what was providing
support to modules via EXPORT_SYMBOL and friends.  That changed
when we forked out support for the latter into the export.h file.

This means we should be able to reduce the usage of module.h
in code that is obj-y Makefile or bool Kconfig.  The advantage
in doing so is that module.h itself sources about 15 other headers;
adding significantly to what we feed cpp, and it can obscure what
headers we are effectively using.

Since module.h was the source for init.h (for __init) and for
export.h (for EXPORT_SYMBOL) we consider each obj-y/bool instance
for the presence of either and replace as needed.

Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Acked-by: Juergen Gross <jgross@suse.com>
Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Cc: David Vrabel <david.vrabel@citrix.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: xen-devel@lists.xenproject.org
Link: http://lkml.kernel.org/r/20160714001901.31603-7-paul.gortmaker@windriver.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 arch/x86/xen/debugfs.c             | 1 -
 arch/x86/xen/enlighten.c           | 2 +-
 arch/x86/xen/mmu.c                 | 3 ++-
 arch/x86/xen/p2m.c                 | 2 +-
 arch/x86/xen/platform-pci-unplug.c | 2 +-
 arch/x86/xen/setup.c               | 2 +-
 6 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/arch/x86/xen/debugfs.c b/arch/x86/xen/debugfs.c
index c8377fb..1daff55 100644
--- a/arch/x86/xen/debugfs.c
+++ b/arch/x86/xen/debugfs.c
@@ -1,7 +1,6 @@
 #include <linux/init.h>
 #include <linux/debugfs.h>
 #include <linux/slab.h>
-#include <linux/module.h>
 
 #include "debugfs.h"
 
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index 760789a..1f984ab 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -23,7 +23,7 @@
 #include <linux/sched.h>
 #include <linux/kprobes.h>
 #include <linux/bootmem.h>
-#include <linux/module.h>
+#include <linux/export.h>
 #include <linux/mm.h>
 #include <linux/page-flags.h>
 #include <linux/highmem.h>
diff --git a/arch/x86/xen/mmu.c b/arch/x86/xen/mmu.c
index 6743371..7d5afdb 100644
--- a/arch/x86/xen/mmu.c
+++ b/arch/x86/xen/mmu.c
@@ -43,7 +43,8 @@
 #include <linux/debugfs.h>
 #include <linux/bug.h>
 #include <linux/vmalloc.h>
-#include <linux/module.h>
+#include <linux/export.h>
+#include <linux/init.h>
 #include <linux/gfp.h>
 #include <linux/memblock.h>
 #include <linux/seq_file.h>
diff --git a/arch/x86/xen/p2m.c b/arch/x86/xen/p2m.c
index dd2a49a..37129db 100644
--- a/arch/x86/xen/p2m.c
+++ b/arch/x86/xen/p2m.c
@@ -60,7 +60,7 @@
  */
 
 #include <linux/init.h>
-#include <linux/module.h>
+#include <linux/export.h>
 #include <linux/list.h>
 #include <linux/hash.h>
 #include <linux/sched.h>
diff --git a/arch/x86/xen/platform-pci-unplug.c b/arch/x86/xen/platform-pci-unplug.c
index 9586ff3..d37a0c7 100644
--- a/arch/x86/xen/platform-pci-unplug.c
+++ b/arch/x86/xen/platform-pci-unplug.c
@@ -21,7 +21,7 @@
 
 #include <linux/init.h>
 #include <linux/io.h>
-#include <linux/module.h>
+#include <linux/export.h>
 
 #include <xen/platform_pci.h>
 #include "xen-ops.h"
diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c
index e345891..1764252 100644
--- a/arch/x86/xen/setup.c
+++ b/arch/x86/xen/setup.c
@@ -4,7 +4,7 @@
  * Jeremy Fitzhardinge <jeremy@xensource.com>, XenSource Inc, 2007
  */
 
-#include <linux/module.h>
+#include <linux/init.h>
 #include <linux/sched.h>
 #include <linux/mm.h>
 #include <linux/pm.h>

[toc] | [prev] | [next] | [standalone]


#1443437

FromIngo Molnar <mingo@kernel.org>
Date2016-07-14 15:10 +0200
Message-ID<rUOyS-1GD-43@gated-at.bofh.it>
In reply to#1442964
* Paul Gortmaker <paul.gortmaker@windriver.com> wrote:

> To that end, I have done allmodconfig, allyesconfig and allnoconfig
> for both 32 bit and 64 bit x86 with these changes on the linux-next
> from today, which presumably has an up to date copy of tip in it.

It does, still I get this on allnoconfig with your patches applied:

arch/x86/kernel/setup_percpu.c: In function ‘setup_percpu_segment’:
arch/x86/kernel/setup_percpu.c:159:2: error: implicit declaration of function 
‘pack_descriptor’ [-Werror=implicit-function-declaration]
  pack_descriptor(&gdt, per_cpu_offset(cpu), 0xFFFFF,
  ^
arch/x86/kernel/setup_percpu.c:162:2: error: implicit declaration of function 
‘write_gdt_entry’ [-Werror=implicit-function-declaration]
  write_gdt_entry(get_cpu_gdt_table(cpu),
  ^
arch/x86/kernel/setup_percpu.c:162:18: error: implicit declaration of function 
‘get_cpu_gdt_table’ [-Werror=implicit-function-declaration]
  write_gdt_entry(get_cpu_gdt_table(cpu),

I'll continue testing with the setup_percpu.c change left out.

Thanks,

	Ingo

[toc] | [prev] | [next] | [standalone]


#1443521

FromPaul Gortmaker <paul.gortmaker@windriver.com>
Date2016-07-14 17:20 +0200
Message-ID<rUQAF-2UX-21@gated-at.bofh.it>
In reply to#1443437
[Re: [PATCH 0/8] x86: audit and remove needless module.h includes] On 14/07/2016 (Thu 15:04) Ingo Molnar wrote:

> 
> * Paul Gortmaker <paul.gortmaker@windriver.com> wrote:
> 
> > To that end, I have done allmodconfig, allyesconfig and allnoconfig
> > for both 32 bit and 64 bit x86 with these changes on the linux-next
> > from today, which presumably has an up to date copy of tip in it.
> 
> It does, still I get this on allnoconfig with your patches applied:

Took me a while to figure out why I didn't see this; I was able to
finally reproduce it on x86-32 with allnoconfig but CONFIG_SMP=y.

> 
> arch/x86/kernel/setup_percpu.c: In function ‘setup_percpu_segment’:
> arch/x86/kernel/setup_percpu.c:159:2: error: implicit declaration of function 
> ‘pack_descriptor’ [-Werror=implicit-function-declaration]
>   pack_descriptor(&gdt, per_cpu_offset(cpu), 0xFFFFF,
>   ^
> arch/x86/kernel/setup_percpu.c:162:2: error: implicit declaration of function 
> ‘write_gdt_entry’ [-Werror=implicit-function-declaration]
>   write_gdt_entry(get_cpu_gdt_table(cpu),
>   ^
> arch/x86/kernel/setup_percpu.c:162:18: error: implicit declaration of function 
> ‘get_cpu_gdt_table’ [-Werror=implicit-function-declaration]
>   write_gdt_entry(get_cpu_gdt_table(cpu),

All three of these guys live in asm/desc.h and adding that to the top of
arch/x86/kernel/setup_percpu.c asm include list seems to fix the
reproducer I now have here.

> 
> I'll continue testing with the setup_percpu.c change left out.

Let me know if you want a resend or if you want to just add the
asm/desc.h locally or ...

Paul.
--

> 
> Thanks,
> 
> 	Ingo

[toc] | [prev] | [next] | [standalone]


#1443676

FromIngo Molnar <mingo@kernel.org>
Date2016-07-14 20:40 +0200
Message-ID<rUTIf-4Mw-43@gated-at.bofh.it>
In reply to#1443521
* Paul Gortmaker <paul.gortmaker@windriver.com> wrote:

> > I'll continue testing with the setup_percpu.c change left out.
> 
> Let me know if you want a resend or if you want to just add the
> asm/desc.h locally or ...

So I tried the asm/desc.h but saw other build failures - for now gave up.
Can we do this in a separate patch?

Thanks,

	Ingo

[toc] | [prev] | [next] | [standalone]


#1443692

FromPaul Gortmaker <paul.gortmaker@windriver.com>
Date2016-07-14 20:50 +0200
Message-ID<rUTRU-4Q7-37@gated-at.bofh.it>
In reply to#1443676
[Re: [PATCH 0/8] x86: audit and remove needless module.h includes] On 14/07/2016 (Thu 20:39) Ingo Molnar wrote:

> 
> * Paul Gortmaker <paul.gortmaker@windriver.com> wrote:
> 
> > > I'll continue testing with the setup_percpu.c change left out.
> > 
> > Let me know if you want a resend or if you want to just add the
> > asm/desc.h locally or ...
> 
> So I tried the asm/desc.h but saw other build failures - for now gave up.
> Can we do this in a separate patch?

Yes of course.  In the meantime I'll investigate further and add more
configs to my testing.  Is there a list of the configs used for sanity
testing tip somewhere?

Thanks, 
Paul.
--

> 
> Thanks,
> 
> 	Ingo

[toc] | [prev] | [next] | [standalone]


#1443695

FromIngo Molnar <mingo@kernel.org>
Date2016-07-14 21:00 +0200
Message-ID<rUU1A-4Tq-11@gated-at.bofh.it>
In reply to#1443692
* Paul Gortmaker <paul.gortmaker@windriver.com> wrote:

> [Re: [PATCH 0/8] x86: audit and remove needless module.h includes] On 14/07/2016 (Thu 20:39) Ingo Molnar wrote:
> 
> > 
> > * Paul Gortmaker <paul.gortmaker@windriver.com> wrote:
> > 
> > > > I'll continue testing with the setup_percpu.c change left out.
> > > 
> > > Let me know if you want a resend or if you want to just add the
> > > asm/desc.h locally or ...
> > 
> > So I tried the asm/desc.h but saw other build failures - for now gave up.
> > Can we do this in a separate patch?
> 
> Yes of course.  In the meantime I'll investigate further and add more
> configs to my testing.  Is there a list of the configs used for sanity
> testing tip somewhere?

No need for you to complicate your testing (unless you have enough hardware 
resources for that) - I can deal with the occasional build failure. Since I 
eventually create and boot randconfigs there's no fixed set of configs. :-/

That I enabled SMP on the "allnoconfig" (and forgot about it!) has to do with the 
fact that even my allnoconfigs are typically bootable (on one of my test systems) 
so there's a handful of pre-baked configs that always get enabled.

But other than those small perturbations I do similar testing to what you did: 
all{no|def|mod|yes}config on x86-{32|64}, plus randconfigs.

Thanks,

	Ingo

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web