All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dario Faggioli <dario.faggioli@citrix.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: Chong Li <chong.li@wustl.edu>, Sisu Xi <xisisu@gmail.com>,
	George Dunlap <george.dunlap@eu.citrix.com>,
	xen-devel <xen-devel@lists.xen.org>,
	Meng Xu <mengxu@cis.upenn.edu>, Chong Li <lichong659@gmail.com>,
	Dagaen Golomb <dgolomb@seas.upenn.edu>
Subject: Re: [PATCH v2 for Xen 4.6 1/4] xen: enabling XL to set per-VCPU parameters of a domain for RTDS scheduler
Date: Thu, 4 Jun 2015 17:27:53 +0200	[thread overview]
Message-ID: <1433431673.6291.27.camel@citrix.com> (raw)
In-Reply-To: <55688260020000780007F088@mail.emea.novell.com>


[-- Attachment #1.1: Type: text/plain, Size: 4163 bytes --]

On Fri, 2015-05-29 at 14:14 +0100, Jan Beulich wrote:
> >>> On 29.05.15 at 15:01, <dario.faggioli@citrix.com> wrote:
> > On Wed, 2015-05-27 at 12:41 +0100, Jan Beulich wrote:
> >> >>> On 26.05.15 at 19:18, <lichong659@gmail.com> wrote:
> >> > On Tue, May 26, 2015 at 4:08 AM, Jan Beulich <JBeulich@suse.com> wrote:
> >> >>>>> On 26.05.15 at 02:05, <lichong659@gmail.com> wrote:
> >> >>> +
> >> >>> +    switch ( op->cmd )
> >> >>> +    {
> >> >>> +    case XEN_DOMCTL_SCHEDOP_getvcpuinfo:
> >> >>> +        spin_lock_irqsave(&prv->lock, flags);
> >> >>> +        list_for_each( iter, &sdom->vcpu )
> >> >>> +        {
> >> >>> +            svc = list_entry(iter, struct rt_vcpu, sdom_elem);
> >> >>> +            vcpuid = svc->vcpu->vcpu_id;
> >> >>> +
> >> >>> +            local_sched.budget = svc->budget / MICROSECS(1);
> >> >>> +            local_sched.period = svc->period / MICROSECS(1);
> >> >>> +            if ( copy_to_guest_offset(op->u.rtds.vcpus, vcpuid,
> >> >>
> >> >> What makes you think that the caller has provided enough slots?
> >> > 
> >> > This code works in a similar way as the one for XEN_SYSCTL_numainfo.
> >> > So if there is no enough slot in guest space, en error code is
> >> > returned.
> >> 
> >> I don't think I saw any place you returned an error here. The
> >> only error being returned is -EFAULT when the copy-out fails.
> >> 
> > Look again at XEN_SYSCTL_numainfo, in particular, at this part:
> > 
> >     if ( ni->num_nodes < num_nodes )
> >     {
> >         ret = -ENOBUFS;
> >         i = num_nodes;
> >     }
> >     else
> >         i = 0
> > 
> > Which, as you'll appreciate if you check from where ni->num_nodes and
> > num_nodes come from, if where the boundary checking we're asking for
> > happens.
> > 
> > Note how the 'i' variable is used in the rest of the block, and you'll
> > see what we mean, and can do something similar.
> 
> I think this was targeted at Chong rather than me (while I was
> listed as To, and Chong only on Cc)?
> 
It was indeed targeted at him. :-)

I replied to your email to re-use and quote the points you made, but did
not think about changing what my MUA does by default when hitting
'Reply'... I never do that, actually, but I now see how it could be a
good idea to do so... I'll try to remember and fit that in my workflow.

> >> >>> +/* Adjust scheduling parameter for the vcpus of a given domain. */
> >> >>> +long sched_adjust_vcpu(
> >> >>> +    struct domain *d,
> >> >>> +    struct xen_domctl_scheduler_vcpu_op *op)
> >> >>> +{
> >> >>> +    long ret;
> >> >>
> >> >> I see no reason for this and the function return type to be "long".
> >> > 
> >> > The reason is stated in the begining.
> >> 
> >> In the beginning of what? I don't see any such, and it would also be
> >> odd for there to be an explanation of why a particular type was chosen.
> >>
> > As Chong he's saying elsewhere, he's moslty following suit. Should we
> > consider a pre-patch making both sched_adjust() and
> > sched_adjust_global() retunr int?
> 
> Perhaps. But the main point here is that people copying existing code
> should sanity check what they copy (so to not spread oddities or even
> bugs).
> 
Agreed, but in this case, he'd have ended up with:

long sched_adjust(...)
int sched_adjust_vcpu(...)
long sched_adjust_global(...)

So I think I see why Chong just went with 'long', that was my point.
Then of course, one could have spotted that it's the two existing ones
that are wrong/suboptimal, but that's more our responsibility than
Chong's fault, IMO (which does not mean that we should not point the
thing out and fix/ask to fix).

In any case, as far as this series is concerned, there should be no need
for a new function like this any longer. For "fixing" _adjust and
_adjust_global, I'll take care of it.

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: 181 bytes --]

[-- Attachment #2: Type: text/plain, Size: 126 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

  reply	other threads:[~2015-06-04 15:27 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-26  0:05 [PATCH v2 for Xen 4.6 1/4] xen: enabling XL to set per-VCPU parameters of a domain for RTDS scheduler Chong Li
2015-05-26  9:08 ` Jan Beulich
2015-05-26 17:18   ` Chong Li
2015-05-27  5:33     ` Chong Li
2015-05-27 11:42       ` Jan Beulich
2015-05-27 11:41     ` Jan Beulich
2015-05-29 13:01       ` Dario Faggioli
2015-05-29 13:14         ` Jan Beulich
2015-06-04 15:27           ` Dario Faggioli [this message]
2015-05-27 10:02 ` Chao Peng
2015-05-27 22:16   ` Chong Li
2015-05-29 13:51 ` Dario Faggioli
2015-05-29 16:47   ` Chong Li
2015-06-04 15:10     ` Dario Faggioli
2015-06-02 16:06   ` George Dunlap
2015-06-02 16:28 ` George Dunlap
2015-06-04 15:14   ` Dario Faggioli

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=1433431673.6291.27.camel@citrix.com \
    --to=dario.faggioli@citrix.com \
    --cc=JBeulich@suse.com \
    --cc=chong.li@wustl.edu \
    --cc=dgolomb@seas.upenn.edu \
    --cc=george.dunlap@eu.citrix.com \
    --cc=lichong659@gmail.com \
    --cc=mengxu@cis.upenn.edu \
    --cc=xen-devel@lists.xen.org \
    --cc=xisisu@gmail.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.