- Remove the eintrcnt/eintrnames usage and introduce the concept of

sintrcnt/sintrnames which are symbols containing the size of the 2
  tables.
- For amd64/i386 remove the storage of intr* stuff from assembly files.
  This area can be widely improved by applying the same to other
  architectures and likely finding an unified approach among them and
  move the whole code to be MI. More work in this area is expected to
  happen fairly soon.

No MFC is previewed for this patch.

Tested by:	pluknet
Reviewed by:	jhb
Approved by:	re (kib)
This commit is contained in:
Attilio Rao 2011-07-18 15:19:40 +00:00
parent 9c931b6fdc
commit 521ea19d1c
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=224187
19 changed files with 70 additions and 72 deletions

View File

@ -201,7 +201,6 @@ ASSYM(UC_EFLAGS, offsetof(ucontext_t, uc_mcontext.mc_rflags));
ASSYM(ENOENT, ENOENT);
ASSYM(EFAULT, EFAULT);
ASSYM(ENAMETOOLONG, ENAMETOOLONG);
ASSYM(MAXCPU, MAXCPU);
ASSYM(MAXCOMLEN, MAXCOMLEN);
ASSYM(MAXPATHLEN, MAXPATHLEN);
ASSYM(PC_SIZEOF, sizeof(struct pcpu));

View File

@ -80,6 +80,11 @@ static STAILQ_HEAD(, pic) pics;
static int assign_cpu;
#endif
u_long intrcnt[INTRCNT_COUNT];
char intrnames[INTRCNT_COUNT * (MAXCOMLEN + 1)];
size_t sintrcnt = sizeof(intrcnt);
size_t sintrnames = sizeof(intrnames);
static int intr_assign_cpu(void *arg, u_char cpu);
static void intr_disable_src(void *arg);
static void intr_init(void *__dummy);

View File

@ -38,18 +38,6 @@
#include "assym.s"
.data
ALIGN_DATA
.globl intrcnt, eintrcnt
intrcnt:
.space INTRCNT_COUNT * 8
eintrcnt:
.globl intrnames, eintrnames
intrnames:
.space INTRCNT_COUNT * (MAXCOMLEN + 1)
eintrnames:
.text
/*

View File

@ -102,14 +102,16 @@ ASENTRY_NP(irq_entry)
.align 0
.global _C_LABEL(intrnames), _C_LABEL(eintrnames)
.global _C_LABEL(intrcnt), _C_LABEL(eintrcnt)
.global _C_LABEL(intrnames), _C_LABEL(sintrnames)
.global _C_LABEL(intrcnt), _C_LABEL(sintrcnt)
_C_LABEL(intrnames):
.space NIRQ * (MAXCOMLEN + 1)
_C_LABEL(eintrnames):
_C_LABEL(intrcnt):
.space NIRQ * 4
_C_LABEL(eintrcnt):
_C_LABEL(sintrnames):
.word NIRQ * (MAXCOMLEN + 1)
_C_LABEL(sintrcnt):
.word NIRQ * 4
.global _C_LABEL(current_intr_depth)
_C_LABEL(current_intr_depth):

View File

@ -118,16 +118,11 @@ ENTRY(sa11x0_activateirqs)
mov r1, #0xffffffff
str r1, [r0, #(SAIPIC_MR)]
mov pc, lr
#ifdef IRQSTATS
Lintrcnt:
.word _C_LABEL(intrcnt)
#endif
.global _C_LABEL(intrnames), _C_LABEL(eintrnames)
.global _C_LABEL(eintrcnt)
.global _C_LABEL(intrnames), _C_LABEL(sintrnames)
_C_LABEL(intrnames):
_C_LABEL(eintrnames):
_C_LABEL(eintrcnt):
_C_LABEL(sintrnames):
.word 0
.globl _C_LABEL(intrcnt), _C_LABEL(sintrcnt)
@ -135,4 +130,4 @@ _C_LABEL(intrcnt):
.space ICU_LEN*4 /* XXX Should be linked to number of interrupts */
_C_LABEL(sintrcnt):
.space 32*4
.word ICU_LEN*4

View File

@ -180,7 +180,6 @@ ASSYM(UC_GS, offsetof(ucontext_t, uc_mcontext.mc_gs));
ASSYM(ENOENT, ENOENT);
ASSYM(EFAULT, EFAULT);
ASSYM(ENAMETOOLONG, ENAMETOOLONG);
ASSYM(MAXCPU, MAXCPU);
ASSYM(MAXCOMLEN, MAXCOMLEN);
ASSYM(MAXPATHLEN, MAXPATHLEN);
ASSYM(BOOTINFO_SIZE, sizeof(struct bootinfo));

