* [igt-dev] [RFC 0/3] tests/perf: new tests for OA interrupt
@ 2018-12-19 14:43 Lionel Landwerlin
2018-12-19 14:43 ` [igt-dev] [RFC 1/3] bump headers Lionel Landwerlin
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: Lionel Landwerlin @ 2018-12-19 14:43 UTC (permalink / raw)
To: igt-dev
Hi all,
Here is a first draft of the tests added for testing the OA interrupt
mechanism added to i915.
This is all subject to changes in the i915 series, just here for
testing and early feedback on the design of the tests.
Cheers,
Lionel Landwerlin (3):
bump headers
tests/perf: new tests for parameterized OA buffer polling
tests/perf: new tests for OA interrupt
include/drm-uapi/i915_drm.h | 15 ++
include/drm-uapi/v3d_drm.h | 25 +++
tests/perf.c | 422 ++++++++++++++++++++++++++++++++----
3 files changed, 422 insertions(+), 40 deletions(-)
--
2.20.1
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
^ permalink raw reply [flat|nested] 6+ messages in thread
* [igt-dev] [RFC 1/3] bump headers
2018-12-19 14:43 [igt-dev] [RFC 0/3] tests/perf: new tests for OA interrupt Lionel Landwerlin
@ 2018-12-19 14:43 ` Lionel Landwerlin
2018-12-19 14:43 ` [igt-dev] [RFC 2/3] tests/perf: new tests for parameterized OA buffer polling Lionel Landwerlin
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Lionel Landwerlin @ 2018-12-19 14:43 UTC (permalink / raw)
To: igt-dev
To be replaced by a proper update commit.
---
include/drm-uapi/i915_drm.h | 15 +++++++++++++++
include/drm-uapi/v3d_drm.h | 25 +++++++++++++++++++++++++
2 files changed, 40 insertions(+)
diff --git a/include/drm-uapi/i915_drm.h b/include/drm-uapi/i915_drm.h
index e39b26d4..3b1eb329 100644
--- a/include/drm-uapi/i915_drm.h
+++ b/include/drm-uapi/i915_drm.h
@@ -1540,6 +1540,21 @@ enum drm_i915_perf_property_id {
*/
DRM_I915_PERF_PROP_OA_EXPONENT,
+ /**
+ * Specifying this property sets up a timer in nanoseconds at which
+ * the i915 driver will check the OA buffer for available data. The
+ * values below 100 microseconds are not allowed.
+ */
+ DRM_I915_PERF_PROP_POLL_OA_DELAY,
+
+ /**
+ * Specifying this property sets up the interrupt mechanism for the OA
+ * buffer in i915. This option in conjuction with a long timer for OA
+ * avaibility can reduce CPU load significantly if you do not care
+ * about OA data being read as soon as it's available.
+ */
+ DRM_I915_PERF_PROP_OA_ENABLE_INTERRUPT,
+
DRM_I915_PERF_PROP_MAX /* non-ABI */
};
diff --git a/include/drm-uapi/v3d_drm.h b/include/drm-uapi/v3d_drm.h
index b1e5de07..35c7d813 100644
--- a/include/drm-uapi/v3d_drm.h
+++ b/include/drm-uapi/v3d_drm.h
@@ -36,6 +36,7 @@ extern "C" {
#define DRM_V3D_MMAP_BO 0x03
#define DRM_V3D_GET_PARAM 0x04
#define DRM_V3D_GET_BO_OFFSET 0x05
+#define DRM_V3D_SUBMIT_TFU 0x06
#define DRM_IOCTL_V3D_SUBMIT_CL DRM_IOWR(DRM_COMMAND_BASE + DRM_V3D_SUBMIT_CL, struct drm_v3d_submit_cl)
#define DRM_IOCTL_V3D_WAIT_BO DRM_IOWR(DRM_COMMAND_BASE + DRM_V3D_WAIT_BO, struct drm_v3d_wait_bo)
@@ -43,6 +44,7 @@ extern "C" {
#define DRM_IOCTL_V3D_MMAP_BO DRM_IOWR(DRM_COMMAND_BASE + DRM_V3D_MMAP_BO, struct drm_v3d_mmap_bo)
#define DRM_IOCTL_V3D_GET_PARAM DRM_IOWR(DRM_COMMAND_BASE + DRM_V3D_GET_PARAM, struct drm_v3d_get_param)
#define DRM_IOCTL_V3D_GET_BO_OFFSET DRM_IOWR(DRM_COMMAND_BASE + DRM_V3D_GET_BO_OFFSET, struct drm_v3d_get_bo_offset)
+#define DRM_IOCTL_V3D_SUBMIT_TFU DRM_IOW(DRM_COMMAND_BASE + DRM_V3D_SUBMIT_TFU, struct drm_v3d_submit_tfu)
/**
* struct drm_v3d_submit_cl - ioctl argument for submitting commands to the 3D
@@ -179,6 +181,7 @@ enum drm_v3d_param {
DRM_V3D_PARAM_V3D_CORE0_IDENT0,
DRM_V3D_PARAM_V3D_CORE0_IDENT1,
DRM_V3D_PARAM_V3D_CORE0_IDENT2,
+ DRM_V3D_PARAM_SUPPORTS_TFU,
};
struct drm_v3d_get_param {
@@ -197,6 +200,28 @@ struct drm_v3d_get_bo_offset {
__u32 offset;
};
+struct drm_v3d_submit_tfu {
+ __u32 icfg;
+ __u32 iia;
+ __u32 iis;
+ __u32 ica;
+ __u32 iua;
+ __u32 ioa;
+ __u32 ios;
+ __u32 coef[4];
+ /* First handle is the output BO, following are other inputs.
+ * 0 for unused.
+ */
+ __u32 bo_handles[4];
+ /* sync object to block on before running the TFU job. Each TFU
+ * job will execute in the order submitted to its FD. Synchronization
+ * against rendering jobs requires using sync objects.
+ */
+ __u32 in_sync;
+ /* Sync object to signal when the TFU job is done. */
+ __u32 out_sync;
+};
+
#if defined(__cplusplus)
}
#endif
--
2.20.1
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [igt-dev] [RFC 2/3] tests/perf: new tests for parameterized OA buffer polling
2018-12-19 14:43 [igt-dev] [RFC 0/3] tests/perf: new tests for OA interrupt Lionel Landwerlin
2018-12-19 14:43 ` [igt-dev] [RFC 1/3] bump headers Lionel Landwerlin
@ 2018-12-19 14:43 ` Lionel Landwerlin
2018-12-19 14:43 ` [igt-dev] [RFC 3/3] tests/perf: new tests for OA interrupt Lionel Landwerlin
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Lionel Landwerlin @ 2018-12-19 14:43 UTC (permalink / raw)
To: igt-dev
2 new tests verifying that the OA buffer is properly checked at the
frequency specified by userspace.
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
---
tests/perf.c | 204 +++++++++++++++++++++++++++++++++++++++++----------
1 file changed, 164 insertions(+), 40 deletions(-)
diff --git a/tests/perf.c b/tests/perf.c
index 54e7f4f4..efa9c4fd 100644
--- a/tests/perf.c
+++ b/tests/perf.c
@@ -210,6 +210,24 @@ get_oa_format(enum drm_i915_oa_format format)
return gen8_oa_formats[format];
}
+static char *
+pretty_print_oa_period(uint64_t oa_period_ns)
+{
+ static char result[100];
+ static const char *units[4] = { "ns", "us", "ms", "s" };
+ double val = oa_period_ns;
+ int iter = 0;
+
+ while (iter < (ARRAY_SIZE(units) - 1) &&
+ val >= 1000.0f) {
+ val /= 1000.0f;
+ iter++;
+ }
+
+ snprintf(result, sizeof(result), "%.3f%s", val, units[iter]);
+ return result;
+}
+
static void
__perf_close(int fd)
{
@@ -1993,15 +2011,12 @@ get_time(void)
* kernelspace.
*/
static void
-test_blocking(void)
+test_blocking(uint64_t requested_oa_period,
+ bool set_kernel_hrtimer,
+ uint64_t kernel_hrtimer,
+ bool verify_kernel_time)
{
- /* ~40 milliseconds
- *
- * Having a period somewhat > sysconf(_SC_CLK_TCK) helps to stop
- * scheduling (liable to kick in when we make blocking poll()s/reads)
- * from interfering with the test.
- */
- int oa_exponent = max_oa_exponent_for_period_lte(40000000);
+ int oa_exponent = max_oa_exponent_for_period_lte(requested_oa_period);
uint64_t oa_period = oa_exponent_to_ns(oa_exponent);
uint64_t properties[] = {
/* Include OA reports in samples */
@@ -2011,11 +2026,16 @@ test_blocking(void)
DRM_I915_PERF_PROP_OA_METRICS_SET, test_metric_set_id,
DRM_I915_PERF_PROP_OA_FORMAT, test_oa_format,
DRM_I915_PERF_PROP_OA_EXPONENT, oa_exponent,
+
+ /* Kernel configuration (optional) */
+ DRM_I915_PERF_PROP_POLL_OA_DELAY, kernel_hrtimer,
};
struct drm_i915_perf_open_param param = {
.flags = I915_PERF_FLAG_FD_CLOEXEC |
I915_PERF_FLAG_DISABLED,
- .num_properties = sizeof(properties) / 16,
+ .num_properties = (set_kernel_hrtimer ?
+ (ARRAY_SIZE(properties) / 2) :
+ ((ARRAY_SIZE(properties) / 2) - 1)),
.properties_ptr = to_user_pointer(properties),
};
uint8_t buf[1024 * 1024];
@@ -2037,7 +2057,7 @@ test_blocking(void)
* the knowledge that that the driver uses a 200Hz hrtimer (5ms period)
* to check for data and giving some time to read().
*/
- int min_iterations = (test_duration_ns / (oa_period + 6000000ull));
+ int min_iterations = (test_duration_ns / (oa_period + kernel_hrtimer + kernel_hrtimer / 5));
int64_t start, end;
int n = 0;
@@ -2047,9 +2067,10 @@ test_blocking(void)
times(&start_times);
igt_debug("tick length = %dns, test duration = %"PRIu64"ns, min iter. = %d,"
- " estimated max iter. = %d, oa_period = %"PRIu64"ns\n",
+ " estimated max iter. = %d, oa_period = %s\n",
(int)tick_ns, test_duration_ns,
- min_iterations, max_iterations, oa_period);
+ min_iterations, max_iterations,
+ pretty_print_oa_period(oa_period));
/* In the loop we perform blocking polls while the HW is sampling at
* ~25Hz, with the expectation that we spend most of our time blocked
@@ -2145,21 +2166,24 @@ test_blocking(void)
*/
igt_assert(n > (min_iterations + n_extra_iterations));
- igt_assert(kernel_ns <= (test_duration_ns / 100ull));
+ /* Only verify the amount of time spent in the kernel if
+ * requested. With the default i915/perf value, we're supposed
+ * to spend less than 1% of the time doing work, but with user
+ * specified values this is out of our hands.
+ */
+ if (verify_kernel_time)
+ igt_assert(kernel_ns <= (test_duration_ns / 100ull));
__perf_close(stream_fd);
}
static void
-test_polling(void)
+test_polling(uint64_t requested_oa_period,
+ bool set_kernel_hrtimer,
+ uint64_t kernel_hrtimer,
+ bool verify_kernel_time)
{
- /* ~40 milliseconds
- *
- * Having a period somewhat > sysconf(_SC_CLK_TCK) helps to stop
- * scheduling (liable to kick in when we make blocking poll()s/reads)
- * from interfering with the test.
- */
- int oa_exponent = max_oa_exponent_for_period_lte(40000000);
+ int oa_exponent = max_oa_exponent_for_period_lte(requested_oa_period);
uint64_t oa_period = oa_exponent_to_ns(oa_exponent);
uint64_t properties[] = {
/* Include OA reports in samples */
@@ -2169,12 +2193,17 @@ test_polling(void)
DRM_I915_PERF_PROP_OA_METRICS_SET, test_metric_set_id,
DRM_I915_PERF_PROP_OA_FORMAT, test_oa_format,
DRM_I915_PERF_PROP_OA_EXPONENT, oa_exponent,
+
+ /* Kernel configuration (optional) */
+ DRM_I915_PERF_PROP_POLL_OA_DELAY, kernel_hrtimer,
};
struct drm_i915_perf_open_param param = {
.flags = I915_PERF_FLAG_FD_CLOEXEC |
I915_PERF_FLAG_DISABLED |
I915_PERF_FLAG_FD_NONBLOCK,
- .num_properties = sizeof(properties) / 16,
+ .num_properties = (set_kernel_hrtimer ?
+ (ARRAY_SIZE(properties) / 2) :
+ ((ARRAY_SIZE(properties) / 2) - 1)),
.properties_ptr = to_user_pointer(properties),
};
uint8_t buf[1024 * 1024];
@@ -2188,24 +2217,24 @@ test_polling(void)
int n_extra_iterations = 0;
/* It's a bit tricky to put a lower limit here, but we expect a
- * relatively low latency for seeing reports, while we don't currently
- * give any control over this in the api.
+ * relatively low latency for seeing reports.
*
- * We assume a maximum latency of 6 millisecond to deliver a POLLIN and
- * read() after a new sample is written (46ms per iteration) considering
- * the knowledge that that the driver uses a 200Hz hrtimer (5ms period)
- * to check for data and giving some time to read().
+ * We assume a maximum latency of kernel_hrtimer + some margin
+ * to deliver a POLLIN and read() after a new sample is
+ * written (40ms + hrtimer + margin per iteration) considering
+ * the knowledge that that the driver uses a 200Hz hrtimer
+ * (5ms period) to check for data and giving some time to
+ * read().
*/
- int min_iterations = (test_duration_ns / (oa_period + 6000000ull));
+ int min_iterations = (test_duration_ns / (oa_period + (kernel_hrtimer + kernel_hrtimer / 5)));
int64_t start, end;
int n = 0;
stream_fd = __perf_open(drm_fd, ¶m, true /* prevent_pm */);
- times(&start_times);
-
- igt_debug("tick length = %dns, test duration = %"PRIu64"ns, min iter. = %d, max iter. = %d\n",
- (int)tick_ns, test_duration_ns,
+ igt_debug("tick length = %dns, oa period = %s, "
+ "test duration = %"PRIu64"ns, min iter. = %d, max iter. = %d\n",
+ (int)tick_ns, pretty_print_oa_period(oa_period), test_duration_ns,
min_iterations, max_iterations);
/* In the loop we perform blocking polls while the HW is sampling at
@@ -2312,8 +2341,8 @@ test_polling(void)
user_ns = (end_times.tms_utime - start_times.tms_utime) * tick_ns;
kernel_ns = (end_times.tms_stime - start_times.tms_stime) * tick_ns;
- igt_debug("%d blocking reads during test with ~25Hz OA sampling (expect no more than %d)\n",
- n, max_iterations);
+ igt_debug("%d blocking reads during test with %s OA sampling (expect no more than %d)\n",
+ n, pretty_print_oa_period(oa_period), max_iterations);
igt_debug("%d extra iterations seen, not related to periodic sampling (e.g. context switches)\n",
n_extra_iterations);
igt_debug("time in userspace = %"PRIu64"ns (+-%dns) (start utime = %d, end = %d)\n",
@@ -2333,7 +2362,13 @@ test_polling(void)
*/
igt_assert(n > (min_iterations + n_extra_iterations));
- igt_assert(kernel_ns <= (test_duration_ns / 100ull));
+ /* Only verify the amount of time spent in the kernel if
+ * requested. With the default i915/perf value, we're supposed
+ * to spend less than 1% of the time doing work, but with user
+ * specified values this is out of our hands.
+ */
+ if (verify_kernel_time)
+ igt_assert(kernel_ns <= (test_duration_ns / 100ull));
__perf_close(stream_fd);
}
@@ -4083,6 +4118,54 @@ test_sysctl_defaults(void)
igt_assert_eq(max_freq, 100000);
}
+static void
+test_invalid_poll_delay(void)
+{
+ uint64_t properties[] = {
+ /* Include OA reports in samples */
+ DRM_I915_PERF_PROP_SAMPLE_OA, true,
+
+ /* OA unit configuration */
+ DRM_I915_PERF_PROP_OA_METRICS_SET, test_metric_set_id,
+ DRM_I915_PERF_PROP_OA_FORMAT, test_oa_format,
+ DRM_I915_PERF_PROP_OA_EXPONENT, oa_exp_1_millisec,
+ DRM_I915_PERF_PROP_POLL_OA_DELAY, 10 * 1000 /* 10us */,
+ };
+ struct drm_i915_perf_open_param param = {
+ .flags = 0,
+ .num_properties = ARRAY_SIZE(properties) / 2,
+ .properties_ptr = to_user_pointer(properties),
+ };
+
+ do_ioctl_err(drm_fd, DRM_IOCTL_I915_PERF_OPEN, ¶m, EINVAL);
+}
+
+static bool
+kernel_supports_open_option(int fd, uint64_t option, uint64_t value)
+{
+ uint64_t properties[] = {
+ /* Intentionally wrong handle */
+ DRM_I915_PERF_PROP_CTX_HANDLE, UINT64_MAX,
+
+ DRM_I915_PERF_PROP_SAMPLE_OA, true,
+ DRM_I915_PERF_PROP_OA_METRICS_SET, test_metric_set_id,
+ DRM_I915_PERF_PROP_OA_FORMAT, test_oa_format,
+ DRM_I915_PERF_PROP_OA_EXPONENT, max_oa_exponent_for_period_lte(5000),
+ option, value,
+ };
+ struct drm_i915_perf_open_param param = {
+ .flags = I915_PERF_FLAG_FD_CLOEXEC,
+ .num_properties = ARRAY_SIZE(properties) / 2,
+ .properties_ptr = to_user_pointer(properties),
+ };
+ int ret;
+
+ ret = igt_ioctl(fd, DRM_IOCTL_I915_PERF_OPEN, ¶m);
+ assert(ret == -1);
+
+ return errno == ENOENT;
+}
+
igt_main
{
igt_skip_on_simulation();
@@ -4166,11 +4249,52 @@ igt_main
igt_subtest("enable-disable")
test_enable_disable();
- igt_subtest("blocking")
- test_blocking();
+ igt_subtest("blocking") {
+ test_blocking(40 * 1000 * 1000 /* 40ms oa period */,
+ false /* set_kernel_hrtimer */,
+ 5 * 1000 * 1000 /* default 5ms/200Hz hrtimer */,
+ true /* verify_kernel_time */);
+ }
+
+ igt_subtest("blocking-parameterized") {
+ igt_require(kernel_supports_open_option(drm_fd,
+ DRM_I915_PERF_PROP_POLL_OA_DELAY,
+ 40 * 1000 * 1000));
+
+ test_blocking(10 * 1000 * 1000 /* 10ms oa period */,
+ true /* set_kernel_hrtimer */,
+ 40 * 1000 * 1000 /* default 40ms hrtimer */,
+ false /* verify_kernel_time */);
+ test_blocking(500 * 1000 /* 500us oa period */,
+ true /* set_kernel_hrtimer */,
+ 1000 * 1000 /* default 1ms hrtimer */,
+ false /* verify_kernel_time */);
+ }
+
+ igt_subtest("polling") {
+ test_polling(40 * 1000 * 1000 /* 40ms oa period */,
+ false /* set_kernel_hrtimer */,
+ 5 * 1000 * 1000 /* default 5ms/200Hz hrtimer */,
+ true /* verify_kernel_time */);
+ }
+
+ igt_subtest("polling-parameterized") {
+ igt_require(kernel_supports_open_option(drm_fd,
+ DRM_I915_PERF_PROP_POLL_OA_DELAY,
+ 40 * 1000 * 1000));
+
+ test_polling(10 * 1000 * 1000 /* 10ms oa period */,
+ true /* set_kernel_hrtimer */,
+ 40 * 1000 * 1000 /* default 40ms hrtimer */,
+ false /* verify_kernel_time */);
+ test_polling(500 * 1000 /* 500us oa period */,
+ true /* set_kernel_hrtimer */,
+ 500 * 1000 /* default 500us hrtimer */,
+ false /* verify_kernel_time */);
+ }
- igt_subtest("polling")
- test_polling();
+ igt_subtest("invalid-poll-delay")
+ test_invalid_poll_delay();
igt_subtest("short-reads")
test_short_reads();
--
2.20.1
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [igt-dev] [RFC 3/3] tests/perf: new tests for OA interrupt
2018-12-19 14:43 [igt-dev] [RFC 0/3] tests/perf: new tests for OA interrupt Lionel Landwerlin
2018-12-19 14:43 ` [igt-dev] [RFC 1/3] bump headers Lionel Landwerlin
2018-12-19 14:43 ` [igt-dev] [RFC 2/3] tests/perf: new tests for parameterized OA buffer polling Lionel Landwerlin
@ 2018-12-19 14:43 ` Lionel Landwerlin
2018-12-19 15:28 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
2018-12-19 17:06 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
4 siblings, 0 replies; 6+ messages in thread
From: Lionel Landwerlin @ 2018-12-19 14:43 UTC (permalink / raw)
To: igt-dev
Those tests verify that the interrupt wakes up userspace waiting on
the perf stream either with poll() or with read().
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
---
tests/perf.c | 218 +++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 218 insertions(+)
diff --git a/tests/perf.c b/tests/perf.c
index efa9c4fd..1904047e 100644
--- a/tests/perf.c
+++ b/tests/perf.c
@@ -442,6 +442,20 @@ oa_exponent_to_ns(int exponent)
return 1000000000ULL * (2ULL << exponent) / timestamp_frequency;
}
+static int
+find_oa_exponent_for_buffer_fill_time(size_t oa_buf_size, size_t report_size, uint64_t fill_time_ns)
+{
+ size_t n_reports = oa_buf_size / report_size;
+
+ for (int e = 1; e < 32; e++) {
+ if (fill_time_ns < oa_exponent_to_ns(e) * n_reports)
+ return e;
+ }
+
+ igt_assert(!"reached");
+ return -1;
+}
+
static bool
oa_report_is_periodic(uint32_t oa_exponent, const uint32_t *report)
{
@@ -2373,6 +2387,111 @@ test_polling(uint64_t requested_oa_period,
__perf_close(stream_fd);
}
+static void
+test_interrupt(uint64_t oa_exponent,
+ uint64_t kernel_oa_poll_delay,
+ bool use_interrupt,
+ bool expect_buffer_lost,
+ bool use_polling,
+ uint32_t expect_min_reports)
+{
+ uint64_t properties[] = {
+ /* Include OA reports in samples */
+ DRM_I915_PERF_PROP_SAMPLE_OA, true,
+
+ /* OA unit configuration */
+ DRM_I915_PERF_PROP_OA_METRICS_SET, test_metric_set_id,
+ DRM_I915_PERF_PROP_OA_FORMAT, test_oa_format,
+ DRM_I915_PERF_PROP_OA_EXPONENT, oa_exponent,
+ DRM_I915_PERF_PROP_OA_ENABLE_INTERRUPT, use_interrupt,
+
+ /* Kernel configuration */
+ DRM_I915_PERF_PROP_POLL_OA_DELAY, kernel_oa_poll_delay,
+ };
+ struct drm_i915_perf_open_param param = {
+ .flags = I915_PERF_FLAG_FD_CLOEXEC |
+ I915_PERF_FLAG_DISABLED |
+ (use_polling ? I915_PERF_FLAG_FD_NONBLOCK : 0),
+ .num_properties = ARRAY_SIZE(properties) / 2,
+ .properties_ptr = to_user_pointer(properties),
+ };
+ struct pollfd pollfd = { .events = POLLIN };
+ struct drm_i915_perf_record_header *header;
+ uint32_t n_reports = 0;
+ bool buffer_lost = false;
+ uint8_t *buf = malloc(MAX_OA_BUF_SIZE);
+ int ret;
+
+ stream_fd = __perf_open(drm_fd, ¶m, true /* prevent_pm */);
+ pollfd.fd = stream_fd;
+
+ igt_debug("OA period = %s, ",
+ pretty_print_oa_period(oa_exponent_to_ns(oa_exponent)));
+ igt_debug("OA poll delay = %s, use interrupt = %i, "
+ "expected min report = %u\n",
+ pretty_print_oa_period(kernel_oa_poll_delay),
+ use_interrupt, expect_min_reports);
+
+ do_ioctl(stream_fd, I915_PERF_IOCTL_ENABLE, 0);
+
+ if (use_polling) {
+ while ((ret = poll(&pollfd, 1, -1)) < 0 &&
+ errno == EINTR)
+ ;
+ igt_assert_eq(ret, 1);
+ igt_assert(pollfd.revents & POLLIN);
+ }
+
+ while ((ret = read(stream_fd, buf, MAX_OA_BUF_SIZE)) < 0 &&
+ errno == EINTR)
+ ;
+
+ if (ret < 0)
+ igt_debug("Unexpected error when reading after poll = %d\n", errno);
+ igt_assert_neq(ret, -1);
+
+ __perf_close(stream_fd);
+
+ /* For Haswell reports don't contain a well defined reason
+ * field we so assume all reports to be 'periodic'. For gen8+
+ * we want to to consider that the HW automatically writes some
+ * non periodic reports (e.g. on context switch) which might
+ * lead to more successful read()s than expected due to
+ * periodic sampling and we don't want these extra reads to
+ * cause the test to fail...
+ */
+ for (int offset = 0; offset < ret; offset += header->size) {
+ header = (void *)(buf + offset);
+
+ switch (header->type) {
+ case DRM_I915_PERF_RECORD_SAMPLE:
+ n_reports++;
+ break;
+ case DRM_I915_PERF_RECORD_OA_BUFFER_LOST:
+ buffer_lost = true;
+ break;
+ }
+ }
+
+ igt_debug("Got %i report(s)\n", n_reports);
+
+ igt_assert_eq(buffer_lost, expect_buffer_lost);
+
+ /*
+ * Leave a 5% error margin for 2 reasons :
+ *
+ * - the tail pointer race condition might remove a couple of
+ * reports because things have not yet landed in memory.
+ *
+ * - the OA unit sometimes drop a writing a report here and
+ * there, the algorithm is linked to pressure on memory
+ * controller but undocumented.
+ */
+ igt_assert_lte(expect_min_reports * 0.95, n_reports);
+
+ free(buf);
+}
+
static void
test_buffer_fill(void)
{
@@ -4271,6 +4390,56 @@ igt_main
false /* verify_kernel_time */);
}
+ igt_subtest("blocking-with-interrupt") {
+ uint64_t target_fill_time = /* 1000ms */ 1000 * 1000 * 1000ul;
+ size_t report_size = get_oa_format(test_oa_format).size;
+ uint32_t max_reports = MAX_OA_BUF_SIZE / report_size;
+ int oa_exponent =
+ find_oa_exponent_for_buffer_fill_time(MAX_OA_BUF_SIZE,
+ report_size, target_fill_time);
+ uint64_t fill_time = oa_exponent_to_ns(oa_exponent) *
+ (MAX_OA_BUF_SIZE / report_size);
+
+ igt_require(kernel_supports_open_option(drm_fd,
+ DRM_I915_PERF_PROP_POLL_OA_DELAY,
+ target_fill_time));
+ igt_require(kernel_supports_open_option(drm_fd,
+ DRM_I915_PERF_PROP_OA_ENABLE_INTERRUPT,
+ true));
+
+ /*
+ * We should be waken up by the HR timer but too late,
+ * so we'll loose reports.
+ */
+ test_interrupt(oa_exponent,
+ fill_time + fill_time / 2,
+ false /* interrupt */, true /* loss */, false /* use_polling */,
+ 0);
+
+ /*
+ * We should get woken up by the HR timer and get the
+ * appropriate number of report.
+ */
+ test_interrupt(oa_exponent,
+ /* 500us */ 500 * 1000,
+ false /* interrupt */, false /* no loss */, false /* use_polling */,
+ (500 * 1000 * max_reports) / fill_time);
+
+
+ /* We should be waken up by the interrupt first. */
+ test_interrupt(oa_exponent,
+ 2 * fill_time,
+ true /* interrupt */, false /* no loss */, false /* use_polling */,
+ max_reports / 2);
+
+ /* We should be waken up by the HR timer first. */
+ test_interrupt(oa_exponent,
+ fill_time / 4,
+ true /* interrupt */, false /* no loss */, false /* use_polling */,
+ (fill_time / 4) * max_reports / fill_time);
+ }
+
+
igt_subtest("polling") {
test_polling(40 * 1000 * 1000 /* 40ms oa period */,
false /* set_kernel_hrtimer */,
@@ -4296,6 +4465,55 @@ igt_main
igt_subtest("invalid-poll-delay")
test_invalid_poll_delay();
+ igt_subtest("polling-with-interrupt") {
+ uint64_t target_fill_time = /* 1000ms */ 1000 * 1000 * 1000ul;
+ size_t report_size = get_oa_format(test_oa_format).size;
+ uint32_t max_reports = MAX_OA_BUF_SIZE / report_size;
+ int oa_exponent =
+ find_oa_exponent_for_buffer_fill_time(MAX_OA_BUF_SIZE,
+ report_size, target_fill_time);
+ uint64_t fill_time = oa_exponent_to_ns(oa_exponent) *
+ (MAX_OA_BUF_SIZE / report_size);
+
+ igt_require(kernel_supports_open_option(drm_fd,
+ DRM_I915_PERF_PROP_POLL_OA_DELAY,
+ target_fill_time));
+ igt_require(kernel_supports_open_option(drm_fd,
+ DRM_I915_PERF_PROP_OA_ENABLE_INTERRUPT,
+ true));
+
+ /*
+ * We should be waken up by the HR timer but too late,
+ * so we'll loose reports.
+ */
+ test_interrupt(oa_exponent,
+ fill_time + fill_time / 2,
+ false /* interrupt */, true /* loss */, true /* use_polling */,
+ 0);
+
+ /*
+ * We should get woken up by the HR timer and get the
+ * appropriate number of report.
+ */
+ test_interrupt(oa_exponent,
+ /* 500us */ 500 * 1000,
+ false /* interrupt */, false /* no loss */, true /* use_polling */,
+ (500 * 1000 * max_reports) / fill_time);
+
+
+ /* We should be waken up by the interrupt first. */
+ test_interrupt(oa_exponent,
+ 2 * fill_time,
+ true /* interrupt */, false /* no loss */, true /* use_polling */,
+ max_reports / 2);
+
+ /* We should be waken up by the HR timer first. */
+ test_interrupt(oa_exponent,
+ fill_time / 4,
+ true /* interrupt */, false /* no loss */, true /* use_polling */,
+ (fill_time / 4) * max_reports / fill_time);
+ }
+
igt_subtest("short-reads")
test_short_reads();
--
2.20.1
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [igt-dev] ✓ Fi.CI.BAT: success for tests/perf: new tests for OA interrupt
2018-12-19 14:43 [igt-dev] [RFC 0/3] tests/perf: new tests for OA interrupt Lionel Landwerlin
` (2 preceding siblings ...)
2018-12-19 14:43 ` [igt-dev] [RFC 3/3] tests/perf: new tests for OA interrupt Lionel Landwerlin
@ 2018-12-19 15:28 ` Patchwork
2018-12-19 17:06 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
4 siblings, 0 replies; 6+ messages in thread
From: Patchwork @ 2018-12-19 15:28 UTC (permalink / raw)
To: Lionel Landwerlin; +Cc: igt-dev
== Series Details ==
Series: tests/perf: new tests for OA interrupt
URL : https://patchwork.freedesktop.org/series/54282/
State : success
== Summary ==
CI Bug Log - changes from CI_DRM_5333 -> IGTPW_2171
====================================================
Summary
-------
**SUCCESS**
No regressions found.
External URL: https://patchwork.freedesktop.org/api/1.0/series/54282/revisions/1/mbox/
Known issues
------------
Here are the changes found in IGTPW_2171 that come from known issues:
### IGT changes ###
#### Issues hit ####
* igt@kms_pipe_crc_basic@nonblocking-crc-pipe-a-frame-sequence:
- fi-byt-clapper: PASS -> FAIL [fdo#103191] / [fdo#107362]
#### Possible fixes ####
* igt@i915_selftest@live_hangcheck:
- fi-bwr-2160: DMESG-FAIL [fdo#108735] -> PASS
- fi-apl-guc: DMESG-FAIL -> PASS
- fi-kbl-7560u: INCOMPLETE [fdo#108044] -> PASS
* igt@kms_flip@basic-flip-vs-dpms:
- fi-skl-6700hq: DMESG-WARN [fdo#105998] -> PASS
* igt@kms_frontbuffer_tracking@basic:
- fi-byt-clapper: FAIL [fdo#103167] -> PASS
* igt@kms_pipe_crc_basic@hang-read-crc-pipe-a:
- fi-byt-clapper: FAIL [fdo#103191] / [fdo#107362] -> PASS
[fdo#103167]: https://bugs.freedesktop.org/show_bug.cgi?id=103167
[fdo#103191]: https://bugs.freedesktop.org/show_bug.cgi?id=103191
[fdo#105998]: https://bugs.freedesktop.org/show_bug.cgi?id=105998
[fdo#107362]: https://bugs.freedesktop.org/show_bug.cgi?id=107362
[fdo#108044]: https://bugs.freedesktop.org/show_bug.cgi?id=108044
[fdo#108735]: https://bugs.freedesktop.org/show_bug.cgi?id=108735
Participating hosts (49 -> 43)
------------------------------
Missing (6): fi-kbl-soraka fi-ilk-m540 fi-byt-squawks fi-bsw-cyan fi-ctg-p8600 fi-bdw-samus
Build changes
-------------
* IGT: IGT_4750 -> IGTPW_2171
CI_DRM_5333: c758693b615deff56e5e2098379b587486cfff8a @ git://anongit.freedesktop.org/gfx-ci/linux
IGTPW_2171: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2171/
IGT_4750: f05c8c2739dce89185349703062784a7745cab14 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
== Testlist changes ==
+igt@perf@blocking-parameterized
+igt@perf@blocking-with-interrupt
+igt@perf@invalid-poll-delay
+igt@perf@polling-parameterized
+igt@perf@polling-with-interrupt
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2171/
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
^ permalink raw reply [flat|nested] 6+ messages in thread
* [igt-dev] ✗ Fi.CI.IGT: failure for tests/perf: new tests for OA interrupt
2018-12-19 14:43 [igt-dev] [RFC 0/3] tests/perf: new tests for OA interrupt Lionel Landwerlin
` (3 preceding siblings ...)
2018-12-19 15:28 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
@ 2018-12-19 17:06 ` Patchwork
4 siblings, 0 replies; 6+ messages in thread
From: Patchwork @ 2018-12-19 17:06 UTC (permalink / raw)
To: Lionel Landwerlin; +Cc: igt-dev
== Series Details ==
Series: tests/perf: new tests for OA interrupt
URL : https://patchwork.freedesktop.org/series/54282/
State : failure
== Summary ==
CI Bug Log - changes from CI_DRM_5333_full -> IGTPW_2171_full
====================================================
Summary
-------
**FAILURE**
Serious unknown changes coming with IGTPW_2171_full absolutely need to be
verified manually.
If you think the reported changes have nothing to do with the changes
introduced in IGTPW_2171_full, please notify your bug team to allow them
to document this new failure mode, which will reduce false positives in CI.
External URL: https://patchwork.freedesktop.org/api/1.0/series/54282/revisions/1/mbox/
Possible new issues
-------------------
Here are the unknown changes that may have been introduced in IGTPW_2171_full:
### IGT changes ###
#### Possible regressions ####
* igt@gem_busy@extended-semaphore-blt:
- shard-hsw: PASS -> FAIL
#### Warnings ####
* igt@kms_cursor_crc@cursor-128x42-offscreen:
- shard-apl: SKIP -> PASS +92
* igt@perf_pmu@rc6:
- shard-kbl: SKIP -> PASS
* igt@pm_rc6_residency@rc6-accuracy:
- shard-snb: PASS -> SKIP
Known issues
------------
Here are the changes found in IGTPW_2171_full that come from known issues:
### IGT changes ###
#### Issues hit ####
* igt@gem_pwrite_pread@uncached-pwrite-blt-gtt_mmap-performance:
- shard-apl: PASS -> INCOMPLETE [fdo#103927]
* igt@kms_available_modes_crc@available_mode_test_crc:
- shard-snb: NOTRUN -> FAIL [fdo#106641]
* igt@kms_busy@extended-pageflip-hang-newfb-render-c:
- shard-glk: PASS -> DMESG-WARN [fdo#107956]
* igt@kms_busy@extended-pageflip-modeset-hang-oldfb-render-c:
- shard-apl: SKIP -> DMESG-WARN [fdo#107956]
* igt@kms_ccs@pipe-a-crc-sprite-planes-basic:
- shard-apl: PASS -> FAIL [fdo#106510] / [fdo#108145]
* igt@kms_cursor_crc@cursor-128x128-onscreen:
- shard-kbl: PASS -> FAIL [fdo#103232] +2
* igt@kms_cursor_crc@cursor-128x42-random:
- shard-apl: SKIP -> FAIL [fdo#103232]
* igt@kms_cursor_crc@cursor-256x256-dpms:
- shard-glk: PASS -> FAIL [fdo#103232] +2
* igt@kms_cursor_crc@cursor-64x21-sliding:
- shard-apl: PASS -> FAIL [fdo#103232] +3
* igt@kms_flip@flip-vs-expired-vblank:
- shard-glk: PASS -> FAIL [fdo#102887] / [fdo#105363]
* igt@kms_frontbuffer_tracking@fbc-1p-primscrn-spr-indfb-draw-blt:
- shard-apl: SKIP -> FAIL [fdo#103167]
* igt@kms_frontbuffer_tracking@fbc-1p-primscrn-spr-indfb-draw-mmap-cpu:
- shard-kbl: PASS -> FAIL [fdo#103167]
* igt@kms_frontbuffer_tracking@fbc-1p-primscrn-spr-indfb-draw-mmap-gtt:
- shard-apl: PASS -> FAIL [fdo#103167] +4
* igt@kms_frontbuffer_tracking@fbc-1p-primscrn-spr-indfb-move:
- shard-glk: PASS -> FAIL [fdo#103167] +3
* igt@kms_plane@plane-position-covered-pipe-a-planes:
- shard-glk: PASS -> FAIL [fdo#103166] +2
* igt@kms_plane_alpha_blend@pipe-a-alpha-basic:
- shard-apl: SKIP -> FAIL [fdo#108145]
* igt@kms_plane_alpha_blend@pipe-a-constant-alpha-max:
- shard-glk: PASS -> FAIL [fdo#108145] +1
- shard-kbl: PASS -> FAIL [fdo#108145]
- shard-apl: PASS -> FAIL [fdo#108145]
* igt@kms_plane_multiple@atomic-pipe-c-tiling-yf:
- shard-apl: PASS -> FAIL [fdo#103166] +1
* igt@kms_rotation_crc@multiplane-rotation-cropping-top:
- shard-glk: PASS -> DMESG-FAIL [fdo#105763] / [fdo#106538]
* igt@syncobj_wait@multi-wait-for-submit-unsubmitted-signaled:
- shard-snb: PASS -> INCOMPLETE [fdo#105411] / [fdo#107469]
#### Possible fixes ####
* igt@gem_ctx_isolation@bcs0-s3:
- shard-apl: DMESG-WARN [fdo#103558] -> PASS
* igt@kms_cursor_crc@cursor-256x256-suspend:
- shard-apl: FAIL [fdo#103191] / [fdo#103232] -> PASS
* igt@kms_cursor_crc@cursor-256x85-random:
- shard-apl: FAIL [fdo#103232] -> PASS
* igt@kms_flip@dpms-vs-vblank-race-interruptible:
- shard-glk: FAIL [fdo#103060] -> PASS
* igt@kms_frontbuffer_tracking@fbc-2p-primscrn-spr-indfb-draw-mmap-cpu:
- shard-glk: FAIL [fdo#103167] -> PASS +6
* igt@kms_plane_multiple@atomic-pipe-a-tiling-y:
- shard-glk: FAIL [fdo#103166] -> PASS +6
* igt@kms_plane_multiple@atomic-pipe-b-tiling-y:
- shard-apl: FAIL [fdo#103166] -> PASS +2
- shard-kbl: FAIL [fdo#103166] -> PASS +1
* igt@kms_setmode@basic:
- shard-apl: FAIL [fdo#99912] -> PASS
- shard-kbl: FAIL [fdo#99912] -> PASS
* igt@perf_pmu@rc6-runtime-pm:
- shard-glk: FAIL [fdo#105010] -> PASS
[fdo#102887]: https://bugs.freedesktop.org/show_bug.cgi?id=102887
[fdo#103060]: https://bugs.freedesktop.org/show_bug.cgi?id=103060
[fdo#103166]: https://bugs.freedesktop.org/show_bug.cgi?id=103166
[fdo#103167]: https://bugs.freedesktop.org/show_bug.cgi?id=103167
[fdo#103191]: https://bugs.freedesktop.org/show_bug.cgi?id=103191
[fdo#103232]: https://bugs.freedesktop.org/show_bug.cgi?id=103232
[fdo#103558]: https://bugs.freedesktop.org/show_bug.cgi?id=103558
[fdo#103927]: https://bugs.freedesktop.org/show_bug.cgi?id=103927
[fdo#105010]: https://bugs.freedesktop.org/show_bug.cgi?id=105010
[fdo#105363]: https://bugs.freedesktop.org/show_bug.cgi?id=105363
[fdo#105411]: https://bugs.freedesktop.org/show_bug.cgi?id=105411
[fdo#105763]: https://bugs.freedesktop.org/show_bug.cgi?id=105763
[fdo#106510]: https://bugs.freedesktop.org/show_bug.cgi?id=106510
[fdo#106538]: https://bugs.freedesktop.org/show_bug.cgi?id=106538
[fdo#106641]: https://bugs.freedesktop.org/show_bug.cgi?id=106641
[fdo#107469]: https://bugs.freedesktop.org/show_bug.cgi?id=107469
[fdo#107956]: https://bugs.freedesktop.org/show_bug.cgi?id=107956
[fdo#108145]: https://bugs.freedesktop.org/show_bug.cgi?id=108145
[fdo#99912]: https://bugs.freedesktop.org/show_bug.cgi?id=99912
Participating hosts (7 -> 5)
------------------------------
Missing (2): shard-skl shard-iclb
Build changes
-------------
* IGT: IGT_4750 -> IGTPW_2171
* Piglit: piglit_4509 -> None
CI_DRM_5333: c758693b615deff56e5e2098379b587486cfff8a @ git://anongit.freedesktop.org/gfx-ci/linux
IGTPW_2171: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2171/
IGT_4750: f05c8c2739dce89185349703062784a7745cab14 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
piglit_4509: fdc5a4ca11124ab8413c7988896eec4c97336694 @ git://anongit.freedesktop.org/piglit
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2171/
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2018-12-19 17:06 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-12-19 14:43 [igt-dev] [RFC 0/3] tests/perf: new tests for OA interrupt Lionel Landwerlin
2018-12-19 14:43 ` [igt-dev] [RFC 1/3] bump headers Lionel Landwerlin
2018-12-19 14:43 ` [igt-dev] [RFC 2/3] tests/perf: new tests for parameterized OA buffer polling Lionel Landwerlin
2018-12-19 14:43 ` [igt-dev] [RFC 3/3] tests/perf: new tests for OA interrupt Lionel Landwerlin
2018-12-19 15:28 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
2018-12-19 17:06 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox