Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 40061
b: refs/heads/master
c: e83f214
h: refs/heads/master
i:
  40059: 73eebfa
v: v3
  • Loading branch information
David S. Miller committed Oct 20, 2006
1 parent 952d300 commit 8db679f
Show file tree
Hide file tree
Showing 177 changed files with 1,892 additions and 2,321 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: c1448791648d44ecbf8cadb192704e3e6eb3bb0e
refs/heads/master: e83f214e45a80459d2931ae1259ab5fae82c8a8e
148 changes: 74 additions & 74 deletions trunk/Documentation/cpu-hotplug.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ maxcpus=n Restrict boot time cpus to n. Say if you have 4 cpus, using
maxcpus=2 will only boot 2. You can choose to bring the
other cpus later online, read FAQ's for more info.

additional_cpus=n (*) Use this to limit hotpluggable cpus. This option sets
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
Expand Down Expand Up @@ -101,15 +101,15 @@ cpu_possible_map/for_each_possible_cpu() to iterate.

Never use anything other than cpumask_t to represent bitmap of CPUs.

#include <linux/cpumask.h>
#include <linux/cpumask.h>

for_each_possible_cpu - Iterate over cpu_possible_map
for_each_online_cpu - Iterate over cpu_online_map
for_each_present_cpu - Iterate over cpu_present_map
for_each_cpu_mask(x,mask) - Iterate over some random collection of cpu mask.
for_each_possible_cpu - Iterate over cpu_possible_map
for_each_online_cpu - Iterate over cpu_online_map
for_each_present_cpu - Iterate over cpu_present_map
for_each_cpu_mask(x,mask) - Iterate over some random collection of cpu mask.

#include <linux/cpu.h>
lock_cpu_hotplug() and unlock_cpu_hotplug():
#include <linux/cpu.h>
lock_cpu_hotplug() and unlock_cpu_hotplug():

The above calls are used to inhibit cpu hotplug operations. While holding the
cpucontrol mutex, cpu_online_map will not change. If you merely need to avoid
Expand All @@ -120,7 +120,7 @@ will work as long as stop_machine_run() is used to take a cpu down.

CPU Hotplug - Frequently Asked Questions.

Q: How to enable my kernel to support CPU hotplug?
Q: How to i enable my kernel to support CPU hotplug?
A: When doing make defconfig, Enable CPU hotplug support

"Processor type and Features" -> Support for Hotpluggable CPUs
Expand All @@ -141,57 +141,57 @@ A: You should now notice an entry in sysfs.
Check if sysfs is mounted, using the "mount" command. You should notice
an entry as shown below in the output.

....
none on /sys type sysfs (rw)
....
....
none on /sys type sysfs (rw)
....

If this is not mounted, do the following.
if this is not mounted, do the following.

#mkdir /sysfs
#mount -t sysfs sys /sys
#mkdir /sysfs
#mount -t sysfs sys /sys

Now you should see entries for all present cpu, the following is an example
now you should see entries for all present cpu, the following is an example
in a 8-way system.

#pwd
#/sys/devices/system/cpu
#ls -l
total 0
drwxr-xr-x 10 root root 0 Sep 19 07:44 .
drwxr-xr-x 13 root root 0 Sep 19 07:45 ..
drwxr-xr-x 3 root root 0 Sep 19 07:44 cpu0
drwxr-xr-x 3 root root 0 Sep 19 07:44 cpu1
drwxr-xr-x 3 root root 0 Sep 19 07:44 cpu2
drwxr-xr-x 3 root root 0 Sep 19 07:44 cpu3
drwxr-xr-x 3 root root 0 Sep 19 07:44 cpu4
drwxr-xr-x 3 root root 0 Sep 19 07:44 cpu5
drwxr-xr-x 3 root root 0 Sep 19 07:44 cpu6
drwxr-xr-x 3 root root 0 Sep 19 07:48 cpu7
#pwd
#/sys/devices/system/cpu
#ls -l
total 0
drwxr-xr-x 10 root root 0 Sep 19 07:44 .
drwxr-xr-x 13 root root 0 Sep 19 07:45 ..
drwxr-xr-x 3 root root 0 Sep 19 07:44 cpu0
drwxr-xr-x 3 root root 0 Sep 19 07:44 cpu1
drwxr-xr-x 3 root root 0 Sep 19 07:44 cpu2
drwxr-xr-x 3 root root 0 Sep 19 07:44 cpu3
drwxr-xr-x 3 root root 0 Sep 19 07:44 cpu4
drwxr-xr-x 3 root root 0 Sep 19 07:44 cpu5
drwxr-xr-x 3 root root 0 Sep 19 07:44 cpu6
drwxr-xr-x 3 root root 0 Sep 19 07:48 cpu7

