[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] Regarding domctl hypercall from dom0 kernel...


  • To: "xen-devel@xxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxx>
  • From: "Tapdiya, Ashish" <ashish.tapdiya@xxxxxxxxxxxxxx>
  • Date: Thu, 21 Jun 2012 16:09:19 -0500
  • Accept-language: en-US
  • Acceptlanguage: en-US
  • Delivery-date: Thu, 21 Jun 2012 21:10:00 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xen.org>
  • Thread-index: AQHNT/BbT10Y+2QqQkyBVQwWZfC/jg==
  • Thread-topic: Regarding domctl hypercall from dom0 kernel...

Hi,

I am trying to invoke domctl hypercall (XEN_DOMCTL_SCHEDOP_putinfo) from dom0 
kernel. For my research i need to dynamically change the credits for guest 
domains. Following are my code additions,  

Kernel modifications: 
In /source/arch/x86/include/asm/xen/hypercall.h added

static inline int
HYPERVISOR_domctl(unsigned long arg)
{
        return _hypercall1(int, domctl, arg);
}


In source/include/xen/interface/xen.h added 

#define __HYPERVISOR_domctl               36


added a system call to invoke hypercall from dom0 user space, system call code 
is as follows

#include <linux/linkage.h>
#include <linux/kernel.h>
#include <asm/xen/hypervisor.h>
#include <asm/xen/hypercall.h>

#ifndef uint64_aligned_t
#define uint64_aligned_t uint64_t
#endif

#define XEN_DOMCTL_INTERFACE_VERSION 0x00000007

/* XEN_DOMCTL_scheduler_op */
/* Scheduler types. */
#define XEN_SCHEDULER_SEDF     4
#define XEN_SCHEDULER_CREDIT   5
#define XEN_SCHEDULER_CREDIT2  6
#define XEN_SCHEDULER_ARINC653 7

/* Set or get info? */
#define XEN_DOMCTL_SCHEDOP_putinfo 0
#define XEN_DOMCTL_SCHEDOP_getinfo 1
struct xen_domctl_scheduler_op {
    uint32_t sched_id;  /* XEN_SCHEDULER_* */
    uint32_t cmd;       /* XEN_DOMCTL_SCHEDOP_* */
    union {
        struct xen_domctl_sched_sedf {
            uint64_aligned_t period;
            uint64_aligned_t slice;
            uint64_aligned_t latency;
            uint32_t extratime;
            uint32_t weight;
        } sedf;
        struct xen_domctl_sched_credit {
            uint16_t weight;
            uint16_t cap;
        } credit;
        struct xen_domctl_sched_credit2 {
            uint16_t weight;
        } credit2;
    } u;
};
typedef struct xen_domctl_scheduler_op xen_domctl_scheduler_op_t;


struct xen_domctl_synced {
    char is_synchronized;
    int sync_done;
    char sync_currently_running;
};
typedef struct xen_domctl_synced xen_domctl_synced_t;

 struct xen_domctl {
        uint32_t cmd;
        #define XEN_DOMCTL_scheduler_op                  16
        #define XEN_DOMCTL_set_synced                    68
        #define XEN_DOMCTL_get_synced                    69
        uint32_t interface_version; /* XEN_DOMCTL_INTERFACE_VERSION */
        domid_t  domain;
        union {
                struct xen_domctl_scheduler_op      scheduler_op;
                struct xen_domctl_synced            synced;

                uint8_t                             pad[128];
        } u;
};
typedef struct xen_domctl xen_domctl_t;

asmlinkage long sys_mycall(int i)
{
        int retval;
        xen_domctl_t dom;

        dom.domain = i;
        dom.interface_version = XEN_DOMCTL_INTERFACE_VERSION;
        dom.cmd = XEN_DOMCTL_scheduler_op;
        dom.u.scheduler_op.sched_id = XEN_SCHEDULER_CREDIT;
        dom.u.scheduler_op.cmd = XEN_DOMCTL_SCHEDOP_putinfo;
        dom.u.scheduler_op.u.credit.weight=128;
        dom.u.scheduler_op.u.credit.cap = 1;
  
        retval = HYPERVISOR_domctl((unsigned long)&dom);
        printk(KERN_DEBUG "XEN_DOMCTL_SCHEDOP_putinfo hypercall returned %d\n", 
retval);

        return retval;
}



Hypercall returns a -22 (EINVAL) error code.

Any help would be appreciated.

Thanks

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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.