[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YFtF8tEPHrXnw7cX@hirez.programming.kicks-ass.net>
Date: Wed, 24 Mar 2021 15:00:18 +0100
From: Peter Zijlstra <peterz@...radead.org>
To: Marco Elver <elver@...gle.com>
Cc: alexander.shishkin@...ux.intel.com, acme@...nel.org,
mingo@...hat.com, jolsa@...hat.com, mark.rutland@....com,
namhyung@...nel.org, tglx@...utronix.de, glider@...gle.com,
viro@...iv.linux.org.uk, arnd@...db.de, christian@...uner.io,
dvyukov@...gle.com, jannh@...gle.com, axboe@...nel.dk,
mascasa@...gle.com, pcc@...gle.com, irogers@...gle.com,
kasan-dev@...glegroups.com, linux-arch@...r.kernel.org,
linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org,
x86@...nel.org, linux-kselftest@...r.kernel.org
Subject: Re: [PATCH v3 07/11] perf: Add breakpoint information to siginfo on
SIGTRAP
One last try, I'll leave it alone now, I promise :-)
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -778,6 +778,9 @@ struct perf_event {
void *security;
#endif
struct list_head sb_list;
+
+ unsigned long si_uattr;
+ unsigned long si_data;
#endif /* CONFIG_PERF_EVENTS */
};
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -5652,13 +5652,17 @@ static long _perf_ioctl(struct perf_even
return perf_event_query_prog_array(event, (void __user *)arg);
case PERF_EVENT_IOC_MODIFY_ATTRIBUTES: {
+ struct perf_event_attr __user *uattr;
struct perf_event_attr new_attr;
- int err = perf_copy_attr((struct perf_event_attr __user *)arg,
- &new_attr);
+ int err;
+ uattr = (struct perf_event_attr __user *)arg;
+ err = perf_copy_attr(uattr, &new_attr);
if (err)
return err;
+ event->si_uattr = (unsigned long)uattr;
+
return perf_event_modify_attr(event, &new_attr);
}
default:
@@ -6399,7 +6403,12 @@ static void perf_sigtrap(struct perf_eve
clear_siginfo(&info);
info.si_signo = SIGTRAP;
info.si_code = TRAP_PERF;
- info.si_errno = event->attr.type;
+ info.si_addr = (void *)event->si_data;
+
+ info.si_perf = event->si_uattr;
+ if (event->parent)
+ info.si_perf = event->parent->si_uattr;
+
force_sig_info(&info);
}
@@ -6414,8 +6423,8 @@ static void perf_pending_event_disable(s
WRITE_ONCE(event->pending_disable, -1);
if (event->attr.sigtrap) {
- atomic_set(&event->event_limit, 1); /* rearm event */
perf_sigtrap(event);
+ atomic_set_release(&event->event_limit, 1); /* rearm event */
return;
}
@@ -9121,6 +9130,7 @@ static int __perf_event_overflow(struct
if (events && atomic_dec_and_test(&event->event_limit)) {
ret = 1;
event->pending_kill = POLL_HUP;
+ event->si_data = data->addr;
perf_event_disable_inatomic(event);
}
@@ -12011,6 +12021,8 @@ SYSCALL_DEFINE5(perf_event_open,
goto err_task;
}
+ event->si_uattr = (unsigned long)attr_uptr;
+
if (is_sampling_event(event)) {
if (event->pmu->capabilities & PERF_PMU_CAP_NO_INTERRUPT) {
err = -EOPNOTSUPP;
Powered by blists - more mailing lists