View File

@ -71,6 +71,11 @@ static STAILQ_HEAD(, pic) pics;
static int assign_cpu;
#endif
u_long intrcnt[INTRCNT_COUNT];
char intrnames[INTRCNT_COUNT * (MAXCOMLEN + 1)];
size_t sintrcnt = sizeof(intrcnt);
size_t sintrnames = sizeof(intrnames);
static int intr_assign_cpu(void *arg, u_char cpu);
static void intr_disable_src(void *arg);
static void intr_init(void *__dummy);

View File

@ -41,18 +41,6 @@
#define IDXSHIFT 10
.data
ALIGN_DATA
.globl intrcnt, eintrcnt
intrcnt:
.space INTRCNT_COUNT * 4
eintrcnt:
.globl intrnames, eintrnames
intrnames:
.space INTRCNT_COUNT * (MAXCOMLEN + 1)
eintrnames:
.text
/*

View File

@ -206,11 +206,14 @@ intr_n = 1
.byte 0
intr_n = intr_n + 1
.endr
EXPORT(eintrnames)
EXPORT(sintrnames)
.word INTRCNT_COUNT * INTRNAME_LEN
.align 8
EXPORT(intrcnt)
.fill INTRCNT_COUNT, 8, 0
EXPORT(eintrcnt)
EXPORT(sintrcnt)
.word INTRCNT_COUNT
.text
// in0: image base

View File

@ -842,7 +842,7 @@ watchdog_fire(void)
curintr = intrcnt;
curname = intrnames;
inttotal = 0;
nintr = eintrcnt - intrcnt;
nintr = sintrcnt;
printf("interrupt total\n");
while (--nintr >= 0) {

View File

@ -1869,8 +1869,7 @@ SYSINIT(start_softintr, SI_SUB_SOFTINTR, SI_ORDER_FIRST, start_softintr,
static int
sysctl_intrnames(SYSCTL_HANDLER_ARGS)
{
return (sysctl_handle_opaque(oidp, intrnames, eintrnames - intrnames,
req));
return (sysctl_handle_opaque(oidp, intrnames, sintrnames, req));
}
SYSCTL_PROC(_hw, OID_AUTO, intrnames, CTLTYPE_OPAQUE | CTLFLAG_RD,
@ -1879,8 +1878,7 @@ SYSCTL_PROC(_hw, OID_AUTO, intrnames, CTLTYPE_OPAQUE | CTLFLAG_RD,
static int
sysctl_intrcnt(SYSCTL_HANDLER_ARGS)
{
return (sysctl_handle_opaque(oidp, intrcnt,
(char *)eintrcnt - (char *)intrcnt, req));
return (sysctl_handle_opaque(oidp, intrcnt, sintrcnt, req));
}
SYSCTL_PROC(_hw, OID_AUTO, intrcnt, CTLTYPE_OPAQUE | CTLFLAG_RD,
@ -1894,9 +1892,12 @@ DB_SHOW_COMMAND(intrcnt, db_show_intrcnt)
{
u_long *i;
char *cp;
u_int j;
cp = intrnames;
for (i = intrcnt; i != eintrcnt && !db_pager_quit; i++) {
j = 0;
for (i = intrcnt; j < (sintrcnt / sizeof(u_long)) && !db_pager_quit;
i++, j++) {
if (*cp == '\0')
break;
if (*i != 0)

View File

@ -1134,16 +1134,19 @@ END(MipsFPTrap)
*/
.data
.globl intrcnt
.globl eintrcnt
.globl sintrcnt
.globl intrnames
.globl eintrnames
.globl sintrnames
intrnames:
.space INTRCNT_COUNT * (MAXCOMLEN + 1) * 2
eintrnames:
sintrnames:
.word INTRCNT_COUNT * (MAXCOMLEN + 1) * 2
.align 4
intrcnt:
.space INTRCNT_COUNT * 4 * 2
eintrcnt:
sintrcnt:
.word INTRCNT_COUNT * 4 * 2
/*

View File

@ -90,11 +90,14 @@ GLOBAL(esym)
#define INTRCNT_COUNT 256 /* max(HROWPIC_IRQMAX,OPENPIC_IRQMAX) */
GLOBAL(intrnames)
.space INTRCNT_COUNT * (MAXCOMLEN + 1) * 2
GLOBAL(eintrnames)
GLOBAL(sintrnames)
.word INTRCNT_COUNT * (MAXCOMLEN + 1) * 2
.align 4
GLOBAL(intrcnt)
.space INTRCNT_COUNT * 4 * 2
GLOBAL(eintrcnt)
GLOBAL(sintrcnt)
.word INTRCNT_COUNT * 4 * 2
.text
.globl btext

