View | Details | Raw Unified | Return to bug 145385 | Differences between
and this patch

Collapse All | Expand All

(-)sys/amd64/amd64/mp_machdep.c (-49 / +58 lines)
Lines 39-44 Link Here
39
#ifdef GPROF 
39
#ifdef GPROF 
40
#include <sys/gmon.h>
40
#include <sys/gmon.h>
41
#endif
41
#endif
42
#include <sys/cpuset.h>
42
#include <sys/kernel.h>
43
#include <sys/kernel.h>
43
#include <sys/ktr.h>
44
#include <sys/ktr.h>
44
#include <sys/lock.h>
45
#include <sys/lock.h>
Lines 85-91 Link Here
85
int	mp_naps;		/* # of Applications processors */
86
int	mp_naps;		/* # of Applications processors */
86
int	boot_cpu_id = -1;	/* designated BSP */
87
int	boot_cpu_id = -1;	/* designated BSP */
87
88
88
extern  struct pcpu __pcpu[];
89
extern	struct pcpu __pcpu[];
89
90
90
/* AP uses this during bootstrap.  Do not staticize.  */
91
/* AP uses this during bootstrap.  Do not staticize.  */
91
char *bootSTK;
92
char *bootSTK;
Lines 1145-1151 Link Here
1145
			old_pending = cpu_ipi_pending[cpu];
1146
			old_pending = cpu_ipi_pending[cpu];
1146
			new_pending = old_pending | bitmap;
1147
			new_pending = old_pending | bitmap;
1147
		} while  (!atomic_cmpset_int(&cpu_ipi_pending[cpu],
1148
		} while  (!atomic_cmpset_int(&cpu_ipi_pending[cpu],
1148
		    old_pending, new_pending)); 
1149
		    old_pending, new_pending));
1149
		if (old_pending)
1150
		if (old_pending)
1150
			return;
1151
			return;
1151
	}
1152
	}
Lines 1333-1339 Link Here
1333
	 */
1334
	 */
1334
	if (ipi == IPI_STOP_HARD)
1335
	if (ipi == IPI_STOP_HARD)
1335
		atomic_set_int(&ipi_nmi_pending, PCPU_GET(other_cpus));
1336
		atomic_set_int(&ipi_nmi_pending, PCPU_GET(other_cpus));
1336
1337
	CTR2(KTR_SMP, "%s: ipi: %x", __func__, ipi);
1337
	CTR2(KTR_SMP, "%s: ipi: %x", __func__, ipi);
1338
	lapic_ipi_vectored(ipi, APIC_IPI_DEST_OTHERS);
1338
	lapic_ipi_vectored(ipi, APIC_IPI_DEST_OTHERS);
1339
}
1339
}
Lines 1357-1363 Link Here
1357
	cpustop_handler();
1357
	cpustop_handler();
1358
	return (0);
1358
	return (0);
1359
}
1359
}
1360
     
1360
1361
/*
1361
/*
1362
 * Handle an IPI_STOP by saving our current context and spinning until we
1362
 * Handle an IPI_STOP by saving our current context and spinning until we
1363
 * are resumed.
1363
 * are resumed.
Lines 1447-1452 Link Here
1447
static int
1447
static int
1448
sysctl_hlt_cpus(SYSCTL_HANDLER_ARGS)
1448
sysctl_hlt_cpus(SYSCTL_HANDLER_ARGS)
1449
{
1449
{
1450
	cpuset_t mask_set;
1450
	cpumask_t mask;
1451
	cpumask_t mask;
1451
	int error;
1452
	int error;
1452
1453
Lines 1455-1472 Link Here
1455
	if (error || !req->newptr)
1456
	if (error || !req->newptr)
1456
		return (error);
1457
		return (error);
1457
1458
1458
	if (logical_cpus_mask != 0 &&
1459
	if (hlt_logical_cpus)
1459
	    (mask & logical_cpus_mask) == logical_cpus_mask)
1460
		mask |= logical_cpus_mask;
1460
		hlt_logical_cpus = 1;
1461
	if (!hyperthreading_allowed)
1461
	else
1462
		hlt_logical_cpus = 0;
1463
1464
	if (! hyperthreading_allowed)
1465
		mask |= hyperthreading_cpus_mask;
1462
		mask |= hyperthreading_cpus_mask;
1466
1463
1464
	/* Don't disable BSP0 */
