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