From: Dario Faggioli <dario.faggioli@citrix.com>
To: anshulmakkar <anshulmakkar@gmail.com>, xen-devel@lists.xen.org
Cc: jgross@suse.com, sstabellini@kernel.org, wei.liu2@citrix.com,
George.Dunlap@eu.citrix.com, andrew.cooper3@citrix.com,
ian.jackson@eu.citrix.com, marmarek@invisiblethingslab.com,
robert.vanvossen@dornerworks.com, tim@xen.org,
josh.whitehead@dornerworks.com, mengxu@cis.upenn.edu,
jbeulich@suse.com
Subject: Re: [PATCH 3/3] credit2: xen related changes to add support for runqueue per cpupool.
Date: Thu, 14 Sep 2017 16:08:42 +0200 [thread overview]
Message-ID: <1505398122.13935.23.camel@citrix.com> (raw)
In-Reply-To: <1505177142-14864-4-git-send-email-anshulmakkar@gmail.com>
[-- Attachment #1.1: Type: text/plain, Size: 5222 bytes --]
On Tue, 2017-09-12 at 01:45 +0100, anshulmakkar wrote:
> --- a/xen/common/cpupool.c
> +++ b/xen/common/cpupool.c
> @@ -129,12 +129,13 @@ void cpupool_put(struct cpupool *pool)
> * - unknown scheduler
> */
> static struct cpupool *cpupool_create(
> - int poolid, unsigned int sched_id, int *perr)
> + int poolid, unsigned int sched_id,
> + xen_sysctl_sched_param_t param,
> + int *perr)
>
I second Juergen's opinion about as much as possible of these
xen_sysctl_sched_param to move around functions as (const?) pointers.
> {
> struct cpupool *c;
> struct cpupool **q;
> int last = 0;
> -
Spurious blank line deletion.
> *perr = -ENOMEM;
> if ( (c = alloc_cpupool_struct()) == NULL )
> return NULL;
> @@ -600,10 +601,11 @@ int cpupool_do_sysctl(struct
> xen_sysctl_cpupool_op *op)
> case XEN_SYSCTL_CPUPOOL_OP_CREATE:
> {
> int poolid;
> + xen_sysctl_sched_param_t param = op->sched_param;
>
> poolid = (op->cpupool_id == XEN_SYSCTL_CPUPOOL_PAR_ANY) ?
> CPUPOOLID_NONE: op->cpupool_id;
> - c = cpupool_create(poolid, op->sched_id, &ret);
> + c = cpupool_create(poolid, op->sched_id, param, &ret);
>
Why you need the 'param' temporary variable?
> @@ -798,7 +800,8 @@ static int __init cpupool_presmp_init(void)
> {
> int err;
> void *cpu = (void *)(long)smp_processor_id();
> - cpupool0 = cpupool_create(0, 0, &err);
> + xen_sysctl_sched_param_t param;
> + cpupool0 = cpupool_create(0, 0, param, &err);
>
And in fact, if you use pointers, here you can pass NULL (to mean "just
use default parameters").
> BUG_ON(cpupool0 == NULL);
> cpupool_put(cpupool0);
> cpu_callback(&cpu_nfb, CPU_ONLINE, cpu);
> --- a/xen/common/sched_arinc653.c
> +++ b/xen/common/sched_arinc653.c
> @@ -343,7 +343,7 @@ arinc653_sched_get(
> * </ul>
> */
> static int
> -a653sched_init(struct scheduler *ops)
> +a653sched_init(struct scheduler *ops, xen_sysctl_sched_param_t
> sched_param)
> {
> a653sched_priv_t *prv;
>
And here, and in other schedulers that doesn't take parameters, still
if you use pointers, you can check that things are being done
properly, by putting an
ASSERT(sched_param == NULL);
> --- a/xen/common/sched_credit2.c
> +++ b/xen/common/sched_credit2.c
> @@ -3410,6 +3411,11 @@ csched2_init(struct scheduler *ops)
> /* initialize ratelimit */
> prv->ratelimit_us = sched_ratelimit_us;
>
> + /* not need of type checking here if sched_para.type = credit2.
> Code
> + * block is here means we have type as credit2.
> + */
> + prv->runqueue = sched_param.u.sched_credit2.runq;
> +
I don't understand what the comment is trying to say (and its style is
wrong: missing the opening 'wing').
> --- a/xen/include/public/sysctl.h
> +++ b/xen/include/public/sysctl.h
> @@ -555,6 +582,8 @@ struct xen_sysctl_cpupool_op {
> uint32_t cpu; /* IN: AR */
> uint32_t n_dom; /* OUT: I */
> struct xenctl_bitmap cpumap; /* OUT: IF */
> + /* IN: scheduler param relevant for cpupool */
> + xen_sysctl_sched_param_t sched_param;
> };
>
For the comment, follow the same convention used for other fields
(i.e., for now, 'IN: C').
We will certainly want to be able to also retrieve the scheduler
parameter set for a certain pool, at which point this will have to
become 'IN: C OUT: I'... but that's for another patch series, I
guess.
> typedef struct xen_sysctl_cpupool_op xen_sysctl_cpupool_op_t;
> DEFINE_XEN_GUEST_HANDLE(xen_sysctl_cpupool_op_t);
> @@ -630,22 +659,6 @@
> DEFINE_XEN_GUEST_HANDLE(xen_sysctl_arinc653_schedule_t);
> #define XEN_SYSCTL_SCHED_RATELIMIT_MAX 500000
> #define XEN_SYSCTL_SCHED_RATELIMIT_MIN 100
>
> -struct xen_sysctl_credit_schedule {
> - /* Length of timeslice in milliseconds */
> -#define XEN_SYSCTL_CSCHED_TSLICE_MAX 1000
> -#define XEN_SYSCTL_CSCHED_TSLICE_MIN 1
> - unsigned tslice_ms;
> - unsigned ratelimit_us;
> -};
> -typedef struct xen_sysctl_credit_schedule
> xen_sysctl_credit_schedule_t;
> -DEFINE_XEN_GUEST_HANDLE(xen_sysctl_credit_schedule_t);
> -
> -struct xen_sysctl_credit2_schedule {
> - unsigned ratelimit_us;
> -};
> -typedef struct xen_sysctl_credit2_schedule
> xen_sysctl_credit2_schedule_t;
> -DEFINE_XEN_GUEST_HANDLE(xen_sysctl_credit2_schedule_t);
> -
>
You're mixing moving and changing code. This is something we prefer to
avoid. Please, so the moving in a pre-patch.
Regards,
Dario
--
<<This happens because I choose it to happen!>> (Raistlin Majere)
-----------------------------------------------------------------
Dario Faggioli, Ph.D, http://about.me/dario.faggioli
Senior Software Engineer, Citrix Systems R&D Ltd., Cambridge (UK)
[-- Attachment #1.2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
[-- Attachment #2: Type: text/plain, Size: 127 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
next prev parent reply other threads:[~2017-09-14 14:08 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-12 0:45 implement runqueue per cpupool anshulmakkar
2017-09-12 0:45 ` [PATCH 1/3] credit2: libxc related changes to add support for " anshulmakkar
2017-09-14 6:42 ` Juergen Gross
2017-09-14 12:58 ` Dario Faggioli
2019-01-17 16:10 ` anshul
2019-01-17 16:17 ` Juergen Gross
2017-09-14 13:28 ` Dario Faggioli
2017-09-12 0:45 ` [PATCH 2/3] credit2: libxl " anshulmakkar
2017-09-14 6:37 ` Juergen Gross
2017-11-16 21:10 ` Anshul Makkar
2017-11-17 6:58 ` Juergen Gross
2017-09-12 0:45 ` [PATCH 3/3] credit2: xen " anshulmakkar
2017-09-14 6:24 ` Juergen Gross
2017-09-14 10:03 ` Jan Beulich
2017-09-14 14:08 ` Dario Faggioli [this message]
2017-09-14 4:21 ` implement " Juergen Gross
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1505398122.13935.23.camel@citrix.com \
--to=dario.faggioli@citrix.com \
--cc=George.Dunlap@eu.citrix.com \
--cc=andrew.cooper3@citrix.com \
--cc=anshulmakkar@gmail.com \
--cc=ian.jackson@eu.citrix.com \
--cc=jbeulich@suse.com \
--cc=jgross@suse.com \
--cc=josh.whitehead@dornerworks.com \
--cc=marmarek@invisiblethingslab.com \
--cc=mengxu@cis.upenn.edu \
--cc=robert.vanvossen@dornerworks.com \
--cc=sstabellini@kernel.org \
--cc=tim@xen.org \
--cc=wei.liu2@citrix.com \
--cc=xen-devel@lists.xen.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).