Skip to content

Commit b6c84ba

Browse files
vaibhav92mpe
authored andcommitted
cxl: Disable prefault_mode in Radix mode
Currently we see a kernel-oops reported on Power-9 while attaching a context to an AFU, with radix-mode and sysfs attr 'prefault_mode' set to anything other than 'none'. The backtrace of the oops is of this form: Unable to handle kernel paging request for data at address 0x00000080 Faulting instruction address: 0xc00800000bcf3b20 cpu 0x1: Vector: 300 (Data Access) at [c00000037f003800] pc: c00800000bcf3b20: cxl_load_segment+0x178/0x290 [cxl] lr: c00800000bcf39f0: cxl_load_segment+0x48/0x290 [cxl] sp: c00000037f003a80 msr: 9000000000009033 dar: 80 dsisr: 40000000 current = 0xc00000037f280000 paca = 0xc0000003ffffe600 softe: 3 irq_happened: 0x01 pid = 3529, comm = afp_no_int <snip> cxl_prefault+0xfc/0x248 [cxl] process_element_entry_psl9+0xd8/0x1a0 [cxl] cxl_attach_dedicated_process_psl9+0x44/0x130 [cxl] native_attach_process+0xc0/0x130 [cxl] afu_ioctl+0x3f4/0x5e0 [cxl] do_vfs_ioctl+0xdc/0x890 ksys_ioctl+0x68/0xf0 sys_ioctl+0x40/0xa0 system_call+0x58/0x6c The issue is caused as on Power-8 the AFU attr 'prefault_mode' was used to improve initial storage fault performance by prefaulting process segments. However on Power-9 with radix mode we don't have Storage-Segments that we can prefault. Also prefaulting process Pages will be too costly and fine-grained. Hence, since the prefaulting mechanism doesn't makes sense of radix-mode, this patch updates prefault_mode_store() to not allow any other value apart from CXL_PREFAULT_NONE when radix mode is enabled. Fixes: f24be42 ("cxl: Add psl9 specific code") Cc: stable@vger.kernel.org # v4.12+ Signed-off-by: Vaibhav Jain <vaibhav@linux.ibm.com> Acked-by: Frederic Barrat <fbarrat@linux.vnet.ibm.com> Acked-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
1 parent 5e3f0d1 commit b6c84ba

2 files changed

Lines changed: 15 additions & 5 deletions

File tree

‎Documentation/ABI/testing/sysfs-class-cxl‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,9 @@ Date: September 2014
6969
Contact: linuxppc-dev@lists.ozlabs.org
7070
Description: read/write
7171
Set the mode for prefaulting in segments into the segment table
72-
when performing the START_WORK ioctl. Possible values:
72+
when performing the START_WORK ioctl. Only applicable when
73+
running under hashed page table mmu.
74+
Possible values:
7375
none: No prefaulting (default)
7476
work_element_descriptor: Treat the work element
7577
descriptor as an effective address and

‎drivers/misc/cxl/sysfs.c‎

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -343,12 +343,20 @@ static ssize_t prefault_mode_store(struct device *device,
343343
struct cxl_afu *afu = to_cxl_afu(device);
344344
enum prefault_modes mode = -1;
345345

346-
if (!strncmp(buf, "work_element_descriptor", 23))
347-
mode = CXL_PREFAULT_WED;
348-
if (!strncmp(buf, "all", 3))
349-
mode = CXL_PREFAULT_ALL;
350346
if (!strncmp(buf, "none", 4))
351347
mode = CXL_PREFAULT_NONE;
348+
else {
349+
if (!radix_enabled()) {
350+
351+
/* only allowed when not in radix mode */
352+
if (!strncmp(buf, "work_element_descriptor", 23))
353+
mode = CXL_PREFAULT_WED;
354+
if (!strncmp(buf, "all", 3))
355+
mode = CXL_PREFAULT_ALL;
356+
} else {
357+
dev_err(device, "Cannot prefault with radix enabled\n");
358+
}
359+
}
352360

353361
if (mode == -1)
354362
return -EINVAL;

0 commit comments

Comments
 (0)