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

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'smp-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull CPU hotplug fix from Thomas Gleixner:
"A single fix preventing the concurrent execution of the CPU hotplug
callback install/invocation machinery. Long standing bug caused by a
massive brain slip of that Gleixner dude, which went unnoticed for
almost a year"

* 'smp-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
cpu/hotplug: Serialize callback invocations proper

+14 -14
+14 -14
kernel/cpu.c
··· 1335 1335 struct cpuhp_step *sp; 1336 1336 int ret = 0; 1337 1337 1338 - mutex_lock(&cpuhp_state_mutex); 1339 - 1340 1338 if (state == CPUHP_AP_ONLINE_DYN || state == CPUHP_BP_PREPARE_DYN) { 1341 1339 ret = cpuhp_reserve_state(state); 1342 1340 if (ret < 0) 1343 - goto out; 1341 + return ret; 1344 1342 state = ret; 1345 1343 } 1346 1344 sp = cpuhp_get_step(state); 1347 - if (name && sp->name) { 1348 - ret = -EBUSY; 1349 - goto out; 1350 - } 1345 + if (name && sp->name) 1346 + return -EBUSY; 1347 + 1351 1348 sp->startup.single = startup; 1352 1349 sp->teardown.single = teardown; 1353 1350 sp->name = name; 1354 1351 sp->multi_instance = multi_instance; 1355 1352 INIT_HLIST_HEAD(&sp->list); 1356 - out: 1357 - mutex_unlock(&cpuhp_state_mutex); 1358 1353 return ret; 1359 1354 } 1360 1355 ··· 1423 1428 return -EINVAL; 1424 1429 1425 1430 get_online_cpus(); 1431 + mutex_lock(&cpuhp_state_mutex); 1426 1432 1427 1433 if (!invoke || !sp->startup.multi) 1428 1434 goto add_node; ··· 1443 1447 if (ret) { 1444 1448 if (sp->teardown.multi) 1445 1449 cpuhp_rollback_install(cpu, state, node); 1446 - goto err; 1450 + goto unlock; 1447 1451 } 1448 1452 } 1449 1453 add_node: 1450 1454 ret = 0; 1451 - mutex_lock(&cpuhp_state_mutex); 1452 1455 hlist_add_head(node, &sp->list); 1456 + unlock: 1453 1457 mutex_unlock(&cpuhp_state_mutex); 1454 - 1455 - err: 1456 1458 put_online_cpus(); 1457 1459 return ret; 1458 1460 } ··· 1485 1491 return -EINVAL; 1486 1492 1487 1493 get_online_cpus(); 1494 + mutex_lock(&cpuhp_state_mutex); 1488 1495 1489 1496 ret = cpuhp_store_callbacks(state, name, startup, teardown, 1490 1497 multi_instance); ··· 1519 1524 } 1520 1525 } 1521 1526 out: 1527 + mutex_unlock(&cpuhp_state_mutex); 1522 1528 put_online_cpus(); 1523 1529 /* 1524 1530 * If the requested state is CPUHP_AP_ONLINE_DYN, return the ··· 1543 1547 return -EINVAL; 1544 1548 1545 1549 get_online_cpus(); 1550 + mutex_lock(&cpuhp_state_mutex); 1551 + 1546 1552 if (!invoke || !cpuhp_get_teardown_cb(state)) 1547 1553 goto remove; 1548 1554 /* ··· 1561 1563 } 1562 1564 1563 1565 remove: 1564 - mutex_lock(&cpuhp_state_mutex); 1565 1566 hlist_del(node); 1566 1567 mutex_unlock(&cpuhp_state_mutex); 1567 1568 put_online_cpus(); ··· 1568 1571 return 0; 1569 1572 } 1570 1573 EXPORT_SYMBOL_GPL(__cpuhp_state_remove_instance); 1574 + 1571 1575 /** 1572 1576 * __cpuhp_remove_state - Remove the callbacks for an hotplug machine state 1573 1577 * @state: The state to remove ··· 1587 1589 1588 1590 get_online_cpus(); 1589 1591 1592 + mutex_lock(&cpuhp_state_mutex); 1590 1593 if (sp->multi_instance) { 1591 1594 WARN(!hlist_empty(&sp->list), 1592 1595 "Error: Removing state %d which has instances left.\n", ··· 1612 1613 } 1613 1614 remove: 1614 1615 cpuhp_store_callbacks(state, NULL, NULL, NULL, false); 1616 + mutex_unlock(&cpuhp_state_mutex); 1615 1617 put_online_cpus(); 1616 1618 } 1617 1619 EXPORT_SYMBOL(__cpuhp_remove_state);