View File

@ -90,11 +90,14 @@ GLOBAL(esym)
#define INTRCNT_COUNT 256 /* max(HROWPIC_IRQMAX,OPENPIC_IRQMAX) */
GLOBAL(intrnames)
.space INTRCNT_COUNT * (MAXCOMLEN + 1) * 2
GLOBAL(eintrnames)
GLOBAL(sintrnames)
.word INTRCNT_COUNT * (MAXCOMLEN + 1) * 2
.align 4
GLOBAL(intrcnt)
.space INTRCNT_COUNT * 4 * 2
GLOBAL(eintrcnt)
GLOBAL(sintrcnt)
.word INTRCNT_COUNT * 4 * 2
.text
.globl btext

View File

@ -789,10 +789,13 @@ GLOBAL(kernload)
.long 0
GLOBAL(intrnames)
.space INTRCNT_COUNT * (MAXCOMLEN + 1) * 2
GLOBAL(eintrnames)
GLOBAL(sintrnames)
.word INTRCNT_COUNT * (MAXCOMLEN + 1) * 2
.align 4
GLOBAL(intrcnt)
.space INTRCNT_COUNT * 4 * 2
GLOBAL(eintrcnt)
GLOBAL(sintrcnt)
.word INTRCNT_COUNT * 4 * 2
#include <powerpc/booke/trap_subr.S>

View File

@ -371,14 +371,17 @@ END(rsf_fatal)
.data
_ALIGN_DATA
.globl intrnames, eintrnames
.globl intrnames, sintrnames
intrnames:
.space IV_MAX * (MAXCOMLEN + 1)
eintrnames:
.globl intrcnt, eintrcnt
sintrnames:
.word IV_MAX * (MAXCOMLEN + 1)
.globl intrcnt, sintrcnt
intrcnt:
.space IV_MAX * 8
eintrcnt:
sintrcnt:
.word IV_MAX * 8
.text

View File

@ -171,7 +171,7 @@ static int
intrcnt_setname(const char *name, int index)
{
if (intrnames + (MAXCOMLEN + 1) * index >= eintrnames)
if ((MAXCOMLEN + 1) * index >= sintrnames)
return (E2BIG);
snprintf(intrnames + (MAXCOMLEN + 1) * index, MAXCOMLEN + 1, "%-*s",
MAXCOMLEN, name);

View File

@ -149,10 +149,10 @@ extern struct intr_event *clk_intr_event;
extern void *vm_ih;
/* Counts and names for statistics (defined in MD code). */
extern u_long eintrcnt[]; /* end of intrcnt[] */
extern char eintrnames[]; /* end of intrnames[] */
extern u_long intrcnt[]; /* counts for for each device and stray */
extern char intrnames[]; /* string table containing device names */
extern size_t sintrcnt; /* size of intrcnt table */
extern size_t sintrnames; /* size of intrnames table */
#ifdef DDB
void db_dump_intr_event(struct intr_event *ie, int handlers);

View File

@ -90,12 +90,12 @@ static struct nlist namelist[] = {
{ "_nchstats" },
#define X_INTRNAMES 5
{ "_intrnames" },
#define X_EINTRNAMES 6
{ "_eintrnames" },
#define X_SINTRNAMES 6
{ "_sintrnames" },
#define X_INTRCNT 7
{ "_intrcnt" },
#define X_EINTRCNT 8
{ "_eintrcnt" },
#define X_SINTRCNT 8
{ "_sintrcnt" },
#define X_KMEMSTATS 9
{ "_kmemstatistics" },
#define X_KMEMZONES 10
@ -1153,10 +1153,8 @@ dointr(void)
uptime = getuptime();
if (kd != NULL) {
intrcntlen = namelist[X_EINTRCNT].n_value -
namelist[X_INTRCNT].n_value;
inamlen = namelist[X_EINTRNAMES].n_value -
namelist[X_INTRNAMES].n_value;
intrcntlen = namelist[X_SINTRCNT].n_value;
inamlen = namelist[X_SINTRNAMES].n_value;
if ((intrcnt = malloc(intrcntlen)) == NULL ||
(intrname = malloc(inamlen)) == NULL)
err(1, "malloc()");