1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
|
debug: 0.989
peripherals: 0.988
permissions: 0.988
semantic: 0.987
graphic: 0.987
assembly: 0.986
performance: 0.985
architecture: 0.984
register: 0.984
arm: 0.983
PID: 0.983
socket: 0.982
mistranslation: 0.982
kernel: 0.981
hypervisor: 0.979
files: 0.979
device: 0.979
virtual: 0.978
alpha: 0.978
user-level: 0.978
operating system: 0.977
risc-v: 0.974
network: 0.973
vnc: 0.973
TCG: 0.969
boot: 0.967
ppc: 0.966
VMM: 0.965
x86: 0.964
KVM: 0.958
i386: 0.957
[BUG REPORT] cxl process in infinity loop
Hi, all
When I did the cxl memory hot-plug test on QEMU, I accidentally connected
two memdev to the same downstream port, the command like below:
>
-object memory-backend-ram,size=262144k,share=on,id=vmem0 \
>
-object memory-backend-ram,size=262144k,share=on,id=vmem1 \
>
-device pxb-cxl,bus_nr=12,bus=pcie.0,id=cxl.1 \
>
-device cxl-rp,port=0,bus=cxl.1,id=root_port0,chassis=0,slot=0 \
>
-device cxl-upstream,bus=root_port0,id=us0 \
>
-device cxl-downstream,port=0,bus=us0,id=swport00,chassis=0,slot=5 \
>
-device cxl-downstream,port=0,bus=us0,id=swport01,chassis=0,slot=7 \
same downstream port but has different slot!
>
-device cxl-type3,bus=swport00,volatile-memdev=vmem0,id=cxl-vmem0 \
>
-device cxl-type3,bus=swport01,volatile-memdev=vmem1,id=cxl-vmem1 \
>
-M
>
cxl-fmw.0.targets.0=cxl.1,cxl-fmw.0.size=64G,cxl-fmw.0.interleave-granularity=4k
>
\
There is no error occurred when vm start, but when I executed the âcxl listâ
command to view
the CXL objects info, the process can not end properly.
Then I used strace to trace the process, I found that the process is in
infinity loop:
# strace cxl list
......
clock_nanosleep(CLOCK_REALTIME, 0, {tv_sec=0, tv_nsec=1000000}, NULL) = 0
openat(AT_FDCWD, "/sys/bus/cxl/flush", O_WRONLY|O_CLOEXEC) = 3
write(3, "1\n\0", 3) = 3
close(3) = 0
access("/run/udev/queue", F_OK) = 0
clock_nanosleep(CLOCK_REALTIME, 0, {tv_sec=0, tv_nsec=1000000}, NULL) = 0
openat(AT_FDCWD, "/sys/bus/cxl/flush", O_WRONLY|O_CLOEXEC) = 3
write(3, "1\n\0", 3) = 3
close(3) = 0
access("/run/udev/queue", F_OK) = 0
clock_nanosleep(CLOCK_REALTIME, 0, {tv_sec=0, tv_nsec=1000000}, NULL) = 0
openat(AT_FDCWD, "/sys/bus/cxl/flush", O_WRONLY|O_CLOEXEC) = 3
write(3, "1\n\0", 3) = 3
close(3) = 0
access("/run/udev/queue", F_OK) = 0
clock_nanosleep(CLOCK_REALTIME, 0, {tv_sec=0, tv_nsec=1000000}, NULL) = 0
openat(AT_FDCWD, "/sys/bus/cxl/flush", O_WRONLY|O_CLOEXEC) = 3
write(3, "1\n\0", 3) = 3
close(3) = 0
access("/run/udev/queue", F_OK) = 0
clock_nanosleep(CLOCK_REALTIME, 0, {tv_sec=0, tv_nsec=1000000}, NULL) = 0
openat(AT_FDCWD, "/sys/bus/cxl/flush", O_WRONLY|O_CLOEXEC) = 3
write(3, "1\n\0", 3) = 3
close(3) = 0
access("/run/udev/queue", F_OK) = 0
clock_nanosleep(CLOCK_REALTIME, 0, {tv_sec=0, tv_nsec=1000000}, NULL) = 0
openat(AT_FDCWD, "/sys/bus/cxl/flush", O_WRONLY|O_CLOEXEC) = 3
write(3, "1\n\0", 3) = 3
close(3) = 0
access("/run/udev/queue", F_OK) = 0
clock_nanosleep(CLOCK_REALTIME, 0, {tv_sec=0, tv_nsec=1000000}, NULL) = 0
openat(AT_FDCWD, "/sys/bus/cxl/flush", O_WRONLY|O_CLOEXEC) = 3
write(3, "1\n\0", 3) = 3
close(3) = 0
access("/run/udev/queue", F_OK) = 0
clock_nanosleep(CLOCK_REALTIME, 0, {tv_sec=0, tv_nsec=1000000}, NULL) = 0
openat(AT_FDCWD, "/sys/bus/cxl/flush", O_WRONLY|O_CLOEXEC) = 3
write(3, "1\n\0", 3) = 3
close(3) = 0
access("/run/udev/queue", F_OK) = 0
[Environment]:
linux: V6.10-rc3
QEMU: V9.0.0
ndctl: v79
I know this is because of the wrong use of the QEMU command, but I think we
should
be aware of this error in one of the QEMU, OS or ndctl side at least.
Thanks
Xingtao
On Tue, 2 Jul 2024 00:30:06 +0000
"Xingtao Yao (Fujitsu)" <yaoxt.fnst@fujitsu.com> wrote:
>
Hi, all
>
>
When I did the cxl memory hot-plug test on QEMU, I accidentally connected
>
two memdev to the same downstream port, the command like below:
>
>
> -object memory-backend-ram,size=262144k,share=on,id=vmem0 \
>
> -object memory-backend-ram,size=262144k,share=on,id=vmem1 \
>
> -device pxb-cxl,bus_nr=12,bus=pcie.0,id=cxl.1 \
>
> -device cxl-rp,port=0,bus=cxl.1,id=root_port0,chassis=0,slot=0 \
>
> -device cxl-upstream,bus=root_port0,id=us0 \
>
> -device cxl-downstream,port=0,bus=us0,id=swport00,chassis=0,slot=5 \
>
> -device cxl-downstream,port=0,bus=us0,id=swport01,chassis=0,slot=7 \
>
same downstream port but has different slot!
>
>
> -device cxl-type3,bus=swport00,volatile-memdev=vmem0,id=cxl-vmem0 \
>
> -device cxl-type3,bus=swport01,volatile-memdev=vmem1,id=cxl-vmem1 \
>
> -M
>
> cxl-fmw.0.targets.0=cxl.1,cxl-fmw.0.size=64G,cxl-fmw.0.interleave-granularity=4k
>
> \
>
>
There is no error occurred when vm start, but when I executed the âcxl listâ
>
command to view
>
the CXL objects info, the process can not end properly.
I'd be happy to look preventing this on QEMU side if you send one,
but in general there are are lots of ways to shoot yourself in the
foot with CXL and PCI device emulation in QEMU so I'm not going
to rush to solve this specific one.
Likewise, some hardening in kernel / userspace probably makes sense but
this is a non compliant switch so priority of a fix is probably fairly low.
Jonathan
>
>
Then I used strace to trace the process, I found that the process is in
>
infinity loop:
>
# strace cxl list
>
......
>
clock_nanosleep(CLOCK_REALTIME, 0, {tv_sec=0, tv_nsec=1000000}, NULL) = 0
>
openat(AT_FDCWD, "/sys/bus/cxl/flush", O_WRONLY|O_CLOEXEC) = 3
>
write(3, "1\n\0", 3) = 3
>
close(3) = 0
>
access("/run/udev/queue", F_OK) = 0
>
clock_nanosleep(CLOCK_REALTIME, 0, {tv_sec=0, tv_nsec=1000000}, NULL) = 0
>
openat(AT_FDCWD, "/sys/bus/cxl/flush", O_WRONLY|O_CLOEXEC) = 3
>
write(3, "1\n\0", 3) = 3
>
close(3) = 0
>
access("/run/udev/queue", F_OK) = 0
>
clock_nanosleep(CLOCK_REALTIME, 0, {tv_sec=0, tv_nsec=1000000}, NULL) = 0
>
openat(AT_FDCWD, "/sys/bus/cxl/flush", O_WRONLY|O_CLOEXEC) = 3
>
write(3, "1\n\0", 3) = 3
>
close(3) = 0
>
access("/run/udev/queue", F_OK) = 0
>
clock_nanosleep(CLOCK_REALTIME, 0, {tv_sec=0, tv_nsec=1000000}, NULL) = 0
>
openat(AT_FDCWD, "/sys/bus/cxl/flush", O_WRONLY|O_CLOEXEC) = 3
>
write(3, "1\n\0", 3) = 3
>
close(3) = 0
>
access("/run/udev/queue", F_OK) = 0
>
clock_nanosleep(CLOCK_REALTIME, 0, {tv_sec=0, tv_nsec=1000000}, NULL) = 0
>
openat(AT_FDCWD, "/sys/bus/cxl/flush", O_WRONLY|O_CLOEXEC) = 3
>
write(3, "1\n\0", 3) = 3
>
close(3) = 0
>
access("/run/udev/queue", F_OK) = 0
>
clock_nanosleep(CLOCK_REALTIME, 0, {tv_sec=0, tv_nsec=1000000}, NULL) = 0
>
openat(AT_FDCWD, "/sys/bus/cxl/flush", O_WRONLY|O_CLOEXEC) = 3
>
write(3, "1\n\0", 3) = 3
>
close(3) = 0
>
access("/run/udev/queue", F_OK) = 0
>
clock_nanosleep(CLOCK_REALTIME, 0, {tv_sec=0, tv_nsec=1000000}, NULL) = 0
>
openat(AT_FDCWD, "/sys/bus/cxl/flush", O_WRONLY|O_CLOEXEC) = 3
>
write(3, "1\n\0", 3) = 3
>
close(3) = 0
>
access("/run/udev/queue", F_OK) = 0
>
clock_nanosleep(CLOCK_REALTIME, 0, {tv_sec=0, tv_nsec=1000000}, NULL) = 0
>
openat(AT_FDCWD, "/sys/bus/cxl/flush", O_WRONLY|O_CLOEXEC) = 3
>
write(3, "1\n\0", 3) = 3
>
close(3) = 0
>
access("/run/udev/queue", F_OK) = 0
>
>
[Environment]:
>
linux: V6.10-rc3
>
QEMU: V9.0.0
>
ndctl: v79
>
>
I know this is because of the wrong use of the QEMU command, but I think we
>
should
>
be aware of this error in one of the QEMU, OS or ndctl side at least.
>
>
Thanks
>
Xingtao
|