Commit f79a17bf authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull perf fixes from Ingo Molnar:
 "Mostly tooling fixes, plus a static key fix fixing /sys/devices/cpu/rdpmc"

* 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  perf tools: Really allow to specify custom CC, AR or LD
  perf auxtrace: Fix misplaced check for HAVE_SYNC_COMPARE_AND_SWAP_SUPPORT
  perf hists browser: Take the --comm, --dsos, etc filters into account
  perf symbols: Store if there is a filter in place
  x86, perf: Fix static_key bug in load_mm_cr4()
  tools: Copy lib/hweight.c from the kernel sources
  perf tools: Fix the detached tarball wrt rbtree copy
  perf thread_map: Fix the sizeof() calculation for map entries
  tools lib: Improve clean target
  perf stat: Fix shadow declaration of close
  perf tools: Fix lockup using 32-bit compat vdso
parents 59ee7621 a6acd6a4
...@@ -23,7 +23,7 @@ extern struct static_key rdpmc_always_available; ...@@ -23,7 +23,7 @@ extern struct static_key rdpmc_always_available;
static inline void load_mm_cr4(struct mm_struct *mm) static inline void load_mm_cr4(struct mm_struct *mm)
{ {
if (static_key_true(&rdpmc_always_available) || if (static_key_false(&rdpmc_always_available) ||
atomic_read(&mm->context.perf_rdpmc_allowed)) atomic_read(&mm->context.perf_rdpmc_allowed))
cr4_set_bits(X86_CR4_PCE); cr4_set_bits(X86_CR4_PCE);
else else
......
...@@ -36,7 +36,7 @@ $(LIBFILE): $(API_IN) ...@@ -36,7 +36,7 @@ $(LIBFILE): $(API_IN)
clean: clean:
$(call QUIET_CLEAN, libapi) $(RM) $(LIBFILE); \ $(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: FORCE:
......
#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 ...@@ -268,7 +268,7 @@ install: install_lib
clean: clean:
$(call QUIET_CLEAN, libtraceevent) \ $(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 $(RM) TRACEEVENT-CFLAGS tags TAGS
PHONY += force plugins PHONY += force plugins
......
...@@ -18,6 +18,7 @@ tools/arch/x86/include/asm/atomic.h ...@@ -18,6 +18,7 @@ tools/arch/x86/include/asm/atomic.h
tools/arch/x86/include/asm/rmwcc.h tools/arch/x86/include/asm/rmwcc.h
tools/lib/traceevent tools/lib/traceevent
tools/lib/api tools/lib/api
tools/lib/hweight.c
tools/lib/rbtree.c tools/lib/rbtree.c
tools/lib/symbol/kallsyms.c tools/lib/symbol/kallsyms.c
tools/lib/symbol/kallsyms.h tools/lib/symbol/kallsyms.h
...@@ -57,7 +58,6 @@ include/linux/perf_event.h ...@@ -57,7 +58,6 @@ include/linux/perf_event.h
include/linux/list.h include/linux/list.h
include/linux/hash.h include/linux/hash.h
include/linux/stringify.h include/linux/stringify.h
lib/hweight.c
include/linux/swab.h include/linux/swab.h
arch/*/include/asm/unistd*.h arch/*/include/asm/unistd*.h
arch/*/include/uapi/asm/unistd*.h arch/*/include/uapi/asm/unistd*.h
......
...@@ -109,9 +109,22 @@ $(OUTPUT)PERF-VERSION-FILE: ../../.git/HEAD ...@@ -109,9 +109,22 @@ $(OUTPUT)PERF-VERSION-FILE: ../../.git/HEAD
$(Q)$(SHELL_PATH) util/PERF-VERSION-GEN $(OUTPUT) $(Q)$(SHELL_PATH) util/PERF-VERSION-GEN $(OUTPUT)
$(Q)touch $(OUTPUT)PERF-VERSION-FILE $(Q)touch $(OUTPUT)PERF-VERSION-FILE
CC = $(CROSS_COMPILE)gcc # Makefiles suck: This macro sets a default value of $(2) for the
LD ?= $(CROSS_COMPILE)ld # variable named by $(1), unless the variable has been set by
AR = $(CROSS_COMPILE)ar # environment or command line. This is necessary for CC and AR
# because make sets default values, so the simpler ?= approach
# won't work as expected.
define allow-override
$(if $(or $(findstring environment,$(origin $(1))),\
$(findstring command line,$(origin $(1)))),,\
$(eval $(1) = $(2)))
endef
# Allow setting CC and AR and LD, or setting CROSS_COMPILE as a prefix.
$(call allow-override,CC,$(CROSS_COMPILE)gcc)
$(call allow-override,AR,$(CROSS_COMPILE)ar)
$(call allow-override,LD,$(CROSS_COMPILE)ld)
PKG_CONFIG = $(CROSS_COMPILE)pkg-config PKG_CONFIG = $(CROSS_COMPILE)pkg-config
RM = rm -f RM = rm -f
......
...@@ -343,7 +343,7 @@ static int read_counter(struct perf_evsel *counter) ...@@ -343,7 +343,7 @@ static int read_counter(struct perf_evsel *counter)
return 0; return 0;
} }
static void read_counters(bool close) static void read_counters(bool close_counters)
{ {
struct perf_evsel *counter; struct perf_evsel *counter;
...@@ -354,7 +354,7 @@ static void read_counters(bool close) ...@@ -354,7 +354,7 @@ static void read_counters(bool close)
if (process_counter(counter)) if (process_counter(counter))
pr_warning("failed to process counter %s\n", counter->name); 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), perf_evsel__close_fd(counter, perf_evsel__nr_cpus(counter),
thread_map__nr(evsel_list->threads)); thread_map__nr(evsel_list->threads));
} }
......
...@@ -48,7 +48,7 @@ static struct rb_node *hists__filter_entries(struct rb_node *nd, ...@@ -48,7 +48,7 @@ static struct rb_node *hists__filter_entries(struct rb_node *nd,
static bool hist_browser__has_filter(struct hist_browser *hb) static bool hist_browser__has_filter(struct hist_browser *hb)
{ {
return hists__has_filter(hb->hists) || hb->min_pcnt; return hists__has_filter(hb->hists) || hb->min_pcnt || symbol_conf.has_filter;
} }
static int hist_browser__get_folding(struct hist_browser *browser) static int hist_browser__get_folding(struct hist_browser *browser)
......
...@@ -143,6 +143,6 @@ $(OUTPUT)util/rbtree.o: ../lib/rbtree.c FORCE ...@@ -143,6 +143,6 @@ $(OUTPUT)util/rbtree.o: ../lib/rbtree.c FORCE
$(call rule_mkdir) $(call rule_mkdir)
$(call if_changed_dep,cc_o_c) $(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 rule_mkdir)
$(call if_changed_dep,cc_o_c) $(call if_changed_dep,cc_o_c)
...@@ -53,11 +53,6 @@ int auxtrace_mmap__mmap(struct auxtrace_mmap *mm, ...@@ -53,11 +53,6 @@ int auxtrace_mmap__mmap(struct auxtrace_mmap *mm,
{ {
struct perf_event_mmap_page *pc = userpg; struct perf_event_mmap_page *pc = userpg;
#if BITS_PER_LONG != 64 && !defined(HAVE_SYNC_COMPARE_AND_SWAP_SUPPORT)
pr_err("Cannot use AUX area tracing mmaps\n");
return -1;
#endif
WARN_ONCE(mm->base, "Uninitialized auxtrace_mmap\n"); WARN_ONCE(mm->base, "Uninitialized auxtrace_mmap\n");
mm->userpg = userpg; mm->userpg = userpg;
...@@ -73,6 +68,11 @@ int auxtrace_mmap__mmap(struct auxtrace_mmap *mm, ...@@ -73,6 +68,11 @@ int auxtrace_mmap__mmap(struct auxtrace_mmap *mm,
return 0; return 0;
} }
#if BITS_PER_LONG != 64 && !defined(HAVE_SYNC_COMPARE_AND_SWAP_SUPPORT)
pr_err("Cannot use AUX area tracing mmaps\n");
return -1;
#endif
pc->aux_offset = mp->offset; pc->aux_offset = mp->offset;
pc->aux_size = mp->len; pc->aux_size = mp->len;
......
...@@ -10,7 +10,7 @@ util/ctype.c ...@@ -10,7 +10,7 @@ util/ctype.c
util/evlist.c util/evlist.c
util/evsel.c util/evsel.c
util/cpumap.c util/cpumap.c
../../lib/hweight.c ../lib/hweight.c
util/thread_map.c util/thread_map.c
util/util.c util/util.c
util/xyarray.c util/xyarray.c
...@@ -19,5 +19,5 @@ util/rblist.c ...@@ -19,5 +19,5 @@ util/rblist.c
util/stat.c util/stat.c
util/strlist.c util/strlist.c
util/trace-event.c util/trace-event.c
../../lib/rbtree.c ../lib/rbtree.c
util/string.c util/string.c
...@@ -1911,6 +1911,8 @@ int setup_list(struct strlist **list, const char *list_str, ...@@ -1911,6 +1911,8 @@ int setup_list(struct strlist **list, const char *list_str,
pr_err("problems parsing %s list\n", list_name); pr_err("problems parsing %s list\n", list_name);
return -1; return -1;
} }
symbol_conf.has_filter = true;
return 0; return 0;
} }
......
...@@ -105,7 +105,8 @@ struct symbol_conf { ...@@ -105,7 +105,8 @@ struct symbol_conf {
demangle_kernel, demangle_kernel,
filter_relative, filter_relative,
show_hist_headers, show_hist_headers,
branch_callstack; branch_callstack,
has_filter;
const char *vmlinux_name, const char *vmlinux_name,
*kallsyms_name, *kallsyms_name,
*source_prefix, *source_prefix,
......
...@@ -136,8 +136,7 @@ struct thread_map *thread_map__new_by_uid(uid_t uid) ...@@ -136,8 +136,7 @@ struct thread_map *thread_map__new_by_uid(uid_t uid)
if (grow) { if (grow) {
struct thread_map *tmp; struct thread_map *tmp;
tmp = realloc(threads, (sizeof(*threads) + tmp = thread_map__realloc(threads, max_threads);
max_threads * sizeof(pid_t)));
if (tmp == NULL) if (tmp == NULL)
goto out_free_namelist; goto out_free_namelist;
......
...@@ -236,18 +236,16 @@ static struct dso *__machine__findnew_compat(struct machine *machine, ...@@ -236,18 +236,16 @@ static struct dso *__machine__findnew_compat(struct machine *machine,
const char *file_name; const char *file_name;
struct dso *dso; struct dso *dso;
pthread_rwlock_wrlock(&machine->dsos.lock);
dso = __dsos__find(&machine->dsos, vdso_file->dso_name, true); dso = __dsos__find(&machine->dsos, vdso_file->dso_name, true);
if (dso) if (dso)
goto out_unlock; goto out;
file_name = vdso__get_compat_file(vdso_file); file_name = vdso__get_compat_file(vdso_file);
if (!file_name) if (!file_name)
goto out_unlock; goto out;
dso = __machine__addnew_vdso(machine, vdso_file->dso_name, file_name); dso = __machine__addnew_vdso(machine, vdso_file->dso_name, file_name);
out_unlock: out:
pthread_rwlock_unlock(&machine->dsos.lock);
return dso; return dso;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment