xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: "Jan Beulich" <JBeulich@suse.com>
To: Chong Li <lichong659@gmail.com>
Cc: Chong Li <chong.li@wustl.edu>, Sisu Xi <xisisu@gmail.com>,
	George Dunlap <george.dunlap@eu.citrix.com>,
	"dario.faggioli" <dario.faggioli@citrix.com>,
	xen-devel <xen-devel@lists.xen.org>,
	Meng Xu <mengxu@cis.upenn.edu>,
	Dagaen Golomb <dgolomb@seas.upenn.edu>
Subject: Re: [PATCH v8 for Xen 4.7 1/4] xen: enable per-VCPU parameter for RTDS
Date: Mon, 21 Mar 2016 09:49:55 -0600	[thread overview]
Message-ID: <56F0263302000078000DEEDE@prv-mh.provo.novell.com> (raw)
In-Reply-To: <CAGHO-io-P7Co=iu55OCxZ9XVaWTZJyEEgHfMg1WSBAEm5t2T=g@mail.gmail.com>

>>> On 21.03.16 at 16:18, <lichong659@gmail.com> wrote:
> On Mon, Mar 21, 2016 at 8:35 AM, Jan Beulich <JBeulich@suse.com> wrote:
>>>>> On 18.03.16 at 22:26, <lichong659@gmail.com> wrote:
>>> --- a/xen/include/public/domctl.h
>>> +++ b/xen/include/public/domctl.h
>>> @@ -338,24 +338,64 @@ DEFINE_XEN_GUEST_HANDLE(xen_domctl_max_vcpus_t);
>>>  #define XEN_SCHEDULER_ARINC653 7
>>>  #define XEN_SCHEDULER_RTDS     8
>>>
>>> -/* Set or get info? */
>>> +typedef struct xen_domctl_sched_credit {
>>> +    uint16_t weight;
>>> +    uint16_t cap;
>>> +} xen_domctl_sched_credit_t;
>>> +
>>> +typedef struct xen_domctl_sched_credit2 {
>>> +    uint16_t weight;
>>> +} xen_domctl_sched_credit2_t;
>>> +
>>> +typedef struct xen_domctl_sched_rtds {
>>> +    uint32_t period;
>>> +    uint32_t budget;
>>> +} xen_domctl_sched_rtds_t;
>>> +
>>> +typedef struct xen_domctl_schedparam_vcpu {
>>> +    union {
>>> +        xen_domctl_sched_credit_t credit;
>>> +        xen_domctl_sched_credit2_t credit2;
>>> +        xen_domctl_sched_rtds_t rtds;
>>> +    } u;
>>> +    uint32_t vcpuid;
>>> +    uint16_t padding[2];
>>
>> So why uint16_t[2] instead of just uint32_t? And what's the
>> padding needed for in the first place?
> 
> You're right. It's better to use uint32_t, which pads (the struct) to
> the 64-bit boundary.

Which doesn't answer the "why in the first place" part - I don't
see why structure size needs to be a multiple of 64 bits.

>> Also, while for a domctl it's
>> not as strictly needed as for other hypercalls, checking that all
>> padding fields are zero would still seem to be rather desirable.
>>
> 
> Do you mean:
> 
> +    case XEN_DOMCTL_SCHEDOP_getvcpuinfo:
> +    case XEN_DOMCTL_SCHEDOP_putvcpuinfo:
> +        if ( op->u.v.padding !=0 )
> +        {
> +            rc = -EINVAL;
> +            break;
> +        }
> +        while ( index < op->u.v.nr_vcpus )
> +        {
> +            if ( copy_from_guest_offset(&local_sched,
> +                                        op->u.v.vcpus, index, 1) )
> +            {
> +                rc = -EFAULT;
> +                break;
> +            }
> +            if ( local_sched.padding != 0 )
> +            {
> +                rc = -EINVAL;
> +                break;
> +            }
> +            if ( local_sched.vcpuid >= d->max_vcpus ||
> +                 d->vcpu[local_sched.vcpuid] == NULL )
> +            {
> +                rc = -EINVAL;
> +                break;
> +            }
> 
> ?

Yes, something along those lines.

Jan


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

  parent reply	other threads:[~2016-03-21 15:49 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-18 21:26 [PATCH v8 for Xen 4.7 0/4] Enable per-VCPU parameter for RTDS Chong Li
2016-03-18 21:26 ` [PATCH v8 for Xen 4.7 1/4] xen: enable " Chong Li
2016-03-21 13:35   ` Jan Beulich
2016-03-21 15:18     ` Chong Li
2016-03-21 15:39       ` George Dunlap
2016-03-21 15:49       ` Jan Beulich [this message]
2016-03-21 16:03         ` Chong Li
2016-03-21 16:25           ` Jan Beulich
2016-03-25 18:07             ` Chong Li
2016-03-29 10:58               ` Dario Faggioli
2016-03-29 16:59               ` Dario Faggioli
2016-03-29 17:13                 ` Konrad Rzeszutek Wilk
2016-03-29 17:36                   ` Dario Faggioli
2016-03-18 21:26 ` [PATCH v8 for Xen 4.7 2/4] libxc: " Chong Li
2016-03-29 17:08   ` Dario Faggioli
2016-03-31 16:59   ` Wei Liu
2016-03-18 21:26 ` [PATCH v8 for Xen 4.7 3/4] libxl: " Chong Li
2016-03-30 17:04   ` Dario Faggioli
2016-03-31 16:59   ` Wei Liu
2016-03-18 21:26 ` [PATCH v8 for Xen 4.7 4/4] xl: " Chong Li
2016-03-31 17:00   ` Wei Liu
2016-03-31 17:22     ` Dario Faggioli
2016-03-31 17:17   ` Dario Faggioli
2016-03-31 20:16     ` Wei Liu

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=56F0263302000078000DEEDE@prv-mh.provo.novell.com \
    --to=jbeulich@suse.com \
    --cc=chong.li@wustl.edu \
    --cc=dario.faggioli@citrix.com \
    --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 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).