mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 03:01:39 -04:00
bitmap, irq: add smp_affinity_list interface to /proc/irq
Manually adjusting the smp_affinity for IRQ's becomes unwieldy when the cpu count is large. Setting smp affinity to cpus 256 to 263 would be: echo 000000ff,00000000,00000000,00000000,00000000,00000000,00000000,00000000 > smp_affinity instead of: echo 256-263 > smp_affinity_list Think about what it looks like for cpus around say, 4088 to 4095. We already have many alternate "list" interfaces: /sys/devices/system/cpu/cpuX/indexY/shared_cpu_list /sys/devices/system/cpu/cpuX/topology/thread_siblings_list /sys/devices/system/cpu/cpuX/topology/core_siblings_list /sys/devices/system/node/nodeX/cpulist /sys/devices/pci***/***/local_cpulist Add a companion interface, smp_affinity_list to use cpu lists instead of cpu maps. This conforms to other companion interfaces where both a map and a list interface exists. This required adding a bitmap_parselist_user() function in a manner similar to the bitmap_parse_user() function. [[email protected]: make __bitmap_parselist() static] Signed-off-by: Mike Travis <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: Jack Steiner <[email protected]> Cc: Lee Schermerhorn <[email protected]> Cc: Andy Shevchenko <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
e50c1f609c
commit
4b060420a5
6 changed files with 188 additions and 23 deletions
|
|
@ -19,7 +19,7 @@ static struct proc_dir_entry *root_irq_dir;
|
|||
|
||||
#ifdef CONFIG_SMP
|
||||
|
||||
static int irq_affinity_proc_show(struct seq_file *m, void *v)
|
||||
static int show_irq_affinity(int type, struct seq_file *m, void *v)
|
||||
{
|
||||
struct irq_desc *desc = irq_to_desc((long)m->private);
|
||||
const struct cpumask *mask = desc->irq_data.affinity;
|
||||
|
|
@ -28,7 +28,10 @@ static int irq_affinity_proc_show(struct seq_file *m, void *v)
|
|||
if (irqd_is_setaffinity_pending(&desc->irq_data))
|
||||
mask = desc->pending_mask;
|
||||
#endif
|
||||
seq_cpumask(m, mask);
|
||||
if (type)
|
||||
seq_cpumask_list(m, mask);
|
||||
else
|
||||
seq_cpumask(m, mask);
|
||||
seq_putc(m, '\n');
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -59,7 +62,18 @@ static int irq_affinity_hint_proc_show(struct seq_file *m, void *v)
|
|||
#endif
|
||||
|
||||
int no_irq_affinity;
|
||||
static ssize_t irq_affinity_proc_write(struct file *file,
|
||||
static int irq_affinity_proc_show(struct seq_file *m, void *v)
|
||||
{
|
||||
return show_irq_affinity(0, m, v);
|
||||
}
|
||||
|
||||
static int irq_affinity_list_proc_show(struct seq_file *m, void *v)
|
||||
{
|
||||
return show_irq_affinity(1, m, v);
|
||||
}
|
||||
|
||||
|
||||
static ssize_t write_irq_affinity(int type, struct file *file,
|
||||
const char __user *buffer, size_t count, loff_t *pos)
|
||||
{
|
||||
unsigned int irq = (int)(long)PDE(file->f_path.dentry->d_inode)->data;
|
||||
|
|
@ -72,7 +86,10 @@ static ssize_t irq_affinity_proc_write(struct file *file,
|
|||
if (!alloc_cpumask_var(&new_value, GFP_KERNEL))
|
||||
return -ENOMEM;
|
||||
|
||||
err = cpumask_parse_user(buffer, count, new_value);
|
||||
if (type)
|
||||
err = cpumask_parselist_user(buffer, count, new_value);
|
||||
else
|
||||
err = cpumask_parse_user(buffer, count, new_value);
|
||||
if (err)
|
||||
goto free_cpumask;
|
||||
|
||||
|
|
@ -100,11 +117,28 @@ free_cpumask:
|
|||
return err;
|
||||
}
|
||||
|
||||
static ssize_t irq_affinity_proc_write(struct file *file,
|
||||
const char __user *buffer, size_t count, loff_t *pos)
|
||||
{
|
||||
return write_irq_affinity(0, file, buffer, count, pos);
|
||||
}
|
||||
|
||||
static ssize_t irq_affinity_list_proc_write(struct file *file,
|
||||
const char __user *buffer, size_t count, loff_t *pos)
|
||||
{
|
||||
return write_irq_affinity(1, file, buffer, count, pos);
|
||||
}
|
||||
|
||||
static int irq_affinity_proc_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
return single_open(file, irq_affinity_proc_show, PDE(inode)->data);
|
||||
}
|
||||
|
||||
static int irq_affinity_list_proc_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
return single_open(file, irq_affinity_list_proc_show, PDE(inode)->data);
|
||||
}
|
||||
|
||||
static int irq_affinity_hint_proc_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
return single_open(file, irq_affinity_hint_proc_show, PDE(inode)->data);
|
||||
|
|
@ -125,6 +159,14 @@ static const struct file_operations irq_affinity_hint_proc_fops = {
|
|||
.release = single_release,
|
||||
};
|
||||
|
||||
static const struct file_operations irq_affinity_list_proc_fops = {
|
||||
.open = irq_affinity_list_proc_open,
|
||||
.read = seq_read,
|
||||
.llseek = seq_lseek,
|
||||
.release = single_release,
|
||||
.write = irq_affinity_list_proc_write,
|
||||
};
|
||||
|
||||
static int default_affinity_show(struct seq_file *m, void *v)
|
||||
{
|
||||
seq_cpumask(m, irq_default_affinity);
|
||||
|
|
@ -289,6 +331,10 @@ void register_irq_proc(unsigned int irq, struct irq_desc *desc)
|
|||
proc_create_data("affinity_hint", 0400, desc->dir,
|
||||
&irq_affinity_hint_proc_fops, (void *)(long)irq);
|
||||
|
||||
/* create /proc/irq/<irq>/smp_affinity_list */
|
||||
proc_create_data("smp_affinity_list", 0600, desc->dir,
|
||||
&irq_affinity_list_proc_fops, (void *)(long)irq);
|
||||
|
||||
proc_create_data("node", 0444, desc->dir,
|
||||
&irq_node_proc_fops, (void *)(long)irq);
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Reference in a new issue