linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC - PATCH 0/7] consolidation of BUG support code.
@ 2012-01-27  2:44 Paul Gortmaker
  2012-01-27  2:44 ` [PATCH 1/7] x86: relocate get/set debugreg fcns to include/asm/debugreg Paul Gortmaker
                   ` (7 more replies)
  0 siblings, 8 replies; 12+ messages in thread
From: Paul Gortmaker @ 2012-01-27  2:44 UTC (permalink / raw)
  To: torvalds, akpm, gregkh, rmk+kernel
  Cc: linux-arch, linux-kernel, Paul Gortmaker

The changes shown here are to unify linux's BUG support under
the one <linux/bug.h> file.  Due to historical reasons, we have
some BUG code in bug.h and some in kernel.h -- i.e. the support for
BUILD_BUG in linux/kernel.h predates the addition of linux/bug.h,
but old code in kernel.h wasn't moved to bug.h at that time.  As
a band-aid, kernel.h was including <asm/bug.h> to pseudo link them.

This has caused confusion[1] and general yuck/WTF[2] reactions.
Here is an example that violates the principle of least surprise:

      CC      lib/string.o
      lib/string.c: In function 'strlcat':
      lib/string.c:225:2: error: implicit declaration of function 'BUILD_BUG_ON'
      make[2]: *** [lib/string.o] Error 1
      $
      $ grep linux/bug.h lib/string.c
      #include <linux/bug.h>
      $

