Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 125710
b: refs/heads/master
c: 0999769
h: refs/heads/master
v: v3
  • Loading branch information
Rusty Russell committed Jan 3, 2009
1 parent 845f1a6 commit e4a712e
Show file tree
Hide file tree
Showing 69 changed files with 1,059 additions and 1,680 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 7eb19553369c46cc1fa64caf120cbcab1b597f7c
refs/heads/master: 0999769e6cad9b0e5abb7c513c0c3f16821f0884
17 changes: 8 additions & 9 deletions trunk/Documentation/cpu-hotplug.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,16 @@ additional_cpus=n (*) Use this to limit hotpluggable cpus. This option sets
cpu_possible_map = cpu_present_map + additional_cpus

(*) Option valid only for following architectures
- ia64
- x86_64, ia64

ia64 uses the number of disabled local apics in ACPI tables MADT to
determine the number of potentially hot-pluggable cpus. The implementation
should only rely on this to count the # of cpus, but *MUST* not rely
on the apicid values in those tables for disabled apics. In the event
BIOS doesn't mark such hot-pluggable cpus as disabled entries, one could
use this parameter "additional_cpus=x" to represent those cpus in the
cpu_possible_map.
ia64 and x86_64 use the number of disabled local apics in ACPI tables MADT
to determine the number of potentially hot-pluggable cpus. The implementation
should only rely on this to count the # of cpus, but *MUST* not rely on the
apicid values in those tables for disabled apics. In the event BIOS doesn't
mark such hot-pluggable cpus as disabled entries, one could use this
parameter "additional_cpus=x" to represent those cpus in the cpu_possible_map.

possible_cpus=n [s390,x86_64] use this to set hotpluggable cpus.
possible_cpus=n [s390 only] use this to set hotpluggable cpus.
This option sets possible_cpus bits in
cpu_possible_map. Thus keeping the numbers of bits set
constant even if the machine gets rebooted.
Expand Down
1 change: 1 addition & 0 deletions trunk/arch/cris/include/asm/bitops.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ static inline int test_and_change_bit(int nr, volatile unsigned long *addr)
#define ffs kernel_ffs

#include <asm-generic/bitops/fls.h>
#include <asm-generic/bitops/__fls.h>
#include <asm-generic/bitops/fls64.h>
#include <asm-generic/bitops/hweight.h>
#include <asm-generic/bitops/find.h>
Expand Down
2 changes: 2 additions & 0 deletions trunk/arch/ia64/include/asm/topology.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
void build_cpu_to_node_map(void);

#define SD_CPU_INIT (struct sched_domain) { \
.span = CPU_MASK_NONE, \
.parent = NULL, \
.child = NULL, \
.groups = NULL, \
Expand All @@ -80,6 +81,7 @@ void build_cpu_to_node_map(void);

/* sched_domains SD_NODE_INIT for IA64 NUMA machines */
#define SD_NODE_INIT (struct sched_domain) { \
.span = CPU_MASK_NONE, \
.parent = NULL, \
.child = NULL, \
.groups = NULL, \
Expand Down
1 change: 1 addition & 0 deletions trunk/arch/mips/include/asm/mach-ip27/topology.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ extern unsigned char __node_distances[MAX_COMPACT_NODES][MAX_COMPACT_NODES];

/* sched_domains SD_NODE_INIT for SGI IP27 machines */
#define SD_NODE_INIT (struct sched_domain) { \
.span = CPU_MASK_NONE, \
.parent = NULL, \
.child = NULL, \
.groups = NULL, \
Expand Down
1 change: 1 addition & 0 deletions trunk/arch/powerpc/include/asm/topology.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ static inline int pcibus_to_node(struct pci_bus *bus)

/* sched_domains SD_NODE_INIT for PPC64 machines */
#define SD_NODE_INIT (struct sched_domain) { \
.span = CPU_MASK_NONE, \
.parent = NULL, \
.child = NULL, \
.groups = NULL, \
Expand Down
1 change: 1 addition & 0 deletions trunk/arch/sh/include/asm/topology.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

