About this list Date view Thread view Subject view Author view Attachment view

From: Alex Lyashkov (shadow_at_psoft.net)
Date: Wed 22 Oct 2003 - 14:20:27 BST


Hello Herbert

we can`t finish talk about multiplexing in vserver syscall.
we proposalals:
first category with number 0 - request for version - returned version of
patch.
all categoryes - have 3 subcategory -
1) set\control
2) get info
3) get command version.
if command not implemented - command handler _must_ return -ENOTSUP;
userland tools for first must request command version and if it version
supported in tool - call command.
I think not need check version and have old code in kernel.

all you currently used commands ( VCMD_new_s_context and VCMD_set_ipv4root )
move to category 1 - CMD_COMPAT.

second we define categoryes for RESOURCE CONTROL.
for vps define categories:
=====================================================================
1) CPU \ main context managment.
with commands:
0 - get version
1 - create virtual context
arg context number
2 - destroy virtual context
arg context number
3 - set scheduling police
args { enum type };

4 - set CPU usage
args
struct CPU_USAGE
{
        uint32_t max_usage;
        uint32_t min_usage
}
... other can be added later
for get be simmilar - but command 1 (create ... ) return OK if context found
=====================================================================
2) PROCESS GROUP
with commands:
1 - migrage to context \ get current context
2 - set\get maximal process in context
3 - set\get max process capablity
4 - set stop to creating processes in context (get current state)
if argument is zero than flag CTX_STOP be cleared.
5 - send signal to all processes in context \ get current process count in
context
=====================================================================
3) VIRTUAL NETWORK DEVICES
with commands:
1 - [ create \ check for exist ] virtual device
2 - [ attach \ get assigments ] for vitual device
3 - [ destroy \ ---------- ] vitual device
4 - [ set \ get ] QoS parameters for device
args
struct VNET_QOS
{
        uint32_t max_baundwith;
        uint32_t warranted_baundwith;
};
.....
=====================================================================
4) MANAGMENT NETWORK ADDRESS
with commands:
1 - [ add permit to use some ipv4_addr with mask | get assigment permits. ]
2 - [ remove permit to use some ipv4_addr with mask | ---------- ]
....
for other protocols commands are simialr ipv4 commands.
all commands work with arguments
struct addr_req
{
        char vdev_name[IFNAMSIZ];
        unint32_t count;
        union
        {
                ipv4_addr ipv4_addrs[];
                ipv6_addr ipv6_addrs[];
.....
        };
}
where
struct ipv4_addr
{
     uint32_t addr;
     uint32_t mask;
};
typedef ipv6_addr struct in6_addr;
...
=====================================================================
5) DISK\VFS MANAGMENT
with commands:
1 - [ create virtual root \ get assigned virtual root ]
2 - [ destroy virtual root \ -----------]
3 - [ set \ get ] total disk limit for context
4 - [ set | get ] limits for file handles used in context
other command as permit to mount/umount some filesystem types can be added
later.
=====================================================================
6) MEMORY MANAGMENT
with commands:
1 - [ set | get ] maximal total used memory
2 - [ set | get ] maximal resident used memory
=====================================================================
7) OTHER LIMITS
with commands:
1 - [ set | get ] limits for tcp sockets in ESTABLISHED state.
or may be other who not have personal categories.

=====================================================================

after it we have following command coding:
first 8 bits for category [0-255]
2 bits for sub category
other bits used for command

all categoryes have personal handler who have following prototype.
int category_handler(uint32_t command, uint32_t id, void *data);

in c code:
#define VC_CATEGORY(c) (((c) >> 24) & 0xFF)
#define VC_FULLCMD_MASK ((c) & 0x00FFFFFF)
#define VC_SUBCAT(c) (((c) >> 21) & 0x3)
#define VC_COMMAND(c) ((c) & 0xFF)

sample syscall hadler:
asmlinkage int
sys_virtual_context(uint32_t cmd, uint32_t id, void *data)
{
        switch( VC_CATEGORY(cmd) )
        {
                case CAT_VERS:
                        return VC_PATCH_VERSION;
                case CAT_CPU:
                        return cpu_handler(VC_CMD_MASK(cmd), id, data );
........
        }
}
..........
int cpu_handler(uint32_t cmd, uint32_t id, void *data)
{
        switch( VC_SUBCAT(c) )
        {
                case SUB_VERS:
                {
                        return CPU_HANDL_VER;
                }
                case SUB_GET:
                {
                        return get_cpu(VC_COMMAND(cmd), id, data );
                }
                case SUB_SET:
                {
                        return get_cpu(VC_COMMAND(cmd), id, data );
                }
        }
}
....................................

-- 
With best regards,
Alex
_______________________________________________
Vserver mailing list
Vserver_at_www.solucorp.qc.ca
http://www.solucorp.qc.ca/mailman/listinfo/vserver


About this list Date view Thread view Subject view Author view Attachment view
[Next/Previous Months] [Main vserver Project Homepage] [Howto Subscribe/Unsubscribe] [Paul Sladen's vserver stuff]
Generated on Wed 22 Oct 2003 - 14:33:33 BST by hypermail 2.1.3