From mboxrd@z Thu Jan 1 00:00:00 1970 From: Keir Fraser Subject: Re: [PATCH 1/1] Add .adjust_global callback Date: Tue, 4 May 2010 17:18:06 +0100 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: quoted-printable Return-path: In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: George Dunlap , Kathy Hadley , "xen-devel@lists.xensource.com" List-Id: xen-devel@lists.xenproject.org For domctl/sysctl we do whatever gives the cleanest API, and bump the interface version number if the change is not backwards compatible. -- Keir On 04/05/2010 16:46, "George Dunlap" wrote: > Keir, the new SCHEDOP_adjust_global needs to have the cpupool_id so that = we > can call the "global" parameters for the right pool.=A0 Would it make sense= to > overload the domid in DOMCTL, making it the cpupool_id if the command is > XEN_DOMCTL_SCHEDOP_{get,put}_global_info?=A0 Or should we put it somewhere > else?=A0 I glanced around the other hypercalls, and nothing seems much bett= er; > the cpupools stuff is in the DOMCTL file anyway. >=20 > =A0-George >=20 > On Mon, May 3, 2010 at 10:29 PM, George Dunlap > wrote: >> Hmm, and it also needs to be adjusted for the new cpu pools stuff.=A0 I'll= take >> a look at it tomorrow. >> =A0-George >>=20 >>=20 >>=20 >>=20 >> On Mon, May 3, 2010 at 4:50 PM, George Dunlap >> wrote: >>> Also, the SCHEDOP needs an xsm callback; but I'm not an expert enough i= n the >>> xsm framework to say what it needs. >>>=20 >>> Other than that: >>>=20 >>> Acked-by: George Dunlap >>>=20 >>>=20 >>> On Mon, Apr 19, 2010 at 6:54 AM, Dulloor wrote: >>>> You don't have to explicitly set adjust_global to NULL for credit and = sedf. >>>>=20 >>>> -dulloor >>>>=20 >>>> On Mon, Apr 19, 2010 at 9:39 AM, Kathy Hadley >>>> wrote: >>>>> Resubmitting now that I have been added to the Xen-devel mailing list= . >>>>> =A0 >>>>> Kathy Hadley >>>>> DornerWorks, Ltd. >>>>> =A0 >>>>>=20 >>>>> From: Kathy Hadley >>>>> Sent: Friday, April 16, 2010 10:14 AM >>>>> To: 'xen-devel@lists.xensource.com' >>>>> Cc: 'Keir.Fraser@citrix.com' >>>>> Subject: [Xen-Devel] [PATCH 1/1] Add .adjust_global callback >>>>> =A0 >>>>> This patch adds an .adjust_global scheduler callback function, which >>>>> allows adjusting the global scheduler parameters (rather than just on= e >>>>> domain=B9s parameters).=A0 This patch supports the addition of an ARINC 6= 53 >>>>> scheduler (which will be submitted in a subsequent patch), and was >>>>> suggested by George Dunlap and Keir Fraser in response to an earlier = patch >>>>> (ref: [Xen-devel] [PATCH 1/1] Xen ARINC 653 scheduler). >>>>> =A0 >>>>> Thanks and regards, >>>>> =A0 >>>>> =A0 >>>>> =20 >>>>> Kathy Hadley >>>>> DornerWorks, Ltd. >>>>> Embedded Systems Engineering >>>>> =20 >>>>> 3445 Lake Eastbrook Blvd SE >>>>> Grand Rapids, MI=A0 49546 Direct: 616.389.6127 Tel:=A0=A0=A0=A0=A0 616.245.836= 9 >>>>> Fax:=A0=A0=A0=A0 616.245.8372 =A0 Kathy.Hadley@DornerWorks.com >>>>> www.DornerWorks.com >>>>> >>>>> Honored as one of the 2010 =B3Michigan 50 Companies to Watch=B2 >>>>> =A0 diff -rupN a/xen/common/domctl.c b/xen/common/domctl.c --- >>>>> a/xen/common/domctl.c=A0=A0=A0=A0=A0=A0=A0 2010-04-07 12:12:06.000000000 -0400 +++ >>>>> b/xen/common/domctl.c=A0=A0=A0=A0 2010-04-14 10:57:11.262796000 -0400 @@ -592= ,22 >>>>> +592,35 @@ long do_domctl(XEN_GUEST_HANDLE(xen_domc =A0 =A0=A0=A0=A0 case >>>>> XEN_DOMCTL_scheduler_op: =A0=A0=A0=A0 { -=A0=A0=A0=A0=A0=A0=A0 struct domain *d; - -=A0=A0=A0=A0=A0=A0=A0= ret >>>>> =3D -ESRCH; -=A0=A0=A0=A0=A0=A0=A0 if ( (d =3D rcu_lock_domain_by_id(op->domain)) =3D=3D NU= LL ) >>>>> -=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 break; +=A0=A0=A0=A0=A0=A0=A0 if ( (op->u.scheduler_op.cmd =3D=3D >>>>> XEN_DOMCTL_SCHEDOP_put_global_info) +=A0=A0=A0=A0=A0=A0=A0=A0=A0 || (op->u.scheduler_op= .cmd >>>>> =3D=3D XEN_DOMCTL_SCHEDOP_get_global_info) ) +=A0=A0=A0=A0=A0=A0=A0 { +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 ret = =3D >>>>> sched_adjust_global(&op->u.scheduler_op); +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 if >>>>> (op->u.scheduler_op.cmd =3D=3D XEN_DOMCTL_SCHEDOP_get_global_info) >>>>> +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 { +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 if ( copy_to_guest(u_domctl, op, 1) ) >>>>> +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 ret =3D -EFAULT; +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 } +=A0=A0=A0=A0=A0=A0=A0 } +=A0=A0=A0=A0=A0=A0= =A0 >>>>> else +=A0=A0=A0=A0=A0=A0=A0 { +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 struct domain *d; =A0 -=A0=A0=A0=A0=A0=A0=A0 ret =3D >>>>> xsm_scheduler(d); -=A0=A0=A0=A0=A0=A0=A0 if ( ret ) -=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 goto scheduler_op_= out; >>>>> +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 ret =3D -ESRCH; +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 if ( (d =3D >>>>> rcu_lock_domain_by_id(op->domain)) =3D=3D NULL ) +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 break; = =A0 >>>>> -=A0=A0=A0=A0=A0=A0=A0 ret =3D sched_adjust(d, &op->u.scheduler_op); -=A0=A0=A0=A0=A0=A0=A0 if ( >>>>> copy_to_guest(u_domctl, op, 1) ) -=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 ret =3D -EFAULT; +=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0 >>>>> ret =3D xsm_scheduler(d); +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 if ( ret ) +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 goto >>>>> scheduler_op_out; + +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 ret =3D sched_adjust(d, >>>>> &op->u.scheduler_op); +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 if ( copy_to_guest(u_domctl, op, 1= ) ) >>>>> +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 ret =3D -EFAULT; =A0 -=A0=A0=A0 scheduler_op_out: -=A0=A0=A0=A0=A0=A0=A0 >>>>> rcu_unlock_domain(d); +=A0=A0=A0=A0=A0=A0=A0 scheduler_op_out: +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 >>>>> rcu_unlock_domain(d); +=A0=A0=A0=A0=A0=A0=A0 } =A0=A0=A0=A0 } =A0=A0=A0=A0 break; =A0 diff -rupN >>>>> a/xen/common/sched_credit.c b/xen/common/sched_credit.c --- >>>>> a/xen/common/sched_credit.c=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 2010-04-07 12:12:06.000000000 -= 0400 >>>>> +++ b/xen/common/sched_credit.c=A0=A0=A0=A0=A0=A0=A0 2010-04-13 17:30:40.710992000 = -0400 >>>>> @@ -1404,6 +1404,7 @@ const struct scheduler sched_credit_def =A0=A0=A0=A0 >>>>> .wake=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 =3D csched_vcpu_wake, =A0 =A0=A0=A0=A0 .adjust=A0=A0=A0=A0=A0=A0=A0=A0 =3D >>>>> csched_dom_cntl, +=A0=A0=A0 .adjust_global=A0 =3D NULL, =A0 =A0=A0=A0=A0 .pick_cpu=A0=A0=A0=A0=A0=A0 = =3D >>>>> csched_cpu_pick, =A0=A0=A0=A0 .do_schedule=A0=A0=A0 =3D csched_schedule, diff -rupN >>>>> a/xen/common/sched_sedf.c b/xen/common/sched_sedf.c --- >>>>> a/xen/common/sched_sedf.c 2010-04-07 12:12:06.000000000 -0400 +++ >>>>> b/xen/common/sched_sedf.c=A0=A0=A0=A0=A0=A0=A0=A0=A0 2010-04-13 17:30:40.710992000 -040= 0 @@ >>>>> -1473,6 +1473,7 @@ const struct scheduler sched_sedf_def =3D =A0=A0=A0=A0 >>>>> .sleep=A0=A0=A0=A0=A0=A0=A0=A0=A0 =3D sedf_sleep, =A0=A0=A0=A0 .wake=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 =3D sedf_wake, =A0=A0=A0=A0 >>>>> .adjust=A0=A0=A0=A0=A0=A0=A0=A0 =3D sedf_adjust, +=A0=A0=A0 .adjust_global=A0 =3D NULL, =A0}; =A0 =A0/*= diff >>>>> -rupN a/xen/common/schedule.c b/xen/common/schedule.c --- >>>>> a/xen/common/schedule.c=A0=A0=A0=A0 2010-04-07 12:12:06.000000000 -0400 +++ >>>>> b/xen/common/schedule.c=A0 2010-04-14 10:57:11.262796000 -0400 @@ -804,= 6 >>>>> +804,21 @@ long sched_adjust(struct domain *d, stru =A0=A0=A0=A0 return ret; = =A0} =A0 >>>>> +/* Adjust scheduling parameters globally */ +long >>>>> sched_adjust_global(struct xen_domctl_scheduler_op *op) +{ +=A0=A0=A0 long = ret; >>>>> + +=A0=A0=A0 if ( (op->sched_id !=3D ops.sched_id) +=A0=A0=A0=A0=A0 || ( (op->cmd !=3D >>>>> XEN_DOMCTL_SCHEDOP_put_global_info) +=A0=A0=A0=A0=A0=A0=A0 && (op->cmd !=3D >>>>> XEN_DOMCTL_SCHEDOP_get_global_info) ) ) +=A0=A0=A0=A0=A0=A0=A0 return -EINVAL; + +=A0= =A0=A0 >>>>> ret =3D SCHED_OP(adjust_global, op); + +=A0=A0=A0 return ret; +} + =A0static vo= id >>>>> vcpu_periodic_timer_work(struct vcpu *v) =A0{ =A0=A0=A0=A0 s_time_t now =3D NOW()= ; >>>>> diff -rupN a/xen/include/public/domctl.h b/xen/include/public/domctl.= h --- >>>>> a/xen/include/public/domctl.h 2010-04-07 12:12:06.000000000 -0400 +++ >>>>> b/xen/include/public/domctl.h=A0=A0=A0=A0=A0=A0=A0=A0 2010-04-14 10:57:11.262796000 -= 0400 >>>>> @@ -306,6 +306,8 @@ DEFINE_XEN_GUEST_HANDLE(xen_domctl_max_v =A0/* Set = or >>>>> get info? */ =A0#define XEN_DOMCTL_SCHEDOP_putinfo 0 =A0#define >>>>> XEN_DOMCTL_SCHEDOP_getinfo 1 +#define XEN_DOMCTL_SCHEDOP_put_global_i= nfo 2 >>>>> +#define XEN_DOMCTL_SCHEDOP_get_global_info 3 =A0struct >>>>> xen_domctl_scheduler_op { =A0=A0=A0=A0 uint32_t sched_id;=A0 /* XEN_SCHEDULER_*= */ >>>>> =A0=A0=A0=A0 uint32_t cmd;=A0=A0=A0=A0=A0=A0 /* XEN_DOMCTL_SCHEDOP_* */ diff -rupN >>>>> a/xen/include/xen/sched.h b/xen/include/xen/sched.h --- >>>>> a/xen/include/xen/sched.h=A0=A0=A0=A0=A0 2010-04-07 12:12:06.000000000 -0400 ++= + >>>>> b/xen/include/xen/sched.h=A0 2010-04-13 17:30:40.710992000 -0400 @@ -47= 2,6 >>>>> +472,7 @@ void sched_destroy_vcpu(struct vcpu *v); =A0int=A0 >>>>> sched_init_domain(struct domain *d); =A0void sched_destroy_domain(struc= t >>>>> domain *d); =A0long sched_adjust(struct domain *, struct >>>>> xen_domctl_scheduler_op *); +long sched_adjust_global(struct >>>>> xen_domctl_scheduler_op *); =A0int=A0 sched_id(void); =A0void >>>>> sched_tick_suspend(void); =A0void sched_tick_resume(void); diff -rupN >>>>> a/xen/include/xen/sched-if.h b/xen/include/xen/sched-if.h --- >>>>> a/xen/include/xen/sched-if.h=A0=A0 2010-04-07 12:12:06.000000000 -0400 ++= + >>>>> b/xen/include/xen/sched-if.h=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 2010-04-13 17:30:40.710992000 = -0400 >>>>> @@ -76,6 +76,7 @@ struct scheduler { =A0=A0=A0=A0 int=A0=A0=A0=A0=A0=A0=A0=A0=A0 (*pick_cpu)=A0=A0=A0= =A0=A0=A0 >>>>> (struct vcpu *); =A0=A0=A0=A0 int=A0=A0=A0=A0=A0=A0=A0=A0=A0 (*adjust)=A0=A0=A0=A0=A0=A0=A0=A0 (struct domain *= , >>>>> =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 struct xen_domctl_scheduler_op *= ); >>>>> +=A0=A0=A0 int=A0=A0=A0=A0=A0=A0=A0=A0=A0 (*adjust_global)=A0 (struct xen_domctl_scheduler_op *= ); >>>>> =A0=A0=A0=A0 void=A0=A0=A0=A0=A0=A0=A0=A0 (*dump_settings)=A0 (void); =A0=A0=A0=A0 void=A0=A0=A0=A0=A0=A0=A0=A0 >>>>> (*dump_cpu_state) (int); >>>>> =A0 >>>>> =A0 >>>>> =A0 >>>>> =A0 >>>>> =A0 >>>>>=20 >>>>> _______________________________________________ >>>>> Xen-devel mailing list >>>>> Xen-devel@lists.xensource.com >>>>> http://lists.xensource.com/xen-devel >>>>>=20 >>>>>=20 >>>>>=20 >>>>> _______________________________________________ >>>>> Xen-devel mailing list >>>>> Xen-devel@lists.xensource.com >>>>> http://lists.xensource.com/xen-devel >>>>>=20 >>>>=20 >>>=20 >>=20 >>=20