Merge branch 'benh/liblockdep'

This commit is contained in:
Ben Hutchings 2015-08-14 14:58:50 +02:00
commit 52bf9f0e95
16 changed files with 232 additions and 1 deletions

2
debian/.gitignore vendored
View File

@ -11,9 +11,11 @@
/control.md5sum
/files
/hyperv-daemons/
/liblockdep*/
/libusbip-dev/
/linux-kbuild-*
/linux-perf-*
/lockdep/
/rules.gen
/stamps/
/tmp/

View File

@ -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/',

View File

@ -1,5 +1,6 @@
SUBDIRS = \
hv \
lib/lockdep \
perf \
usb/usbip

26
debian/build/tools/lib/lockdep/Makefile vendored Normal file
View File

@ -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

View File

@ -0,0 +1,2 @@
#!/bin/sh
LD_PRELOAD="liblockdep.so.@VERSION@ $LD_PRELOAD" exec "$@"

1
debian/changelog vendored
View File

@ -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<version>, liblockdep-dev)
-- Ben Hutchings <ben@decadent.org.uk> Tue, 11 Aug 2015 18:56:56 +0200

13
debian/liblockdep-dev.README.Debian vendored Normal file
View File

@ -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 <ben@decadent.org.uk>, Fri, 14 Aug 2015 14:22:55 +0200

1
debian/liblockdep-dev.docs vendored Normal file
View File

@ -0,0 +1 @@
Documentation/locking/lockdep-design.txt

3
debian/liblockdep-dev.install vendored Normal file
View File

@ -0,0 +1,3 @@
usr/include/liblockdep
usr/lib/*/liblockdep.a
usr/lib/*/liblockdep.so

1
debian/lockdep.install vendored Normal file
View File

@ -0,0 +1 @@
usr/bin/lockdep

View File

@ -0,0 +1,68 @@
From: Ben Hutchings <ben@decadent.org.uk>
Date: Thu, 13 Aug 2015 20:48:12 +0200
Subject: liblockdep: Add more headers and definitions needed by lockdep
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
--- /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 <stdlib.h>
#include <sysexits.h>
#include "include/liblockdep/mutex.h"
-#include "../../../include/linux/rbtree.h"
+#include <linux/rbtree.h>
/**
* 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

View File

@ -0,0 +1,39 @@
From: Ben Hutchings <ben@decadent.org.uk>
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 <ben@decadent.org.uk>
---
--- 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

17
debian/patches/lockdep-fix-soname.patch vendored Normal file
View File

@ -0,0 +1,17 @@
From: Ben Hutchings <ben@decadent.org.uk>
Date: Thu, 13 Aug 2015 20:48:12 +0200
Subject: liblockdep: Remove double-quotes from soname
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
--- 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) \

View File

@ -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

26
debian/rules.real vendored
View File

@ -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

View File

@ -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.