diff options
-rw-r--r-- | usr/src/uts/common/Makefile.files | 1 | ||||
-rw-r--r-- | usr/src/uts/common/disp/thread_intr.c | 115 | ||||
-rw-r--r-- | usr/src/uts/common/sys/cpuvar.h | 3 | ||||
-rw-r--r-- | usr/src/uts/common/sys/proc.h | 6 | ||||
-rw-r--r-- | usr/src/uts/i86pc/os/intr.c | 25 | ||||
-rw-r--r-- | usr/src/uts/i86pc/os/mp_startup.c | 8 | ||||
-rw-r--r-- | usr/src/uts/i86pc/os/startup.c | 9 | ||||
-rw-r--r-- | usr/src/uts/i86pc/sys/machcpuvar.h | 7 | ||||
-rw-r--r-- | usr/src/uts/i86pc/sys/machsystm.h | 8 | ||||
-rw-r--r-- | usr/src/uts/sun4/os/intr.c | 20 | ||||
-rw-r--r-- | usr/src/uts/sun4/os/mp_startup.c | 10 | ||||
-rw-r--r-- | usr/src/uts/sun4/os/startup.c | 4 | ||||
-rw-r--r-- | usr/src/uts/sun4/sys/intr.h | 12 | ||||
-rw-r--r-- | usr/src/uts/sun4u/sys/machcpuvar.h | 8 | ||||
-rw-r--r-- | usr/src/uts/sun4u/sys/machsystm.h | 8 | ||||
-rw-r--r-- | usr/src/uts/sun4v/sys/machcpuvar.h | 8 | ||||
-rw-r--r-- | usr/src/uts/sun4v/sys/machsystm.h | 8 |
17 files changed, 161 insertions, 99 deletions
diff --git a/usr/src/uts/common/Makefile.files b/usr/src/uts/common/Makefile.files index 8038b6b1cf..f347dc71a7 100644 --- a/usr/src/uts/common/Makefile.files +++ b/usr/src/uts/common/Makefile.files @@ -58,6 +58,7 @@ COMMON_CORE_OBJS += \ rctl_proc.o \ rwlock.o \ seg_kmem.o \ + thread_intr.o \ vm_page.o \ vm_pagelist.o diff --git a/usr/src/uts/common/disp/thread_intr.c b/usr/src/uts/common/disp/thread_intr.c new file mode 100644 index 0000000000..67ccc6922f --- /dev/null +++ b/usr/src/uts/common/disp/thread_intr.c @@ -0,0 +1,115 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ + +/* + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* + * FILE NOTICE BEGIN + * + * This file should not be modified. If you wish to modify it or have it + * modified, please contact Sun Microsystems at <LFI149367@-sun-.-com-> + * (without anti-spam dashes) + * + * FILE NOTICE END + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +#include <sys/cpuvar.h> +#include <sys/stack.h> +#include <vm/seg_kp.h> +#include <sys/proc.h> +#include <sys/pset.h> +#include <sys/sysmacros.h> + +/* + * Create and initialize an interrupt thread. + */ +static void +thread_create_intr(cpu_t *cp) +{ + kthread_t *tp; + + tp = thread_create(NULL, 0, + (void (*)())thread_create_intr, NULL, 0, &p0, TS_ONPROC, 0); + + /* + * Set the thread in the TS_FREE state. The state will change + * to TS_ONPROC only while the interrupt is active. Think of these + * as being on a private free list for the CPU. Being TS_FREE keeps + * inactive interrupt threads out of debugger thread lists. + * + * We cannot call thread_create with TS_FREE because of the current + * checks there for ONPROC. Fix this when thread_create takes flags. + */ + THREAD_FREEINTR(tp, cp); + + /* + * Nobody should ever reference the credentials of an interrupt + * thread so make it NULL to catch any such references. + */ + tp->t_cred = NULL; + tp->t_flag |= T_INTR_THREAD; + tp->t_cpu = cp; + tp->t_bound_cpu = cp; + tp->t_disp_queue = cp->cpu_disp; + tp->t_affinitycnt = 1; + tp->t_preempt = 1; + + /* + * Don't make a user-requested binding on this thread so that + * the processor can be offlined. + */ + tp->t_bind_cpu = PBIND_NONE; /* no USER-requested binding */ + tp->t_bind_pset = PS_NONE; + +#if defined(__i386) || defined(__amd64) + tp->t_stk -= STACK_ALIGN; + *(tp->t_stk) = 0; /* terminate intr thread stack */ +#endif + + /* + * Link onto CPU's interrupt pool. + */ + tp->t_link = cp->cpu_intr_thread; + cp->cpu_intr_thread = tp; +} + +/* + * Allocate a given number of interrupt threads for a given CPU. + * These threads will get freed by cpu_destroy_bound_threads() + * when CPU gets unconfigured. + */ +void +cpu_intr_alloc(cpu_t *cp, int n) +{ + int i; + + for (i = 0; i < n; i++) + thread_create_intr(cp); + + cp->cpu_intr_stack = (caddr_t)segkp_get(segkp, INTR_STACK_SIZE, + KPD_HASREDZONE | KPD_NO_ANON | KPD_LOCKED) + + INTR_STACK_SIZE - SA(MINFRAME); +} diff --git a/usr/src/uts/common/sys/cpuvar.h b/usr/src/uts/common/sys/cpuvar.h index 353a2346ea..85f42e9e16 100644 --- a/usr/src/uts/common/sys/cpuvar.h +++ b/usr/src/uts/common/sys/cpuvar.h @@ -20,7 +20,7 @@ */ /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -572,6 +572,7 @@ int cpu_intr_count(cpu_t *cp); /* count # of CPUs handling intrs */ int cpu_intr_on(cpu_t *cp); /* CPU taking I/O interrupts? */ void cpu_intr_enable(cpu_t *cp); /* enable I/O interrupts */ int cpu_intr_disable(cpu_t *cp); /* disable I/O interrupts */ +void cpu_intr_alloc(cpu_t *cp, int n); /* allocate interrupt threads */ /* * Routines for checking CPU states. diff --git a/usr/src/uts/common/sys/proc.h b/usr/src/uts/common/sys/proc.h index eb1463d88d..5d638f5038 100644 --- a/usr/src/uts/common/sys/proc.h +++ b/usr/src/uts/common/sys/proc.h @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -667,7 +666,6 @@ extern void forkpctx(proc_t *, proc_t *); extern void exitpctx(proc_t *); extern void freepctx(proc_t *, int); extern kthread_t *thread_unpin(void); -extern void thread_create_intr(struct cpu *); extern void thread_init(void); extern void thread_load(kthread_t *, void (*)(), caddr_t, size_t); diff --git a/usr/src/uts/i86pc/os/intr.c b/usr/src/uts/i86pc/os/intr.c index 37d0aa9b10..7e55409de8 100644 --- a/usr/src/uts/i86pc/os/intr.c +++ b/usr/src/uts/i86pc/os/intr.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -20,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -627,24 +626,6 @@ intr_passivate( #endif /* __amd64 */ /* - * Allocate threads and stacks for interrupt handling. - */ -#define NINTR_THREADS (LOCK_LEVEL-1) /* number of interrupt threads */ - -void -init_intr_threads(struct cpu *cp) -{ - int i; - - for (i = 0; i < NINTR_THREADS; i++) - thread_create_intr(cp); - - cp->cpu_intr_stack = (caddr_t)segkp_get(segkp, INTR_STACK_SIZE, - KPD_HASREDZONE | KPD_NO_ANON | KPD_LOCKED) + - INTR_STACK_SIZE - SA(MINFRAME); -} - -/* * Create interrupt kstats for this CPU. */ void diff --git a/usr/src/uts/i86pc/os/mp_startup.c b/usr/src/uts/i86pc/os/mp_startup.c index a0809d99fe..cf615011d2 100644 --- a/usr/src/uts/i86pc/os/mp_startup.c +++ b/usr/src/uts/i86pc/os/mp_startup.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -232,7 +231,6 @@ extern void *long_mode_64(void); int size; proc_t *procp; extern void idle(); - extern void init_intr_threads(struct cpu *); struct cpu_tables *tablesp; rm_platter_t *real_mode_platter = (rm_platter_t *)rm_platter_va; @@ -484,7 +482,7 @@ extern void *long_mode_64(void); /* * Initialize the interrupt threads for this CPU */ - init_intr_threads(cp); + cpu_intr_alloc(cp, NINTR_THREADS); /* * Add CPU to list of available CPUs. It'll be on the active list * after mp_startup(). diff --git a/usr/src/uts/i86pc/os/startup.c b/usr/src/uts/i86pc/os/startup.c index f097b4357c..1bfb1b0e7f 100644 --- a/usr/src/uts/i86pc/os/startup.c +++ b/usr/src/uts/i86pc/os/startup.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -430,8 +429,6 @@ static pgcnt_t kphysm_init(page_t *, struct memseg *, pgcnt_t, pgcnt_t); * of kernelbase to balance out the need of user applications. */ -void init_intr_threads(struct cpu *); - /* real-time-clock initialization parameters */ long gmt_lag; /* offset in seconds of gmt to local time */ extern long process_rtc_config_file(void); @@ -1806,7 +1803,7 @@ startup_end(void) * support. */ setx86isalist(); - init_intr_threads(CPU); + cpu_intr_alloc(CPU, NINTR_THREADS); psm_install(); /* diff --git a/usr/src/uts/i86pc/sys/machcpuvar.h b/usr/src/uts/i86pc/sys/machcpuvar.h index f339b97951..696ede7bf1 100644 --- a/usr/src/uts/i86pc/sys/machcpuvar.h +++ b/usr/src/uts/i86pc/sys/machcpuvar.h @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -100,6 +99,8 @@ struct machcpu { #endif }; +#define NINTR_THREADS (LOCK_LEVEL-1) /* number of interrupt threads */ + #endif /* _ASM */ #define cpu_nodeid cpu_m.mcpu_nodeid diff --git a/usr/src/uts/i86pc/sys/machsystm.h b/usr/src/uts/i86pc/sys/machsystm.h index 8dc5c5414b..43a3a94df1 100644 --- a/usr/src/uts/i86pc/sys/machsystm.h +++ b/usr/src/uts/i86pc/sys/machsystm.h @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -55,9 +54,6 @@ extern void mp_halt(char *); extern int Cpudelay; extern void setcpudelay(void); -extern void init_intr_threads(struct cpu *); -extern void init_clock_thread(void); - extern void send_dirint(int, int); extern void siron(void); diff --git a/usr/src/uts/sun4/os/intr.c b/usr/src/uts/sun4/os/intr.c index 6822380c39..da388da912 100644 --- a/usr/src/uts/sun4/os/intr.c +++ b/usr/src/uts/sun4/os/intr.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -20,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -362,19 +361,6 @@ send_dirint( xt_one(cpuix, setsoftint_tl1, intr_id, 0); } -void -init_intr_threads(struct cpu *cp) -{ - int i; - - for (i = 0; i < NINTR_THREADS; i++) - thread_create_intr(cp); - - cp->cpu_intr_stack = (caddr_t)segkp_get(segkp, INTR_STACK_SIZE, - KPD_HASREDZONE | KPD_NO_ANON | KPD_LOCKED) + - INTR_STACK_SIZE - SA(MINFRAME); -} - /* * Take the specified CPU out of participation in interrupts. * Called by p_online(2) when a processor is being taken off-line. diff --git a/usr/src/uts/sun4/os/mp_startup.c b/usr/src/uts/sun4/os/mp_startup.c index a121dee913..edc3b5b785 100644 --- a/usr/src/uts/sun4/os/mp_startup.c +++ b/usr/src/uts/sun4/os/mp_startup.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -20,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -305,7 +304,6 @@ setup_cpu_common(int cpuid) #endif /* TRAPTRACE */ extern void idle(); - extern void init_intr_threads(struct cpu *); ASSERT(MUTEX_HELD(&cpu_lock)); ASSERT(cpu[cpuid] == NULL); @@ -411,7 +409,7 @@ setup_cpu_common(int cpuid) * Initialize the interrupt threads for this CPU */ init_intr_pool(cp); - init_intr_threads(cp); + cpu_intr_alloc(cp, NINTR_THREADS); /* * Add CPU to list of available CPUs. diff --git a/usr/src/uts/sun4/os/startup.c b/usr/src/uts/sun4/os/startup.c index d4f5627430..11a467dca8 100644 --- a/usr/src/uts/sun4/os/startup.c +++ b/usr/src/uts/sun4/os/startup.c @@ -3,7 +3,7 @@ * * The contents of this file are subject to the terms of the * Common Development and Distribution License (the "License"). - * You may not use this file except in compliance *with the License. + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -2124,7 +2124,7 @@ startup_end(void) /* * Initialize interrupt related stuff */ - init_intr_threads(CPU); + cpu_intr_alloc(CPU, NINTR_THREADS); (void) splzs(); /* allow hi clock ints but not zs */ diff --git a/usr/src/uts/sun4/sys/intr.h b/usr/src/uts/sun4/sys/intr.h index 0e94c60508..3a3dfd976c 100644 --- a/usr/src/uts/sun4/sys/intr.h +++ b/usr/src/uts/sun4/sys/intr.h @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -20,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 1994, 1997-2002 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -42,11 +41,6 @@ extern "C" { #define INTR_POOL_SIZE (sizeof (struct intr_req) * INTR_PENDING_MAX) /* - * Allocate threads and stacks for interrupt handling. - */ -#define NINTR_THREADS (LOCK_LEVEL) /* number of interrupt threads */ - -/* * Each cpu allocates two arrays, intr_head[] and intr_tail[], with the size of * PIL_LEVELS each. * diff --git a/usr/src/uts/sun4u/sys/machcpuvar.h b/usr/src/uts/sun4u/sys/machcpuvar.h index 7351430049..641154b543 100644 --- a/usr/src/uts/sun4u/sys/machcpuvar.h +++ b/usr/src/uts/sun4u/sys/machcpuvar.h @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -20,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -135,6 +134,7 @@ struct machcpu { typedef struct machcpu machcpu_t; #define cpu_startup_thread cpu_m.startup_thread +#define NINTR_THREADS (LOCK_LEVEL) /* number of interrupt threads */ /* * Macro to access the "cpu private" data structure. diff --git a/usr/src/uts/sun4u/sys/machsystm.h b/usr/src/uts/sun4u/sys/machsystm.h index 2150c56334..f9b5458938 100644 --- a/usr/src/uts/sun4u/sys/machsystm.h +++ b/usr/src/uts/sun4u/sys/machsystm.h @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -20,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -213,7 +212,6 @@ extern struct intr_req *intr_add_head; extern struct intr_req *intr_add_tail; extern struct scb *set_tbr(struct scb *); -extern void init_intr_threads(struct cpu *); extern uint_t disable_vec_intr(void); extern void enable_vec_intr(uint_t); extern void setintrenable(int); diff --git a/usr/src/uts/sun4v/sys/machcpuvar.h b/usr/src/uts/sun4v/sys/machcpuvar.h index a49e693e17..24050ea18f 100644 --- a/usr/src/uts/sun4v/sys/machcpuvar.h +++ b/usr/src/uts/sun4v/sys/machcpuvar.h @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -20,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -164,6 +163,7 @@ struct machcpu { typedef struct machcpu machcpu_t; #define cpu_startup_thread cpu_m.startup_thread +#define NINTR_THREADS (LOCK_LEVEL) /* number of interrupt threads */ /* * Macro to access the "cpu private" data structure. diff --git a/usr/src/uts/sun4v/sys/machsystm.h b/usr/src/uts/sun4v/sys/machsystm.h index 01e5699f8b..64d6e5dd8f 100644 --- a/usr/src/uts/sun4v/sys/machsystm.h +++ b/usr/src/uts/sun4v/sys/machsystm.h @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -20,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -213,7 +212,6 @@ extern struct intr_req *intr_add_head; extern struct intr_req *intr_add_tail; extern struct scb *set_tbr(struct scb *); -extern void init_intr_threads(struct cpu *); extern uint_t disable_vec_intr(void); extern void enable_vec_intr(uint_t); extern void setintrenable(int); |