From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dario Faggioli Subject: Re: [PATCH] xen: credit1: fix tickling when it happens from a remote pCPU Date: Thu, 24 Sep 2015 11:52:08 +0200 Message-ID: <1443088328.3276.28.camel@citrix.com> References: <20150924043127.10326.62756.stgit@Solace.station> <5603DE7C02000078000A52C7@prv-mh.provo.novell.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============2004184399519487970==" Return-path: Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1Zf3CO-0002Pm-I9 for xen-devel@lists.xenproject.org; Thu, 24 Sep 2015 09:52:20 +0000 In-Reply-To: <5603DE7C02000078000A52C7@prv-mh.provo.novell.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: Jan Beulich Cc: George Dunlap , xen-devel@lists.xenproject.org, Juergen Gross List-Id: xen-devel@lists.xenproject.org --===============2004184399519487970== Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-vEZAY+/lolCd6ZlUF/5u" --=-vEZAY+/lolCd6ZlUF/5u Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, 2015-09-24 at 03:29 -0600, Jan Beulich wrote: > > > > On 24.09.15 at 06:31, wrote: > > --- a/xen/common/sched_credit.c > > +++ b/xen/common/sched_credit.c > > #define csched_balance_mask (CSCHED_PCPU(smp_processor_id()) > > ->balance_mask) > > =20 > > +#define csched_balance_mask_cpu(c) (CSCHED_PCPU(c)->balance_mask) >=20 > csched_runq_steal() gets called with peer_cpu's runqueue lock held > afaics, but uses smp_processor_id()'s balance_mask. I.e. it looks to > me that what J=C3=BCrgen suggested as an option is actually a requirement= . >=20 And I'm very much agreeable on taking his suggestion, because I actually like it. Correctness should not be an issue, though. In fact, here is the story about csched_runq_steal(): schedule() cpu =3D smp_processor_id() lock =3D pcpu_schedule_lock_irq(cpu); sched =3D this_cpu(scheduler); next_slice =3D sched->do_schedule(sched, ...);=20 | --> csched_schedule() cpu =3D smp_processor_id(); snext =3D csched_load_balance(..., cpu, ...); peer_cpu =3D xxx; lock =3D pcpu_schedule_trylock(peer_cpu); speer =3D csched_runq_steal(peer_cpu, cpu, ...); csched_balance_cpumask(..., csched_balance_mask); pcpu_schedule_unlock(lock, peer_cpu); pcpu_schedule_unlock_irq(lock, cpu); So, we can safely use smp_processor_id()'s scratch space, as we own its runqueue lock too. In any case, thanks a lot for having a look. Dario --=20 <> (Raistlin Majere) ----------------------------------------------------------------- Dario Faggioli, Ph.D, http://about.me/dario.faggioli Senior Software Engineer, Citrix Systems R&D Ltd., Cambridge (UK) --=-vEZAY+/lolCd6ZlUF/5u 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 v1 iEYEABECAAYFAlYDx8kACgkQk4XaBE3IOsSyvgCgl65YDT/yHMHyzaw8+u+O5oKf YLMAoJqzV8GMpnSrfBCxRZvPgNTwm19S =MmOL -----END PGP SIGNATURE----- --=-vEZAY+/lolCd6ZlUF/5u-- --===============2004184399519487970== 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 --===============2004184399519487970==--