[B][SRU][PATCH 0/2] Fix for tm-unavailable test in powerpc from ubuntu_kernel_selftests

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

[B][SRU][PATCH 0/2] Fix for tm-unavailable test in powerpc from ubuntu_kernel_selftests

Po-Hsu Lin (Sam)
BugLink: https://bugs.launchpad.net/bugs/1813129

== Justification ==
The tm-unavailable test in powerpc from ubuntu_kernel_selftests will
fail on Bionic PowerPC:
  $ sudo ./tm-unavailable
  Checking if FP/VEC registers are sane after a FP unavailable exception...
  Illegal instruction

This is because the Hardware Transactional Memory (HTM) is not supported
on the revision of the processor in our PowerPC boxes.

== Fix ==
b395e55b (selftests/powerpc: Skip tm-unavailable if TM is not enabled)
With a prerequisite to make it a clean cherry-pick:
5783ee6e (selftests/powerpc: Check for pthread errors in tm-unavailable)

An extra check for this test:
   SKIP_IF(!have_htm())

Will be added to ensure we have HTM support before start testing.

For Xenial, we don't have this test in our tree thus it can be ignored.

This patchset has already landed in Cosmic and newer, and can be
cherry-picked for Bionic.

For the prerequisite patch, it touches only the code in testing tool and
improves the test case quality by adding check for pthread errors. So I
think it's safe to bring this in.

== Test ==
Patch verified on a Bionic P9 system, the test will be marked as passed
(skipped) with these two patches applied.

== Regression potential ==
None.
This patchset is just for the kernel testing tool.

Cyril Bur (1):
  selftests/powerpc: Check for pthread errors in tm-unavailable

Gustavo Romero (1):
  selftests/powerpc: Skip tm-unavailable if TM is not enabled

 .../testing/selftests/powerpc/tm/tm-unavailable.c  | 57 +++++++++++++++++-----
 1 file changed, 45 insertions(+), 12 deletions(-)

--
2.7.4


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

[B][SRU][PATCH 1/2] selftests/powerpc: Check for pthread errors in tm-unavailable

Po-Hsu Lin (Sam)
From: Cyril Bur <[hidden email]>

BugLink: https://bugs.launchpad.net/bugs/1813129

Signed-off-by: Cyril Bur <[hidden email]>
Signed-off-by: Gustavo Romero <[hidden email]>
Signed-off-by: Michael Ellerman <[hidden email]>
(cherry picked from commit 5783ee6ec3d3323a04cc69764d57cac7bf026332)
Signed-off-by: Po-Hsu Lin <[hidden email]>
---
 .../testing/selftests/powerpc/tm/tm-unavailable.c  | 43 +++++++++++++++++-----
 1 file changed, 34 insertions(+), 9 deletions(-)

diff --git a/tools/testing/selftests/powerpc/tm/tm-unavailable.c b/tools/testing/selftests/powerpc/tm/tm-unavailable.c
index 96c37f8..e6a0fad 100644
--- a/tools/testing/selftests/powerpc/tm/tm-unavailable.c
+++ b/tools/testing/selftests/powerpc/tm/tm-unavailable.c
@@ -15,6 +15,7 @@
  */
 
 #define _GNU_SOURCE
+#include <error.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <unistd.h>
@@ -33,6 +34,11 @@
 #define VSX_UNA_EXCEPTION 2
 
 #define NUM_EXCEPTIONS 3
