From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dario Faggioli Subject: Re: [v3 07/15] vmx: Initialize VT-d Posted-Interrupts Descriptor Date: Tue, 30 Jun 2015 04:32:01 +0200 Message-ID: <1435631521.25170.256.camel@citrix.com> References: <1435123109-10481-1-git-send-email-feng.wu@intel.com> <1435123109-10481-8-git-send-email-feng.wu@intel.com> <5591651D.1060707@citrix.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0969484966720191001==" Return-path: In-Reply-To: <5591651D.1060707@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 --===============0969484966720191001== Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-nipqXd4pe/4Q3DrqxrH+" --=-nipqXd4pe/4Q3DrqxrH+ Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Mon, 2015-06-29 at 16:32 +0100, Andrew Cooper wrote: > On 24/06/15 06:18, Feng Wu wrote: > > diff --git a/xen/arch/x86/hvm/vmx/vmcs.c b/xen/arch/x86/hvm/vmx/vmcs.c > > index 3aff365..11dc1b5 100644 > > --- a/xen/arch/x86/hvm/vmx/vmcs.c > > +++ b/xen/arch/x86/hvm/vmx/vmcs.c > > @@ -40,6 +40,7 @@ > > #include > > #include > > #include > > +#include > > =20 > > static bool_t __read_mostly opt_vpid_enabled =3D 1; > > boolean_param("vpid", opt_vpid_enabled); > > @@ -921,6 +922,20 @@ void virtual_vmcs_vmwrite(void *vvmcs, u32 vmcs_en= coding, u64 val) > > virtual_vmcs_exit(vvmcs); > > } > > =20 > > +static void pi_desc_init(struct vcpu *v) > > +{ > > + uint32_t dest; > > + > > + v->arch.hvm_vmx.pi_desc.nv =3D posted_intr_vector; > > + > > + dest =3D cpu_physical_id(v->processor); >=20 > I am fairly sure that this is not a safe use of v->processor.=20 > Everything else in this patch looks fine, but I would like review from > people more familiar with scheduling. >=20 It is unsafe, IMO. However, this is called by vcpu_initialise(), within alloc_vcpu(), which is in turn triggered by XEN_DOMCTL_max_vcpus. When we get to there, the vcpu is RUNSTATE_offline, it's got _VPF_down in pause_flags, and the whole domain is paused. Honestly, I don't think there are many chances that v->processor changes under our feet, in this case. A comment, explaining this quickly, would be useful, though, I think. George? In any case, even if v->processor would be at risk of fluctuating, Feng, what's the risk of going live with a spurious content in dest? Is it just that the first posted interrupt will be consumed by the wrong vCPU, but after that, things will settle properly? If yes, I think that would be ok too (but really, I think things are safe, although by chance, in this case). Regards, Dario --=20 <> (Raistlin Majere) ----------------------------------------------------------------- Dario Faggioli, Ph.D, http://about.me/dario.faggioli Senior Software Engineer, Citrix Systems R&D Ltd., Cambridge (UK) --=-nipqXd4pe/4Q3DrqxrH+ 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 iEYEABECAAYFAlWR/6EACgkQk4XaBE3IOsQJkQCgnO3FedS5yVTAA1Up9aqLeYQN JikAn1hJi4wwswxxGFfIGm/VyWYDKGKo =WBhL -----END PGP SIGNATURE----- --=-nipqXd4pe/4Q3DrqxrH+-- --===============0969484966720191001== 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 --===============0969484966720191001==--