irqbalance/irqbalance.h
Neil Horman 65169e022c Add banscript option
Its been requested in several different ways, that irqbalance have a more robust
mechanism for setting balancing policy at run time.  While I don't feel its
apropriate to have irqbalance be able to implement arbitrary balance policy
(having a flexible mechanism to define which irqs should be placed where can
become exceedingly complex), I do think we need some mechanism that easily
allows users to dynamically exclude irqs from the irqbalance policy at run time.
The banscript option does exactly this.  It allows the user to point irqbalance
toward an exacutable file that is run one for each irq deiscovered passing the
sysfs path of the device and an irq vector as arguments.  A zero exit code tells
irqbalance to manage the irq as it normally would, while a non-zero exit tells
irqbalance to ignore the interrupt entirely.  This provides adminstrators a code
point with which to exclude irqs dynamically based on any programatic
informatino available, and to manage those irqs independently, etither via
another irqbalance like program, or via static affinity setting.

Signed-off-by: Neil Horman <nhorman@tuxdriver.com>

Reesolves: http://code.google.com/p/irqbalance/issues/detail?id=33
2012-07-05 15:21:25 -04:00

131 lines
3.1 KiB
C

#ifndef __INCLUDE_GUARD_IRQBALANCE_H_
#define __INCLUDE_GUARD_IRQBALANCE_H_
#include "constants.h"
#include "cpumask.h"
#include <stdint.h>
#include <glib.h>
#include <syslog.h>
#include <limits.h>
#include "types.h"
#ifdef HAVE_NUMA_H
#include <numa.h>
#else
#define numa_available() -1
#endif
extern int package_count;
extern int cache_domain_count;
extern int core_count;
extern char *classes[];
extern void parse_cpu_tree(void);
extern void clear_work_stats(void);
extern void parse_proc_interrupts(void);
extern void parse_proc_stat(void);
extern void set_interrupt_count(int number, uint64_t count);
extern void set_msi_interrupt_numa(int number);
extern GList *rebalance_irq_list;
void update_migration_status(void);
void reset_counts(void);
void dump_workloads(void);
void sort_irq_list(GList **list);
void calculate_placement(void);
void dump_tree(void);
void activate_mappings(void);
void account_for_nic_stats(void);
void clear_cpu_tree(void);
void pci_numa_scan(void);
/*===================NEW BALANCER FUNCTIONS============================*/
/*
* Master topo_obj type lists
*/
extern GList *numa_nodes;
extern GList *packages;
extern GList *cache_domains;
extern GList *cpus;
extern int numa_avail;
enum hp_e {
HINT_POLICY_IGNORE,
HINT_POLICY_SUBSET,
HINT_POLICY_EXACT
};
extern int debug_mode;
extern int one_shot_mode;
extern int power_mode;
extern int need_rescan;
extern enum hp_e hint_policy;
extern unsigned long long cycle_count;
extern unsigned long power_thresh;
extern char *banscript;
/*
* Numa node access routines
*/
extern void build_numa_node_list(void);
extern void free_numa_node_list(void);
extern void dump_numa_node_info(struct topo_obj *node, void *data);
extern void add_package_to_node(struct topo_obj *p, int nodeid);
extern struct topo_obj *get_numa_node(int nodeid);
/*
* Package functions
*/
#define package_numa_node(p) ((p)->parent)
/*
* cache_domain functions
*/
#define cache_domain_package(c) ((c)->parent)
#define cache_domain_numa_node(c) (package_numa_node(cache_domain_package((c))))
/*
* cpu core functions
*/
#define cpu_cache_domain(cpu) ((cpu)->parent)
#define cpu_package(cpu) (cache_domain_package(cpu_cache_domain((cpu))))
#define cpu_numa_node(cpu) (package_numa_node(cache_domain_package(cpu_cache_domain((cpu)))))
extern struct topo_obj *find_cpu_core(int cpunr);
extern int get_cpu_count(void);
/*
* irq db functions
*/
extern void rebuild_irq_db(void);
extern void free_irq_db(void);
extern void add_banned_irq(int irq);
extern void for_each_irq(GList *list, void (*cb)(struct irq_info *info, void *data), void *data);
extern struct irq_info *get_irq_info(int irq);
extern void migrate_irq(GList **from, GList **to, struct irq_info *info);
extern struct irq_info *add_misc_irq(int irq);
#define irq_numa_node(irq) ((irq)->numa_node)
/*
* Generic object functions
*/
static inline void for_each_object(GList *list, void (*cb)(struct topo_obj *obj, void *data), void *data)
{
GList *entry, *next;
entry = g_list_first(list);
while (entry) {
next = g_list_next(entry);
cb(entry->data, data);
entry = next;
}
}
#endif