diff --git a/debian/.gitignore b/debian/.gitignore index e94573978eb8..c5589b51b81e 100644 --- a/debian/.gitignore +++ b/debian/.gitignore @@ -11,9 +11,11 @@ /control.md5sum /files /hyperv-daemons/ +/liblockdep*/ /libusbip-dev/ /linux-kbuild-* /linux-perf-* +/lockdep/ /rules.gen /stamps/ /tmp/ diff --git a/debian/bin/genorig.py b/debian/bin/genorig.py index 76a3b53d98ef..c1e8b70d103e 100755 --- a/debian/bin/genorig.py +++ b/debian/bin/genorig.py @@ -138,6 +138,7 @@ class Main(object): to_copy = ( 'COPYING', + 'Documentation/locking/lockdep-design.txt', 'Kbuild', 'Makefile', 'arch/*/include/', @@ -147,6 +148,7 @@ class Main(object): 'arch/x86/lib/memset_64.S', 'arch/x86/tools/', 'include/', + 'kernel/locking/', 'lib/hweight.c', 'lib/rbtree.c', 'scripts/', diff --git a/debian/build/tools/Makefile b/debian/build/tools/Makefile index 06bc266092f7..a3cdd8728b79 100644 --- a/debian/build/tools/Makefile +++ b/debian/build/tools/Makefile @@ -1,5 +1,6 @@ SUBDIRS = \ hv \ + lib/lockdep \ perf \ usb/usbip diff --git a/debian/build/tools/lib/lockdep/Makefile b/debian/build/tools/lib/lockdep/Makefile new file mode 100644 index 000000000000..7c8408ffc122 --- /dev/null +++ b/debian/build/tools/lib/lockdep/Makefile @@ -0,0 +1,26 @@ +srcdir := $(top_srcdir)/tools/lib/lockdep + +DEB_HOST_MULTIARCH := $(shell dpkg-architecture -qDEB_HOST_MULTIARCH) + +MAKE_LOCKDEP := $(MAKE) -C $(srcdir) O=$(CURDIR)/out V=1 \ + prefix=/usr libdir_relative=lib/$(DEB_HOST_MULTIARCH) \ + LIBLOCKDEP_VERSION=$(VERSION) + +unexport CFLAGS + +all: + mkdir -p out + $(MAKE_LOCKDEP) + +install: + $(MAKE_LOCKDEP) install + mkdir -p $(DESTDIR)/usr/include + cp -R $(srcdir)/include/liblockdep $(DESTDIR)/usr/include/ + ln -s liblockdep.so.$(VERSION) \ + $(DESTDIR)/usr/lib/$(DEB_HOST_MULTIARCH)/liblockdep.so +# Upstream lockdep preload script is not suitable for installation + sed 's/@VERSION@/$(VERSION)/' lockdep.in > $(DESTDIR)/usr/bin/lockdep + chmod 755 $(DESTDIR)/usr/bin/lockdep + +clean: + rm -rf out diff --git a/debian/build/tools/lib/lockdep/lockdep.in b/debian/build/tools/lib/lockdep/lockdep.in new file mode 100644 index 000000000000..4a0d03ac5211 --- /dev/null +++ b/debian/build/tools/lib/lockdep/lockdep.in @@ -0,0 +1,2 @@ +#!/bin/sh +LD_PRELOAD="liblockdep.so.@VERSION@ $LD_PRELOAD" exec "$@" diff --git a/debian/changelog b/debian/changelog index 72b2d00cd9b8..c2a0fdee7aca 100644 --- a/debian/changelog +++ b/debian/changelog @@ -7,6 +7,7 @@ linux-tools (4.2~rc6-1~exp1) UNRELEASED; urgency=medium - Update .gitignore files - debian/control: Update Vcs-* fields - debian/rules: Exclude .git from maintainerclean rule + * Add packages of liblockdep (lockdep, liblockdep, liblockdep-dev) -- Ben Hutchings Tue, 11 Aug 2015 18:56:56 +0200 diff --git a/debian/liblockdep-dev.README.Debian b/debian/liblockdep-dev.README.Debian new file mode 100644 index 000000000000..a0673a1707d7 --- /dev/null +++ b/debian/liblockdep-dev.README.Debian @@ -0,0 +1,13 @@ +liblockdep for Debian +--------------------- + +liblockdep does not have proper documentation, but these articles +provide an introduction: + + https://lwn.net/Articles/536363/ + http://www.vctlabs.com/posts/2014/Jul/09/liblockdep/ + +'lockdep-design.txt' explains some more detail about what lockdep +does, both in the kernel and as liblockdep. + + -- Ben Hutchings , Fri, 14 Aug 2015 14:22:55 +0200 diff --git a/debian/liblockdep-dev.docs b/debian/liblockdep-dev.docs new file mode 100644 index 000000000000..15b2bbe123e5 --- /dev/null +++ b/debian/liblockdep-dev.docs @@ -0,0 +1 @@ +Documentation/locking/lockdep-design.txt diff --git a/debian/liblockdep-dev.install b/debian/liblockdep-dev.install new file mode 100644 index 000000000000..bd857244bef9 --- /dev/null +++ b/debian/liblockdep-dev.install @@ -0,0 +1,3 @@ +usr/include/liblockdep +usr/lib/*/liblockdep.a +usr/lib/*/liblockdep.so diff --git a/debian/lockdep.install b/debian/lockdep.install new file mode 100644 index 000000000000..236942003fc1 --- /dev/null +++ b/debian/lockdep.install @@ -0,0 +1 @@ +usr/bin/lockdep diff --git a/debian/patches/lockdep-fix-headers.patch b/debian/patches/lockdep-fix-headers.patch new file mode 100644 index 000000000000..95f16161fcb5 --- /dev/null +++ b/debian/patches/lockdep-fix-headers.patch @@ -0,0 +1,68 @@ +From: Ben Hutchings +Date: Thu, 13 Aug 2015 20:48:12 +0200 +Subject: liblockdep: Add more headers and definitions needed by lockdep + +Signed-off-by: Ben Hutchings +--- +--- /dev/null ++++ b/tools/lib/lockdep/uinclude/linux/export.h +@@ -0,0 +1,10 @@ ++#ifndef _LINUX_EXPORT_H ++#define _LINUX_EXPORT_H ++ ++#define EXPORT_SYMBOL(sym) ++#define EXPORT_SYMBOL_GPL(sym) ++#define EXPORT_SYMBOL_GPL_FUTURE(sym) ++#define EXPORT_UNUSED_SYMBOL(sym) ++#define EXPORT_UNUSED_SYMBOL_GPL(sym) ++ ++#endif /* _LINUX_EXPORT_H */ +--- a/tools/lib/lockdep/uinclude/linux/kernel.h ++++ b/tools/lib/lockdep/uinclude/linux/kernel.h +@@ -23,7 +23,7 @@ + #define WARN_ON(x) (x) + #define WARN_ON_ONCE(x) (x) + #define likely(x) (x) +-#define WARN(x, y, z) (x) ++#define WARN(x, y...) (x) + #define uninitialized_var(x) x + #define __init + #define noinline +--- a/tools/lib/lockdep/preload.c ++++ b/tools/lib/lockdep/preload.c +@@ -5,7 +5,7 @@ + #include + #include + #include "include/liblockdep/mutex.h" +-#include "../../../include/linux/rbtree.h" ++#include + + /** + * struct lock_lookup - liblockdep's view of a single unique lock +--- a/tools/lib/lockdep/uinclude/linux/rbtree.h ++++ b/tools/lib/lockdep/uinclude/linux/rbtree.h +@@ -1 +1 @@ +-#include "../../../include/linux/rbtree.h" ++#include "../../include/linux/rbtree.h" +--- a/tools/lib/lockdep/uinclude/linux/compiler.h ++++ b/tools/lib/lockdep/uinclude/linux/compiler.h +@@ -4,4 +4,10 @@ + #define __used __attribute__((__unused__)) + #define unlikely + ++#define __ACCESS_ONCE(x) ({ \ ++ __attribute__((__unused__)) typeof(x) __var = (__force typeof(x)) 0; \ ++ (volatile typeof(x) *)&(x); }) ++#define ACCESS_ONCE(x) (*__ACCESS_ONCE(x)) ++#define WRITE_ONCE(x, val) (ACCESS_ONCE(x) = (val)) ++ + #endif +--- a/tools/lib/lockdep/uinclude/linux/rcu.h ++++ b/tools/lib/lockdep/uinclude/linux/rcu.h +@@ -18,4 +18,6 @@ static inline bool rcu_is_watching(void) + return false; + } + ++#define RCU_INIT_POINTER(p, v) (p = v) ++ + #endif diff --git a/debian/patches/lockdep-fix-oot-build.patch b/debian/patches/lockdep-fix-oot-build.patch new file mode 100644 index 000000000000..03bc43298fe1 --- /dev/null +++ b/debian/patches/lockdep-fix-oot-build.patch @@ -0,0 +1,39 @@ +From: Ben Hutchings +Date: Thu, 13 Aug 2015 20:48:12 +0200 +Subject: liblockdep: Fix object file paths used in an out-of-tree build + +Signed-off-by: Ben Hutchings +--- +--- a/tools/lib/lockdep/Makefile ++++ b/tools/lib/lockdep/Makefile +@@ -98,7 +98,7 @@ build := -f $(srctree)/tools/build/Makef + + do_compile_shared_library = \ + ($(print_shared_lib_compile) \ +- $(CC) --shared $^ -o $@ -lpthread -ldl -Wl,-soname='"$@"';$(shell ln -s $@ liblockdep.so)) ++ $(CC) --shared $^ -o $@ -lpthread -ldl -Wl,-soname='"$(@F)"';$(shell ln -s $(@F) $(@D)/liblockdep.so)) + + do_build_static_lib = \ + ($(print_static_lib_build) \ +@@ -116,10 +116,10 @@ all_cmd: $(CMD_TARGETS) + $(LIB_IN): force + $(Q)$(MAKE) $(build)=liblockdep + +-liblockdep.so.$(LIBLOCKDEP_VERSION): $(LIB_IN) ++$(OUTPUT)liblockdep.so.$(LIBLOCKDEP_VERSION): $(LIB_IN) + $(Q)$(do_compile_shared_library) + +-liblockdep.a: $(LIB_IN) ++$(OUTPUT)liblockdep.a: $(LIB_IN) + $(Q)$(do_build_static_lib) + + tags: force +@@ -147,7 +147,7 @@ install_lib: all_cmd + install: install_lib + + clean: +- $(RM) *.o *~ $(TARGETS) *.a *liblockdep*.so* $(VERSION_FILES) .*.d ++ $(RM) $(OUTPUT)*.o *~ $(TARGETS) $(OUTPUT)*.a $(OUTPUT)*liblockdep*.so* $(VERSION_FILES) $(OUTPUT).*.d + $(RM) tags TAGS + + PHONY += force diff --git a/debian/patches/lockdep-fix-soname.patch b/debian/patches/lockdep-fix-soname.patch new file mode 100644 index 000000000000..a3ac90be902f --- /dev/null +++ b/debian/patches/lockdep-fix-soname.patch @@ -0,0 +1,17 @@ +From: Ben Hutchings +Date: Thu, 13 Aug 2015 20:48:12 +0200 +Subject: liblockdep: Remove double-quotes from soname + +Signed-off-by: Ben Hutchings +--- +--- a/tools/lib/lockdep/Makefile ++++ b/tools/lib/lockdep/Makefile +@@ -98,7 +98,7 @@ build := -f $(srctree)/tools/build/Makef + + do_compile_shared_library = \ + ($(print_shared_lib_compile) \ +- $(CC) --shared $^ -o $@ -lpthread -ldl -Wl,-soname='"$(@F)"';$(shell ln -s $(@F) $(@D)/liblockdep.so)) ++ $(CC) --shared $^ -o $@ -lpthread -ldl -Wl,-soname='$(@F)';$(shell ln -s $(@F) $(@D)/liblockdep.so)) + + do_build_static_lib = \ + ($(print_static_lib_build) \ diff --git a/debian/patches/series b/debian/patches/series index d2cc300b9667..e1943ce4213f 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -7,3 +7,6 @@ kbuild-fix-recordmcount-dependency.patch usbip-include-uninstalled-linux-usbip-h.patch tools-perf-man-date.patch tools-perf-add-empty-build-files-for-architectures-lacking.patch +lockdep-fix-oot-build.patch +lockdep-fix-headers.patch +lockdep-fix-soname.patch diff --git a/debian/rules.real b/debian/rules.real index 3f2669fb1968..feaafa62f0d7 100644 --- a/debian/rules.real +++ b/debian/rules.real @@ -3,7 +3,7 @@ export KBUILD_BUILD_TIMESTAMP := $(shell dpkg-parsechangelog | sed -ne 's,^Date: include debian/rules.defs -binary-arch: install-kbuild install-usbip +binary-arch: install-kbuild install-usbip install-lockdep ifneq ($(filter alpha amd64 arm64 armel armhf hppa i386 mips mips64 mips64el mipsel powerpc powerpcspe ppc64 ppc64el s390 s390x sh4 sparc sparc64 x32,$(DEB_BUILD_ARCH)),) binary-arch: install-perf endif @@ -103,3 +103,27 @@ install-hyperv-daemons: $(STAMPS_DIR)/build dh_gencontrol dh_md5sums dh_builddeb + +install-lockdep: DH_OPTIONS = -plockdep -pliblockdep$(VERSION) -pliblockdep-dev +install-lockdep: DIR = $(CURDIR)/debian/tmp +install-lockdep: $(STAMPS_DIR)/build + dh_testdir + dh_testroot + dh_prep + $(MAKE) -C $(BUILD_DIR)/tools/lib/lockdep install top_srcdir=$(CURDIR) \ + DESTDIR=$(DIR) + env -u DH_OPTIONS dh_install -pliblockdep$(VERSION) \ + 'usr/lib/*/liblockdep.so.*' + dh_install + dh_installchangelogs + dh_installdocs + dh_strip + dh_compress + dh_fixperms + env -u DH_OPTIONS dh_makeshlibs -pliblockdep$(VERSION) \ + liblockdep$(VERSION) + dh_installdeb + dh_shlibdeps + dh_gencontrol + dh_md5sums + dh_builddeb diff --git a/debian/templates/control.main.in b/debian/templates/control.main.in index e76b88637f9e..75ff67258213 100644 --- a/debian/templates/control.main.in +++ b/debian/templates/control.main.in @@ -70,3 +70,31 @@ Description: Support daemons for Linux running on Hyper-V . hv_vss_daemon provides the volume shadow copy service (VSS), allowing the host to freeze the guest filesystems while taking a snapshot. + +Package: lockdep +Architecture: all +Depends: ${shlibs:Depends}, ${misc:Depends}, liblockdep@version@ +Recommends: liblockdep-dev +Section: devel +Multi-Arch: allowed +Description: Runtime locking correctness validator + lockdep is a wrapper for programs that use the pthreads API, which detects + actual and potential deadlocks and other locking bugs. + +Package: liblockdep@version@ +Architecture: linux-any +Depends: ${shlibs:Depends}, ${misc:Depends} +Section: libs +Multi-Arch: same +Description: Runtime locking correctness validator (shared library) + liblockdep is a library for programs that use the pthreads API, which can + be used to detect actual and potential deadlocks and other locking bugs. + +Package: liblockdep-dev +Architecture: linux-any +Depends: ${shlibs:Depends}, ${misc:Depends} +Section: libdevel +Multi-Arch: same +Description: Runtime locking correctness validator (development files) + liblockdep is a library for programs that use the pthreads API, which can + be used to detect actual and potential deadlocks and other locking bugs.