1467
	if ((mask & all_cpus) == all_cpus)
1465
	if ((mask & all_cpus) == all_cpus)
1468
		mask &= ~(1<<0);
1466
		mask &= ~(1<<0);
1469
	hlt_cpus_mask = mask;
1467
1468
	CPU_ZERO(&mask_set);
1469
	CPU_SETMASK(~mask & all_cpus, &mask_set);
1470
	error = cpuset_zero_modify(&mask_set);
1471
	if (error == 0)
1472
		hlt_cpus_mask = mask;
1470
	return (error);
1473
	return (error);
1471
}
1474
}
1472
SYSCTL_PROC(_machdep, OID_AUTO, hlt_cpus, CTLTYPE_INT|CTLFLAG_RW,
1475
SYSCTL_PROC(_machdep, OID_AUTO, hlt_cpus, CTLTYPE_INT|CTLFLAG_RW,
Lines 1476-1481 Link Here
1476
static int
1479
static int
1477
sysctl_hlt_logical_cpus(SYSCTL_HANDLER_ARGS)
1480
sysctl_hlt_logical_cpus(SYSCTL_HANDLER_ARGS)
1478
{
1481
{
1482
	cpuset_t mask_set;
1483
	cpumask_t mask;
1479
	int disable, error;
1484
	int disable, error;
1480
1485
1481
	disable = hlt_logical_cpus;
1486
	disable = hlt_logical_cpus;
Lines 1483-1506 Link Here
1483
	if (error || !req->newptr)
1488
	if (error || !req->newptr)
1484
		return (error);
1489
		return (error);
1485
1490
1491
	mask = hlt_cpus_mask;
1486
	if (disable)
1492
	if (disable)
1487
		hlt_cpus_mask |= logical_cpus_mask;
1493
		mask |= logical_cpus_mask;
1488
	else
1494
	if (!hyperthreading_allowed)
1489
		hlt_cpus_mask &= ~logical_cpus_mask;
1495
		mask |= hyperthreading_cpus_mask;
1490
1496
1491
	if (! hyperthreading_allowed)
1497
	/* Don't disable BSP0 */
1492
		hlt_cpus_mask |= hyperthreading_cpus_mask;
1498
	if ((mask & all_cpus) == all_cpus)
1499
		mask &= ~(1<<0);
1493
1500
1494
	if ((hlt_cpus_mask & all_cpus) == all_cpus)
1501
	printf("%s: mask: %d\n", __func__, mask);
1495
		hlt_cpus_mask &= ~(1<<0);
1496
1502
1497
	hlt_logical_cpus = disable;
1503
	CPU_ZERO(&mask_set);
1504
	CPU_SETMASK(~mask & all_cpus, &mask_set);
1505
	error = cpuset_zero_modify(&mask_set);
1506
	if (error == 0) 
1507
		hlt_logical_cpus = disable;
1498
	return (error);
1508
	return (error);
1499
}
1509
}
1500
1510
1501
static int
1511
static int
1502
sysctl_hyperthreading_allowed(SYSCTL_HANDLER_ARGS)
1512
sysctl_hyperthreading_allowed(SYSCTL_HANDLER_ARGS)
1503
{
1513
{
1514
	cpuset_t mask_set;
1515
	cpumask_t mask;
1504
	int allowed, error;
1516
	int allowed, error;
1505
1517
1506
	allowed = hyperthreading_allowed;
1518
	allowed = hyperthreading_allowed;
Lines 1508-1549 Link Here
1508
	if (error || !req->newptr)
1520
	if (error || !req->newptr)
1509
		return (error);
1521
		return (error);
1510
1522
1511
#ifdef SCHED_ULE
1523
	mask = hlt_cpus_mask;
1512
	/*
1524
	if (hlt_logical_cpus)
1513
	 * SCHED_ULE doesn't allow enabling/disabling HT cores at
1525
		mask |= logical_cpus_mask;
1514
	 * run-time.
1526
	if (!allowed)
1515
	 */
1527
		mask |= hyperthreading_cpus_mask;
1516
	if (allowed != hyperthreading_allowed)
1517
		return (ENOTSUP);
1518
	return (error);
1519
#endif
1520
1528
1521
	if (allowed)
1529
	/* Don't disable BSP0 */
1522
		hlt_cpus_mask &= ~hyperthreading_cpus_mask;
1530
	if ((mask & all_cpus) == all_cpus)
1523
	else
1531
		mask &= ~(1<<0);
1524
		hlt_cpus_mask |= hyperthreading_cpus_mask;
1525
1532
1526
	if (logical_cpus_mask != 0 &&
1533
	CPU_ZERO(&mask_set);
1527
	    (hlt_cpus_mask & logical_cpus_mask) == logical_cpus_mask)
1534
	CPU_SETMASK(~mask & all_cpus, &mask_set);
1528
		hlt_logical_cpus = 1;
1535
	error = cpuset_zero_modify(&mask_set);
1529
	else
1536
	if (error == 0) 
1530
		hlt_logical_cpus = 0;
1537
		hyperthreading_allowed = allowed;
1531
1532
	if ((hlt_cpus_mask & all_cpus) == all_cpus)
1533
		hlt_cpus_mask &= ~(1<<0);
1534
1535
	hyperthreading_allowed = allowed;
1536
	return (error);
1538
	return (error);
1537
}
1539
}
1538
1540
1539
static void
1541
static void
1540
cpu_hlt_setup(void *dummy __unused)
1542
cpu_hlt_setup(void *dummy __unused)
1541
{
1543
{
1544
	cpuset_t mask_set;
1542
1545
1543
	if (logical_cpus_mask != 0) {
1546
	if (logical_cpus_mask != 0) {
1544
		TUNABLE_INT_FETCH("machdep.hlt_logical_cpus",
1547
		TUNABLE_INT_FETCH("machdep.hlt_logical_cpus",
1545
		    &hlt_logical_cpus);
1548
		    &hlt_logical_cpus);
1549
		if (hlt_logical_cpus != 0) {
1550
			CPU_ZERO(&mask_set);
1551
			CPU_SETMASK(~logical_cpus_mask & all_cpus, &mask_set);
1552
			if (cpuset_zero_modify(&mask_set) == 0)
1553
				hlt_logical_cpus = 1;
1554
			else
1555
				hlt_logical_cpus = 0;
1556
		}
1546
		sysctl_ctx_init(&logical_cpu_clist);
1557
		sysctl_ctx_init(&logical_cpu_clist);
1558
		SYSCTL_ADD_UINT(&logical_cpu_clist,
1559
		    SYSCTL_STATIC_CHILDREN(_machdep), OID_AUTO,
1560
		    "all_cpus_mask", CTLTYPE_INT|CTLFLAG_RD,
1561
		    &all_cpus, 0, "");
1547
		SYSCTL_ADD_PROC(&logical_cpu_clist,
1562
		SYSCTL_ADD_PROC(&logical_cpu_clist,
1548
		    SYSCTL_STATIC_CHILDREN(_machdep), OID_AUTO,
1563
		    SYSCTL_STATIC_CHILDREN(_machdep), OID_AUTO,
1549
		    "hlt_logical_cpus", CTLTYPE_INT|CTLFLAG_RW, 0, 0,
1564
		    "hlt_logical_cpus", CTLTYPE_INT|CTLFLAG_RW, 0, 0,
Lines 1553-1561 Link Here
1553
		    "logical_cpus_mask", CTLTYPE_INT|CTLFLAG_RD,
1568
		    "logical_cpus_mask", CTLTYPE_INT|CTLFLAG_RD,
1554
		    &logical_cpus_mask, 0, "");
1569
		    &logical_cpus_mask, 0, "");
1555
1570
1556
		if (hlt_logical_cpus)
1557
			hlt_cpus_mask |= logical_cpus_mask;
1558
1559
		/*
1571
		/*
1560
		 * If necessary for security purposes, force
1572
		 * If necessary for security purposes, force
1561
		 * hyperthreading off, regardless of the value
1573
		 * hyperthreading off, regardless of the value
Lines 1566-1573 Link Here
1566
			    SYSCTL_STATIC_CHILDREN(_machdep), OID_AUTO,
1578
			    SYSCTL_STATIC_CHILDREN(_machdep), OID_AUTO,
1567
			    "hyperthreading_allowed", CTLTYPE_INT|CTLFLAG_RW,
1579
			    "hyperthreading_allowed", CTLTYPE_INT|CTLFLAG_RW,
1568
			    0, 0, sysctl_hyperthreading_allowed, "IU", "");
1580
			    0, 0, sysctl_hyperthreading_allowed, "IU", "");
1569
			if (! hyperthreading_allowed)
1570
				hlt_cpus_mask |= hyperthreading_cpus_mask;
1571
		}
1581
		}
1572
	}
1582
	}
1573
}
1583
}
Lines 1627-1630 Link Here
1627
}
1637
}
1628
SYSINIT(mp_ipi_intrcnt, SI_SUB_INTR, SI_ORDER_MIDDLE, mp_ipi_intrcnt, NULL);
1638
SYSINIT(mp_ipi_intrcnt, SI_SUB_INTR, SI_ORDER_MIDDLE, mp_ipi_intrcnt, NULL);
1629
#endif
1639
#endif
1630
(-)sys/i386/i386/mp_machdep.c (-48 / +59 lines)
Lines 54-59 Link Here
54
#ifdef GPROF 
54
#ifdef GPROF 
55
#include <sys/gmon.h>
55
#include <sys/gmon.h>
56
#endif
56
#endif
57
#include <sys/cpuset.h>
57
#include <sys/kernel.h>
58
#include <sys/kernel.h>
58
#include <sys/ktr.h>
59
#include <sys/ktr.h>
59
#include <sys/lock.h>
60
#include <sys/lock.h>
Lines 1197-1203 Link Here
1197
	int ncpu, othercpus;
1198
	int ncpu, othercpus;
1198
1199
1199
	othercpus = mp_ncpus - 1;
1200
	othercpus = mp_ncpus - 1;
1200
	if (mask == (u_int)-1) {
1201
	if (mask == (cpumask_t)-1) {
1201
		ncpu = othercpus;
1202
		ncpu = othercpus;
1202
		if (ncpu < 1)
1203
		if (ncpu < 1)
1203
			return;
1204
			return;
Lines 1222-1228 Link Here
1222
	smp_tlb_addr1 = addr1;
1223
	smp_tlb_addr1 = addr1;
1223
	smp_tlb_addr2 = addr2;
1224
	smp_tlb_addr2 = addr2;
1224
	atomic_store_rel_int(&smp_tlb_wait, 0);
1225
	atomic_store_rel_int(&smp_tlb_wait, 0);
1225
	if (mask == (u_int)-1)
1226
	if (mask == (cpumask_t)-1)
1226
		ipi_all_but_self(vector);
1227
		ipi_all_but_self(vector);
1227
	else
1228
	else
1228
		ipi_selected(mask, vector);
1229
		ipi_selected(mask, vector);
Lines 1248-1254 Link Here
1248
			old_pending = cpu_ipi_pending[cpu];
1249
			old_pending = cpu_ipi_pending[cpu];
1249
			new_pending = old_pending | bitmap;
1250
			new_pending = old_pending | bitmap;
1250
		} while  (!atomic_cmpset_int(&cpu_ipi_pending[cpu],
1251
		} while  (!atomic_cmpset_int(&cpu_ipi_pending[cpu],
1251
		    old_pending, new_pending));	
1252
		    old_pending, new_pending));
1252
		if (old_pending)
1253
		if (old_pending)
1253
			return;
1254
			return;
1254
	}
1255
	}
Lines 1510-1515 Link Here
1510
static int
1511
static int
1511
sysctl_hlt_cpus(SYSCTL_HANDLER_ARGS)
1512
sysctl_hlt_cpus(SYSCTL_HANDLER_ARGS)
1512
{
1513
{
1514
	cpuset_t mask_set;
1513
	cpumask_t mask;
1515
	cpumask_t mask;
1514
	int error;
1516
	int error;
1515
1517
Lines 1518-1535 Link Here
1518
	if (error || !req->newptr)
1520
	if (error || !req->newptr)
1519
		return (error);
1521
		return (error);
1520
1522
1521
	if (logical_cpus_mask != 0 &&
1523
	if (hlt_logical_cpus)
1522
	    (mask & logical_cpus_mask) == logical_cpus_mask)
1524
		mask |= logical_cpus_mask;
1523
		hlt_logical_cpus = 1;
1525
	if (!hyperthreading_allowed)
1524
	else
1525
		hlt_logical_cpus = 0;
1526
1527
	if (! hyperthreading_allowed)
1528
		mask |= hyperthreading_cpus_mask;
1526
		mask |= hyperthreading_cpus_mask;
1529
1527
1528
	/* Don't disable BSP0 */
1530
	if ((mask & all_cpus) == all_cpus)
1529
	if ((mask & all_cpus) == all_cpus)
1531
		mask &= ~(1<<0);
1530
		mask &= ~(1<<0);
1532
	hlt_cpus_mask = mask;
1531
1532
	CPU_ZERO(&mask_set);
1533
	CPU_SETMASK(~mask & all_cpus, &mask_set);
1534
	error = cpuset_zero_modify(&mask_set);
1535
	if (error == 0)
1536
		hlt_cpus_mask = mask;
1533
	return (error);
1537
	return (error);
1534
}
1538
}
1535
SYSCTL_PROC(_machdep, OID_AUTO, hlt_cpus, CTLTYPE_INT|CTLFLAG_RW,
1539
SYSCTL_PROC(_machdep, OID_AUTO, hlt_cpus, CTLTYPE_INT|CTLFLAG_RW,
Lines 1539-1544 Link Here
1539
static int
1543
static int
1540
sysctl_hlt_logical_cpus(SYSCTL_HANDLER_ARGS)
1544
sysctl_hlt_logical_cpus(SYSCTL_HANDLER_ARGS)
1541
{
1545
{
1546
	cpuset_t mask_set;
1547
	cpumask_t mask;
1542
	int disable, error;
1548
	int disable, error;
1543
1549
1544
	disable = hlt_logical_cpus;
1550
	disable = hlt_logical_cpus;
Lines 1546-1569 Link Here
1546
	if (error || !req->newptr)
1552
	if (error || !req->newptr)
1547
		return (error);
1553
		return (error);
1548
1554
1555
	mask = hlt_cpus_mask;
1549
	if (disable)
1556
	if (disable)
1550
		hlt_cpus_mask |= logical_cpus_mask;
1557
		mask |= logical_cpus_mask;
1551
	else
1558
	if (!hyperthreading_allowed)
1552
		hlt_cpus_mask &= ~logical_cpus_mask;
1559
		mask |= hyperthreading_cpus_mask;
1553
1560
1554
	if (! hyperthreading_allowed)
1561
	/* Don't disable BSP0 */
1555
		hlt_cpus_mask |= hyperthreading_cpus_mask;
1562
	if ((mask & all_cpus) == all_cpus)
1563
		mask &= ~(1<<0);
1556
1564
1557
	if ((hlt_cpus_mask & all_cpus) == all_cpus)
1565
	printf("%s: mask: %d\n", __func__, mask);
1558
		hlt_cpus_mask &= ~(1<<0);
1559
1566
1560
	hlt_logical_cpus = disable;
1567
	CPU_ZERO(&mask_set);
1568
	CPU_SETMASK(~mask & all_cpus, &mask_set);
1569
	error = cpuset_zero_modify(&mask_set);
1570
	if (error == 0) 
1571
		hlt_logical_cpus = disable;
1561
	return (error);
1572
	return (error);
1562
}
1573
}
1563
1574
1564
static int
1575
static int
1565
sysctl_hyperthreading_allowed(SYSCTL_HANDLER_ARGS)
1576
sysctl_hyperthreading_allowed(SYSCTL_HANDLER_ARGS)
1566
{
1577
{
1578
	cpuset_t mask_set;
1579
	cpumask_t mask;
1567
	int allowed, error;
1580
	int allowed, error;
1568
1581
1569
	allowed = hyperthreading_allowed;
1582
	allowed = hyperthreading_allowed;
Lines 1571-1612 Link Here
1571
	if (error || !req->newptr)
1584
	if (error || !req->newptr)
1572
		return (error);
1585
		return (error);
1573
1586
1574
#ifdef SCHED_ULE
1587
	mask = hlt_cpus_mask;
1575
	/*
1588
	if (hlt_logical_cpus)
1576
	 * SCHED_ULE doesn't allow enabling/disabling HT cores at
1589
		mask |= logical_cpus_mask;
1577
	 * run-time.
1590
	if (!allowed)
1578
	 */
1591
		mask |= hyperthreading_cpus_mask;
1579
	if (allowed != hyperthreading_allowed)
1580
		return (ENOTSUP);
1581
	return (error);
1582
#endif
1583
1592
1584
	if (allowed)
1593
	/* Don't disable BSP0 */
1585
		hlt_cpus_mask &= ~hyperthreading_cpus_mask;
1594
	if ((mask & all_cpus) == all_cpus)
1586
	else
1595
		mask &= ~(1<<0);
1587
		hlt_cpus_mask |= hyperthreading_cpus_mask;
1588
1596
1589
	if (logical_cpus_mask != 0 &&
1597
	CPU_ZERO(&mask_set);
1590
	    (hlt_cpus_mask & logical_cpus_mask) == logical_cpus_mask)
1598
	CPU_SETMASK(~mask & all_cpus, &mask_set);
1591
		hlt_logical_cpus = 1;
1599
	error = cpuset_zero_modify(&mask_set);
1592
	else
1600
	if (error == 0) 
1593
		hlt_logical_cpus = 0;
1601
		hyperthreading_allowed = allowed;
1594
1595
	if ((hlt_cpus_mask & all_cpus) == all_cpus)
1596
		hlt_cpus_mask &= ~(1<<0);
1597
1598
	hyperthreading_allowed = allowed;
1599
	return (error);
1602
	return (error);
1600
}
1603
}
1601
1604
1602
static void
1605
static void
1603
cpu_hlt_setup(void *dummy __unused)
1606
cpu_hlt_setup(void *dummy __unused)
1604
{
1607
{
1608
	cpuset_t mask_set;
1605
1609
1606
	if (logical_cpus_mask != 0) {
1610
	if (logical_cpus_mask != 0) {
1607
		TUNABLE_INT_FETCH("machdep.hlt_logical_cpus",
1611
		TUNABLE_INT_FETCH("machdep.hlt_logical_cpus",
1608
		    &hlt_logical_cpus);
1612
		    &hlt_logical_cpus);
1613
		if (hlt_logical_cpus != 0) {
1614
			CPU_ZERO(&mask_set);
1615
			CPU_SETMASK(~logical_cpus_mask & all_cpus, &mask_set);
1616
			if (cpuset_zero_modify(&mask_set) == 0)
1617
				hlt_logical_cpus = 1;
1618
			else
1619
				hlt_logical_cpus = 0;
1620
		}
1609
		sysctl_ctx_init(&logical_cpu_clist);
1621
		sysctl_ctx_init(&logical_cpu_clist);
1622
		SYSCTL_ADD_UINT(&logical_cpu_clist,
1623
		    SYSCTL_STATIC_CHILDREN(_machdep), OID_AUTO,
1624
		    "all_cpus_mask", CTLTYPE_INT|CTLFLAG_RD,
1625
		    &all_cpus, 0, "");
1610
		SYSCTL_ADD_PROC(&logical_cpu_clist,
1626
		SYSCTL_ADD_PROC(&logical_cpu_clist,
1611
		    SYSCTL_STATIC_CHILDREN(_machdep), OID_AUTO,
1627
		    SYSCTL_STATIC_CHILDREN(_machdep), OID_AUTO,
1612
		    "hlt_logical_cpus", CTLTYPE_INT|CTLFLAG_RW, 0, 0,
1628
		    "hlt_logical_cpus", CTLTYPE_INT|CTLFLAG_RW, 0, 0,
Lines 1616-1624 Link Here
1616
		    "logical_cpus_mask", CTLTYPE_INT|CTLFLAG_RD,
1632
		    "logical_cpus_mask", CTLTYPE_INT|CTLFLAG_RD,
1617
		    &logical_cpus_mask, 0, "");
1633
		    &logical_cpus_mask, 0, "");
1618
1634
1619
		if (hlt_logical_cpus)
1620
			hlt_cpus_mask |= logical_cpus_mask;
1621
1622
		/*
1635
		/*
1623
		 * If necessary for security purposes, force
1636
		 * If necessary for security purposes, force
1624
		 * hyperthreading off, regardless of the value
1637
		 * hyperthreading off, regardless of the value
Lines 1629-1636 Link Here
1629
			    SYSCTL_STATIC_CHILDREN(_machdep), OID_AUTO,
1642
			    SYSCTL_STATIC_CHILDREN(_machdep), OID_AUTO,
1630
			    "hyperthreading_allowed", CTLTYPE_INT|CTLFLAG_RW,
1643
			    "hyperthreading_allowed", CTLTYPE_INT|CTLFLAG_RW,
1631
			    0, 0, sysctl_hyperthreading_allowed, "IU", "");
1644
			    0, 0, sysctl_hyperthreading_allowed, "IU", "");
1632
			if (! hyperthreading_allowed)
1633
				hlt_cpus_mask |= hyperthreading_cpus_mask;
1634
		}
1645
		}
1635
	}
1646
	}
1636
}
1647
}
Lines 1686-1692 Link Here
1686
		intrcnt_add(buf, &ipi_lazypmap_counts[i]);
1697
		intrcnt_add(buf, &ipi_lazypmap_counts[i]);
1687
		snprintf(buf, sizeof(buf), "cpu%d:hardclock", i);
1698
		snprintf(buf, sizeof(buf), "cpu%d:hardclock", i);
1688
		intrcnt_add(buf, &ipi_hardclock_counts[i]);
1699
		intrcnt_add(buf, &ipi_hardclock_counts[i]);
1689
	}		
1700
	}
1690
}
1701
}
1691
SYSINIT(mp_ipi_intrcnt, SI_SUB_INTR, SI_ORDER_MIDDLE, mp_ipi_intrcnt, NULL);
1702
SYSINIT(mp_ipi_intrcnt, SI_SUB_INTR, SI_ORDER_MIDDLE, mp_ipi_intrcnt, NULL);
1692
#endif
1703
#endif
(-)sys/kern/kern_cpuset.c (-1 / +26 lines)
Lines 332-337 Link Here
332
332
333
	mtx_assert(&cpuset_lock, MA_OWNED);
333
	mtx_assert(&cpuset_lock, MA_OWNED);
334
	CPU_AND(&set->cs_mask, mask);
334
	CPU_AND(&set->cs_mask, mask);
335
#if 1
336
	printf("%s (after): set: %ld, mask: %ld\n", __func__,
337
	    set->cs_mask.__bits[0], mask->__bits[0]);
338
#endif
335
	LIST_FOREACH(nset, &set->cs_children, cs_siblings) 
339
	LIST_FOREACH(nset, &set->cs_children, cs_siblings) 
336
		cpuset_update(nset, &set->cs_mask);
340
		cpuset_update(nset, &set->cs_mask);
337
341
Lines 764-771 Link Here
764
		panic("Can't set initial cpuset mask.\n");
768
		panic("Can't set initial cpuset mask.\n");
765
	cpuset_zero->cs_flags |= CPU_SET_RDONLY;
769
	cpuset_zero->cs_flags |= CPU_SET_RDONLY;
766
}
770
}
767
SYSINIT(cpuset, SI_SUB_SMP, SI_ORDER_ANY, cpuset_init, NULL);
771
SYSINIT(cpuset, SI_SUB_SMP, SI_ORDER_MIDDLE, cpuset_init, NULL);
768
772
773
int
774
cpuset_zero_modify(cpuset_t *mask)
775
{
776
	int err;
777
778
	mtx_lock_spin(&cpuset_lock);
779
	cpuset_zero->cs_flags &= ~CPU_SET_RDONLY;
780
#if 1
781
	printf("%s (before): cpuset_zero: %ld, mask: %ld\n", __func__,
782
	    cpuset_zero->cs_mask.__bits[0], mask->__bits[0]);
783
#endif
784
	err = cpuset_modify(cpuset_zero, mask);
785
#if 1
786
	printf("%s (after): cpuset_zero: %ld, mask: %ld\n", __func__,
787
	    cpuset_zero->cs_mask.__bits[0], mask->__bits[0]);
788
#endif
789
	cpuset_zero->cs_flags |= CPU_SET_RDONLY;
790
	mtx_unlock_spin(&cpuset_lock);
791
	return (err);
792
}
793
769
#ifndef _SYS_SYSPROTO_H_
794
#ifndef _SYS_SYSPROTO_H_
770
struct cpuset_args {
795
struct cpuset_args {
771
	cpusetid_t	*setid;
796
	cpusetid_t	*setid;
(-)sys/sys/cpuset.h (+2 lines)
Lines 54-59 Link Here
54
#define	CPU_COPY(f, t)	(void)(*(t) = *(f))
54
#define	CPU_COPY(f, t)	(void)(*(t) = *(f))
55
#define	CPU_ISSET(n, p)	(((p)->__bits[(n)/_NCPUBITS] & __cpuset_mask(n)) != 0)
55
#define	CPU_ISSET(n, p)	(((p)->__bits[(n)/_NCPUBITS] & __cpuset_mask(n)) != 0)
56
#define	CPU_SET(n, p)	((p)->__bits[(n)/_NCPUBITS] |= __cpuset_mask(n))
56
#define	CPU_SET(n, p)	((p)->__bits[(n)/_NCPUBITS] |= __cpuset_mask(n))
57
#define	CPU_SETMASK(mask, p)	((p)->__bits[0] = (mask))
57
#define	CPU_ZERO(p) do {				\
58
#define	CPU_ZERO(p) do {				\
58
	__size_t __i;					\
59
	__size_t __i;					\
59
	for (__i = 0; __i < _NCPUWORDS; __i++)		\
60
	for (__i = 0; __i < _NCPUWORDS; __i++)		\
Lines 178-183 Link Here
178
struct prison;
179
struct prison;
179
struct proc;
180
struct proc;
180
181
182
int	cpuset_zero_modify(cpuset_t *mask);
181
struct cpuset *cpuset_thread0(void);
183
struct cpuset *cpuset_thread0(void);
182
struct cpuset *cpuset_ref(struct cpuset *);
184
struct cpuset *cpuset_ref(struct cpuset *);
183
void	cpuset_rel(struct cpuset *);
185
void	cpuset_rel(struct cpuset *);

Return to bug 145385