From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dario Faggioli Subject: Re: [v3 12/15] vmx: posted-interrupt handling when vCPU is blocked Date: Wed, 1 Jul 2015 15:26:02 +0200 Message-ID: <1435757162.25170.354.camel@citrix.com> References: <1435123109-10481-1-git-send-email-feng.wu@intel.com> <1435123109-10481-13-git-send-email-feng.wu@intel.com> <55926B62.1000605@citrix.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============5897430464269455813==" Return-path: In-Reply-To: <55926B62.1000605@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Andrew Cooper Cc: kevin.tian@intel.com, keir@xen.org, george.dunlap@eu.citrix.com, xen-devel@lists.xen.org, jbeulich@suse.com, yang.z.zhang@intel.com, Feng Wu List-Id: xen-devel@lists.xenproject.org --===============5897430464269455813== Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-pZe9Q+E9qxIAmmI4uGrG" --=-pZe9Q+E9qxIAmmI4uGrG Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tue, 2015-06-30 at 11:11 +0100, Andrew Cooper wrote: > On 24/06/15 06:18, Feng Wu wrote: > > +/* > > + * Handle VT-d posted-interrupt when VCPU is blocked. > > + */ > > +static void pi_wakeup_interrupt(struct cpu_user_regs *regs) > > +{ > > + struct arch_vmx_struct *vmx; > > + unsigned int cpu =3D smp_processor_id(); > > + > > + spin_lock(&per_cpu(pi_blocked_vcpu_lock, cpu)); > > + > > + /* > > + * FIXME: The length of the list depends on how many > > + * vCPU is current blocked on this specific pCPU. > > + * This may hurt the interrupt latency if the list > > + * grows to too many entries. > > + */ > > + list_for_each_entry(vmx, &per_cpu(pi_blocked_vcpu, cpu), > > + pi_blocked_vcpu_list) > > + if ( vmx->pi_desc.on ) > > + tasklet_schedule(&vmx->pi_vcpu_wakeup_tasklet); >=20 > There is a logical bug here. If we have two NV's delivered to this > pcpu, we will kick the first vcpu twice. >=20 > On finding desc.on, a kick should be scheduled, then the vcpu removed > from this list. With desc.on set, we know for certain that another NV > will not arrive for it until it has been scheduled again and the > interrupt posted. >=20 Yes, that seems a possible issue (and one that should indeed be avoided). I'm still unsure about the one that I raised myself but, if it is possible to have more than one vcpu in a pcpu list, with desc.on=3D=3Dtrue, then it looks to me that we kick all of them, for each notification. Added what Andrew's spotted, if there are a bunch of vcpus, queued with desc.on=3D=3Dture, and a bunch of notifications arrives before the tasklet gets executed, we'll be kicking the whole bunch of them for a bunch of times! :-/ Regards, Dario --=20 <> (Raistlin Majere) ----------------------------------------------------------------- Dario Faggioli, Ph.D, http://about.me/dario.faggioli Senior Software Engineer, Citrix Systems R&D Ltd., Cambridge (UK) --=-pZe9Q+E9qxIAmmI4uGrG Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iEYEABECAAYFAlWT6moACgkQk4XaBE3IOsQpTACeJtpxA9u3Gm7+Lh4zLLVPvWOV S4EAn1EIoQSugaR1fhNkCiztVQJnNqIe =gnko -----END PGP SIGNATURE----- --=-pZe9Q+E9qxIAmmI4uGrG-- --===============5897430464269455813== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel --===============5897430464269455813==--