From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dario Faggioli Subject: Re: [PATCH 4/9] xen: sched: add .init_pdata hook to the scheduler interface Date: Thu, 1 Oct 2015 08:33:17 +0200 Message-ID: <1443681197.3276.163.camel@citrix.com> References: <20150929164726.17589.96920.stgit@Solace.station> <20150929165556.17589.62924.stgit@Solace.station> <560CC2EC.6030801@suse.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============3641244138952589565==" Return-path: Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1ZhXQx-0006Xw-3z for xen-devel@lists.xenproject.org; Thu, 01 Oct 2015 06:33:39 +0000 In-Reply-To: <560CC2EC.6030801@suse.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: Juergen Gross , xen-devel@lists.xenproject.org Cc: George Dunlap List-Id: xen-devel@lists.xenproject.org --===============3641244138952589565== Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-gUFgG3sVnyxodsZuSWk9" --=-gUFgG3sVnyxodsZuSWk9 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, 2015-10-01 at 07:21 +0200, Juergen Gross wrote: > On 09/29/2015 06:55 PM, Dario Faggioli wrote: > > --- a/xen/common/schedule.c > > +++ b/xen/common/schedule.c > > @@ -1407,6 +1407,9 @@ static int cpu_schedule_callback( > >=20 > > switch ( action ) > > { > > + case CPU_STARTING: > > + SCHED_OP(&ops, init_pdata, cpu); > > + break; > > case CPU_UP_PREPARE: > > rc =3D cpu_schedule_up(cpu); > > break; > > @@ -1484,6 +1487,7 @@ void __init scheduler_init(void) > > if ( ops.alloc_pdata && > > !(this_cpu(schedule_data).sched_priv =3D > > ops.alloc_pdata(&ops, 0)) ) > > BUG(); > > + SCHED_OP(&ops, init_pdata, 0); >=20 > You can't call this without having it set in all schedulers. >=20 > I guess using the init_pdata hook has to be introduced after or in > patch 5. >=20 But, if it is not set, it is NULL, in which case, SCHED_OP does the trick for me, doesn't it? #define SCHED_OP(opsptr, fn, ...) = \ (( (opsptr)->fn !=3D NULL ) ? (opsptr)->fn(opsptr, ##__VA_ARGS__ )= \ : (typeof((opsptr)->fn(opsptr, ##__VA_ARGS__)))0 ) AFAICT, the cases where we want to be absolutely sure whether the hook "exists" is when we care about its return value, especially if it may return NULL to report an error (like, for instance, alloc_pdata()), as that would make it impossible to distinguish between "hook not there" and "hook failed". All other cases, should be fine handled like this. Thanks and Regards, Dario --=20 <> (Raistlin Majere) ----------------------------------------------------------------- Dario Faggioli, Ph.D, http://about.me/dario.faggioli Senior Software Engineer, Citrix Systems R&D Ltd., Cambridge (UK) --=-gUFgG3sVnyxodsZuSWk9 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 iEYEABECAAYFAlYM060ACgkQk4XaBE3IOsSC0gCghneYicLm8SZJ6aXCzM154OAO /sYAoJMloy31t+/UJByNex73SEjDElew =fi+t -----END PGP SIGNATURE----- --=-gUFgG3sVnyxodsZuSWk9-- --===============3641244138952589565== 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 --===============3641244138952589565==--