+#define err_at_line(status, errnum, format, ...) \
+ error_at_line(status, errnum,  __FILE__, __LINE__, format ##__VA_ARGS__)
+
+#define pr_warn(code, format, ...) err_at_line(0, code, format, ##__VA_ARGS__)
+#define pr_err(code, format, ...) err_at_line(1, code, format, ##__VA_ARGS__)
 
 struct Flags {
  int touch_fp;
@@ -303,10 +309,19 @@ void test_fp_vec(int fp, int vec, pthread_attr_t *attr)
  * checking if the failure cause is the one we expect.
  */
  do {
+ int rc;
+
  /* Bind 'ping' to CPU 0, as specified in 'attr'. */
- pthread_create(&t0, attr, ping, (void *) &flags);
- pthread_setname_np(t0, "ping");
- pthread_join(t0, &ret_value);
+ rc = pthread_create(&t0, attr, ping, (void *) &flags);
+ if (rc)
+ pr_err(rc, "pthread_create()");
+ rc = pthread_setname_np(t0, "ping");
+ if (rc)
+ pr_warn(rc, "pthread_setname_np");
+ rc = pthread_join(t0, &ret_value);
+ if (rc)
+ pr_err(rc, "pthread_join");
+
  retries--;
  } while (ret_value != NULL && retries);
 
@@ -320,7 +335,7 @@ void test_fp_vec(int fp, int vec, pthread_attr_t *attr)
 
 int main(int argc, char **argv)
 {
- int exception; /* FP = 0, VEC = 1, VSX = 2 */
+ int rc, exception; /* FP = 0, VEC = 1, VSX = 2 */
  pthread_t t1;
  pthread_attr_t attr;
  cpu_set_t cpuset;
@@ -330,13 +345,23 @@ int main(int argc, char **argv)
  CPU_SET(0, &cpuset);
 
  /* Init pthread attribute. */
- pthread_attr_init(&attr);
+ rc = pthread_attr_init(&attr);
+ if (rc)
+ pr_err(rc, "pthread_attr_init()");
 
  /* Set CPU 0 mask into the pthread attribute. */
- pthread_attr_setaffinity_np(&attr, sizeof(cpu_set_t), &cpuset);
-
- pthread_create(&t1, &attr /* Bind 'pong' to CPU 0 */, pong, NULL);
- pthread_setname_np(t1, "pong"); /* Name it for systemtap convenience */
+ rc = pthread_attr_setaffinity_np(&attr, sizeof(cpu_set_t), &cpuset);
+ if (rc)
+ pr_err(rc, "pthread_attr_setaffinity_np()");
+
+ rc = pthread_create(&t1, &attr /* Bind 'pong' to CPU 0 */, pong, NULL);
+ if (rc)
+ pr_err(rc, "pthread_create()");
+
+ /* Name it for systemtap convenience */
+ rc = pthread_setname_np(t1, "pong");
+ if (rc)
+ pr_warn(rc, "pthread_create()");
 
  flags.result = 0;
 
--
2.7.4


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

[B][SRU][PATCH 2/2] selftests/powerpc: Skip tm-unavailable if TM is not enabled

Po-Hsu Lin (Sam)
In reply to this post by Po-Hsu Lin (Sam)
From: Gustavo Romero <[hidden email]>

BugLink: https://bugs.launchpad.net/bugs/1813129

Some processor revisions do not support transactional memory, and
additionally kernel support can be disabled. In either case the
tm-unavailable test should be skipped, otherwise it will fail with
a SIGILL.

That commit also sets this selftest to be called through the test
harness as it's done for other TM selftests.

Finally, it avoids using "ping" as a thread name since it's
ambiguous and can be confusing when shown, for instance,
in a kernel backtrace log.

Fixes: 77fad8bfb1d2 ("selftests/powerpc: Check FP/VEC on exception in TM")
Signed-off-by: Gustavo Romero <[hidden email]>
Reviewed-by: Cyril Bur <[hidden email]>
Signed-off-by: Michael Ellerman <[hidden email]>
(cherry picked from commit b395e55b49ecd56ea28dc629f4ca4c6239fc07c3)
Signed-off-by: Po-Hsu Lin <[hidden email]>
---
 .../testing/selftests/powerpc/tm/tm-unavailable.c  | 24 ++++++++++++++--------
 1 file changed, 16 insertions(+), 8 deletions(-)

diff --git a/tools/testing/selftests/powerpc/tm/tm-unavailable.c b/tools/testing/selftests/powerpc/tm/tm-unavailable.c
index e6a0fad..156c8e7 100644
--- a/tools/testing/selftests/powerpc/tm/tm-unavailable.c
+++ b/tools/testing/selftests/powerpc/tm/tm-unavailable.c
@@ -80,7 +80,7 @@ bool is_failure(uint64_t condition_reg)
  return ((condition_reg >> 28) & 0xa) == 0xa;
 }
 
-void *ping(void *input)
+void *tm_una_ping(void *input)
 {
 
  /*
@@ -280,7 +280,7 @@ void *ping(void *input)
 }
 
 /* Thread to force context switch */
-void *pong(void *not_used)
+void *tm_una_pong(void *not_used)
 {
  /* Wait thread get its name "pong". */
  if (DEBUG)
@@ -311,11 +311,11 @@ void test_fp_vec(int fp, int vec, pthread_attr_t *attr)
  do {
  int rc;
 
- /* Bind 'ping' to CPU 0, as specified in 'attr'. */
- rc = pthread_create(&t0, attr, ping, (void *) &flags);
+ /* Bind to CPU 0, as specified in 'attr'. */
+ rc = pthread_create(&t0, attr, tm_una_ping, (void *) &flags);
  if (rc)
  pr_err(rc, "pthread_create()");
- rc = pthread_setname_np(t0, "ping");
+ rc = pthread_setname_np(t0, "tm_una_ping");
  if (rc)
  pr_warn(rc, "pthread_setname_np");
  rc = pthread_join(t0, &ret_value);
@@ -333,13 +333,15 @@ void test_fp_vec(int fp, int vec, pthread_attr_t *attr)
  }
 }
 
-int main(int argc, char **argv)
+int tm_unavailable_test(void)
 {
  int rc, exception; /* FP = 0, VEC = 1, VSX = 2 */
  pthread_t t1;
  pthread_attr_t attr;
  cpu_set_t cpuset;
 
+ SKIP_IF(!have_htm());
+
  /* Set only CPU 0 in the mask. Both threads will be bound to CPU 0. */
  CPU_ZERO(&cpuset);
  CPU_SET(0, &cpuset);
@@ -354,12 +356,12 @@ int main(int argc, char **argv)
  if (rc)
  pr_err(rc, "pthread_attr_setaffinity_np()");
 
- rc = pthread_create(&t1, &attr /* Bind 'pong' to CPU 0 */, pong, NULL);
+ rc = pthread_create(&t1, &attr /* Bind to CPU 0 */, tm_una_pong, NULL);
  if (rc)
  pr_err(rc, "pthread_create()");
 
  /* Name it for systemtap convenience */
- rc = pthread_setname_np(t1, "pong");
+ rc = pthread_setname_np(t1, "tm_una_pong");
  if (rc)
  pr_warn(rc, "pthread_create()");
 
@@ -394,3 +396,9 @@ int main(int argc, char **argv)
  exit(0);
  }
 }
+
+int main(int argc, char **argv)
+{
+ test_harness_set_timeout(220);
+ return test_harness(tm_unavailable_test, "tm_unavailable_test");
+}
--
2.7.4


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

ACK: [B][SRU][PATCH 0/2] Fix for tm-unavailable test in powerpc from ubuntu_kernel_selftests

Kleber Souza
In reply to this post by Po-Hsu Lin (Sam)
On 4/23/19 12:55 PM, Po-Hsu Lin wrote:

> BugLink: https://bugs.launchpad.net/bugs/1813129
>
> == Justification ==
> The tm-unavailable test in powerpc from ubuntu_kernel_selftests will
> fail on Bionic PowerPC:
>   $ sudo ./tm-unavailable
>   Checking if FP/VEC registers are sane after a FP unavailable exception...
>   Illegal instruction
>
> This is because the Hardware Transactional Memory (HTM) is not supported
> on the revision of the processor in our PowerPC boxes.
>
> == Fix ==
> b395e55b (selftests/powerpc: Skip tm-unavailable if TM is not enabled)
> With a prerequisite to make it a clean cherry-pick:
> 5783ee6e (selftests/powerpc: Check for pthread errors in tm-unavailable)
>
> An extra check for this test:
>    SKIP_IF(!have_htm())
>
> Will be added to ensure we have HTM support before start testing.
>
> For Xenial, we don't have this test in our tree thus it can be ignored.
>
> This patchset has already landed in Cosmic and newer, and can be
> cherry-picked for Bionic.
>
> For the prerequisite patch, it touches only the code in testing tool and
> improves the test case quality by adding check for pthread errors. So I
> think it's safe to bring this in.
>
> == Test ==
> Patch verified on a Bionic P9 system, the test will be marked as passed
> (skipped) with these two patches applied.
>
> == Regression potential ==
> None.
> This patchset is just for the kernel testing tool.
>
> Cyril Bur (1):
>   selftests/powerpc: Check for pthread errors in tm-unavailable
>
> Gustavo Romero (1):
>   selftests/powerpc: Skip tm-unavailable if TM is not enabled
>
>  .../testing/selftests/powerpc/tm/tm-unavailable.c  | 57 +++++++++++++++++-----
>  1 file changed, 45 insertions(+), 12 deletions(-)
>

Acked-by: Kleber Sacilotto de Souza <[hidden email]>

--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

ACK: [B][SRU][PATCH 0/2] Fix for tm-unavailable test in powerpc from ubuntu_kernel_selftests

Connor Kuehl
In reply to this post by Po-Hsu Lin (Sam)
On 4/23/19 3:55 AM, Po-Hsu Lin wrote:

> BugLink: https://bugs.launchpad.net/bugs/1813129
>
> == Justification ==
> The tm-unavailable test in powerpc from ubuntu_kernel_selftests will
> fail on Bionic PowerPC:
>   $ sudo ./tm-unavailable
>   Checking if FP/VEC registers are sane after a FP unavailable exception...
>   Illegal instruction
>
> This is because the Hardware Transactional Memory (HTM) is not supported
> on the revision of the processor in our PowerPC boxes.
>
> == Fix ==
> b395e55b (selftests/powerpc: Skip tm-unavailable if TM is not enabled)
> With a prerequisite to make it a clean cherry-pick:
> 5783ee6e (selftests/powerpc: Check for pthread errors in tm-unavailable)
>
> An extra check for this test:
>    SKIP_IF(!have_htm())
>
> Will be added to ensure we have HTM support before start testing.
>
> For Xenial, we don't have this test in our tree thus it can be ignored.
>
> This patchset has already landed in Cosmic and newer, and can be
> cherry-picked for Bionic.
>
> For the prerequisite patch, it touches only the code in testing tool and
> improves the test case quality by adding check for pthread errors. So I
> think it's safe to bring this in.
>
> == Test ==
> Patch verified on a Bionic P9 system, the test will be marked as passed
> (skipped) with these two patches applied.
>
> == Regression potential ==
> None.
> This patchset is just for the kernel testing tool.
>
> Cyril Bur (1):
>   selftests/powerpc: Check for pthread errors in tm-unavailable
>
> Gustavo Romero (1):
>   selftests/powerpc: Skip tm-unavailable if TM is not enabled
>
>  .../testing/selftests/powerpc/tm/tm-unavailable.c  | 57 +++++++++++++++++-----
>  1 file changed, 45 insertions(+), 12 deletions(-)
>
Acked-by: Connor Kuehl <[hidden email]>

--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team

pEpkey.asc (5K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

APPLIED: [B][SRU][PATCH 0/2] Fix for tm-unavailable test in powerpc from ubuntu_kernel_selftests

Khalid Elmously
In reply to this post by Po-Hsu Lin (Sam)
On 2019-04-23 18:55:52 , Po-Hsu Lin wrote:

> BugLink: https://bugs.launchpad.net/bugs/1813129
>
> == Justification ==
> The tm-unavailable test in powerpc from ubuntu_kernel_selftests will
> fail on Bionic PowerPC:
>   $ sudo ./tm-unavailable
>   Checking if FP/VEC registers are sane after a FP unavailable exception...
>   Illegal instruction
>
> This is because the Hardware Transactional Memory (HTM) is not supported
> on the revision of the processor in our PowerPC boxes.
>
> == Fix ==
> b395e55b (selftests/powerpc: Skip tm-unavailable if TM is not enabled)
> With a prerequisite to make it a clean cherry-pick:
> 5783ee6e (selftests/powerpc: Check for pthread errors in tm-unavailable)
>
> An extra check for this test:
>    SKIP_IF(!have_htm())
>
> Will be added to ensure we have HTM support before start testing.
>
> For Xenial, we don't have this test in our tree thus it can be ignored.
>
> This patchset has already landed in Cosmic and newer, and can be
> cherry-picked for Bionic.
>
> For the prerequisite patch, it touches only the code in testing tool and
> improves the test case quality by adding check for pthread errors. So I
> think it's safe to bring this in.
>
> == Test ==
> Patch verified on a Bionic P9 system, the test will be marked as passed
> (skipped) with these two patches applied.
>
> == Regression potential ==
> None.
> This patchset is just for the kernel testing tool.
>
> Cyril Bur (1):
>   selftests/powerpc: Check for pthread errors in tm-unavailable
>
> Gustavo Romero (1):
>   selftests/powerpc: Skip tm-unavailable if TM is not enabled
>
>  .../testing/selftests/powerpc/tm/tm-unavailable.c  | 57 +++++++++++++++++-----
>  1 file changed, 45 insertions(+), 12 deletions(-)
>
> --
> 2.7.4
>
>
> --
> kernel-team mailing list
> [hidden email]
> https://lists.ubuntu.com/mailman/listinfo/kernel-team

--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team