From owner-p4-projects@FreeBSD.ORG Mon Apr 3 07:23:21 2006 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 0338416A422; Mon, 3 Apr 2006 07:23:21 +0000 (UTC) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B397016A41F for ; Mon, 3 Apr 2006 07:23:20 +0000 (UTC) (envelope-from kmacy@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 77BC343D45 for ; Mon, 3 Apr 2006 07:23:20 +0000 (GMT) (envelope-from kmacy@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.1/8.13.1) with ESMTP id k337NJmh058396 for ; Mon, 3 Apr 2006 07:23:20 GMT (envelope-from kmacy@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.1/8.13.1/Submit) id k337NJsJ058392 for perforce@freebsd.org; Mon, 3 Apr 2006 07:23:19 GMT (envelope-from kmacy@freebsd.org) Date: Mon, 3 Apr 2006 07:23:19 GMT Message-Id: <200604030723.k337NJsJ058392@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to kmacy@freebsd.org using -f From: Kip Macy To: Perforce Change Reviews Cc: Subject: PERFORCE change 94516 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Apr 2006 07:23:21 -0000 http://perforce.freebsd.org/chv.cgi?CH=94516 Change 94516 by kmacy@kmacy_storage:sun4v_work on 2006/04/03 07:22:38 create separate intrq_alloc function so that per-cpu queues are pre-allocated before cpu_mp_bootstrap initialize IPIs locally Affected files ... .. //depot/projects/kmacy_sun4v/src/sys/sun4v/sun4v/intr_machdep.c#5 edit Differences ... ==== //depot/projects/kmacy_sun4v/src/sys/sun4v/sun4v/intr_machdep.c#5 (text+ko) ==== @@ -74,12 +74,14 @@ #include #include #include +#include #include #include #include #include #include +#include #include #include @@ -119,14 +121,25 @@ int cpu_q_entries = 128; int dev_q_entries = 128; +static vm_offset_t *mondo_data_array; +static vm_offset_t *cpu_list_array; +static vm_offset_t *cpu_q_array; +static vm_offset_t *dev_q_array; +static vm_offset_t *rq_array; +static vm_offset_t *nrq_array; +static int cpu_list_size; + + + /* protect the intr_vectors table */ static struct mtx intr_table_lock; static void intr_execute_handlers(void *); static void intr_stray_level(struct trapframe *); static void intr_stray_vector(void *); -static int intrcnt_setname(const char *, int); +static int intrcnt_setname(const char *, int); static void intrcnt_updatename(int, const char *, int); +static void cpu_intrq_alloc(void); /* * not MPSAFE @@ -207,7 +220,7 @@ intr_stray_level(struct trapframe *tf) { - printf("stray level interrupt\n"); + printf("stray level interrupt - pil=%ld\n", tf->tf_pil); } static void @@ -240,8 +253,14 @@ intr_vectors[i].iv_vec = i; } intr_handlers[PIL_LOW] = intr_fast; + +#ifdef SMP + intr_handlers[PIL_AST] = cpu_ipi_ast; + intr_handlers[PIL_RENDEZVOUS] = (ih_func_t *)smp_rendezvous_action; + intr_handlers[PIL_STOP]= cpu_ipi_stop; +#endif mtx_init(&intr_table_lock, "intr table", NULL, MTX_SPIN); - + cpu_intrq_alloc(); cpu_intrq_init(); } @@ -365,42 +384,64 @@ /* * Allocate and register intrq fields */ +static void +cpu_intrq_alloc(void) +{ + + + + mondo_data_array = malloc(INTR_REPORT_SIZE*MAXCPU, M_DEVBUF, M_WAITOK | M_ZERO); + PANIC_IF(mondo_data_array == NULL); + + cpu_list_size = CPU_LIST_SIZE > INTR_REPORT_SIZE ? CPU_LIST_SIZE : INTR_REPORT_SIZE; + cpu_list_array = malloc(cpu_list_size*MAXCPU, M_DEVBUF, M_WAITOK | M_ZERO); + PANIC_IF(cpu_list_array == NULL); + + cpu_q_array = malloc(INTR_CPU_Q_SIZE*MAXCPU, M_DEVBUF, M_WAITOK | M_ZERO); + PANIC_IF(cpu_q_array == NULL); + + dev_q_array = malloc(INTR_DEV_Q_SIZE*MAXCPU, M_DEVBUF, M_WAITOK | M_ZERO); + PANIC_IF(dev_q_array == NULL); + + rq_array = malloc(2*CPU_RQ_SIZE*MAXCPU, M_DEVBUF, M_WAITOK | M_ZERO); + PANIC_IF(rq_array == NULL); + + nrq_array = malloc(2*CPU_NRQ_SIZE*MAXCPU, M_DEVBUF, M_WAITOK | M_ZERO); + PANIC_IF(nrq_array == NULL); + +} + void cpu_intrq_init() { - + uint64_t error; - int cpu_list_size; - pcpup->pc_mondo_data = malloc(INTR_REPORT_SIZE, M_DEVBUF, M_WAITOK | M_ZERO); - PANIC_IF(pcpup->pc_mondo_data == NULL) + pcpup->pc_mondo_data = mondo_data_array + curcpu*INTR_REPORT_SIZE; pcpup->pc_mondo_data_ra = vtophys(pcpup->pc_mondo_data); - cpu_list_size = CPU_LIST_SIZE > INTR_REPORT_SIZE ? CPU_LIST_SIZE : INTR_REPORT_SIZE; - pcpup->pc_cpu_list = malloc(cpu_list_size, M_DEVBUF, M_WAITOK | M_ZERO); - PANIC_IF(pcpup->pc_cpu_list == NULL) + pcpup->pc_cpu_list = cpu_list_array + curcpu*cpu_list_size; + pcpup->pc_cpu_list_ra = vtophys(pcpup->pc_cpu_list); - pcpup->pc_cpu_q = malloc(INTR_CPU_Q_SIZE, M_DEVBUF, M_WAITOK | M_ZERO); - PANIC_IF(pcpup->pc_cpu_q == NULL); + pcpup->pc_cpu_q = cpu_q_array + curcpu*INTR_CPU_Q_SIZE; + pcpup->pc_cpu_q_ra = vtophys(pcpup->pc_cpu_q); pcpup->pc_cpu_q_size = INTR_CPU_Q_SIZE; - pcpup->pc_dev_q = malloc(INTR_DEV_Q_SIZE, M_DEVBUF, M_WAITOK | M_ZERO); - PANIC_IF(pcpup->pc_dev_q == NULL); + pcpup->pc_dev_q = dev_q_array + curcpu*INTR_DEV_Q_SIZE; pcpup->pc_dev_q_ra = vtophys(pcpup->pc_dev_q); pcpup->pc_dev_q_size = INTR_DEV_Q_SIZE; - pcpup->pc_rq = malloc(2*CPU_RQ_SIZE, M_DEVBUF, M_WAITOK | M_ZERO); - PANIC_IF(pcpup->pc_rq == NULL); + pcpup->pc_rq = rq_array + curcpu*2*CPU_RQ_SIZE; pcpup->pc_rq_ra = vtophys(pcpup->pc_rq); pcpup->pc_rq_size = CPU_RQ_SIZE; - pcpup->pc_nrq = malloc(2*CPU_NRQ_SIZE, M_DEVBUF, M_WAITOK | M_ZERO); - PANIC_IF(pcpup->pc_nrq == NULL); + pcpup->pc_nrq = nrq_array + curcpu*2*CPU_NRQ_SIZE; pcpup->pc_nrq_ra = vtophys(pcpup->pc_nrq); pcpup->pc_nrq_size = CPU_NRQ_SIZE; + error = hv_cpu_qconf(Q(CPU_MONDO_QUEUE_HEAD), pcpup->pc_cpu_q_ra, cpu_q_entries); if (error != H_EOK) panic("cpu_mondo queue configuration failed: %lu", error); @@ -417,5 +458,4 @@ if (error != H_EOK) panic("non-resumable error queue configuration failed: %lu", error); - }