diff --git a/debian/changelog b/debian/changelog index 6132e475f..06ac6ecae 100644 --- a/debian/changelog +++ b/debian/changelog @@ -7,6 +7,21 @@ linux-tools (4.5~rc4-1~exp1) UNRELEASED; urgency=medium -- Ben Hutchings Thu, 18 Feb 2016 03:19:14 +0000 +linux-tools (4.4-3) unstable; urgency=medium + + * hyperv-daemons: Add init scripts + + -- Ben Hutchings Sun, 21 Feb 2016 15:07:55 +0000 + +linux-tools (4.4-2) unstable; urgency=medium + + * linux-perf: Include version number in strace groups installation directory + (Closes: #813080) + * [alpha,sh4] Attempt to fix build failures + * Build fixdep under debian/build and clean it up properly + + -- Ben Hutchings Fri, 19 Feb 2016 17:11:29 +0000 + linux-tools (4.4-1) unstable; urgency=medium * Upload to unstable diff --git a/debian/copyright b/debian/copyright index 1e7200f61..7ba027e84 100644 --- a/debian/copyright +++ b/debian/copyright @@ -30,3 +30,22 @@ License: GPL-2 Files: debian/* Copyright: 2006-2012 Debian kernel team License: GPL-2 + +Files: debian/build/tools/hv/check-hyperv.c +Copyright: 2011 Lennart Poettering +License: LGPL-2.1 + This program is free software; you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation; either version 2.1 of the License, or + (at your option) any later version. + . + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + . + You should have received a copy of the GNU Lesser General Public License + along with this program; If not, see . + . + On Debian systems, the complete text of the GNU Lesser General Public + License version 2.1 can be found in `/usr/share/common-licenses/LGPL-2.1'. diff --git a/debian/hyperv-daemons.hv-fcopy-daemon.init b/debian/hyperv-daemons.hv-fcopy-daemon.init new file mode 100755 index 000000000..24d944d01 --- /dev/null +++ b/debian/hyperv-daemons.hv-fcopy-daemon.init @@ -0,0 +1,110 @@ +#! /bin/sh +### BEGIN INIT INFO +# Provides: hyperv-daemons.hv-fcopy-daemon +# Required-Start: $remote_fs $syslog +# Required-Stop: $remote_fs $syslog +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: Hyper-V file copy service (FCOPY) daemon +### END INIT INFO + +PATH=/sbin:/usr/sbin:/bin:/usr/bin +DESC="Hyper-V file copy service (FCOPY) daemon" +NAME=hv_fcopy_daemon +DAEMON=/usr/sbin/$NAME +PIDFILE=/var/run/$NAME.pid +SCRIPTNAME=/etc/init.d/hyperv-daemons.hv-fcopy-daemon + +# Exit if the package is not installed +[ -x "$DAEMON" ] || exit 0 + +# Exit if we are not running under Hyper-V or the kernel device does not exist +/lib/hyperv-daemons/check-hyperv || exit 0 +[ -e "/dev/vmbus/hv_fcopy" ] || exit 0 + +# Load the VERBOSE setting and other rcS variables +. /lib/init/vars.sh + +# Define LSB log_* functions. +. /lib/lsb/init-functions + +# +# Function that starts the daemon/service +# +do_start() +{ + # Return + # 0 if daemon has been started + # 1 if daemon was already running + # 2 if daemon could not be started + start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \ + || return 1 + start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --background --make-pidfile -- -n \ + || return 2 +} + +# +# Function that stops the daemon/service +# +do_stop() +{ + # Return + # 0 if daemon has been stopped + # 1 if daemon was already stopped + # 2 if daemon could not be stopped + # other if a failure occurred + start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME + [ "$?" = 2 ] && return 2 + start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON + RETVAL=$? + [ "$RETVAL" = 2 ] && return 2 + # Many daemons don't delete their pidfiles when they exit. + rm -f $PIDFILE + return "$RETVAL" +} + +case "$1" in + start) + [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME" + do_start + case "$?" in + 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;; + 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;; + esac + ;; + stop) + [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME" + do_stop + case "$?" in + 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;; + 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;; + esac + ;; + status) + status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $? + ;; + restart|force-reload) + log_daemon_msg "Restarting $DESC" "$NAME" + do_stop + case "$?" in + 0|1) + do_start + case "$?" in + 0) log_end_msg 0 ;; + 1) log_end_msg 1 ;; # Old process is still running + *) log_end_msg 1 ;; # Failed to start + esac + ;; + *) + # Failed to stop + log_end_msg 1 + ;; + esac + ;; + *) + echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2 + exit 3 + ;; +esac + +: diff --git a/debian/hyperv-daemons.hv-kvp-daemon.init b/debian/hyperv-daemons.hv-kvp-daemon.init new file mode 100755 index 000000000..e5908ec28 --- /dev/null +++ b/debian/hyperv-daemons.hv-kvp-daemon.init @@ -0,0 +1,109 @@ +#! /bin/sh +### BEGIN INIT INFO +# Provides: hyperv-daemons.hv-kvp-daemon +# Required-Start: $remote_fs $syslog +# Required-Stop: $remote_fs $syslog +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: Hyper-V key-value pair (KVP) daemon +### END INIT INFO + +PATH=/sbin:/usr/sbin:/bin:/usr/bin +DESC="Hyper-V key-value pair (KVP) daemon" +NAME=hv_kvp_daemon +DAEMON=/usr/sbin/$NAME +PIDFILE=/var/run/$NAME.pid +SCRIPTNAME=/etc/init.d/hyperv-daemons.hv-kvp-daemon + +# Exit if the package is not installed +[ -x "$DAEMON" ] || exit 0 + +# Exit if we are not running under Hyper-V +/lib/hyperv-daemons/check-hyperv || exit 0 + +# Load the VERBOSE setting and other rcS variables +. /lib/init/vars.sh + +# Define LSB log_* functions. +. /lib/lsb/init-functions + +# +# Function that starts the daemon/service +# +do_start() +{ + # Return + # 0 if daemon has been started + # 1 if daemon was already running + # 2 if daemon could not be started + start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \ + || return 1 + start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --background --make-pidfile -- -n \ + || return 2 +} + +# +# Function that stops the daemon/service +# +do_stop() +{ + # Return + # 0 if daemon has been stopped + # 1 if daemon was already stopped + # 2 if daemon could not be stopped + # other if a failure occurred + start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME + [ "$?" = 2 ] && return 2 + start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON + RETVAL=$? + [ "$RETVAL" = 2 ] && return 2 + # Many daemons don't delete their pidfiles when they exit. + rm -f $PIDFILE + return "$RETVAL" +} + +case "$1" in + start) + [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME" + do_start + case "$?" in + 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;; + 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;; + esac + ;; + stop) + [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME" + do_stop + case "$?" in + 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;; + 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;; + esac + ;; + status) + status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $? + ;; + restart|force-reload) + log_daemon_msg "Restarting $DESC" "$NAME" + do_stop + case "$?" in + 0|1) + do_start + case "$?" in + 0) log_end_msg 0 ;; + 1) log_end_msg 1 ;; # Old process is still running + *) log_end_msg 1 ;; # Failed to start + esac + ;; + *) + # Failed to stop + log_end_msg 1 + ;; + esac + ;; + *) + echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2 + exit 3 + ;; +esac + +: diff --git a/debian/hyperv-daemons.hv-vss-daemon.init b/debian/hyperv-daemons.hv-vss-daemon.init new file mode 100755 index 000000000..aff28fcbe --- /dev/null +++ b/debian/hyperv-daemons.hv-vss-daemon.init @@ -0,0 +1,109 @@ +#! /bin/sh +### BEGIN INIT INFO +# Provides: hyperv-daemons.hv-vss-daemon +# Required-Start: $remote_fs $syslog +# Required-Stop: $remote_fs $syslog +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: Hyper-V volume shadow copy service (VSS) daemon +### END INIT INFO + +PATH=/sbin:/usr/sbin:/bin:/usr/bin +DESC="Hyper-V volume shadow copy service (VSS) daemon" +NAME=hv_vss_daemon +DAEMON=/usr/sbin/$NAME +PIDFILE=/var/run/$NAME.pid +SCRIPTNAME=/etc/init.d/hyperv-daemons.hv-vss-daemon + +# Exit if the package is not installed +[ -x "$DAEMON" ] || exit 0 + +# Exit if we are not running under Hyper-V +/lib/hyperv-daemons/check-hyperv || exit 0 + +# Load the VERBOSE setting and other rcS variables +. /lib/init/vars.sh + +# Define LSB log_* functions. +. /lib/lsb/init-functions + +# +# Function that starts the daemon/service +# +do_start() +{ + # Return + # 0 if daemon has been started + # 1 if daemon was already running + # 2 if daemon could not be started + start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \ + || return 1 + start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --background --make-pidfile -- -n \ + || return 2 +} + +# +# Function that stops the daemon/service +# +do_stop() +{ + # Return + # 0 if daemon has been stopped + # 1 if daemon was already stopped + # 2 if daemon could not be stopped + # other if a failure occurred + start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME + [ "$?" = 2 ] && return 2 + start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON + RETVAL=$? + [ "$RETVAL" = 2 ] && return 2 + # Many daemons don't delete their pidfiles when they exit. + rm -f $PIDFILE + return "$RETVAL" +} + +case "$1" in + start) + [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME" + do_start + case "$?" in + 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;; + 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;; + esac + ;; + stop) + [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME" + do_stop + case "$?" in + 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;; + 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;; + esac + ;; + status) + status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $? + ;; + restart|force-reload) + log_daemon_msg "Restarting $DESC" "$NAME" + do_stop + case "$?" in + 0|1) + do_start + case "$?" in + 0) log_end_msg 0 ;; + 1) log_end_msg 1 ;; # Old process is still running + *) log_end_msg 1 ;; # Failed to start + esac + ;; + *) + # Failed to stop + log_end_msg 1 + ;; + esac + ;; + *) + echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2 + exit 3 + ;; +esac + +: diff --git a/debian/patches/revert-perf-tools-x86-build-perf-on-older-user-space.patch b/debian/patches/revert-perf-tools-x86-build-perf-on-older-user-space.patch new file mode 100644 index 000000000..c4e2e272a --- /dev/null +++ b/debian/patches/revert-perf-tools-x86-build-perf-on-older-user-space.patch @@ -0,0 +1,57 @@ +From d9ea89d8408f647c05c720bf35a1fba4992dd4a8 Mon Sep 17 00:00:00 2001 +From: Ben Hutchings +Date: Thu, 18 Feb 2016 23:37:19 +0000 +Subject: [PATCH] Revert "perf tools, x86: Build perf on older user-space as + well" + +This reverts commit eae7a755ee81129370c8f555b0d5672e6673735d. +The empty unistd_{32,64}.h headers prevent building on sh, which also +now splits its unistd.h this way. + +Signed-off-by: Ben Hutchings +--- + tools/perf/perf-sys.h | 6 ------ + tools/perf/util/include/asm/unistd_32.h | 1 - + tools/perf/util/include/asm/unistd_64.h | 1 - + 3 files changed, 8 deletions(-) + delete mode 100644 tools/perf/util/include/asm/unistd_32.h + delete mode 100644 tools/perf/util/include/asm/unistd_64.h + +diff --git a/tools/perf/perf-sys.h b/tools/perf/perf-sys.h +index 83a25cef82fd..182a84eb5bd6 100644 +--- a/tools/perf/perf-sys.h ++++ b/tools/perf/perf-sys.h +@@ -11,9 +11,6 @@ + #if defined(__i386__) + #define cpu_relax() asm volatile("rep; nop" ::: "memory"); + #define CPUINFO_PROC {"model name"} +-#ifndef __NR_perf_event_open +-# define __NR_perf_event_open 336 +-#endif + #ifndef __NR_futex + # define __NR_futex 240 + #endif +@@ -25,9 +22,6 @@ + #if defined(__x86_64__) + #define cpu_relax() asm volatile("rep; nop" ::: "memory"); + #define CPUINFO_PROC {"model name"} +-#ifndef __NR_perf_event_open +-# define __NR_perf_event_open 298 +-#endif + #ifndef __NR_futex + # define __NR_futex 202 + #endif +diff --git a/tools/perf/util/include/asm/unistd_32.h b/tools/perf/util/include/asm/unistd_32.h +deleted file mode 100644 +index 8b137891791f..000000000000 +--- a/tools/perf/util/include/asm/unistd_32.h ++++ /dev/null +@@ -1 +0,0 @@ +- +diff --git a/tools/perf/util/include/asm/unistd_64.h b/tools/perf/util/include/asm/unistd_64.h +deleted file mode 100644 +index 8b137891791f..000000000000 +--- a/tools/perf/util/include/asm/unistd_64.h ++++ /dev/null +@@ -1 +0,0 @@ +- diff --git a/debian/patches/series b/debian/patches/series index 88588321a..1d7e9974d 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -16,4 +16,5 @@ revert-perf-build-fix-libunwind-feature-detection-on.patch alpha-uapi-add-support-for-__sane_userspace_types__.patch perf-fix-misleadingly-indented-assignment-whitespace.patch perf-tools-fix-unused-variables-x86_-32-64-_regoffse.patch +revert-perf-tools-x86-build-perf-on-older-user-space.patch lockdep-add-missing-macros.patch diff --git a/debian/rules.d/tools/hv/Makefile b/debian/rules.d/tools/hv/Makefile index 25af78660..06a50a4f7 100644 --- a/debian/rules.d/tools/hv/Makefile +++ b/debian/rules.d/tools/hv/Makefile @@ -1,14 +1,16 @@ PROGS = \ hv_fcopy_daemon \ hv_kvp_daemon \ - hv_vss_daemon + hv_vss_daemon \ + check-hyperv prefix = /usr/sbin include $(top_rulesdir)/Makefile.inc install-local-progs: $(PROGS) - @for p in $^; do \ + @for p in $(filter-out check-hyperv,$^); do \ echo " install -m755 '$$p' '$(DESTDIR)/$(prefix)'"; \ install -D -m755 "$$p" "$(DESTDIR)/$(prefix)/$$(basename $$p)"; \ done + install -D -m755 check-hyperv '$(DESTDIR)/lib/hyperv-daemons/check-hyperv' diff --git a/debian/rules.d/tools/hv/check-hyperv.c b/debian/rules.d/tools/hv/check-hyperv.c new file mode 100644 index 000000000..4d2b6f515 --- /dev/null +++ b/debian/rules.d/tools/hv/check-hyperv.c @@ -0,0 +1,103 @@ +/* + * This program is derived from systemd. + * + * Copyright 2011 Lennart Poettering + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation; either version 2.1 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; If not, see . + */ + +#include +#include +#include + +#define streq(a, b) (!strcmp(a, b)) +#define ELEMENTSOF(a) (sizeof(a) / sizeof((a)[0])) + +enum { + VIRTUALIZATION_NONE, + VIRTUALIZATION_VM_OTHER, + VIRTUALIZATION_MICROSOFT, +}; + +static int detect_vm_cpuid(void) { + + static const struct { + const char *cpuid; + int id; + } cpuid_vendor_table[] = { + /* http://msdn.microsoft.com/en-us/library/ff542428.aspx */ + { "Microsoft Hv", VIRTUALIZATION_MICROSOFT }, + }; + + uint32_t eax, ecx; + bool hypervisor; + + /* http://lwn.net/Articles/301888/ */ + +#if defined (__i386__) +#define REG_a "eax" +#define REG_b "ebx" +#elif defined (__amd64__) +#define REG_a "rax" +#define REG_b "rbx" +#endif + + /* First detect whether there is a hypervisor */ + eax = 1; + __asm__ __volatile__ ( + /* ebx/rbx is being used for PIC! */ + " push %%"REG_b" \n\t" + " cpuid \n\t" + " pop %%"REG_b" \n\t" + + : "=a" (eax), "=c" (ecx) + : "0" (eax) + ); + + hypervisor = !!(ecx & 0x80000000U); + + if (hypervisor) { + union { + uint32_t sig32[3]; + char text[13]; + } sig = {}; + unsigned j; + + /* There is a hypervisor, see what it is */ + eax = 0x40000000U; + __asm__ __volatile__ ( + /* ebx/rbx is being used for PIC! */ + " push %%"REG_b" \n\t" + " cpuid \n\t" + " mov %%ebx, %1 \n\t" + " pop %%"REG_b" \n\t" + + : "=a" (eax), "=r" (sig.sig32[0]), "=c" (sig.sig32[1]), "=d" (sig.sig32[2]) + : "0" (eax) + ); + + for (j = 0; j < ELEMENTSOF(cpuid_vendor_table); j ++) + if (streq(sig.text, cpuid_vendor_table[j].cpuid)) + return cpuid_vendor_table[j].id; + + return VIRTUALIZATION_VM_OTHER; + } + + return VIRTUALIZATION_NONE; +} + +int main(void) +{ + return detect_vm_cpuid() != VIRTUALIZATION_MICROSOFT; +} diff --git a/debian/rules.d/tools/perf/Makefile b/debian/rules.d/tools/perf/Makefile index 0d97497ab..6813e8302 100644 --- a/debian/rules.d/tools/perf/Makefile +++ b/debian/rules.d/tools/perf/Makefile @@ -33,7 +33,7 @@ MAKE_PERF := $(MAKE) O=$(CURDIR) prefix=/usr V=1 ARCH=$(KERNEL_ARCH_PERF) EXTRA_ MAKE_PERF += NO_GTK2=1 # Include version in all directory names -MAKE_PERF += perfexecdir=lib/perf_$(VERSION)-core plugindir=/usr/lib/traceevent_$(VERSION)/plugins +MAKE_PERF += perfexecdir=lib/perf_$(VERSION)-core plugindir=/usr/lib/traceevent_$(VERSION)/plugins STRACE_GROUPS_DIR=share/perf_$(VERSION)-core/strace/groups # perf can link against libbfd if available, but the result is # undistributable as they are licenced under GPL v2 and v3+ diff --git a/debian/rules.real b/debian/rules.real index 34b0ebc2f..adf4520d7 100644 --- a/debian/rules.real +++ b/debian/rules.real @@ -99,9 +99,19 @@ install-hyperv-daemons: $(STAMPS_DIR)/build dh_prep $(call submake,tools/hv) install DESTDIR=$(DIR) dh_install + for service in fcopy kvp vss; do \ + install -D -m755 debian/hyperv-daemons.hv-$$service-daemon.init \ + $(DIR)/etc/init.d/hyperv-daemons.hv-$$service-daemon \ + || break; \ + done dh_installchangelogs dh_installdocs dh_systemd_enable + for service in fcopy kvp vss; do \ + dh_installinit --name hyperv-daemons.hv-$$service-daemon \ + --onlyscripts \ + || break; \ + done dh_systemd_start dh_lintian dh_strip diff --git a/debian/templates/control.main.in b/debian/templates/control.main.in index 6106752f6..9da6d26ef 100644 --- a/debian/templates/control.main.in +++ b/debian/templates/control.main.in @@ -55,7 +55,7 @@ Description: USB device sharing system over IP network Package: hyperv-daemons Architecture: i386 amd64 x32 -Depends: ${shlibs:Depends}, ${misc:Depends} +Depends: lsb-base (>= 3.2-14), ${shlibs:Depends}, ${misc:Depends} Section: admin Description: Support daemons for Linux running on Hyper-V Suite of daemons for Linux guests running on Hyper-V, consisting of