/* sched_domains SD_NODE_INIT for sh machines */
#define SD_NODE_INIT (struct sched_domain) { \
.span = CPU_MASK_NONE, \
.parent = NULL, \
.child = NULL, \
.groups = NULL, \
Expand Down
13 changes: 6 additions & 7 deletions trunk/arch/x86/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -601,20 +601,19 @@ config IOMMU_HELPER

config MAXSMP
bool "Configure Maximum number of SMP Processors and NUMA Nodes"
depends on X86_64 && SMP && DEBUG_KERNEL && EXPERIMENTAL
select CPUMASK_OFFSTACK
depends on X86_64 && SMP && BROKEN
default n
help
Configure maximum number of CPUS and NUMA Nodes for this architecture.
If unsure, say N.

config NR_CPUS
int "Maximum number of CPUs" if SMP && !MAXSMP
range 2 512 if SMP && !MAXSMP
default "1" if !SMP
int "Maximum number of CPUs (2-512)" if !MAXSMP
range 2 512
depends on SMP
default "4096" if MAXSMP
default "32" if SMP && (X86_NUMAQ || X86_SUMMIT || X86_BIGSMP || X86_ES7000)
default "8" if SMP
default "32" if X86_NUMAQ || X86_SUMMIT || X86_BIGSMP || X86_ES7000
default "8"
help
This allows you to specify the maximum number of CPUs which this
kernel will support. The maximum supported value is 512 and the
Expand Down
32 changes: 7 additions & 25 deletions trunk/arch/x86/include/asm/bigsmp/apic.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ static inline int apic_id_registered(void)
return (1);
}

static inline const cpumask_t *target_cpus(void)
static inline cpumask_t target_cpus(void)
{
#ifdef CONFIG_SMP
return &cpu_online_map;
return cpu_online_map;
#else
return &cpumask_of_cpu(0);
return cpumask_of_cpu(0);
#endif
}

Expand Down Expand Up @@ -79,7 +79,7 @@ static inline int apicid_to_node(int logical_apicid)

static inline int cpu_present_to_apicid(int mps_cpu)
{
if (mps_cpu < nr_cpu_ids)
if (mps_cpu < NR_CPUS)
return (int) per_cpu(x86_bios_cpu_apicid, mps_cpu);

return BAD_APICID;
Expand All @@ -94,7 +94,7 @@ extern u8 cpu_2_logical_apicid[];
/* Mapping from cpu number to logical apicid */
static inline int cpu_to_logical_apicid(int cpu)
{
if (cpu >= nr_cpu_ids)
if (cpu >= NR_CPUS)
return BAD_APICID;
return cpu_physical_id(cpu);
}
Expand All @@ -119,34 +119,16 @@ static inline int check_phys_apicid_present(int boot_cpu_physical_apicid)
}

/* As we are using single CPU as destination, pick only one CPU here */
static inline unsigned int cpu_mask_to_apicid(const cpumask_t *cpumask)
static inline unsigned int cpu_mask_to_apicid(cpumask_t cpumask)
{
int cpu;
int apicid;

cpu = first_cpu(*cpumask);
cpu = first_cpu(cpumask);
apicid = cpu_to_logical_apicid(cpu);
return apicid;
}

static inline unsigned int cpu_mask_to_apicid_and(const struct cpumask *cpumask,
const struct cpumask *andmask)
{
int cpu;

/*
* We're using fixed IRQ delivery, can only return one phys APIC ID.
* May as well be the first.
*/
for_each_cpu_and(cpu, cpumask, andmask)
if (cpumask_test_cpu(cpu, cpu_online_mask))
break;
if (cpu < nr_cpu_ids)
return cpu_to_logical_apicid(cpu);

return BAD_APICID;
}

