mirror of
https://github.com/torvalds/linux.git
synced 2024-11-10 14:11:52 +00:00
perf/urgent fixes:
These are only noticed when doing a detached tarball, i.e. when one does: make perf-perf-tar-src-pkg to create a perf-4.2.0-rc1.tar file and then try to build the contents of this tarball: - The python binding also has a MANIFEST like file where we list the files that need to be built and linked to form the resulting python shared object module file. And it has an entry for rbtree.c that still pointed to the one in the kernel sources, fix it by also removing one level of indirection so that it uses the tools/lib/rbtree.c copy. (Arnaldo Carvalho de Melo) - For the same reasons as for rbtree.c, copy the kernel lib/hweight.c file to tools/lib/, sanitizing it in the process to remove kernel specific stuff like EXPORT_SYMBOL() lines and the linux/export.h include reference, as that file doesn't exist anymore in tools/include/linux. (Arnaldo Carvalho de Melo) Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAABAgAGBQJVnuOBAAoJENZQFvNTUqpAgQwP/30+PqfZgFl1NQ980/cCguLW nMIwlw+GyQerOzffbCjRpilPJSV5IyWl9EwRxb53eyUugD/vUwEw0C3lgP1Txm27 4yMudNFDLSk4Nux3FIl+z0Y6Zp2y4RnmpDNqbGpro7zv7/G6YzcvSzS/qjhyKeS6 0leGcFVFRcnezpLFRGvNjChUhVtQ8ldoZW0PR5bGXika1BnQSs15aaUfZU7HDSHr RNf5LLO/ODh+XQZdBH42nOKbFlHJBWT6WyuuSC7+3shtM2Z2dS7jpFWILkdhdnSk Dypm9qAkU91gxuhLunasfzhJUXf2g+nbP5R75lwiIL6Z97/D3O9WBF8BBZgmfozt T29FDO/hPsW8SjHRfceyUysrVjUR4XP6vISj+6W+3ptAg1r7fPRrXzMsIRNJiDgB VK7ZWloO6aAHC+C1szudR99CXIxhz0x9sOOyrKmBi7Qc3hi0UszsT0yHOKzfFqga 4JtGAGUQUijQsiL+jN6vgUuWcuGW9/huGosDH4t7FR7o8eGHBap6e3rxXX0weKer Y8MVrm3a3v6SA2hUD6kSlw3XuBOSL0vBid8aAATiTzhQZfmMHKb48yxDt+U3eoO9 4Ygae6vNveKr0vYMlwvsy0lCcTbwxLwvtG4rRyQVOj7zwW/wdJ+30FAUFowD9r+9 MhUPsCF4B4OO1RkZtwjZ =bQ38 -----END PGP SIGNATURE----- Merge tag 'perf-urgent-for-mingo-2' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/urgent Pull perf/urgent fixes from Arnaldo Carvalho de Melo: - Fix 'perf top -u username', where not enough memory per thread_map entry was being allocated nor was being initialized, causing a segfault (Arnaldo Carvalho de Melo) - Fix locking lockup using 32-bit compat vdso (Adrian Hunter) - Fix shadow declaration of 'close' with older build environments (Jiri Olsa) - Make the 'clean' target do a better job, removing some more temp files (Riku Voipio) - The python binding also has a MANIFEST like file where we list the files that need to be built and linked to form the resulting python shared object module file. And it has an entry for rbtree.c that still pointed to the one in the kernel sources, fix it by also removing one level of indirection so that it uses the tools/lib/rbtree.c copy. (Arnaldo Carvalho de Melo) - For the same reasons as for rbtree.c, copy the kernel lib/hweight.c file to tools/lib/, sanitizing it in the process to remove kernel specific stuff like EXPORT_SYMBOL() lines and the linux/export.h include reference, as that file doesn't exist anymore in tools/include/linux. (Arnaldo Carvalho de Melo) Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: Ingo Molnar <mingo@kernel.org>
This commit is contained in:
commit
4756e1966c
@ -36,7 +36,7 @@ $(LIBFILE): $(API_IN)
|
||||
|
||||
clean:
|
||||
$(call QUIET_CLEAN, libapi) $(RM) $(LIBFILE); \
|
||||
find $(if $(OUTPUT),$(OUTPUT),.) -name \*.o | xargs $(RM)
|
||||
find $(if $(OUTPUT),$(OUTPUT),.) -name \*.o -or -name \*.o.cmd -or -name \*.o.d | xargs $(RM)
|
||||
|
||||
FORCE:
|
||||
|
||||
|
62
tools/lib/hweight.c
Normal file
62
tools/lib/hweight.c
Normal file
@ -0,0 +1,62 @@
|
||||
#include <linux/bitops.h>
|
||||
#include <asm/types.h>
|
||||
|
||||
/**
|
||||
* hweightN - returns the hamming weight of a N-bit word
|
||||
* @x: the word to weigh
|
||||
*
|
||||
* The Hamming Weight of a number is the total number of bits set in it.
|
||||
*/
|
||||
|
||||
unsigned int __sw_hweight32(unsigned int w)
|
||||
{
|
||||
#ifdef CONFIG_ARCH_HAS_FAST_MULTIPLIER
|
||||
w -= (w >> 1) & 0x55555555;
|
||||
w = (w & 0x33333333) + ((w >> 2) & 0x33333333);
|
||||
w = (w + (w >> 4)) & 0x0f0f0f0f;
|
||||
return (w * 0x01010101) >> 24;
|
||||
#else
|
||||
unsigned int res = w - ((w >> 1) & 0x55555555);
|
||||
res = (res & 0x33333333) + ((res >> 2) & 0x33333333);
|
||||
res = (res + (res >> 4)) & 0x0F0F0F0F;
|
||||
res = res + (res >> 8);
|
||||
return (res + (res >> 16)) & 0x000000FF;
|
||||
#endif
|
||||
}
|
||||
|
||||
unsigned int __sw_hweight16(unsigned int w)
|
||||
{
|
||||
unsigned int res = w - ((w >> 1) & 0x5555);
|
||||
res = (res & 0x3333) + ((res >> 2) & 0x3333);
|
||||
res = (res + (res >> 4)) & 0x0F0F;
|
||||
return (res + (res >> 8)) & 0x00FF;
|
||||
}
|
||||
|
||||
unsigned int __sw_hweight8(unsigned int w)
|
||||
{
|
||||
unsigned int res = w - ((w >> 1) & 0x55);
|
||||
res = (res & 0x33) + ((res >> 2) & 0x33);
|
||||
return (res + (res >> 4)) & 0x0F;
|
||||
}
|
||||
|
||||
unsigned long __sw_hweight64(__u64 w)
|
||||
{
|
||||
#if BITS_PER_LONG == 32
|
||||
return __sw_hweight32((unsigned int)(w >> 32)) +
|
||||
__sw_hweight32((unsigned int)w);
|
||||
#elif BITS_PER_LONG == 64
|
||||
#ifdef CONFIG_ARCH_HAS_FAST_MULTIPLIER
|
||||
w -= (w >> 1) & 0x5555555555555555ul;
|
||||
w = (w & 0x3333333333333333ul) + ((w >> 2) & 0x3333333333333333ul);
|
||||
w = (w + (w >> 4)) & 0x0f0f0f0f0f0f0f0ful;
|
||||
return (w * 0x0101010101010101ul) >> 56;
|
||||
#else
|
||||
__u64 res = w - ((w >> 1) & 0x5555555555555555ul);
|
||||
res = (res & 0x3333333333333333ul) + ((res >> 2) & 0x3333333333333333ul);
|
||||
res = (res + (res >> 4)) & 0x0F0F0F0F0F0F0F0Ful;
|
||||
res = res + (res >> 8);
|
||||
res = res + (res >> 16);
|
||||
return (res + (res >> 32)) & 0x00000000000000FFul;
|
||||
#endif
|
||||
#endif
|
||||
}
|
@ -268,7 +268,7 @@ install: install_lib
|
||||
|
||||
clean:
|
||||
$(call QUIET_CLEAN, libtraceevent) \
|
||||
$(RM) *.o *~ $(TARGETS) *.a *.so $(VERSION_FILES) .*.d \
|
||||
$(RM) *.o *~ $(TARGETS) *.a *.so $(VERSION_FILES) .*.d .*.cmd \
|
||||
$(RM) TRACEEVENT-CFLAGS tags TAGS
|
||||
|
||||
PHONY += force plugins
|
||||
|
@ -18,6 +18,7 @@ tools/arch/x86/include/asm/atomic.h
|
||||
tools/arch/x86/include/asm/rmwcc.h
|
||||
tools/lib/traceevent
|
||||
tools/lib/api
|
||||
tools/lib/hweight.c
|
||||
tools/lib/rbtree.c
|
||||
tools/lib/symbol/kallsyms.c
|
||||
tools/lib/symbol/kallsyms.h
|
||||
@ -57,7 +58,6 @@ include/linux/perf_event.h
|
||||
include/linux/list.h
|
||||
include/linux/hash.h
|
||||
include/linux/stringify.h
|
||||
lib/hweight.c
|
||||
include/linux/swab.h
|
||||
arch/*/include/asm/unistd*.h
|
||||
arch/*/include/uapi/asm/unistd*.h
|
||||
|
@ -343,7 +343,7 @@ static int read_counter(struct perf_evsel *counter)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void read_counters(bool close)
|
||||
static void read_counters(bool close_counters)
|
||||
{
|
||||
struct perf_evsel *counter;
|
||||
|
||||
@ -354,7 +354,7 @@ static void read_counters(bool close)
|
||||
if (process_counter(counter))
|
||||
pr_warning("failed to process counter %s\n", counter->name);
|
||||
|
||||
if (close) {
|
||||
if (close_counters) {
|
||||
perf_evsel__close_fd(counter, perf_evsel__nr_cpus(counter),
|
||||
thread_map__nr(evsel_list->threads));
|
||||
}
|
||||
|
@ -143,6 +143,6 @@ $(OUTPUT)util/rbtree.o: ../lib/rbtree.c FORCE
|
||||
$(call rule_mkdir)
|
||||
$(call if_changed_dep,cc_o_c)
|
||||
|
||||
$(OUTPUT)util/hweight.o: ../../lib/hweight.c FORCE
|
||||
$(OUTPUT)util/hweight.o: ../lib/hweight.c FORCE
|
||||
$(call rule_mkdir)
|
||||
$(call if_changed_dep,cc_o_c)
|
||||
|
@ -10,7 +10,7 @@ util/ctype.c
|
||||
util/evlist.c
|
||||
util/evsel.c
|
||||
util/cpumap.c
|
||||
../../lib/hweight.c
|
||||
../lib/hweight.c
|
||||
util/thread_map.c
|
||||
util/util.c
|
||||
util/xyarray.c
|
||||
@ -19,5 +19,5 @@ util/rblist.c
|
||||
util/stat.c
|
||||
util/strlist.c
|
||||
util/trace-event.c
|
||||
../../lib/rbtree.c
|
||||
../lib/rbtree.c
|
||||
util/string.c
|
||||
|
@ -136,8 +136,7 @@ struct thread_map *thread_map__new_by_uid(uid_t uid)
|
||||
if (grow) {
|
||||
struct thread_map *tmp;
|
||||
|
||||
tmp = realloc(threads, (sizeof(*threads) +
|
||||
max_threads * sizeof(pid_t)));
|
||||
tmp = thread_map__realloc(threads, max_threads);
|
||||
if (tmp == NULL)
|
||||
goto out_free_namelist;
|
||||
|
||||
|
@ -236,18 +236,16 @@ static struct dso *__machine__findnew_compat(struct machine *machine,
|
||||
const char *file_name;
|
||||
struct dso *dso;
|
||||
|
||||
pthread_rwlock_wrlock(&machine->dsos.lock);
|
||||
dso = __dsos__find(&machine->dsos, vdso_file->dso_name, true);
|
||||
if (dso)
|
||||
goto out_unlock;
|
||||
goto out;
|
||||
|
||||
file_name = vdso__get_compat_file(vdso_file);
|
||||
if (!file_name)
|
||||
goto out_unlock;
|
||||
goto out;
|
||||
|
||||
dso = __machine__addnew_vdso(machine, vdso_file->dso_name, file_name);
|
||||
out_unlock:
|
||||
pthread_rwlock_unlock(&machine->dsos.lock);
|
||||
out:
|
||||
return dso;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user