File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed
tools/testing/selftests/vm Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -1153,15 +1153,24 @@ void test_pkey_alloc_exhaust(int *ptr, u16 pkey)
1153
1153
dprintf3 ("%s()::%d\n" , __func__ , __LINE__ );
1154
1154
1155
1155
/*
1156
+ * On x86:
1156
1157
* There are 16 pkeys supported in hardware. Three are
1157
1158
* allocated by the time we get here:
1158
1159
* 1. The default key (0)
1159
1160
* 2. One possibly consumed by an execute-only mapping.
1160
1161
* 3. One allocated by the test code and passed in via
1161
1162
* 'pkey' to this function.
1162
1163
* Ensure that we can allocate at least another 13 (16-3).
1164
+ *
1165
+ * On powerpc:
1166
+ * There are either 5, 28, 29 or 32 pkeys supported in
1167
+ * hardware depending on the page size (4K or 64K) and
1168
+ * platform (powernv or powervm). Four are allocated by
1169
+ * the time we get here. These include pkey-0, pkey-1,
1170
+ * exec-only pkey and the one allocated by the test code.
1171
+ * Ensure that we can allocate the remaining.
1163
1172
*/
1164
- pkey_assert (i >= NR_PKEYS - 3 );
1173
+ pkey_assert (i >= ( NR_PKEYS - get_arch_reserved_keys () - 1 ) );
1165
1174
1166
1175
for (i = 0 ; i < nr_allocated_pkeys ; i ++ ) {
1167
1176
err = sys_pkey_free (allocated_pkeys [i ]);
You can’t perform that action at this time.
0 commit comments