Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ddc4becc authored by Ingo Molnar's avatar Ingo Molnar
Browse files

Merge tag 'perf-core-for-mingo-4.17-20180220' of...

Merge tag 'perf-core-for-mingo-4.17-20180220' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux

 into perf/core

Pull perf/core improvements and fixes from Arnaldo Carvalho de Melo:

- Initial support for linking with python3, by explicitely setting
  the PYTHON Makefile variable, python2 remains supported, more work
  needed to test the shipped python scripts used with 'perf script'
  (Jaroslav Škarvada)

- Make twatch.py, an example python script that sets up evlists and
  evsels to then parse events from mmap, to work with both python2 and
  python3 (Arnaldo Carvalho de Melo)

- Fix setting 'perf ftrace' function filter when using a non-existent
  function, which should result in an error instead of simply not setting
  the filter and showing all functions (Changbin Du)

- Fix paranoid check in machine__set_kernel_mmap(), problem introduced
  in previous perf/core batch (Namhyung Kim)

- Fix reading cpuid model information in s/390, ditto, also introduced
  in the previous perf/core batch (Thomas Richter)

Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
parents 11737ca9 66dfdff0
Loading
Loading
Loading
Loading
+4 −19
Original line number Diff line number Diff line
@@ -667,20 +667,6 @@ else

      ifneq ($(feature-libpython), 1)
        $(call disable-python,No 'Python.h' (for Python 2.x support) was found: disables Python support - please install python-devel/python-dev)
      else
        ifneq ($(feature-libpython-version), 1)
          $(warning Python 3 is not yet supported; please set)
          $(warning PYTHON and/or PYTHON_CONFIG appropriately.)
          $(warning If you also have Python 2 installed, then)
          $(warning try something like:)
          $(warning $(and ,))
          $(warning $(and ,)  make PYTHON=python2)
          $(warning $(and ,))
          $(warning Otherwise, disable Python support entirely:)
          $(warning $(and ,))
          $(warning $(and ,)  make NO_LIBPYTHON=1)
          $(warning $(and ,))
          $(error   $(and ,))
      else
         LDFLAGS += $(PYTHON_EMBED_LDFLAGS)
         EXTLIBS += $(PYTHON_EMBED_LIBADD)
@@ -690,7 +676,6 @@ else
    endif
  endif
endif
endif

ifeq ($(feature-libbfd), 1)
  EXTLIBS += -lbfd
+2 −2
Original line number Diff line number Diff line
@@ -302,7 +302,7 @@ PYTHON_EXTBUILD_LIB := $(PYTHON_EXTBUILD)lib/
PYTHON_EXTBUILD_TMP := $(PYTHON_EXTBUILD)tmp/
export PYTHON_EXTBUILD_LIB PYTHON_EXTBUILD_TMP

python-clean := $(call QUIET_CLEAN, python) $(RM) -r $(PYTHON_EXTBUILD) $(OUTPUT)python/perf.so
python-clean := $(call QUIET_CLEAN, python) $(RM) -r $(PYTHON_EXTBUILD) $(OUTPUT)python/perf*.so

PYTHON_EXT_SRCS := $(shell grep -v ^\# util/python-ext-sources)
PYTHON_EXT_DEPS := util/python-ext-sources util/setup.py $(LIBTRACEEVENT) $(LIBAPI)
@@ -479,7 +479,7 @@ $(OUTPUT)python/perf.so: $(PYTHON_EXT_SRCS) $(PYTHON_EXT_DEPS) $(LIBTRACEEVENT_D
	  $(PYTHON_WORD) util/setup.py \
	  --quiet build_ext; \
	mkdir -p $(OUTPUT)python && \
	cp $(PYTHON_EXTBUILD_LIB)perf.so $(OUTPUT)python/
	cp $(PYTHON_EXTBUILD_LIB)perf*.so $(OUTPUT)python/

please_set_SHELL_PATH_to_a_more_modern_shell:
	$(Q)$$(:)
+1 −1
Original line number Diff line number Diff line
@@ -81,7 +81,7 @@ int get_cpuid(char *buffer, size_t sz)
			line2 = line + strlen(SYSINFO_MODEL);

			while ((cp = strtok_r(line2, "\n ", &line2))) {
				mdsize += scnprintf(model + mdsize, sizeof(type) - mdsize,
				mdsize += scnprintf(model + mdsize, sizeof(model) - mdsize,
						    "%s%s", model[0] ? "," : "", cp);
			}
			break;
+16 −2
Original line number Diff line number Diff line
@@ -72,6 +72,7 @@ static int __write_tracing_file(const char *name, const char *val, bool append)
	ssize_t size = strlen(val);
	int flags = O_WRONLY;
	char errbuf[512];
	char *val_copy;

	file = get_tracing_file(name);
	if (!file) {
@@ -91,12 +92,23 @@ static int __write_tracing_file(const char *name, const char *val, bool append)
		goto out;
	}

	if (write(fd, val, size) == size)
	/*
	 * Copy the original value and append a '\n'. Without this,
	 * the kernel can hide possible errors.
	 */
	val_copy = strdup(val);
	if (!val_copy)
		goto out_close;
	val_copy[size] = '\n';

	if (write(fd, val_copy, size + 1) == size + 1)
		ret = 0;
	else
		pr_debug("write '%s' to tracing/%s failed: %s\n",
			 val, name, str_error_r(errno, errbuf, sizeof(errbuf)));

	free(val_copy);
out_close:
	close(fd);
out:
	put_tracing_file(file);
@@ -280,8 +292,10 @@ static int __cmd_ftrace(struct perf_ftrace *ftrace, int argc, const char **argv)
	signal(SIGCHLD, sig_handler);
	signal(SIGPIPE, sig_handler);

	if (reset_tracing_files(ftrace) < 0)
	if (reset_tracing_files(ftrace) < 0) {
		pr_err("failed to reset ftrace\n");
		goto out;
	}

	/* reset ftrace buffer */
	if (write_tracing_file("trace", "0") < 0)
+4 −4
Original line number Diff line number Diff line
@@ -42,10 +42,10 @@ def main(context_switch = 0, thread = -1):
			event = evlist.read_on_cpu(cpu)
			if not event:
				continue
			print "cpu: %2d, pid: %4d, tid: %4d" % (event.sample_cpu,
			print("cpu: {0}, pid: {1}, tid: {2} {3}".format(event.sample_cpu,
                                                                        event.sample_pid,
								event.sample_tid),
			print event
                                                                        event.sample_tid,
                                                                        event))

if __name__ == '__main__':
    """
Loading