static inline u32 phys_pkg_id(u32 cpuid_apic, int index_msb)
{
return cpuid_apic >> index_msb;
Expand Down
13 changes: 8 additions & 5 deletions trunk/arch/x86/include/asm/bigsmp/ipi.h
Original file line number Diff line number Diff line change
@@ -1,22 +1,25 @@
#ifndef __ASM_MACH_IPI_H
#define __ASM_MACH_IPI_H

void send_IPI_mask_sequence(const struct cpumask *mask, int vector);
void send_IPI_mask_allbutself(const struct cpumask *mask, int vector);
void send_IPI_mask_sequence(cpumask_t mask, int vector);

static inline void send_IPI_mask(const struct cpumask *mask, int vector)
static inline void send_IPI_mask(cpumask_t mask, int vector)
{
send_IPI_mask_sequence(mask, vector);
}

static inline void send_IPI_allbutself(int vector)
{
send_IPI_mask_allbutself(cpu_online_mask, vector);
cpumask_t mask = cpu_online_map;
cpu_clear(smp_processor_id(), mask);

if (!cpus_empty(mask))
send_IPI_mask(mask, vector);
}

static inline void send_IPI_all(int vector)
{
send_IPI_mask(cpu_online_mask, vector);
send_IPI_mask(cpu_online_map, vector);
}

#endif /* __ASM_MACH_IPI_H */
10 changes: 6 additions & 4 deletions trunk/arch/x86/include/asm/desc.h
Original file line number Diff line number Diff line change
Expand Up @@ -320,14 +320,16 @@ static inline void set_intr_gate(unsigned int n, void *addr)
_set_gate(n, GATE_INTERRUPT, addr, 0, 0, __KERNEL_CS);
}

#define SYS_VECTOR_FREE 0
#define SYS_VECTOR_ALLOCED 1

extern int first_system_vector;
/* used_vectors is BITMAP for irq is not managed by percpu vector_irq */
extern unsigned long used_vectors[];
extern char system_vectors[];