Under each directory you would find an "online" file which is the control
file to logically online/offline a processor.

Q: Does hot-add/hot-remove refer to physical add/remove of cpus?
A: The usage of hot-add/remove may not be very consistently used in the code.
CONFIG_HOTPLUG_CPU enables logical online/offline capability in the kernel.
CONFIG_CPU_HOTPLUG enables logical online/offline capability in the kernel.
To support physical addition/removal, one would need some BIOS hooks and
the platform should have something like an attention button in PCI hotplug.
CONFIG_ACPI_HOTPLUG_CPU enables ACPI support for physical add/remove of CPUs.

Q: How do i logically offline a CPU?
A: Do the following.

#echo 0 > /sys/devices/system/cpu/cpuX/online
#echo 0 > /sys/devices/system/cpu/cpuX/online

Once the logical offline is successful, check
once the logical offline is successful, check

#cat /proc/interrupts
#cat /proc/interrupts

You should now not see the CPU that you removed. Also online file will report
you should now not see the CPU that you removed. Also online file will report
the state as 0 when a cpu if offline and 1 when its online.

#To display the current cpu state.
#cat /sys/devices/system/cpu/cpuX/online
#To display the current cpu state.
#cat /sys/devices/system/cpu/cpuX/online

Q: Why cant i remove CPU0 on some systems?
A: Some architectures may have some special dependency on a certain CPU.
Expand Down Expand Up @@ -234,8 +234,8 @@ Q: If i have some kernel code that needs to be aware of CPU arrival and
departure, how to i arrange for proper notification?
A: This is what you would need in your kernel code to receive notifications.

