From owner-freebsd-current@FreeBSD.ORG Fri Jan 3 20:45:47 2014 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 72811ED6; Fri, 3 Jan 2014 20:45:47 +0000 (UTC) Received: from aserp1040.oracle.com (aserp1040.oracle.com [141.146.126.69]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 3323711A4; Fri, 3 Jan 2014 20:45:46 +0000 (UTC) Received: from acsinet22.oracle.com (acsinet22.oracle.com [141.146.126.238]) by aserp1040.oracle.com (Sentrion-MTA-4.3.1/Sentrion-MTA-4.3.1) with ESMTP id s03Kjb6N005543 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 3 Jan 2014 20:45:38 GMT Received: from aserz7022.oracle.com (aserz7022.oracle.com [141.146.126.231]) by acsinet22.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id s03Kjac9023439 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 3 Jan 2014 20:45:37 GMT Received: from abhmp0008.oracle.com (abhmp0008.oracle.com [141.146.116.14]) by aserz7022.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id s03Kja4t023432; Fri, 3 Jan 2014 20:45:36 GMT Received: from phenom.dumpdata.com (/50.195.21.189) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 03 Jan 2014 12:45:36 -0800 Received: by phenom.dumpdata.com (Postfix, from userid 1000) id 0A7541BFB02; Fri, 3 Jan 2014 15:45:35 -0500 (EST) Date: Fri, 3 Jan 2014 15:45:34 -0500 From: Konrad Rzeszutek Wilk To: Roger Pau Monne Subject: Re: [Xen-devel] [PATCH RFC 03/13] xen: mask event channels while changing affinity Message-ID: <20140103204534.GA2732@phenom.dumpdata.com> References: <1387884062-41154-1-git-send-email-roger.pau@citrix.com> <1387884062-41154-4-git-send-email-roger.pau@citrix.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1387884062-41154-4-git-send-email-roger.pau@citrix.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-Source-IP: acsinet22.oracle.com [141.146.126.238] X-Mailman-Approved-At: Sat, 04 Jan 2014 01:51:43 +0000 Cc: julien.grall@citrix.com, freebsd-xen@freebsd.org, freebsd-current@freebsd.org, kib@freebsd.org, xen-devel@lists.xenproject.org, gibbs@freebsd.org X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Jan 2014 20:45:47 -0000 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