.. | .. |
---|
52 | 52 | |
---|
53 | 53 | static struct xencons_info *vtermno_to_xencons(int vtermno) |
---|
54 | 54 | { |
---|
55 | | - struct xencons_info *entry, *n, *ret = NULL; |
---|
| 55 | + struct xencons_info *entry, *ret = NULL; |
---|
| 56 | + unsigned long flags; |
---|
56 | 57 | |
---|
57 | | - if (list_empty(&xenconsoles)) |
---|
58 | | - return NULL; |
---|
| 58 | + spin_lock_irqsave(&xencons_lock, flags); |
---|
| 59 | + if (list_empty(&xenconsoles)) { |
---|
| 60 | + spin_unlock_irqrestore(&xencons_lock, flags); |
---|
| 61 | + return NULL; |
---|
| 62 | + } |
---|
59 | 63 | |
---|
60 | | - list_for_each_entry_safe(entry, n, &xenconsoles, list) { |
---|
| 64 | + list_for_each_entry(entry, &xenconsoles, list) { |
---|
61 | 65 | if (entry->vtermno == vtermno) { |
---|
62 | 66 | ret = entry; |
---|
63 | 67 | break; |
---|
64 | 68 | } |
---|
65 | 69 | } |
---|
| 70 | + spin_unlock_irqrestore(&xencons_lock, flags); |
---|
66 | 71 | |
---|
67 | 72 | return ret; |
---|
68 | 73 | } |
---|
.. | .. |
---|
223 | 228 | { |
---|
224 | 229 | int r; |
---|
225 | 230 | uint64_t v = 0; |
---|
226 | | - unsigned long gfn; |
---|
| 231 | + unsigned long gfn, flags; |
---|
227 | 232 | struct xencons_info *info; |
---|
228 | 233 | |
---|
229 | 234 | if (!xen_hvm_domain()) |
---|
.. | .. |
---|
258 | 263 | goto err; |
---|
259 | 264 | info->vtermno = HVC_COOKIE; |
---|
260 | 265 | |
---|
261 | | - spin_lock(&xencons_lock); |
---|
| 266 | + spin_lock_irqsave(&xencons_lock, flags); |
---|
262 | 267 | list_add_tail(&info->list, &xenconsoles); |
---|
263 | | - spin_unlock(&xencons_lock); |
---|
| 268 | + spin_unlock_irqrestore(&xencons_lock, flags); |
---|
264 | 269 | |
---|
265 | 270 | return 0; |
---|
266 | 271 | err: |
---|
.. | .. |
---|
283 | 288 | static int xen_pv_console_init(void) |
---|
284 | 289 | { |
---|
285 | 290 | struct xencons_info *info; |
---|
| 291 | + unsigned long flags; |
---|
286 | 292 | |
---|
287 | 293 | if (!xen_pv_domain()) |
---|
288 | 294 | return -ENODEV; |
---|
.. | .. |
---|
299 | 305 | /* already configured */ |
---|
300 | 306 | return 0; |
---|
301 | 307 | } |
---|
302 | | - spin_lock(&xencons_lock); |
---|
| 308 | + spin_lock_irqsave(&xencons_lock, flags); |
---|
303 | 309 | xencons_info_pv_init(info, HVC_COOKIE); |
---|
304 | | - spin_unlock(&xencons_lock); |
---|
| 310 | + spin_unlock_irqrestore(&xencons_lock, flags); |
---|
305 | 311 | |
---|
306 | 312 | return 0; |
---|
307 | 313 | } |
---|
.. | .. |
---|
309 | 315 | static int xen_initial_domain_console_init(void) |
---|
310 | 316 | { |
---|
311 | 317 | struct xencons_info *info; |
---|
| 318 | + unsigned long flags; |
---|
312 | 319 | |
---|
313 | 320 | if (!xen_initial_domain()) |
---|
314 | 321 | return -ENODEV; |
---|
.. | .. |
---|
323 | 330 | info->irq = bind_virq_to_irq(VIRQ_CONSOLE, 0, false); |
---|
324 | 331 | info->vtermno = HVC_COOKIE; |
---|
325 | 332 | |
---|
326 | | - spin_lock(&xencons_lock); |
---|
| 333 | + spin_lock_irqsave(&xencons_lock, flags); |
---|
327 | 334 | list_add_tail(&info->list, &xenconsoles); |
---|
328 | | - spin_unlock(&xencons_lock); |
---|
| 335 | + spin_unlock_irqrestore(&xencons_lock, flags); |
---|
329 | 336 | |
---|
330 | 337 | return 0; |
---|
331 | 338 | } |
---|
.. | .. |
---|
380 | 387 | |
---|
381 | 388 | static int xen_console_remove(struct xencons_info *info) |
---|
382 | 389 | { |
---|
| 390 | + unsigned long flags; |
---|
| 391 | + |
---|
383 | 392 | xencons_disconnect_backend(info); |
---|
384 | | - spin_lock(&xencons_lock); |
---|
| 393 | + spin_lock_irqsave(&xencons_lock, flags); |
---|
385 | 394 | list_del(&info->list); |
---|
386 | | - spin_unlock(&xencons_lock); |
---|
| 395 | + spin_unlock_irqrestore(&xencons_lock, flags); |
---|
387 | 396 | if (info->xbdev != NULL) |
---|
388 | 397 | xencons_free(info); |
---|
389 | 398 | else { |
---|
.. | .. |
---|
464 | 473 | { |
---|
465 | 474 | int ret, devid; |
---|
466 | 475 | struct xencons_info *info; |
---|
| 476 | + unsigned long flags; |
---|
467 | 477 | |
---|
468 | 478 | devid = dev->nodename[strlen(dev->nodename) - 1] - '0'; |
---|
469 | 479 | if (devid == 0) |
---|
.. | .. |
---|
482 | 492 | ret = xencons_connect_backend(dev, info); |
---|
483 | 493 | if (ret < 0) |
---|
484 | 494 | goto error; |
---|
485 | | - spin_lock(&xencons_lock); |
---|
| 495 | + spin_lock_irqsave(&xencons_lock, flags); |
---|
486 | 496 | list_add_tail(&info->list, &xenconsoles); |
---|
487 | | - spin_unlock(&xencons_lock); |
---|
| 497 | + spin_unlock_irqrestore(&xencons_lock, flags); |
---|
488 | 498 | |
---|
489 | 499 | return 0; |
---|
490 | 500 | |
---|
.. | .. |
---|
583 | 593 | |
---|
584 | 594 | info->hvc = hvc_alloc(HVC_COOKIE, info->irq, ops, 256); |
---|
585 | 595 | if (IS_ERR(info->hvc)) { |
---|
| 596 | + unsigned long flags; |
---|
| 597 | + |
---|
586 | 598 | r = PTR_ERR(info->hvc); |
---|
587 | | - spin_lock(&xencons_lock); |
---|
| 599 | + spin_lock_irqsave(&xencons_lock, flags); |
---|
588 | 600 | list_del(&info->list); |
---|
589 | | - spin_unlock(&xencons_lock); |
---|
| 601 | + spin_unlock_irqrestore(&xencons_lock, flags); |
---|
590 | 602 | if (info->irq) |
---|
591 | 603 | unbind_from_irqhandler(info->irq, NULL); |
---|
592 | 604 | kfree(info); |
---|