Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'for-linus-6.2-rc4-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip

Pull xen fixes from Juergen Gross:

- two cleanup patches

- a fix of a memory leak in the Xen pvfront driver

- a fix of a locking issue in the Xen hypervisor console driver

* tag 'for-linus-6.2-rc4-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip:
xen/pvcalls: free active map buffer on pvcalls_front_free_map
hvc/xen: lock console list traversal
x86/xen: Remove the unused function p2m_index()
xen: make remove callback of xen driver void returned

+54 -70
-5
arch/x86/xen/p2m.c
··· 134 134 return (pfn / P2M_PER_PAGE) % P2M_MID_PER_PAGE; 135 135 } 136 136 137 - static inline unsigned p2m_index(unsigned long pfn) 138 - { 139 - return pfn % P2M_PER_PAGE; 140 - } 141 - 142 137 static void p2m_top_mfn_init(unsigned long *top) 143 138 { 144 139 unsigned i;
+1 -3
drivers/block/xen-blkback/xenbus.c
··· 524 524 return 0; 525 525 } 526 526 527 - static int xen_blkbk_remove(struct xenbus_device *dev) 527 + static void xen_blkbk_remove(struct xenbus_device *dev) 528 528 { 529 529 struct backend_info *be = dev_get_drvdata(&dev->dev); 530 530 ··· 547 547 /* Put the reference we set in xen_blkif_alloc(). */ 548 548 xen_blkif_put(be->blkif); 549 549 } 550 - 551 - return 0; 552 550 } 553 551 554 552 int xen_blkbk_flush_diskcache(struct xenbus_transaction xbt,
+1 -2
drivers/block/xen-blkfront.c
··· 2467 2467 } 2468 2468 } 2469 2469 2470 - static int blkfront_remove(struct xenbus_device *xbdev) 2470 + static void blkfront_remove(struct xenbus_device *xbdev) 2471 2471 { 2472 2472 struct blkfront_info *info = dev_get_drvdata(&xbdev->dev); 2473 2473 ··· 2488 2488 } 2489 2489 2490 2490 kfree(info); 2491 - return 0; 2492 2491 } 2493 2492 2494 2493 static int blkfront_is_ready(struct xenbus_device *dev)
+1 -2
drivers/char/tpm/xen-tpmfront.c
··· 360 360 return tpm_chip_register(priv->chip); 361 361 } 362 362 363 - static int tpmfront_remove(struct xenbus_device *dev) 363 + static void tpmfront_remove(struct xenbus_device *dev) 364 364 { 365 365 struct tpm_chip *chip = dev_get_drvdata(&dev->dev); 366 366 struct tpm_private *priv = dev_get_drvdata(&chip->dev); 367 367 tpm_chip_unregister(chip); 368 368 ring_free(priv); 369 369 dev_set_drvdata(&chip->dev, NULL); 370 - return 0; 371 370 } 372 371 373 372 static int tpmfront_resume(struct xenbus_device *dev)
+1 -2
drivers/gpu/drm/xen/xen_drm_front.c
··· 717 717 return xenbus_switch_state(xb_dev, XenbusStateInitialising); 718 718 } 719 719 720 - static int xen_drv_remove(struct xenbus_device *dev) 720 + static void xen_drv_remove(struct xenbus_device *dev) 721 721 { 722 722 struct xen_drm_front_info *front_info = dev_get_drvdata(&dev->dev); 723 723 int to = 100; ··· 751 751 752 752 xen_drm_drv_fini(front_info); 753 753 xenbus_frontend_closed(dev); 754 - return 0; 755 754 } 756 755 757 756 static const struct xenbus_device_id xen_driver_ids[] = {
+2 -3
drivers/input/misc/xen-kbdfront.c
··· 51 51 MODULE_PARM_DESC(ptr_size, 52 52 "Pointing device width, height in pixels (default 800,600)"); 53 53 54 - static int xenkbd_remove(struct xenbus_device *); 54 + static void xenkbd_remove(struct xenbus_device *); 55 55 static int xenkbd_connect_backend(struct xenbus_device *, struct xenkbd_info *); 56 56 static void xenkbd_disconnect_backend(struct xenkbd_info *); 57 57 ··· 404 404 return xenkbd_connect_backend(dev, info); 405 405 } 406 406 407 - static int xenkbd_remove(struct xenbus_device *dev) 407 + static void xenkbd_remove(struct xenbus_device *dev) 408 408 { 409 409 struct xenkbd_info *info = dev_get_drvdata(&dev->dev); 410 410 ··· 417 417 input_unregister_device(info->mtouch); 418 418 free_page((unsigned long)info->page); 419 419 kfree(info); 420 - return 0; 421 420 } 422 421 423 422 static int xenkbd_connect_backend(struct xenbus_device *dev,
+1 -2
drivers/net/xen-netback/xenbus.c
··· 977 977 return 0; 978 978 } 979 979 980 - static int netback_remove(struct xenbus_device *dev) 980 + static void netback_remove(struct xenbus_device *dev) 981 981 { 982 982 struct backend_info *be = dev_get_drvdata(&dev->dev); 983 983 ··· 992 992 kfree(be->hotplug_script); 993 993 kfree(be); 994 994 dev_set_drvdata(&dev->dev, NULL); 995 - return 0; 996 995 } 997 996 998 997 /*
+1 -3
drivers/net/xen-netfront.c
··· 2646 2646 } while (!ret); 2647 2647 } 2648 2648 2649 - static int xennet_remove(struct xenbus_device *dev) 2649 + static void xennet_remove(struct xenbus_device *dev) 2650 2650 { 2651 2651 struct netfront_info *info = dev_get_drvdata(&dev->dev); 2652 2652 ··· 2662 2662 rtnl_unlock(); 2663 2663 } 2664 2664 xennet_free_netdev(info->netdev); 2665 - 2666 - return 0; 2667 2665 } 2668 2666 2669 2667 static const struct xenbus_device_id netfront_ids[] = {
+1 -3
drivers/pci/xen-pcifront.c
··· 1055 1055 return err; 1056 1056 } 1057 1057 1058 - static int pcifront_xenbus_remove(struct xenbus_device *xdev) 1058 + static void pcifront_xenbus_remove(struct xenbus_device *xdev) 1059 1059 { 1060 1060 struct pcifront_device *pdev = dev_get_drvdata(&xdev->dev); 1061 1061 1062 1062 if (pdev) 1063 1063 free_pdev(pdev); 1064 - 1065 - return 0; 1066 1064 } 1067 1065 1068 1066 static const struct xenbus_device_id xenpci_ids[] = {
+1 -3
drivers/scsi/xen-scsifront.c
··· 995 995 return err; 996 996 } 997 997 998 - static int scsifront_remove(struct xenbus_device *dev) 998 + static void scsifront_remove(struct xenbus_device *dev) 999 999 { 1000 1000 struct vscsifrnt_info *info = dev_get_drvdata(&dev->dev); 1001 1001 ··· 1011 1011 1012 1012 scsifront_free_ring(info); 1013 1013 scsi_host_put(info->host); 1014 - 1015 - return 0; 1016 1014 } 1017 1015 1018 1016 static void scsifront_disconnect(struct vscsifrnt_info *info)
+31 -19
drivers/tty/hvc/hvc_xen.c
··· 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 } ··· 228 223 { 229 224 int r; 230 225 uint64_t v = 0; 231 - unsigned long gfn; 226 + unsigned long gfn, flags; 232 227 struct xencons_info *info; 233 228 234 229 if (!xen_hvm_domain()) ··· 263 258 goto err; 264 259 info->vtermno = HVC_COOKIE; 265 260 266 - spin_lock(&xencons_lock); 261 + spin_lock_irqsave(&xencons_lock, flags); 267 262 list_add_tail(&info->list, &xenconsoles); 268 - spin_unlock(&xencons_lock); 263 + spin_unlock_irqrestore(&xencons_lock, flags); 269 264 270 265 return 0; 271 266 err: ··· 288 283 static int xen_pv_console_init(void) 289 284 { 290 285 struct xencons_info *info; 286 + unsigned long flags; 291 287 292 288 if (!xen_pv_domain()) 293 289 return -ENODEV; ··· 305 299 /* already configured */ 306 300 return 0; 307 301 } 308 - spin_lock(&xencons_lock); 302 + spin_lock_irqsave(&xencons_lock, flags); 309 303 xencons_info_pv_init(info, HVC_COOKIE); 310 - spin_unlock(&xencons_lock); 304 + spin_unlock_irqrestore(&xencons_lock, flags); 311 305 312 306 return 0; 313 307 } ··· 315 309 static int xen_initial_domain_console_init(void) 316 310 { 317 311 struct xencons_info *info; 312 + unsigned long flags; 318 313 319 314 if (!xen_initial_domain()) 320 315 return -ENODEV; ··· 330 323 info->irq = bind_virq_to_irq(VIRQ_CONSOLE, 0, false); 331 324 info->vtermno = HVC_COOKIE; 332 325 333 - spin_lock(&xencons_lock); 326 + spin_lock_irqsave(&xencons_lock, flags); 334 327 list_add_tail(&info->list, &xenconsoles); 335 - spin_unlock(&xencons_lock); 328 + spin_unlock_irqrestore(&xencons_lock, flags); 336 329 337 330 return 0; 338 331 } ··· 387 380 388 381 static int xen_console_remove(struct xencons_info *info) 389 382 { 383 + unsigned long flags; 384 + 390 385 xencons_disconnect_backend(info); 391 - spin_lock(&xencons_lock); 386 + spin_lock_irqsave(&xencons_lock, flags); 392 387 list_del(&info->list); 393 - spin_unlock(&xencons_lock); 388 + spin_unlock_irqrestore(&xencons_lock, flags); 394 389 if (info->xbdev != NULL) 395 390 xencons_free(info); 396 391 else { ··· 403 394 return 0; 404 395 } 405 396 406 - static int xencons_remove(struct xenbus_device *dev) 397 + static void xencons_remove(struct xenbus_device *dev) 407 398 { 408 - return xen_console_remove(dev_get_drvdata(&dev->dev)); 399 + xen_console_remove(dev_get_drvdata(&dev->dev)); 409 400 } 410 401 411 402 static int xencons_connect_backend(struct xenbus_device *dev, ··· 473 464 { 474 465 int ret, devid; 475 466 struct xencons_info *info; 467 + unsigned long flags; 476 468 477 469 devid = dev->nodename[strlen(dev->nodename) - 1] - '0'; 478 470 if (devid == 0) ··· 492 482 ret = xencons_connect_backend(dev, info); 493 483 if (ret < 0) 494 484 goto error; 495 - spin_lock(&xencons_lock); 485 + spin_lock_irqsave(&xencons_lock, flags); 496 486 list_add_tail(&info->list, &xenconsoles); 497 - spin_unlock(&xencons_lock); 487 + spin_unlock_irqrestore(&xencons_lock, flags); 498 488 499 489 return 0; 500 490 ··· 594 584 595 585 info->hvc = hvc_alloc(HVC_COOKIE, info->irq, ops, 256); 596 586 if (IS_ERR(info->hvc)) { 587 + unsigned long flags; 588 + 597 589 r = PTR_ERR(info->hvc); 598 - spin_lock(&xencons_lock); 590 + spin_lock_irqsave(&xencons_lock, flags); 599 591 list_del(&info->list); 600 - spin_unlock(&xencons_lock); 592 + spin_unlock_irqrestore(&xencons_lock, flags); 601 593 if (info->irq) 602 594 unbind_from_irqhandler(info->irq, NULL); 603 595 kfree(info);
+1 -3
drivers/usb/host/xen-hcd.c
··· 1530 1530 } 1531 1531 } 1532 1532 1533 - static int xenhcd_remove(struct xenbus_device *dev) 1533 + static void xenhcd_remove(struct xenbus_device *dev) 1534 1534 { 1535 1535 struct xenhcd_info *info = dev_get_drvdata(&dev->dev); 1536 1536 struct usb_hcd *hcd = xenhcd_info_to_hcd(info); 1537 1537 1538 1538 xenhcd_destroy_rings(info); 1539 1539 usb_put_hcd(hcd); 1540 - 1541 - return 0; 1542 1540 } 1543 1541 1544 1542 static int xenhcd_probe(struct xenbus_device *dev,
+2 -4
drivers/video/fbdev/xen-fbfront.c
··· 67 67 "Video memory size in MB, width, height in pixels (default 2,800,600)"); 68 68 69 69 static void xenfb_make_preferred_console(void); 70 - static int xenfb_remove(struct xenbus_device *); 70 + static void xenfb_remove(struct xenbus_device *); 71 71 static void xenfb_init_shared_page(struct xenfb_info *, struct fb_info *); 72 72 static int xenfb_connect_backend(struct xenbus_device *, struct xenfb_info *); 73 73 static void xenfb_disconnect_backend(struct xenfb_info *); ··· 523 523 return xenfb_connect_backend(dev, info); 524 524 } 525 525 526 - static int xenfb_remove(struct xenbus_device *dev) 526 + static void xenfb_remove(struct xenbus_device *dev) 527 527 { 528 528 struct xenfb_info *info = dev_get_drvdata(&dev->dev); 529 529 ··· 538 538 vfree(info->gfns); 539 539 vfree(info->fb); 540 540 kfree(info); 541 - 542 - return 0; 543 541 } 544 542 545 543 static unsigned long vmalloc_to_gfn(void *address)
+1 -2
drivers/xen/pvcalls-back.c
··· 1181 1181 } 1182 1182 } 1183 1183 1184 - static int pvcalls_back_remove(struct xenbus_device *dev) 1184 + static void pvcalls_back_remove(struct xenbus_device *dev) 1185 1185 { 1186 - return 0; 1187 1186 } 1188 1187 1189 1188 static int pvcalls_back_uevent(struct xenbus_device *xdev,
+4 -3
drivers/xen/pvcalls-front.c
··· 225 225 return IRQ_HANDLED; 226 226 } 227 227 228 + static void free_active_ring(struct sock_mapping *map); 229 + 228 230 static void pvcalls_front_free_map(struct pvcalls_bedata *bedata, 229 231 struct sock_mapping *map) 230 232 { ··· 242 240 for (i = 0; i < (1 << PVCALLS_RING_ORDER); i++) 243 241 gnttab_end_foreign_access(map->active.ring->ref[i], NULL); 244 242 gnttab_end_foreign_access(map->active.ref, NULL); 245 - free_page((unsigned long)map->active.ring); 243 + free_active_ring(map); 246 244 247 245 kfree(map); 248 246 } ··· 1087 1085 { "" } 1088 1086 }; 1089 1087 1090 - static int pvcalls_front_remove(struct xenbus_device *dev) 1088 + static void pvcalls_front_remove(struct xenbus_device *dev) 1091 1089 { 1092 1090 struct pvcalls_bedata *bedata; 1093 1091 struct sock_mapping *map = NULL, *n; ··· 1123 1121 kfree(bedata->ring.sring); 1124 1122 kfree(bedata); 1125 1123 xenbus_switch_state(dev, XenbusStateClosed); 1126 - return 0; 1127 1124 } 1128 1125 1129 1126 static int pvcalls_front_probe(struct xenbus_device *dev,
+1 -3
drivers/xen/xen-pciback/xenbus.c
··· 716 716 return err; 717 717 } 718 718 719 - static int xen_pcibk_xenbus_remove(struct xenbus_device *dev) 719 + static void xen_pcibk_xenbus_remove(struct xenbus_device *dev) 720 720 { 721 721 struct xen_pcibk_device *pdev = dev_get_drvdata(&dev->dev); 722 722 723 723 if (pdev != NULL) 724 724 free_pdev(pdev); 725 - 726 - return 0; 727 725 } 728 726 729 727 static const struct xenbus_device_id xen_pcibk_ids[] = {
+1 -3
drivers/xen/xen-scsiback.c
··· 1249 1249 spin_unlock_irqrestore(&info->v2p_lock, flags); 1250 1250 } 1251 1251 1252 - static int scsiback_remove(struct xenbus_device *dev) 1252 + static void scsiback_remove(struct xenbus_device *dev) 1253 1253 { 1254 1254 struct vscsibk_info *info = dev_get_drvdata(&dev->dev); 1255 1255 ··· 1261 1261 gnttab_page_cache_shrink(&info->free_pages, 0); 1262 1262 1263 1263 dev_set_drvdata(&dev->dev, NULL); 1264 - 1265 - return 0; 1266 1264 } 1267 1265 1268 1266 static int scsiback_probe(struct xenbus_device *dev,
+1 -1
include/xen/xenbus.h
··· 117 117 const struct xenbus_device_id *id); 118 118 void (*otherend_changed)(struct xenbus_device *dev, 119 119 enum xenbus_state backend_state); 120 - int (*remove)(struct xenbus_device *dev); 120 + void (*remove)(struct xenbus_device *dev); 121 121 int (*suspend)(struct xenbus_device *dev); 122 122 int (*resume)(struct xenbus_device *dev); 123 123 int (*uevent)(struct xenbus_device *, struct kobj_uevent_env *);
+1 -2
net/9p/trans_xen.c
··· 305 305 kfree(priv); 306 306 } 307 307 308 - static int xen_9pfs_front_remove(struct xenbus_device *dev) 308 + static void xen_9pfs_front_remove(struct xenbus_device *dev) 309 309 { 310 310 struct xen_9pfs_front_priv *priv = dev_get_drvdata(&dev->dev); 311 311 312 312 dev_set_drvdata(&dev->dev, NULL); 313 313 xen_9pfs_front_free(priv); 314 - return 0; 315 314 } 316 315 317 316 static int xen_9pfs_front_alloc_dataring(struct xenbus_device *dev,
+1 -2
sound/xen/xen_snd_front.c
··· 311 311 return xenbus_switch_state(xb_dev, XenbusStateInitialising); 312 312 } 313 313 314 - static int xen_drv_remove(struct xenbus_device *dev) 314 + static void xen_drv_remove(struct xenbus_device *dev) 315 315 { 316 316 struct xen_snd_front_info *front_info = dev_get_drvdata(&dev->dev); 317 317 int to = 100; ··· 345 345 346 346 xen_snd_drv_fini(front_info); 347 347 xenbus_frontend_closed(dev); 348 - return 0; 349 348 } 350 349 351 350 static const struct xenbus_device_id xen_drv_ids[] = {