xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>,
	Jan Beulich <JBeulich@suse.com>
Cc: xen-devel@lists.xenproject.org, wei.liu2@citrix.com
Subject: Re: [PATCH v2 5/8] tmem: Move TMEM_CONTROL subop of tmem hypercall to sysctl.
Date: Thu, 27 Aug 2015 20:02:43 +0100	[thread overview]
Message-ID: <55DF5ED3.4080007@citrix.com> (raw)
In-Reply-To: <20150827184325.GF5982@konrad-lan.dumpdata.com>

On 27/08/15 19:43, Konrad Rzeszutek Wilk wrote:
>
>>> --- a/xen/include/public/sysctl.h
>>> +++ b/xen/include/public/sysctl.h
>>> @@ -710,6 +710,48 @@ struct xen_sysctl_psr_cat_op {
>>>  typedef struct xen_sysctl_psr_cat_op xen_sysctl_psr_cat_op_t;
>>>  DEFINE_XEN_GUEST_HANDLE(xen_sysctl_psr_cat_op_t);
>>>  
>>> +#define XEN_SYSCTL_TMEM_OP_ALL_CLIENTS 0xFFFFU
>>> +
>>> +#define XEN_SYSCTL_TMEM_OP_THAW                   0
>>> +#define XEN_SYSCTL_TMEM_OP_FREEZE                 1
>>> +#define XEN_SYSCTL_TMEM_OP_FLUSH                  2
>>> +#define XEN_SYSCTL_TMEM_OP_DESTROY                3
>>> +#define XEN_SYSCTL_TMEM_OP_LIST                   4
>>> +#define XEN_SYSCTL_TMEM_OP_SET_WEIGHT             5
>>> +#define XEN_SYSCTL_TMEM_OP_SET_CAP                6
>>> +#define XEN_SYSCTL_TMEM_OP_SET_COMPRESS           7
>>> +#define XEN_SYSCTL_TMEM_OP_QUERY_FREEABLE_MB      8
>>> +#define XEN_SYSCTL_TMEM_OP_SAVE_BEGIN             10
>>> +#define XEN_SYSCTL_TMEM_OP_SAVE_GET_VERSION       11
>>> +#define XEN_SYSCTL_TMEM_OP_SAVE_GET_MAXPOOLS      12
>>> +#define XEN_SYSCTL_TMEM_OP_SAVE_GET_CLIENT_WEIGHT 13
>>> +#define XEN_SYSCTL_TMEM_OP_SAVE_GET_CLIENT_CAP    14
>>> +#define XEN_SYSCTL_TMEM_OP_SAVE_GET_CLIENT_FLAGS  15
>>> +#define XEN_SYSCTL_TMEM_OP_SAVE_GET_POOL_FLAGS    16
>>> +#define XEN_SYSCTL_TMEM_OP_SAVE_GET_POOL_NPAGES   17
>>> +#define XEN_SYSCTL_TMEM_OP_SAVE_GET_POOL_UUID     18
>>> +#define XEN_SYSCTL_TMEM_OP_SAVE_GET_NEXT_PAGE     19
>>> +#define XEN_SYSCTL_TMEM_OP_SAVE_GET_NEXT_INV      20
>>> +#define XEN_SYSCTL_TMEM_OP_SAVE_END               21
>>> +#define XEN_SYSCTL_TMEM_OP_RESTORE_BEGIN          30
>>> +#define XEN_SYSCTL_TMEM_OP_RESTORE_PUT_PAGE       32
>>> +#define XEN_SYSCTL_TMEM_OP_RESTORE_FLUSH_PAGE     33
>> Perhaps better to have all these in tmem.h, to not clutter this
>> header?
> Yes and no. The other sysctl had their #defines for commands here so I figured I
> would follow that rule. But I am OK keeping it in tmem.h and just do
>
> /* For the 'cmd' values consule tmem.h. Look for XEN_SYSCTL_TMEM_OP_* */

Better to stay consistent with sysctl.h.   Separating the structure and
the subops is unhelpful to people reading the code.

>>> +struct xen_sysctl_tmem_op {
>>> +    uint32_t cmd;       /* IN: XEN_SYSCTL_TMEM_OP_* . */
>>> +    int32_t pool_id;    /* IN: 0 by default unless _SAVE_*, RESTORE_* .*/
>>> +    uint32_t cli_id;    /* IN: client id, 0 for XEN_SYSCTL_TMEM_QUERY_FREEABLE_MB
>>> +                           for all others can be the domain id or
>>> +                           XEN_SYSCTL_TMEM_OP_ALL_CLIENTS for all. */
>>> +    uint32_t arg1;      /* IN: If not applicable to command use 0. */
>>> +    uint32_t arg2;      /* IN: If not applicable to command use 0. */
>>> +    uint8_t  pad[4];    /* Padding so structure is the same under 32 and 64. */
>> uint32_t please. And despite this being an (easily changeable) sysctl,
>> verifying that it's zero on input would be nice.
> Yes! That was what I forgotten!
>>> --- a/xen/include/public/tmem.h
>>> +++ b/xen/include/public/tmem.h
>>> @@ -33,7 +33,7 @@
>>>  #define TMEM_SPEC_VERSION          1
>>>  
>>>  /* Commands to HYPERVISOR_tmem_op() */
>>> -#define TMEM_CONTROL               0
>>> +#define TMEM_CONTROL_MOVED         0
>> Perhaps say where it moved in a brief comment?
> Yes, good idea.
>
> /* Deprecated. These operations are done now via XEN_SYSCTL_tmem_op
>  * using the sysctl hypercall. */

I hope "XEN_SYSCTL_tmem_op" is sufficient to imply "using the sysctl
hypercall" ;)

>
>>> --- a/xen/xsm/flask/hooks.c
>>> +++ b/xen/xsm/flask/hooks.c
>>> @@ -761,6 +761,9 @@ static int flask_sysctl(int cmd)
>>>      case XEN_SYSCTL_tbuf_op:
>>>          return domain_has_xen(current->domain, XEN__TBUFCONTROL);
>>>  
>>> +    case XEN_SYSCTL_tmem_op:
>>> +        return domain_has_xen(current->domain, XEN__TMEM_CONTROL);
>>> +
>>>      case XEN_SYSCTL_sched_id:
>>>          return domain_has_xen(current->domain, XEN__GETSCHEDULER);
>> Hmm, these cases appear to be roughly sorted numerically, i.e.
>> yours would normally go at the end.
> I recall a comment from Andrew asking the newly introduced commands to
> be in alphabetical order. But perhaps that was for domctl which is more
> .. ah.. random?

Really? that doesn't sound like me.  Apologies if it was.  (Alphabetic
for obj-y in a Makefile perhaps?)

Numeric would be far better here.

~Andrew

  reply	other threads:[~2015-08-27 19:03 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-27 11:01 [PATCH v2] Tmem bug-fixes and cleanups Konrad Rzeszutek Wilk
2015-08-27 11:01 ` [PATCH v2 1/8] tmem: Don't crash/hang/leak hypervisor when using shared pools within an guest Konrad Rzeszutek Wilk
2015-08-27 11:21   ` Wei Liu
2015-08-27 11:01 ` [PATCH v2 2/8] tmem: Add ASSERT in obj_rb_insert for pool->rwlock lock Konrad Rzeszutek Wilk
2015-08-27 14:55   ` Jan Beulich
2015-08-27 11:01 ` [PATCH v2 3/8] tmem: remove in xc_tmem_control_oid duplicate set_xen_guest_handle call Konrad Rzeszutek Wilk
2015-08-27 11:01 ` [PATCH v2 4/8] tmem: Remove xc_tmem_control mystical arg3 Konrad Rzeszutek Wilk
2015-08-27 11:15   ` Wei Liu
2015-08-27 12:53   ` Andrew Cooper
2015-08-27 18:38     ` Konrad Rzeszutek Wilk
2015-08-27 11:02 ` [PATCH v2 5/8] tmem: Move TMEM_CONTROL subop of tmem hypercall to sysctl Konrad Rzeszutek Wilk
2015-08-27 11:22   ` Wei Liu
2015-08-27 13:12   ` Andrew Cooper
2015-08-27 15:13     ` Jan Beulich
2015-08-27 18:47     ` Konrad Rzeszutek Wilk
2015-08-27 18:58       ` Andrew Cooper
2015-08-27 19:20         ` Konrad Rzeszutek Wilk
2015-08-28  8:31           ` Jan Beulich
2015-08-28 14:15         ` Konrad Rzeszutek Wilk
2015-08-28 14:40           ` Jan Beulich
2015-08-27 15:11   ` Jan Beulich
2015-08-27 18:43     ` Konrad Rzeszutek Wilk
2015-08-27 19:02       ` Andrew Cooper [this message]
2015-08-28  7:03       ` Jan Beulich
2015-08-27 11:02 ` [PATCH v2 6/8] tmem: Remove the old tmem control XSM checks as it is part of sysctl hypercall Konrad Rzeszutek Wilk
2015-08-27 20:59   ` Daniel De Graaf
2015-08-27 11:02 ` [PATCH v2 7/8] tmem: Remove extra spaces at end and some hard tabbing Konrad Rzeszutek Wilk
2015-08-27 13:19   ` Andrew Cooper
2015-08-27 11:02 ` [PATCH v2 8/8] tmem: Spelling mistakes Konrad Rzeszutek Wilk
2015-08-27 15:14   ` Jan Beulich
2015-08-27 13:30 ` [PATCH v2] Tmem bug-fixes and cleanups Andrew Cooper
2015-08-27 14:10 ` 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=55DF5ED3.4080007@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=JBeulich@suse.com \
    --cc=konrad.wilk@oracle.com \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xenproject.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).