We've included <linux/bug.h> for the BUG infrastructure and yet we
still get a compile fail!  [We've not kernel.h for BUILD_BUG_ON.]
Ugh - very confusing for someone who is new to kernel development.

With the above in mind, the goals of this changeset are:

1) find and fix any include/*.h files that were relying on the
   implicit presence of BUG code.
2) find and fix any C files that were consuming kernel.h and
   hence relying on implicitly getting some/all BUG code.
3) Move the BUG related code living in kernel.h to <linux/bug.h>
4) remove the asm/bug.h from kernel.h to finally break the chain.

During development, the order was more like 3-4, build-test, 1-2.
But to ensure that git history for bisect doesn't get needless
build failures introduced, the commits have been reorderd to fix
the problem areas in advance.

With respect to #1 -- I was wanting to avoid putting bug.h into
high usage header files.  So you will see processor.h and the
spinlock.h getting special treatment.  Others who might(?) be
considered high usage and hence maybe needing special treatment
are called out via a cmdline filter in the commit message.

Unlike the module.h cleanup[3], I've made no attempt to separate
the changes along maintainer/arch lines -- I'm assuming that if
this seems OK to folks, then it will be pulled all at once.  The
separation I did for module.h was costly and not really required.

Testing so far has been on i386, x86-64, mips, arm, powerpc,
alpha, sparc, ...    If nobody has any fundamental problems
with the underlying concept here, I'd like to put it into the
linux-next pool for 3.4 sometime soon.

Thanks,
Paul

[1] https://lkml.org/lkml/2012/1/3/90
[2] https://lkml.org/lkml/2012/1/17/414
[3] http://lwn.net/Articles/453517/

---

Paul Gortmaker (7):
  x86: relocate get/set debugreg fcns to include/asm/debugreg.
  spinlock: macroize assert_spin_locked to avoid bug.h dependency
  lib: fix implicit users of kernel.h for TAINT_WARN
  bug.h: add include of it to various implicit C users
  BUG: headers with BUG/BUG_ON etc. need linux/bug.h
  bug: consolidate BUILD_BUG_ON with other bug code
  kernel.h: doesn't explicitly use bug.h, so don't include it.

 arch/arm/mach-ux500/board-mop500-pins.c         |    1 +
 arch/mips/fw/arc/cmdline.c                      |    1 +
 arch/mips/fw/arc/identify.c                     |    1 +
 arch/powerpc/kernel/pmc.c                       |    1 +
 arch/powerpc/xmon/ppc-opc.c                     |    1 +
 arch/powerpc/xmon/spu-opc.c                     |    1 +
 arch/x86/include/asm/debugreg.h                 |   67 +++++++++++++++++++++++
 arch/x86/include/asm/paravirt.h                 |    1 +
 arch/x86/include/asm/processor.h                |   63 ---------------------
 arch/x86/kernel/cpu/common.c                    |    1 +
 arch/x86/kernel/paravirt.c                      |    1 +
 arch/x86/mm/kmemcheck/selftest.c                |    1 +
 drivers/gpu/drm/radeon/cayman_blit_shaders.c    |    1 +
 drivers/gpu/drm/radeon/evergreen_blit_shaders.c |    1 +
 drivers/gpu/drm/radeon/r600_blit_shaders.c      |    1 +
 include/asm-generic/dma-mapping-common.h        |    1 +
 include/asm-generic/pgtable.h                   |    1 +
 include/asm-generic/tlbflush.h                  |    2 +
 include/drm/ttm/ttm_memory.h                    |    1 +
 include/linux/atmdev.h                          |    1 +
 include/linux/bio.h                             |    1 +
 include/linux/bit_spinlock.h                    |    1 +
 include/linux/bug.h                             |   61 +++++++++++++++++++++
 include/linux/ceph/decode.h                     |    3 +-
 include/linux/ceph/libceph.h                    |    1 +
 include/linux/ceph/mdsmap.h                     |    1 +
 include/linux/cpumask.h                         |    1 +
 include/linux/crypto.h                          |    1 +
 include/linux/debug_locks.h                     |    1 +
 include/linux/dmaengine.h                       |    1 +
 include/linux/elfcore.h                         |    1 +
 include/linux/ext3_fs.h                         |    1 +
 include/linux/fs.h                              |    1 +
 include/linux/fsnotify.h                        |    1 +
 include/linux/gpio.h                            |    1 +
 include/linux/highmem.h                         |    1 +
 include/linux/i2o.h                             |    1 +
 include/linux/if_vlan.h                         |    1 +
 include/linux/io-mapping.h                      |    1 +
 include/linux/kernel.h                          |   62 ---------------------
 include/linux/kprobes.h                         |    1 +
 include/linux/kvm_host.h                        |    1 +
 include/linux/memory_hotplug.h                  |    1 +
 include/linux/mm.h                              |    1 +
 include/linux/mtd/cfi.h                         |    1 +
 include/linux/netdevice.h                       |    1 +
 include/linux/nilfs2_fs.h                       |    1 +
 include/linux/page-flags.h                      |    1 +
 include/linux/pid_namespace.h                   |    1 +
 include/linux/posix_acl.h                       |    1 +
 include/linux/ptrace.h                          |    1 +
 include/linux/radix-tree.h                      |    1 +
 include/linux/rcupdate.h                        |    1 +
 include/linux/regset.h                          |    1 +
 include/linux/reiserfs_fs.h                     |    1 +
 include/linux/relay.h                           |    1 +
 include/linux/scatterlist.h                     |    6 ++-
 include/linux/seq_file.h                        |    1 +
 include/linux/skbuff.h                          |    1 +
 include/linux/slub_def.h                        |    1 +
 include/linux/spinlock.h                        |    5 +--
 include/linux/ssb/ssb_driver_gige.h             |    1 +
 include/linux/swapops.h                         |    1 +
 include/linux/syscalls.h                        |    1 +
 include/linux/transport_class.h                 |    1 +
 include/linux/virtio_config.h                   |    1 +
 include/net/cfg80211.h                          |    1 +
 include/net/dst.h                               |    1 +
 include/net/ip_vs.h                             |    1 +
 include/net/mac80211.h                          |    1 +
 include/net/netns/generic.h                     |    1 +
 include/net/red.h                               |    1 +
 include/net/tcp.h                               |    1 +
 include/net/timewait_sock.h                     |    1 +
 include/net/udp.h                               |    1 +
 include/net/wpan-phy.h                          |    1 +
 include/scsi/osd_ore.h                          |    1 +
 include/scsi/scsi_transport.h                   |    1 +
 lib/average.c                                   |    1 +
 lib/bitmap.c                                    |    1 +
 lib/iommu-helper.c                              |    1 +
 lib/list_debug.c                                |    2 +
 lib/plist.c                                     |    1 +
 lib/string.c                                    |    1 +
 lib/timerqueue.c                                |    1 +
 85 files changed, 215 insertions(+), 132 deletions(-)

-- 
1.7.7.2


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2012-01-27 19:29 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-27  2:44 [RFC - PATCH 0/7] consolidation of BUG support code Paul Gortmaker
2012-01-27  2:44 ` [PATCH 1/7] x86: relocate get/set debugreg fcns to include/asm/debugreg Paul Gortmaker
2012-01-27 11:51   ` Ingo Molnar
2012-01-27 19:28     ` Paul Gortmaker
2012-01-27  2:44 ` [PATCH 2/7] spinlock: macroize assert_spin_locked to avoid bug.h dependency Paul Gortmaker
2012-01-27  2:44 ` [PATCH 3/7] lib: fix implicit users of kernel.h for TAINT_WARN Paul Gortmaker
2012-01-27  2:44 ` [PATCH 4/7] bug.h: add include of it to various implicit C users Paul Gortmaker
2012-01-27  2:44 ` [PATCH 5/7] BUG: headers with BUG/BUG_ON etc. need linux/bug.h Paul Gortmaker
2012-01-27  2:44 ` [PATCH 6/7] bug: consolidate BUILD_BUG_ON with other bug code Paul Gortmaker
2012-01-27  2:44 ` [PATCH 7/7] kernel.h: doesn't explicitly use bug.h, so don't include it Paul Gortmaker
2012-01-27  5:52 ` [RFC - PATCH 0/7] consolidation of BUG support code Stephen Rothwell
2012-01-27 19:23   ` Paul Gortmaker

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).