static inline void alloc_system_vector(int vector)
{
if (!test_bit(vector, used_vectors)) {
set_bit(vector, used_vectors);
if (system_vectors[vector] == SYS_VECTOR_FREE) {
system_vectors[vector] = SYS_VECTOR_ALLOCED;
if (first_system_vector > vector)
first_system_vector = vector;
} else
Expand Down
82 changes: 18 additions & 64 deletions trunk/arch/x86/include/asm/es7000/apic.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ static inline int apic_id_registered(void)
return (1);
}

static inline const cpumask_t *target_cpus_cluster(void)
static inline cpumask_t target_cpus_cluster(void)
{
return &CPU_MASK_ALL;
return CPU_MASK_ALL;
}

static inline const cpumask_t *target_cpus(void)
static inline cpumask_t target_cpus(void)
{
return &cpumask_of_cpu(smp_processor_id());
return cpumask_of_cpu(smp_processor_id());
}

#define APIC_DFR_VALUE_CLUSTER (APIC_DFR_CLUSTER)
Expand Down Expand Up @@ -80,10 +80,9 @@ extern int apic_version [MAX_APICS];
static inline void setup_apic_routing(void)
{
int apic = per_cpu(x86_bios_cpu_apicid, smp_processor_id());
printk("Enabling APIC mode: %s. Using %d I/O APICs, target cpus %lx\n",
printk("Enabling APIC mode: %s. Using %d I/O APICs, target cpus %lx\n",
(apic_version[apic] == 0x14) ?
"Physical Cluster" : "Logical Cluster",
nr_ioapics, cpus_addr(*target_cpus())[0]);
"Physical Cluster" : "Logical Cluster", nr_ioapics, cpus_addr(target_cpus())[0]);
}

static inline int multi_timer_check(int apic, int irq)
Expand All @@ -101,7 +100,7 @@ static inline int cpu_present_to_apicid(int mps_cpu)
{
if (!mps_cpu)
return boot_cpu_physical_apicid;
else if (mps_cpu < nr_cpu_ids)
else if (mps_cpu < NR_CPUS)
return (int) per_cpu(x86_bios_cpu_apicid, mps_cpu);
else
return BAD_APICID;
Expand All @@ -121,9 +120,9 @@ extern u8 cpu_2_logical_apicid[];
static inline int cpu_to_logical_apicid(int cpu)
{
#ifdef CONFIG_SMP
if (cpu >= nr_cpu_ids)
return BAD_APICID;
return (int)cpu_2_logical_apicid[cpu];
if (cpu >= NR_CPUS)
return BAD_APICID;
return (int)cpu_2_logical_apicid[cpu];
#else
return logical_smp_processor_id();
#endif
Expand All @@ -147,26 +146,25 @@ static inline int check_phys_apicid_present(int cpu_physical_apicid)
return (1);
}

static inline unsigned int
cpu_mask_to_apicid_cluster(const struct cpumask *cpumask)
static inline unsigned int cpu_mask_to_apicid_cluster(cpumask_t cpumask)
{
int num_bits_set;
int cpus_found = 0;
int cpu;
int apicid;

num_bits_set = cpumask_weight(cpumask);
num_bits_set = cpus_weight(cpumask);
/* Return id to all */
if (num_bits_set == NR_CPUS)
return 0xFF;
/*
* The cpus in the mask must all be on the apic cluster. If are not
* on the same apicid cluster return default value of TARGET_CPUS.
*/
cpu = cpumask_first(cpumask);
cpu = first_cpu(cpumask);
apicid = cpu_to_logical_apicid(cpu);
while (cpus_found < num_bits_set) {
if (cpumask_test_cpu(cpu, cpumask)) {
if (cpu_isset(cpu, cpumask)) {
int new_apicid = cpu_to_logical_apicid(cpu);
if (apicid_cluster(apicid) !=
apicid_cluster(new_apicid)){
Expand All @@ -181,67 +179,25 @@ cpu_mask_to_apicid_cluster(const struct cpumask *cpumask)
return apicid;
}

static inline unsigned int cpu_mask_to_apicid(const cpumask_t *cpumask)
static inline unsigned int cpu_mask_to_apicid(cpumask_t cpumask)
{
int num_bits_set;
int cpus_found = 0;
int cpu;
int apicid;

num_bits_set = cpus_weight(*cpumask);
num_bits_set = cpus_weight(cpumask);
/* Return id to all */
if (num_bits_set == NR_CPUS)
return cpu_to_logical_apicid(0);
/*
* The cpus in the mask must all be on the apic cluster. If are not
* on the same apicid cluster return default value of TARGET_CPUS.
*/
cpu = first_cpu(*cpumask);
apicid = cpu_to_logical_apicid(cpu);
while (cpus_found < num_bits_set) {
if (cpu_isset(cpu, *cpumask)) {
int new_apicid = cpu_to_logical_apicid(cpu);
if (apicid_cluster(apicid) !=
apicid_cluster(new_apicid)){
printk ("%s: Not a valid mask!\n", __func__);
return cpu_to_logical_apicid(0);
}
apicid = new_apicid;
cpus_found++;
}
cpu++;
}
return apicid;
}


static inline unsigned int cpu_mask_to_apicid_and(const struct cpumask *inmask,
const struct cpumask *andmask)
{
int num_bits_set;
int cpus_found = 0;
int cpu;
int apicid = cpu_to_logical_apicid(0);
cpumask_var_t cpumask;

if (!alloc_cpumask_var(&cpumask, GFP_ATOMIC))
return apicid;

cpumask_and(cpumask, inmask, andmask);
cpumask_and(cpumask, cpumask, cpu_online_mask);

num_bits_set = cpumask_weight(cpumask);
/* Return id to all */
if (num_bits_set == NR_CPUS)
goto exit;
/*
* The cpus in the mask must all be on the apic cluster. If are not
* on the same apicid cluster return default value of TARGET_CPUS.
*/
cpu = cpumask_first(cpumask);
cpu = first_cpu(cpumask);
apicid = cpu_to_logical_apicid(cpu);
while (cpus_found < num_bits_set) {
if (cpumask_test_cpu(cpu, cpumask)) {
if (cpu_isset(cpu, cpumask)) {
int new_apicid = cpu_to_logical_apicid(cpu);
if (apicid_cluster(apicid) !=
apicid_cluster(new_apicid)){
Expand All @@ -253,8 +209,6 @@ static inline unsigned int cpu_mask_to_apicid_and(const struct cpumask *inmask,
}
cpu++;
}
exit:
free_cpumask_var(cpumask);
return apicid;
}

Expand Down
Loading

0 comments on commit e4a712e

Please sign in to comment.