Date: Fri, 3 Jan 2014 15:45:34 -0500 From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> To: Roger Pau Monne <roger.pau@citrix.com> Cc: jhb@freebsd.org, julien.grall@citrix.com, freebsd-xen@freebsd.org, freebsd-current@freebsd.org, kib@freebsd.org, xen-devel@lists.xenproject.org, gibbs@freebsd.org Subject: Re: [Xen-devel] [PATCH RFC 03/13] xen: mask event channels while changing affinity Message-ID: <20140103204534.GA2732@phenom.dumpdata.com> In-Reply-To: <1387884062-41154-4-git-send-email-roger.pau@citrix.com> References: <1387884062-41154-1-git-send-email-roger.pau@citrix.com> <1387884062-41154-4-git-send-email-roger.pau@citrix.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Dec 24, 2013 at 12:20:52PM +0100, Roger Pau Monne wrote: > Event channels should be masked while chaning affinity, or else we changing > might get spurious/lost interrupts. > --- > sys/x86/xen/xen_intr.c | 15 ++++++++++++--- > 1 files changed, 12 insertions(+), 3 deletions(-) > > diff --git a/sys/x86/xen/xen_intr.c b/sys/x86/xen/xen_intr.c > index fd36e68..bc0781e 100644 > --- a/sys/x86/xen/xen_intr.c > +++ b/sys/x86/xen/xen_intr.c > @@ -797,7 +797,7 @@ xen_intr_assign_cpu(struct intsrc *base_isrc, u_int apic_id) > struct evtchn_bind_vcpu bind_vcpu; > struct xenisrc *isrc; > u_int to_cpu, vcpu_id; > - int error; > + int error, masked; > > #ifdef XENHVM > if (xen_vector_callback_enabled == 0) > @@ -815,6 +815,12 @@ xen_intr_assign_cpu(struct intsrc *base_isrc, u_int apic_id) > return (EINVAL); > } > > + /* > + * Mask the event channel port so we don't receive spurious events > + * while changing affinity. > + */ > + masked = evtchn_test_and_set_mask(isrc->xi_port); > + > if ((isrc->xi_type == EVTCHN_TYPE_VIRQ) || > (isrc->xi_type == EVTCHN_TYPE_IPI)) { > /* > @@ -825,8 +831,7 @@ xen_intr_assign_cpu(struct intsrc *base_isrc, u_int apic_id) > evtchn_cpu_mask_port(isrc->xi_cpu, isrc->xi_port); > isrc->xi_cpu = to_cpu; > evtchn_cpu_unmask_port(isrc->xi_cpu, isrc->xi_port); > - mtx_unlock(&xen_intr_isrc_lock); > - return (0); > + goto out; > } > > bind_vcpu.port = isrc->xi_port; > @@ -848,6 +853,10 @@ xen_intr_assign_cpu(struct intsrc *base_isrc, u_int apic_id) > evtchn_cpu_mask_port(to_cpu, isrc->xi_port); > } > } > + > +out: > + if (!masked) > + evtchn_unmask_port(isrc->xi_port); > mtx_unlock(&xen_intr_isrc_lock); > return (0); > #else > -- > 1.7.7.5 (Apple Git-26) > > > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xen.org > http://lists.xen.org/xen-devel
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20140103204534.GA2732>