From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dario Faggioli Subject: Re: [PATCH v8]xen: sched: convert RTDS from time to event driven model Date: Mon, 14 Mar 2016 12:58:07 +0100 Message-ID: <1457956687.3102.657.camel@citrix.com> References: <1457724196-4760-1-git-send-email-tiche@seas.upenn.edu> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============6925627485888005904==" Return-path: Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.84) (envelope-from ) id 1afR8e-0006GE-GH for xen-devel@lists.xenproject.org; Mon, 14 Mar 2016 11:58:20 +0000 In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" To: Meng Xu , Tianyang Chen Cc: "xen-devel@lists.xenproject.org" , George Dunlap , Dagaen Golomb List-Id: xen-devel@lists.xenproject.org --===============6925627485888005904== Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-hvW8AOFo8LK4dJ4N9T39" --=-hvW8AOFo8LK4dJ4N9T39 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, 2016-03-11 at 23:54 -0500, Meng Xu wrote: >=C2=A0 > > @@ -1150,6 +1300,101 @@ rt_dom_cntl( > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0return rc; > > =C2=A0} > >=20 > > +/* > > + * The replenishment timer handler picks vcpus > > + * from the replq and does the actual replenishment. > > + */ > > +static void repl_handler(void *data){ > > +=C2=A0=C2=A0=C2=A0=C2=A0unsigned long flags; > > +=C2=A0=C2=A0=C2=A0=C2=A0s_time_t now =3D NOW(); > > +=C2=A0=C2=A0=C2=A0=C2=A0struct scheduler *ops =3D data; > > +=C2=A0=C2=A0=C2=A0=C2=A0struct rt_private *prv =3D rt_priv(ops); > > +=C2=A0=C2=A0=C2=A0=C2=A0struct list_head *replq =3D rt_replq(ops); > > +=C2=A0=C2=A0=C2=A0=C2=A0struct list_head *runq =3D rt_runq(ops); > > +=C2=A0=C2=A0=C2=A0=C2=A0struct timer *repl_timer =3D prv->repl_timer; > > +=C2=A0=C2=A0=C2=A0=C2=A0struct list_head *iter, *tmp; > > +=C2=A0=C2=A0=C2=A0=C2=A0struct list_head tmp_replq; > > +=C2=A0=C2=A0=C2=A0=C2=A0struct rt_vcpu *svc =3D NULL; > > + > > +=C2=A0=C2=A0=C2=A0=C2=A0spin_lock_irqsave(&prv->lock, flags); > Hmm, I haven't thought hard about the choice between > spin_lock_irqsave() and spin_lock_irq(), before. >=20 > Hi Dario, > Is it better to use spin_lock_irqsave() or spin_lock_irq() at this > place? >=20 Just very quickly about this (I'll comment about the rest of the patch later). > I'm not quite sure if the handler can be called in an interrupt > disabled context? Can it? > I recommend looking at what happens inside init_timer(), i.e., where a pointer to this function is stashed. Then, still in xen/common/timer.c, check where this (and, in general, a timer handling function provided to timer_init()) is actually invoked. When you'll find that spot, the answer to whether spin_lock_irq() is safe or not in here, will appear quite evident. :-) > When I used the spin_lock_irq(save), I just refered to what credit2 > scheduler does, but didn't think hard enough about which one has > better performance. > I'm not sure what you mean when you talk about Credit2, as there are no timers in there. In any case, it is indeed the case that, if just _irq() is safe, we should use it, as it's cheaper. Regards, Dario --=20 <> (Raistlin Majere) ----------------------------------------------------------------- Dario Faggioli, Ph.D, http://about.me/dario.faggioli Senior Software Engineer, Citrix Systems R&D Ltd., Cambridge (UK) --=-hvW8AOFo8LK4dJ4N9T39 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 iEYEABECAAYFAlbmp1AACgkQk4XaBE3IOsQzygCdFEo78q4u9sKYFxPdxsFb8B3t QCAAoKaCLUYbKY39mmiHRKi51muMZJBe =1ehj -----END PGP SIGNATURE----- --=-hvW8AOFo8LK4dJ4N9T39-- --===============6925627485888005904== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KWGVuLWRldmVs IG1haWxpbmcgbGlzdApYZW4tZGV2ZWxAbGlzdHMueGVuLm9yZwpodHRwOi8vbGlzdHMueGVuLm9y Zy94ZW4tZGV2ZWwK --===============6925627485888005904==--