mirror of
https://github.com/torvalds/linux.git
synced 2024-12-26 21:02:19 +00:00
perf/urgent fixes:
- Fix TUI progress bar when delta from new total from that of the previous update is greater than the progress "step" (screen width progress bar block)) (Jiri Olsa) - Make tools/lib/api make DEBUG=1 build use -D_FORTIFY_SOURCE=2 not to cripple debuginfo, just like tools/perf/ does (Jiri Olsa) - Avoid leaking the 'perf.data' file to workloads started from the 'perf record' command line by using the O_CLOEXEC open flag (Jiri Olsa) - Fix building when libunwind's 'unwind.h' file is present in the include path, clashing with tools/perf/util/unwind.h (Milian Wolff) - Check per .perfconfig section entry flag, not just per section (Taeung Song) - Support running perf binaries with a dash in their name, needed to run perf as an AppImage (Milian Wolff) - Wait for the right child by using waitpid() when running workloads from 'perf stat', also to fix using perf as an AppImage (Milian Wolff) Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEELb9bqkb7Te0zijNb1lAW81NSqkAFAlm4HVkACgkQ1lAW81NS qkByEhAAsNfQRKGQIeudLdEWx63wyZviU0KQ2zeNurbpEMHsttcHgQciYvqQmyCn FZ+zm21vcNBKd0pqFwPL0WPJzYSnudRT23cG2NFSLlFX7RNZhzgp0X1a75kACXCH oJKpu/D4YDDS8J+xLjApJUWaVOYW39yAG3Cdzq2IBYHvbvPg/ovrBkxrwKLhJJTE ZdQIjt+DbGbEUvgOMAji/BmpgjnV5/goz736KoOIiWso3LpAsEb5kiLBMghnSTyR M4Hxl7NHS+3f7J8QpTTVlcL4oxI7RgYSQbjnqdwhff4LRrTfS3txRcit20KCMwF/ u+n1JBgR7I3ogUoO1jXyi0IaDdi77Vr7EckO5Yd+8shGIiXICwx1pMl88NvxBNHN 6YB8sL8/Fbw6q7d/o5iHwbrkuLZDWaE7fU3kj31l+W5jSIM1orCwcUG+IPU8e2UQ M40vtebGEVWKkYl/UqGNGh9d6zlN8du8HW+uT0l9Hebon6YQFt/qDnP0PRQ5QlFi p8AozBXbCUxjenUknuaHN4QtIJhshOhzw2YRKxghWeVHqP/yJ8lrPy646NosKXMj qPHezIvrEarERDxn8sMlHic2edOfcbiol6GjZmxeDutvLJzc3i54+tfwVuIUG3TV o123i3Xt7vld6xaENxPhCvfEqo/IRRuvqAxAIvLRq+OLwc3H2ec= =d3gz -----END PGP SIGNATURE----- Merge tag 'perf-urgent-for-mingo-4.14-20170912' 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 TUI progress bar when delta from new total from that of the previous update is greater than the progress "step" (screen width progress bar block)) (Jiri Olsa) - Make tools/lib/api make DEBUG=1 build use -D_FORTIFY_SOURCE=2 not to cripple debuginfo, just like tools/perf/ does (Jiri Olsa) - Avoid leaking the 'perf.data' file to workloads started from the 'perf record' command line by using the O_CLOEXEC open flag (Jiri Olsa) - Fix building when libunwind's 'unwind.h' file is present in the include path, clashing with tools/perf/util/unwind.h (Milian Wolff) - Check per .perfconfig section entry flag, not just per section (Taeung Song) - Support running perf binaries with a dash in their name, needed to run perf as an AppImage (Milian Wolff) - Wait for the right child by using waitpid() when running workloads from 'perf stat', also to fix using perf as an AppImage (Milian Wolff) Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: Ingo Molnar <mingo@kernel.org>
This commit is contained in:
commit
b130a699c0
@ -21,11 +21,14 @@
|
||||
#define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0]))
|
||||
|
||||
#define noinline __attribute__((noinline))
|
||||
|
||||
#ifndef __packed
|
||||
#define __packed __attribute__((packed))
|
||||
|
||||
#endif
|
||||
#ifndef __noreturn
|
||||
#define __noreturn __attribute__((noreturn))
|
||||
|
||||
#endif
|
||||
#ifndef __aligned
|
||||
#define __aligned(x) __attribute__((aligned(x)))
|
||||
#endif
|
||||
#define __printf(a, b) __attribute__((format(printf, a, b)))
|
||||
#define __scanf(a, b) __attribute__((format(scanf, a, b)))
|
||||
|
@ -17,13 +17,19 @@ MAKEFLAGS += --no-print-directory
|
||||
LIBFILE = $(OUTPUT)libapi.a
|
||||
|
||||
CFLAGS := $(EXTRA_WARNINGS) $(EXTRA_CFLAGS)
|
||||
CFLAGS += -ggdb3 -Wall -Wextra -std=gnu99 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fPIC
|
||||
CFLAGS += -ggdb3 -Wall -Wextra -std=gnu99 -U_FORTIFY_SOURCE -fPIC
|
||||
|
||||
ifeq ($(DEBUG),0)
|
||||
ifeq ($(CC_NO_CLANG), 0)
|
||||
CFLAGS += -O3
|
||||
else
|
||||
CFLAGS += -O6
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(DEBUG),0)
|
||||
CFLAGS += -D_FORTIFY_SOURCE
|
||||
endif
|
||||
|
||||
# Treat warnings as errors unless directed not to
|
||||
ifneq ($(WERROR),0)
|
||||
|
@ -59,7 +59,7 @@ static int set_config(struct perf_config_set *set, const char *file_name,
|
||||
fprintf(fp, "[%s]\n", section->name);
|
||||
|
||||
perf_config_items__for_each_entry(§ion->items, item) {
|
||||
if (!use_system_config && section->from_system_config)
|
||||
if (!use_system_config && item->from_system_config)
|
||||
continue;
|
||||
if (item->value)
|
||||
fprintf(fp, "\t%s = %s\n",
|
||||
|
@ -707,7 +707,7 @@ try_again:
|
||||
process_interval();
|
||||
}
|
||||
}
|
||||
wait(&status);
|
||||
waitpid(child_pid, &status, 0);
|
||||
|
||||
if (workload_exec_errno) {
|
||||
const char *emsg = str_error_r(workload_exec_errno, msg, sizeof(msg));
|
||||
|
@ -467,15 +467,21 @@ int main(int argc, const char **argv)
|
||||
* - cannot execute it externally (since it would just do
|
||||
* the same thing over again)
|
||||
*
|
||||
* So we just directly call the internal command handler, and
|
||||
* die if that one cannot handle it.
|
||||
* So we just directly call the internal command handler. If that one
|
||||
* fails to handle this, then maybe we just run a renamed perf binary
|
||||
* that contains a dash in its name. To handle this scenario, we just
|
||||
* fall through and ignore the "xxxx" part of the command string.
|
||||
*/
|
||||
if (strstarts(cmd, "perf-")) {
|
||||
cmd += 5;
|
||||
argv[0] = cmd;
|
||||
handle_internal_command(argc, argv);
|
||||
fprintf(stderr, "cannot handle %s internally", cmd);
|
||||
goto out;
|
||||
/*
|
||||
* If the command is handled, the above function does not
|
||||
* return undo changes and fall through in such a case.
|
||||
*/
|
||||
cmd -= 5;
|
||||
argv[0] = cmd;
|
||||
}
|
||||
if (strstarts(cmd, "trace")) {
|
||||
#ifdef HAVE_LIBAUDIT_SUPPORT
|
||||
|
@ -6,7 +6,7 @@
|
||||
#include "debug.h"
|
||||
#include "machine.h"
|
||||
#include "event.h"
|
||||
#include "unwind.h"
|
||||
#include "../util/unwind.h"
|
||||
#include "perf_regs.h"
|
||||
#include "map.h"
|
||||
#include "thread.h"
|
||||
|
@ -1,3 +1,4 @@
|
||||
#include <linux/kernel.h>
|
||||
#include "../cache.h"
|
||||
#include "progress.h"
|
||||
|
||||
@ -14,10 +15,14 @@ struct ui_progress_ops *ui_progress__ops = &null_progress__ops;
|
||||
|
||||
void ui_progress__update(struct ui_progress *p, u64 adv)
|
||||
{
|
||||
u64 last = p->curr;
|
||||
|
||||
p->curr += adv;
|
||||
|
||||
if (p->curr >= p->next) {
|
||||
p->next += p->step;
|
||||
u64 nr = DIV_ROUND_UP(p->curr - last, p->step);
|
||||
|
||||
p->next += nr * p->step;
|
||||
ui_progress__ops->update(p);
|
||||
}
|
||||
}
|
||||
@ -25,7 +30,7 @@ void ui_progress__update(struct ui_progress *p, u64 adv)
|
||||
void ui_progress__init(struct ui_progress *p, u64 total, const char *title)
|
||||
{
|
||||
p->curr = 0;
|
||||
p->next = p->step = total / 16;
|
||||
p->next = p->step = total / 16 ?: 1;
|
||||
p->total = total;
|
||||
p->title = title;
|
||||
|
||||
|
@ -10,6 +10,16 @@
|
||||
#include "util.h"
|
||||
#include "debug.h"
|
||||
|
||||
#ifndef O_CLOEXEC
|
||||
#ifdef __sparc__
|
||||
#define O_CLOEXEC 0x400000
|
||||
#elif defined(__alpha__) || defined(__hppa__)
|
||||
#define O_CLOEXEC 010000000
|
||||
#else
|
||||
#define O_CLOEXEC 02000000
|
||||
#endif
|
||||
#endif
|
||||
|
||||
static bool check_pipe(struct perf_data_file *file)
|
||||
{
|
||||
struct stat st;
|
||||
@ -96,7 +106,8 @@ static int open_file_write(struct perf_data_file *file)
|
||||
if (check_backup(file))
|
||||
return -1;
|
||||
|
||||
fd = open(file->path, O_CREAT|O_RDWR|O_TRUNC, S_IRUSR|S_IWUSR);
|
||||
fd = open(file->path, O_CREAT|O_RDWR|O_TRUNC|O_CLOEXEC,
|
||||
S_IRUSR|S_IWUSR);
|
||||
|
||||
if (fd < 0)
|
||||
pr_err("failed to open %s : %s\n", file->path,
|
||||
|
Loading…
Reference in New Issue
Block a user