32 // Class Aix defines the interface to the Aix operating systems. |
32 // Class Aix defines the interface to the Aix operating systems. |
33 |
33 |
34 class Aix { |
34 class Aix { |
35 friend class os; |
35 friend class os; |
36 |
36 |
37 // Length of strings included in the libperfstat structures. |
|
38 #define IDENTIFIER_LENGTH 64 |
|
39 |
|
40 static bool libjsig_is_loaded; // libjsig that interposes sigaction(), |
37 static bool libjsig_is_loaded; // libjsig that interposes sigaction(), |
41 // __sigaction(), signal() is loaded |
38 // __sigaction(), signal() is loaded |
42 static struct sigaction *(*get_signal_action)(int); |
39 static struct sigaction *(*get_signal_action)(int); |
43 static struct sigaction *get_preinstalled_handler(int); |
40 static struct sigaction *get_preinstalled_handler(int); |
44 static void save_preinstalled_handler(int, struct sigaction&); |
41 static void save_preinstalled_handler(int, struct sigaction&); |
45 |
42 |
46 static void check_signal_handler(int sig); |
43 static void check_signal_handler(int sig); |
47 |
44 |
48 protected: |
45 private: |
49 |
46 |
50 static julong _physical_memory; |
47 static julong _physical_memory; |
51 static pthread_t _main_thread; |
48 static pthread_t _main_thread; |
52 static Mutex* _createThread_lock; |
49 static Mutex* _createThread_lock; |
53 static int _page_size; |
50 static int _page_size; |
54 static int _logical_cpus; |
51 |
|
52 // Page size of newly created pthreads. |
|
53 static int _stack_page_size; |
55 |
54 |
56 // -1 = uninitialized, 0 = AIX, 1 = OS/400 (PASE) |
55 // -1 = uninitialized, 0 = AIX, 1 = OS/400 (PASE) |
57 static int _on_pase; |
56 static int _on_pase; |
58 |
57 |
59 // -1 = uninitialized, otherwise 16 bit number: |
58 // -1 = uninitialized, otherwise 16 bit number: |
61 // higher 8 bit - major version |
60 // higher 8 bit - major version |
62 // For AIX, e.g. 0x0601 for AIX 6.1 |
61 // For AIX, e.g. 0x0601 for AIX 6.1 |
63 // for OS/400 e.g. 0x0504 for OS/400 V5R4 |
62 // for OS/400 e.g. 0x0504 for OS/400 V5R4 |
64 static int _os_version; |
63 static int _os_version; |
65 |
64 |
|
65 // 4 Byte kernel version: Version, Release, Tech Level, Service Pack. |
|
66 static unsigned int _os_kernel_version; |
|
67 |
66 // -1 = uninitialized, |
68 // -1 = uninitialized, |
67 // 0 - SPEC1170 not requested (XPG_SUS_ENV is OFF or not set) |
69 // 0 - SPEC1170 not requested (XPG_SUS_ENV is OFF or not set) |
68 // 1 - SPEC1170 requested (XPG_SUS_ENV is ON) |
70 // 1 - SPEC1170 requested (XPG_SUS_ENV is ON) |
69 static int _xpg_sus_mode; |
71 static int _xpg_sus_mode; |
70 |
72 |
71 // -1 = uninitialized, |
73 // -1 = uninitialized, |
72 // 0 - EXTSHM=OFF or not set |
74 // 0 - EXTSHM=OFF or not set |
73 // 1 - EXTSHM=ON |
75 // 1 - EXTSHM=ON |
74 static int _extshm; |
76 static int _extshm; |
75 |
|
76 // page sizes on AIX. |
|
77 // |
|
78 // AIX supports four different page sizes - 4K, 64K, 16MB, 16GB. The latter two |
|
79 // (16M "large" resp. 16G "huge" pages) require special setup and are normally |
|
80 // not available. |
|
81 // |
|
82 // AIX supports multiple page sizes per process, for: |
|
83 // - Stack (of the primordial thread, so not relevant for us) |
|
84 // - Data - data, bss, heap, for us also pthread stacks |
|
85 // - Text - text code |
|
86 // - shared memory |
|
87 // |
|
88 // Default page sizes can be set via linker options (-bdatapsize, -bstacksize, ...) |
|
89 // and via environment variable LDR_CNTRL (DATAPSIZE, STACKPSIZE, ...) |
|
90 // |
|
91 // For shared memory, page size can be set dynamically via shmctl(). Different shared memory |
|
92 // regions can have different page sizes. |
|
93 // |
|
94 // More information can be found at AIBM info center: |
|
95 // http://publib.boulder.ibm.com/infocenter/aix/v6r1/index.jsp?topic=/com.ibm.aix.prftungd/doc/prftungd/multiple_page_size_app_support.htm |
|
96 // |
|
97 // ----- |
|
98 // We want to support 4K and 64K and, if the machine is set up correctly, 16MB pages. |
|
99 // |
|
100 |
|
101 // page size of the stack of newly created pthreads |
|
102 // (should be LDR_CNTRL DATAPSIZE because stack is allocated on heap by pthread lib) |
|
103 static int _stack_page_size; |
|
104 |
77 |
105 static julong available_memory(); |
78 static julong available_memory(); |
106 static julong physical_memory() { return _physical_memory; } |
79 static julong physical_memory() { return _physical_memory; } |
107 static void initialize_system_info(); |
80 static void initialize_system_info(); |
108 |
81 |
123 static void initialize_libperfstat(); |
96 static void initialize_libperfstat(); |
124 |
97 |
125 public: |
98 public: |
126 static void init_thread_fpu_state(); |
99 static void init_thread_fpu_state(); |
127 static pthread_t main_thread(void) { return _main_thread; } |
100 static pthread_t main_thread(void) { return _main_thread; } |
128 // returns kernel thread id (similar to LWP id on Solaris), which can be |
|
129 // used to access /proc |
|
130 static pid_t gettid(); |
|
131 static void set_createThread_lock(Mutex* lk) { _createThread_lock = lk; } |
101 static void set_createThread_lock(Mutex* lk) { _createThread_lock = lk; } |
132 static Mutex* createThread_lock(void) { return _createThread_lock; } |
102 static Mutex* createThread_lock(void) { return _createThread_lock; } |
133 static void hotspot_sigmask(Thread* thread); |
103 static void hotspot_sigmask(Thread* thread); |
134 |
104 |
135 // Given an address, returns the size of the page backing that address |
105 // Given an address, returns the size of the page backing that address |
213 static int os_version () { |
183 static int os_version () { |
214 assert(_os_version != -1, "not initialized"); |
184 assert(_os_version != -1, "not initialized"); |
215 return _os_version; |
185 return _os_version; |
216 } |
186 } |
217 |
187 |
|
188 // Get 4 byte AIX kernel version number: |
|
189 // highest 2 bytes: Version, Release |
|
190 // if available: lowest 2 bytes: Tech Level, Service Pack. |
|
191 static unsigned int os_kernel_version() { |
|
192 if (_os_kernel_version) return _os_kernel_version; |
|
193 return os_version() << 16; |
|
194 } |
|
195 |
218 // Convenience method: returns true if running on PASE V5R4 or older. |
196 // Convenience method: returns true if running on PASE V5R4 or older. |
219 static bool on_pase_V5R4_or_older() { |
197 static bool on_pase_V5R4_or_older() { |
220 return on_pase() && os_version() <= 0x0504; |
198 return on_pase() && os_version() <= 0x0504; |
221 } |
199 } |
222 |
200 |
255 // Amount of free paging space, in bytes |
233 // Amount of free paging space, in bytes |
256 unsigned long long pgsp_free; |
234 unsigned long long pgsp_free; |
257 |
235 |
258 }; |
236 }; |
259 |
237 |
260 // Result struct for get_cpuinfo(). |
|
261 struct cpuinfo_t { |
|
262 char description[IDENTIFIER_LENGTH]; // processor description (type/official name) |
|
263 u_longlong_t processorHZ; // processor speed in Hz |
|
264 int ncpus; // number of active logical processors |
|
265 double loadavg[3]; // (1<<SBITS) times the average number of runnables processes during the last 1, 5 and 15 minutes. |
|
266 // To calculate the load average, divide the numbers by (1<<SBITS). SBITS is defined in <sys/proc.h>. |
|
267 char version[20]; // processor version from _system_configuration (sys/systemcfg.h) |
|
268 }; |
|
269 |
|
270 // Functions to retrieve memory information on AIX, PASE. |
238 // Functions to retrieve memory information on AIX, PASE. |
271 // (on AIX, using libperfstat, on PASE with libo4.so). |
239 // (on AIX, using libperfstat, on PASE with libo4.so). |
272 // Returns true if ok, false if error. |
240 // Returns true if ok, false if error. |
273 static bool get_meminfo(meminfo_t* pmi); |
241 static bool get_meminfo(meminfo_t* pmi); |
274 |
242 |
275 // Function to retrieve cpu information on AIX |
243 }; |
276 // (on AIX, using libperfstat) |
|
277 // Returns true if ok, false if error. |
|
278 static bool get_cpuinfo(cpuinfo_t* pci); |
|
279 |
|
280 }; // os::Aix class |
|
281 |
244 |
282 |
245 |
283 class PlatformEvent : public CHeapObj<mtInternal> { |
246 class PlatformEvent : public CHeapObj<mtInternal> { |
284 private: |
247 private: |
285 double CachePad [4]; // increase odds that _mutex is sole occupant of cache line |
248 double CachePad [4]; // increase odds that _mutex is sole occupant of cache line |