tmem: Move TMEM_CONTROL subop of tmem hypercall to sysctl.

The operations are to be used by an control domain to set parameters,
list pools, clients, and to be used during migration.

There is no need to have them in the tmem hypercall path.

This patch moves code without adding fixes - and in fact in
some cases makes the parameters soo long that they hurt eyes - but
that is for another patch.

Note that in regards to existing users:

 - Only the control domain could call it - which meant that if
   a guest called it would get -EPERM, so we are OK there.
   In practice no guests called this TMEM_CONTROL command.

 - The spec: https://oss.oracle.com/projects/tmem/dist/documentation/api/tmemspec-v001.pdf
   mentions: "TBD [Not sure if this is really needed.]"
   which is a carte blanche as any to do this!

Note: The XSM check is the same - we just move it from do_tmem_op
to do_sysctl.

We also add an 32-bit pad to make the sysctl structure have the same
exact size under 32 and 64-bit toolstacks and not worry about aligment
issues.

And the XLAT does not need to deal with the buf as it has been
moved to another structure which is 32/64 fixed.

Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Acked-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Acked-by: Jen Beulich <jbeulich@suse.com>
This commit is contained in:
Konrad Rzeszutek Wilk committed 2015-09-02 08:48:00 -04:00
1 parent 54a51b1766
commit d0edc15a6c
11 files changed
+201 -180

No files matched your search

+10 -10
View File
@@ -1809,25 +1809,25 @@ static PyObject *pyxc_tmem_control(XcObject *self,
&pool_id, &subop, &cli_id, &arg1, &arg2, &buf) )
return NULL;
if ( (subop == TMEMC_LIST) && (arg1 > 32768) )
if ( (subop == XEN_SYSCTL_TMEM_OP_LIST) && (arg1 > 32768) )
arg1 = 32768;
if ( (rc = xc_tmem_control(self->xc_handle, pool_id, subop, cli_id, arg1, arg2, buffer)) < 0 )
return Py_BuildValue("i", rc);
switch (subop) {
case TMEMC_LIST:
case XEN_SYSCTL_TMEM_OP_LIST:
return Py_BuildValue("s", buffer);
case TMEMC_FLUSH:
case XEN_SYSCTL_TMEM_OP_FLUSH:
return Py_BuildValue("i", rc);
case TMEMC_QUERY_FREEABLE_MB:
case XEN_SYSCTL_TMEM_OP_QUERY_FREEABLE_MB:
return Py_BuildValue("i", rc);
case TMEMC_THAW:
case TMEMC_FREEZE:
case TMEMC_DESTROY:
case TMEMC_SET_WEIGHT:
case TMEMC_SET_CAP:
case TMEMC_SET_COMPRESS:
case XEN_SYSCTL_TMEM_OP_THAW:
case XEN_SYSCTL_TMEM_OP_FREEZE:
case XEN_SYSCTL_TMEM_OP_DESTROY:
case XEN_SYSCTL_TMEM_OP_SET_WEIGHT:
case XEN_SYSCTL_TMEM_OP_SET_CAP:
case XEN_SYSCTL_TMEM_OP_SET_COMPRESS:
default:
break;
}
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.