|
|
29e444 |
This is a combination of two commits:
|
|
|
29e444 |
|
|
|
29e444 |
From 42b373ad467ba426610a358d90034bcf68abb15f Mon Sep 17 00:00:00 2001
|
|
|
29e444 |
From: Edjunior Machado <emachado@linux.vnet.ibm.com>
|
|
|
29e444 |
Date: Thu, 23 May 2013 10:06:24 -0500
|
|
|
29e444 |
Subject: [PATCH 31/42] PowerPC: Add functions for shared resources hints.
|
|
|
29e444 |
(cherry picked from commit
|
|
|
29e444 |
9323d39baea2fb0cca3735136abe263eff405133)
|
|
|
29e444 |
|
|
|
29e444 |
From a6d45052042c1fc962523633c0489634864e1a02 Mon Sep 17 00:00:00 2001
|
|
|
29e444 |
From: Adhemerval Zanella <azanella@linux.vnet.ibm.com>
|
|
|
29e444 |
Date: Fri, 24 May 2013 13:29:30 -0500
|
|
|
29e444 |
Subject: [PATCH 32/42] PowerPC: Program Priority Register support
|
|
|
29e444 |
|
|
|
29e444 |
This patch add inline functions to change the Program Priority Register
|
|
|
29e444 |
from ISA 2.05.
|
|
|
29e444 |
(cherry picked from commit d116b7c414c8239b677e341ac517745db689ac2d)
|
|
|
29e444 |
|
|
|
12745e |
diff -pruN glibc-2.17-c758a686/manual/platform.texi glibc-2.17-c758a686/manual/platform.texi
|
|
|
29e444 |
--- glibc-2.17-c758a686/manual/platform.texi 2012-12-25 08:32:13.000000000 +0530
|
|
|
12745e |
+++ glibc-2.17-c758a686/manual/platform.texi 2013-08-05 19:06:49.523550318 +0530
|
|
|
29e444 |
@@ -34,3 +34,48 @@ This frequency is not related to the pro
|
|
|
29e444 |
It is also possible that this frequency is not constant. More information is
|
|
|
29e444 |
available in @cite{Power ISA 2.06b - Book II - Section 5.2}.
|
|
|
29e444 |
@end deftypefun
|
|
|
29e444 |
+
|
|
|
29e444 |
+The following functions provide hints about the usage of resources that are
|
|
|
29e444 |
+shared with other processors. They can be used, for example, if a program
|
|
|
29e444 |
+waiting on a lock intends to divert the shared resources to be used by other
|
|
|
29e444 |
+processors. More information is available in @cite{Power ISA 2.06b - Book II -
|
|
|
29e444 |
+Section 3.2}.
|
|
|
29e444 |
+
|
|
|
29e444 |
+@deftypefun {void} __ppc_yield (void)
|
|
|
29e444 |
+Provide a hint that performance will probably be improved if shared resources
|
|
|
29e444 |
+dedicated to the executing processor are released for use by other processors.
|
|
|
29e444 |
+@end deftypefun
|
|
|
29e444 |
+
|
|
|
29e444 |
+@deftypefun {void} __ppc_mdoio (void)
|
|
|
29e444 |
+Provide a hint that performance will probably be improved if shared resources
|
|
|
29e444 |
+dedicated to the executing processor are released until all outstanding storage
|
|
|
29e444 |
+accesses to caching-inhibited storage have been completed.
|
|
|
29e444 |
+@end deftypefun
|
|
|
29e444 |
+
|
|
|
29e444 |
+@deftypefun {void} __ppc_mdoom (void)
|
|
|
29e444 |
+Provide a hint that performance will probably be improved if shared resources
|
|
|
29e444 |
+dedicated to the executing processor are released until all outstanding storage
|
|
|
29e444 |
+accesses to cacheable storage for which the data is not in the cache have been
|
|
|
29e444 |
+completed.
|
|
|
29e444 |
+@end deftypefun
|
|
|
29e444 |
+
|
|
|
29e444 |
+@deftypefun {void} __ppc_set_ppr_med (void)
|
|
|
29e444 |
+Set the Program Priority Register to medium value (default).
|
|
|
29e444 |
+
|
|
|
29e444 |
+The @dfn{Program Priority Register} (PPR) is a 64-bit register that controls
|
|
|
29e444 |
+the program's priority. By adjusting the PPR value the programmer may
|
|
|
29e444 |
+improve system throughput by causing the system resources to be used
|
|
|
29e444 |
+more efficiently, especially in contention situations.
|
|
|
29e444 |
+The three unprivileged states available are covered by the functions
|
|
|
29e444 |
+@code{__ppc_set_ppr_med} (medium -- default), @code{__ppc_set_ppc_low} (low)
|
|
|
29e444 |
+and @code{__ppc_set_ppc_med_low} (medium low). More information
|
|
|
29e444 |
+available in @cite{Power ISA 2.06b - Book II - Section 3.1}.
|
|
|
29e444 |
+@end deftypefun
|
|
|
29e444 |
+
|
|
|
29e444 |
+@deftypefun {void} __ppc_set_ppr_low (void)
|
|
|
29e444 |
+Set the Program Priority Register to low value.
|
|
|
29e444 |
+@end deftypefun
|
|
|
29e444 |
+
|
|
|
29e444 |
+@deftypefun {void} __ppc_set_ppr_med_low (void)
|
|
|
29e444 |
+Set the Program Priority Register to medium low value.
|
|
|
29e444 |
+@end deftypefun
|
|
|
12745e |
diff -pruN glibc-2.17-c758a686/sysdeps/powerpc/sys/platform/ppc.h glibc-2.17-c758a686/sysdeps/powerpc/sys/platform/ppc.h
|
|
|
29e444 |
--- glibc-2.17-c758a686/sysdeps/powerpc/sys/platform/ppc.h 2012-12-25 08:32:13.000000000 +0530
|
|
|
12745e |
+++ glibc-2.17-c758a686/sysdeps/powerpc/sys/platform/ppc.h 2013-08-05 19:06:49.523550318 +0530
|
|
|
29e444 |
@@ -50,4 +50,66 @@ __ppc_get_timebase (void)
|
|
|
29e444 |
#endif
|
|
|
29e444 |
}
|
|
|
29e444 |
|
|
|
29e444 |
+/* The following functions provide hints about the usage of shared processor
|
|
|
29e444 |
+ resources, as defined in ISA 2.06 and newer. */
|
|
|
29e444 |
+
|
|
|
29e444 |
+/* Provides a hint that performance will probably be improved if shared
|
|
|
29e444 |
+ resources dedicated to the executing processor are released for use by other
|
|
|
29e444 |
+ processors. */
|
|
|
29e444 |
+static inline void
|
|
|
29e444 |
+__ppc_yield (void)
|
|
|
29e444 |
+{
|
|
|
29e444 |
+ __asm__ volatile ("or 27,27,27");
|
|
|
29e444 |
+}
|
|
|
29e444 |
+
|
|
|
29e444 |
+/* Provides a hint that performance will probably be improved if shared
|
|
|
29e444 |
+ resources dedicated to the executing processor are released until
|
|
|
29e444 |
+ all outstanding storage accesses to caching-inhibited storage have been
|
|
|
29e444 |
+ completed. */
|
|
|
29e444 |
+static inline void
|
|
|
29e444 |
+__ppc_mdoio (void)
|
|
|
29e444 |
+{
|
|
|
29e444 |
+ __asm__ volatile ("or 29,29,29");
|
|
|
29e444 |
+}
|
|
|
29e444 |
+
|
|
|
29e444 |
+/* Provides a hint that performance will probably be improved if shared
|
|
|
29e444 |
+ resources dedicated to the executing processor are released until all
|
|
|
29e444 |
+ outstanding storage accesses to cacheable storage for which the data is not
|
|
|
29e444 |
+ in the cache have been completed. */
|
|
|
29e444 |
+static inline void
|
|
|
29e444 |
+__ppc_mdoom (void)
|
|
|
29e444 |
+{
|
|
|
29e444 |
+ __asm__ volatile ("or 30,30,30");
|
|
|
29e444 |
+}
|
|
|
29e444 |
+
|
|
|
29e444 |
+
|
|
|
29e444 |
+/* ISA 2.05 and beyond support the Program Priority Register (PPR) to adjust
|
|
|
29e444 |
+ thread priorities based on lock acquisition, wait and release. The ISA
|
|
|
29e444 |
+ defines the use of form 'or Rx,Rx,Rx' as the way to modify the PRI field.
|
|
|
29e444 |
+ The unprivileged priorities are:
|
|
|
29e444 |
+ Rx = 1 (low)
|
|
|
29e444 |
+ Rx = 2 (medium)
|
|
|
29e444 |
+ Rx = 6 (medium-low/normal)
|
|
|
29e444 |
+ The 'or' instruction form is a nop in previous hardware, so it is safe to
|
|
|
29e444 |
+ use unguarded. The default value is 'medium'.
|
|
|
29e444 |
+ */
|
|
|
29e444 |
+
|
|
|
29e444 |
+static inline void
|
|
|
29e444 |
+__ppc_set_ppr_med (void)
|
|
|
29e444 |
+{
|
|
|
29e444 |
+ __asm__ volatile ("or 2,2,2");
|
|
|
29e444 |
+}
|
|
|
29e444 |
+
|
|
|
29e444 |
+static inline void
|
|
|
29e444 |
+__ppc_set_ppr_med_low (void)
|
|
|
29e444 |
+{
|
|
|
29e444 |
+ __asm__ volatile ("or 6,6,6");
|
|
|
29e444 |
+}
|
|
|
29e444 |
+
|
|
|
29e444 |
+static inline void
|
|
|
29e444 |
+__ppc_set_ppr_low (void)
|
|
|
29e444 |
+{
|
|
|
29e444 |
+ __asm__ volatile ("or 1,1,1");
|
|
|
29e444 |
+}
|
|
|
29e444 |
+
|
|
|
29e444 |
#endif /* sys/platform/ppc.h */
|