#include <linux/cpu.h>
static int __cpuinit foobar_cpu_callback(struct notifier_block *nfb,
#include <linux/cpu.h>
static int __cpuinit foobar_cpu_callback(struct notifier_block *nfb,
unsigned long action, void *hcpu)
{
unsigned int cpu = (unsigned long)hcpu;
Expand Down Expand Up @@ -279,10 +279,10 @@ Q: I don't see my action being called for all CPUs already up and running?
A: Yes, CPU notifiers are called only when new CPUs are on-lined or offlined.
If you need to perform some action for each cpu already in the system, then

for_each_online_cpu(i) {
for_each_online_cpu(i) {
foobar_cpu_callback(&foobar_cpu_notifier, CPU_UP_PREPARE, i);
foobar_cpu_callback(&foobar_cpu_notifier, CPU_ONLINE, i);
}
foobar_cpu_callback(&foobar-cpu_notifier, CPU_ONLINE, i);
}

Q: If i would like to develop cpu hotplug support for a new architecture,
what do i need at a minimum?
Expand All @@ -307,38 +307,38 @@ Q: I need to ensure that a particular cpu is not removed when there is some
work specific to this cpu is in progress.
A: First switch the current thread context to preferred cpu

int my_func_on_cpu(int cpu)
{
cpumask_t saved_mask, new_mask = CPU_MASK_NONE;
int curr_cpu, err = 0;

saved_mask = current->cpus_allowed;
cpu_set(cpu, new_mask);
err = set_cpus_allowed(current, new_mask);

if (err)
return err;

/*
* If we got scheduled out just after the return from
* set_cpus_allowed() before running the work, this ensures
* we stay locked.
*/
curr_cpu = get_cpu();

if (curr_cpu != cpu) {
err = -EAGAIN;
goto ret;
} else {
/*
* Do work : But cant sleep, since get_cpu() disables preempt
*/
}
ret:
put_cpu();
set_cpus_allowed(current, saved_mask);
return err;
}
int my_func_on_cpu(int cpu)
{
cpumask_t saved_mask, new_mask = CPU_MASK_NONE;
int curr_cpu, err = 0;

saved_mask = current->cpus_allowed;
cpu_set(cpu, new_mask);
err = set_cpus_allowed(current, new_mask);

if (err)
return err;

/*
* If we got scheduled out just after the return from
* set_cpus_allowed() before running the work, this ensures
* we stay locked.
*/
curr_cpu = get_cpu();

if (curr_cpu != cpu) {
err = -EAGAIN;
goto ret;
} else {
/*
* Do work : But cant sleep, since get_cpu() disables preempt
*/
}
ret:
put_cpu();
set_cpus_allowed(current, saved_mask);
return err;
}


Q: How do we determine how many CPUs are available for hotplug.
Expand Down
2 changes: 1 addition & 1 deletion trunk/Documentation/memory-barriers.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1898,7 +1898,7 @@ queue before processing any further requests:
smp_wmb();
<A:modify v=2> <C:busy>
<C:queue v=2>
p = &v; q = p;
p = &b; q = p;
<D:request p>
<B:modify p=&v> <D:commit p=&v>
<D:read p>
Expand Down
2 changes: 1 addition & 1 deletion trunk/arch/arm/mach-lh7a40x/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ extern void lh7a404_init_irq (void);
extern void lh7a40x_clcd_init (void);
extern void lh7a40x_init_board_irq (void);

#define IRQ_DISPATCH(irq) desc_handle_irq((irq),(irq_desc + irq))
#define IRQ_DISPATCH(irq) desc_handle_irq((irq),(irq_desc + irq), regs)
4 changes: 0 additions & 4 deletions trunk/arch/i386/kernel/alternative.c
Original file line number Diff line number Diff line change
Expand Up @@ -344,16 +344,13 @@ void alternatives_smp_switch(int smp)

void __init alternative_instructions(void)
{
unsigned long flags;
if (no_replacement) {
printk(KERN_INFO "(SMP-)alternatives turned off\n");
free_init_pages("SMP alternatives",
(unsigned long)__smp_alt_begin,
(unsigned long)__smp_alt_end);
return;
}

local_irq_save(flags);
apply_alternatives(__alt_instructions, __alt_instructions_end);

/* switch to patch-once-at-boottime-only mode and free the
Expand Down Expand Up @@ -389,5 +386,4 @@ void __init alternative_instructions(void)
alternatives_smp_switch(0);
}
#endif
local_irq_restore(flags);
}
3 changes: 1 addition & 2 deletions trunk/arch/i386/lib/usercopy.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
#include <linux/highmem.h>
#include <linux/blkdev.h>
#include <linux/module.h>
#include <linux/backing-dev.h>
#include <asm/uaccess.h>
#include <asm/mmx.h>

Expand Down Expand Up @@ -742,7 +741,7 @@ unsigned long __copy_to_user_ll(void __user *to, const void *from,

if (retval == -ENOMEM && is_init(current)) {
up_read(&current->mm->mmap_sem);
congestion_wait(WRITE, HZ/50);
blk_congestion_wait(WRITE, HZ/50);
goto survive;
}

Expand Down
2 changes: 1 addition & 1 deletion trunk/arch/sparc64/kernel/pci_sabre.c
Original file line number Diff line number Diff line change
Expand Up @@ -1465,5 +1465,5 @@ void sabre_init(struct device_node *dp, char *model_name)
/*
* Look for APB underneath.
*/
sabre_pbm_init(p, dp, vdma[0], vdma[1]);
sabre_pbm_init(p, dp, vdma[0], vdma[0] + vdma[1]);
}
6 changes: 0 additions & 6 deletions trunk/arch/um/Kconfig
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
config DEFCONFIG_LIST
string
option defconfig_list
default "arch/$ARCH/defconfig"

# UML uses the generic IRQ sugsystem
config GENERIC_HARDIRQS
bool
Expand Down Expand Up @@ -57,7 +52,6 @@ menu "UML-specific options"
config MODE_TT
bool "Tracing thread support (DEPRECATED)"
default n
depends on BROKEN
help
This option controls whether tracing thread support is compiled
into UML. This option is largely obsolete, given that skas0 provides
Expand Down
5 changes: 0 additions & 5 deletions trunk/arch/um/Kconfig.char
Original file line number Diff line number Diff line change
Expand Up @@ -190,11 +190,6 @@ config HOSTAUDIO
tristate
default UML_SOUND

#It is selected elsewhere, so kconfig would warn without this.
config HW_RANDOM
tristate
default n

config UML_RANDOM
tristate "Hardware random number generator"
help
Expand Down
1 change: 0 additions & 1 deletion trunk/arch/um/drivers/cow_sys.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#include "user_util.h"
#include "os.h"
#include "user.h"
#include "um_malloc.h"

static inline void *cow_malloc(int size)
{
Expand Down
1 change: 0 additions & 1 deletion trunk/arch/um/drivers/daemon_user.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
#include "user_util.h"
#include "user.h"
#include "os.h"
#include "um_malloc.h"

#define MAX_PACKET (ETH_MAX_PACKET + ETH_HEADER_OTHER)

Expand Down
1 change: 0 additions & 1 deletion trunk/arch/um/drivers/fd.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
#include "user_util.h"
#include "chan_user.h"
#include "os.h"
#include "um_malloc.h"

struct fd_chan {
int fd;
Expand Down
1 change: 0 additions & 1 deletion trunk/arch/um/drivers/mcast_user.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
#include "user_util.h"
#include "user.h"
#include "os.h"
#include "um_malloc.h"

#define MAX_PACKET (ETH_MAX_PACKET + ETH_HEADER_OTHER)

Expand Down
3 changes: 1 addition & 2 deletions trunk/arch/um/drivers/mmapper_kern.c
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,7 @@ static const struct file_operations mmapper_fops = {
.release = mmapper_release,
};

/* No locking needed - only used (and modified) by below initcall and exitcall. */
static struct miscdevice mmapper_dev = {
static const struct miscdevice mmapper_dev = {
.minor = MISC_DYNAMIC_MINOR,
.name = "mmapper",
.fops = &mmapper_fops
Expand Down
1 change: 0 additions & 1 deletion trunk/arch/um/drivers/net_user.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
#include "kern_util.h"
#include "net_user.h"
#include "os.h"
#include "um_malloc.h"

int tap_open_common(void *dev, char *gate_addr)
{
Expand Down
1 change: 0 additions & 1 deletion trunk/arch/um/drivers/pcap_user.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
#include "net_user.h"
#include "pcap_user.h"
#include "user.h"
#include "um_malloc.h"

#define MAX_PACKET (ETH_MAX_PACKET + ETH_HEADER_OTHER)

Expand Down
1 change: 0 additions & 1 deletion trunk/arch/um/drivers/port_user.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
#include "chan_user.h"
#include "port.h"
#include "os.h"
#include "um_malloc.h"

struct port_chan {
int raw;
Expand Down
1 change: 0 additions & 1 deletion trunk/arch/um/drivers/pty.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
#include "user_util.h"
#include "kern_util.h"
#include "os.h"
#include "um_malloc.h"

struct pty_chan {
void (*announce)(char *dev_name, int dev);
Expand Down
1 change: 0 additions & 1 deletion trunk/arch/um/drivers/slip_user.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
#include "slip.h"
#include "slip_common.h"
#include "os.h"
#include "um_malloc.h"

void slip_user_init(void *data, void *dev)
{
Expand Down
Loading

0 comments on commit 8db679f

Please sign in to comment.