]>
Commit | Line | Data |
---|---|---|
1 | From b6c84ba22ff3a198eb8d5552cf9b8fda1d792e54 Mon Sep 17 00:00:00 2001 | |
2 | From: Vaibhav Jain <vaibhav@linux.ibm.com> | |
3 | Date: Fri, 18 May 2018 15:12:23 +0530 | |
4 | Subject: cxl: Disable prefault_mode in Radix mode | |
5 | ||
6 | From: Vaibhav Jain <vaibhav@linux.ibm.com> | |
7 | ||
8 | commit b6c84ba22ff3a198eb8d5552cf9b8fda1d792e54 upstream. | |
9 | ||
10 | Currently we see a kernel-oops reported on Power-9 while attaching a | |
11 | context to an AFU, with radix-mode and sysfs attr 'prefault_mode' set | |
12 | to anything other than 'none'. The backtrace of the oops is of this | |
13 | form: | |
14 | ||
15 | Unable to handle kernel paging request for data at address 0x00000080 | |
16 | Faulting instruction address: 0xc00800000bcf3b20 | |
17 | cpu 0x1: Vector: 300 (Data Access) at [c00000037f003800] | |
18 | pc: c00800000bcf3b20: cxl_load_segment+0x178/0x290 [cxl] | |
19 | lr: c00800000bcf39f0: cxl_load_segment+0x48/0x290 [cxl] | |
20 | sp: c00000037f003a80 | |
21 | msr: 9000000000009033 | |
22 | dar: 80 | |
23 | dsisr: 40000000 | |
24 | current = 0xc00000037f280000 | |
25 | paca = 0xc0000003ffffe600 softe: 3 irq_happened: 0x01 | |
26 | pid = 3529, comm = afp_no_int | |
27 | <snip> | |
28 | cxl_prefault+0xfc/0x248 [cxl] | |
29 | process_element_entry_psl9+0xd8/0x1a0 [cxl] | |
30 | cxl_attach_dedicated_process_psl9+0x44/0x130 [cxl] | |
31 | native_attach_process+0xc0/0x130 [cxl] | |
32 | afu_ioctl+0x3f4/0x5e0 [cxl] | |
33 | do_vfs_ioctl+0xdc/0x890 | |
34 | ksys_ioctl+0x68/0xf0 | |
35 | sys_ioctl+0x40/0xa0 | |
36 | system_call+0x58/0x6c | |
37 | ||
38 | The issue is caused as on Power-8 the AFU attr 'prefault_mode' was | |
39 | used to improve initial storage fault performance by prefaulting | |
40 | process segments. However on Power-9 with radix mode we don't have | |
41 | Storage-Segments that we can prefault. Also prefaulting process Pages | |
42 | will be too costly and fine-grained. | |
43 | ||
44 | Hence, since the prefaulting mechanism doesn't makes sense of | |
45 | radix-mode, this patch updates prefault_mode_store() to not allow any | |
46 | other value apart from CXL_PREFAULT_NONE when radix mode is enabled. | |
47 | ||
48 | Fixes: f24be42aab37 ("cxl: Add psl9 specific code") | |
49 | Cc: stable@vger.kernel.org # v4.12+ | |
50 | Signed-off-by: Vaibhav Jain <vaibhav@linux.ibm.com> | |
51 | Acked-by: Frederic Barrat <fbarrat@linux.vnet.ibm.com> | |
52 | Acked-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com> | |
53 | Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> | |
54 | Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> | |
55 | ||
56 | --- | |
57 | Documentation/ABI/testing/sysfs-class-cxl | 4 +++- | |
58 | drivers/misc/cxl/sysfs.c | 16 ++++++++++++---- | |
59 | 2 files changed, 15 insertions(+), 5 deletions(-) | |
60 | ||
61 | --- a/Documentation/ABI/testing/sysfs-class-cxl | |
62 | +++ b/Documentation/ABI/testing/sysfs-class-cxl | |
63 | @@ -69,7 +69,9 @@ Date: September 2014 | |
64 | Contact: linuxppc-dev@lists.ozlabs.org | |
65 | Description: read/write | |
66 | Set the mode for prefaulting in segments into the segment table | |
67 | - when performing the START_WORK ioctl. Possible values: | |
68 | + when performing the START_WORK ioctl. Only applicable when | |
69 | + running under hashed page table mmu. | |
70 | + Possible values: | |
71 | none: No prefaulting (default) | |
72 | work_element_descriptor: Treat the work element | |
73 | descriptor as an effective address and | |
74 | --- a/drivers/misc/cxl/sysfs.c | |
75 | +++ b/drivers/misc/cxl/sysfs.c | |
76 | @@ -331,12 +331,20 @@ static ssize_t prefault_mode_store(struc | |
77 | struct cxl_afu *afu = to_cxl_afu(device); | |
78 | enum prefault_modes mode = -1; | |
79 | ||
80 | - if (!strncmp(buf, "work_element_descriptor", 23)) | |
81 | - mode = CXL_PREFAULT_WED; | |
82 | - if (!strncmp(buf, "all", 3)) | |
83 | - mode = CXL_PREFAULT_ALL; | |
84 | if (!strncmp(buf, "none", 4)) | |
85 | mode = CXL_PREFAULT_NONE; | |
86 | + else { | |
87 | + if (!radix_enabled()) { | |
88 | + | |
89 | + /* only allowed when not in radix mode */ | |
90 | + if (!strncmp(buf, "work_element_descriptor", 23)) | |
91 | + mode = CXL_PREFAULT_WED; | |
92 | + if (!strncmp(buf, "all", 3)) | |
93 | + mode = CXL_PREFAULT_ALL; | |
94 | + } else { | |
95 | + dev_err(device, "Cannot prefault with radix enabled\n"); | |
96 | + } | |
97 | + } | |
98 | ||
99 | if (mode == -1) | |
100 | return -EINVAL; |