From owner-svn-src-all@FreeBSD.ORG Fri May 16 19:15:04 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 4381BBE9; Fri, 16 May 2014 19:15:04 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2F95C2F49; Fri, 16 May 2014 19:15:04 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s4GJF4xL043817; Fri, 16 May 2014 19:15:04 GMT (envelope-from cperciva@svn.freebsd.org) Received: (from cperciva@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s4GJF3DI043814; Fri, 16 May 2014 19:15:03 GMT (envelope-from cperciva@svn.freebsd.org) Message-Id: <201405161915.s4GJF3DI043814@svn.freebsd.org> From: Colin Percival Date: Fri, 16 May 2014 19:15:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r266268 - in stable/9/sys: amd64/include dev/xen/xenpci i386/include X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 May 2014 19:15:04 -0000 Author: cperciva Date: Fri May 16 19:15:03 2014 New Revision: 266268 URL: http://svnweb.freebsd.org/changeset/base/266268 Log: Change Xen event channel "last processed" values from per-CPU to global. In FreeBSD 9.x we only run this code on (virtual) CPU #0, so there is no need for these to be per-CPU values. Retain the values in the per-CPU data structure (when compiled with options XENHVM) for KBI compatibility. This is a direct commit to stable/9, since the relevant code has been substantially changed (in ways which cannot be easily MFCed) in HEAD and stable/10. Submitted by: royger (earlier version) Modified: stable/9/sys/amd64/include/pcpu.h stable/9/sys/dev/xen/xenpci/evtchn.c stable/9/sys/i386/include/pcpu.h Modified: stable/9/sys/amd64/include/pcpu.h ============================================================================== --- stable/9/sys/amd64/include/pcpu.h Fri May 16 18:44:23 2014 (r266267) +++ stable/9/sys/amd64/include/pcpu.h Fri May 16 19:15:03 2014 (r266268) @@ -43,6 +43,7 @@ #endif #ifdef XENHVM +/* This is now unused, but remains here for KBI compatibility reasons. */ #define PCPU_XEN_FIELDS \ ; \ unsigned int pc_last_processed_l1i; \ Modified: stable/9/sys/dev/xen/xenpci/evtchn.c ============================================================================== --- stable/9/sys/dev/xen/xenpci/evtchn.c Fri May 16 18:44:23 2014 (r266267) +++ stable/9/sys/dev/xen/xenpci/evtchn.c Fri May 16 19:15:03 2014 (r266268) @@ -68,6 +68,9 @@ static inline unsigned long __ffs(unsign #define is_valid_evtchn(x) ((x) != 0) #define evtchn_from_irq(x) (irq_evtchn[irq].evtchn) +static unsigned int last_processed_l1i; +static unsigned int last_processed_l2i; + static struct { struct mtx lock; driver_intr_t *handler; @@ -317,7 +320,6 @@ evtchn_interrupt(void *arg) int irq, handler_mpsafe; shared_info_t *s = HYPERVISOR_shared_info; vcpu_info_t *v = &s->vcpu_info[cpu]; - struct pcpu *pc = pcpu_find(cpu); unsigned long l1, l2; v->evtchn_upcall_pending = 0; @@ -331,8 +333,8 @@ evtchn_interrupt(void *arg) l1 = atomic_readandclear_long(&v->evtchn_pending_sel); - l1i = pc->pc_last_processed_l1i; - l2i = pc->pc_last_processed_l2i; + l1i = last_processed_l1i; + l2i = last_processed_l2i; while (l1 != 0) { @@ -392,8 +394,8 @@ evtchn_interrupt(void *arg) mtx_unlock(&irq_evtchn[irq].lock); /* if this is the final port processed, we'll pick up here+1 next time */ - pc->pc_last_processed_l1i = l1i; - pc->pc_last_processed_l2i = l2i; + last_processed_l1i = l1i; + last_processed_l2i = l2i; } while (l2i != LONG_BIT - 1); @@ -442,7 +444,7 @@ irq_resume(void) int xenpci_irq_init(device_t device, struct xenpci_softc *scp) { - int irq, cpu; + int irq; int error; mtx_init(&irq_alloc_lock, "xen-irq-lock", NULL, MTX_DEF); @@ -450,10 +452,8 @@ xenpci_irq_init(device_t device, struct for (irq = 0; irq < ARRAY_SIZE(irq_evtchn); irq++) mtx_init(&irq_evtchn[irq].lock, "irq-evtchn", NULL, MTX_DEF); - for (cpu = 0; cpu < mp_ncpus; cpu++) { - pcpu_find(cpu)->pc_last_processed_l1i = LONG_BIT - 1; - pcpu_find(cpu)->pc_last_processed_l2i = LONG_BIT - 1; - } + last_processed_l1i = LONG_BIT - 1; + last_processed_l2i = LONG_BIT - 1; error = BUS_SETUP_INTR(device_get_parent(device), device, scp->res_irq, INTR_MPSAFE|INTR_TYPE_MISC, NULL, evtchn_interrupt, Modified: stable/9/sys/i386/include/pcpu.h ============================================================================== --- stable/9/sys/i386/include/pcpu.h Fri May 16 18:44:23 2014 (r266267) +++ stable/9/sys/i386/include/pcpu.h Fri May 16 19:15:03 2014 (r266268) @@ -78,6 +78,7 @@ struct shadow_time_info { #elif defined(XENHVM) +/* This is now unused, but remains here for KBI compatibility reasons. */ #define PCPU_XEN_FIELDS \ ; \ unsigned int pc_last_processed_l1i; \