svn commit: r266268 - in stable/9/sys: amd64/include dev/xen/xenpci i386/include
Colin Percival
cperciva at FreeBSD.org
Fri May 16 19:15:04 UTC 2014
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; \
More information about the svn-src-stable-9
mailing list