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

Re: [Xen-devel] Request for help: passing network statistics from netback driver to Xen scheduler.



On 01 Aug 2014, at 12:29, Wei Liu <wei.liu2@xxxxxxxxxx> wrote:

> 
> It's better to just paste in the diff instead of the whole function.

My apologies for that! Hereâs the diff:

diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index fa6ade7..121e793 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -134,7 +134,7 @@ EXPORT_SYMBOL_GPL(xen_have_vector_callback);
  * page as soon as fixmap is up and running.
  */
 struct shared_info *HYPERVISOR_shared_info = &xen_dummy_shared_info;
-
+EXPORT_SYMBOL(HYPERVISOR_shared_info);
 /*
  * Flag to determine whether vcpu info placement is available on all
  * VCPUs.  We assume it is to start with, and then set it to zero on
diff --git a/drivers/net/xen-netback/netback.c 
b/drivers/net/xen-netback/netback.c
index b898c6b..4b3e9d8 100644
--- a/drivers/net/xen-netback/netback.c
+++ b/drivers/net/xen-netback/netback.c
@@ -44,9 +44,11 @@
 #include <xen/xen.h>
 #include <xen/events.h>
 #include <xen/interface/memory.h>
+#include <xen/interface/xen.h>
 
 #include <asm/xen/hypercall.h>
 #include <asm/xen/page.h>
+#include <asm/xen/hypervisor.h>
 
 /* Provide an option to disable split event channels at load time as
  * event channels are limited resource. Split event channels are
@@ -572,6 +574,7 @@ void xenvif_rx_action(struct xenvif *vif)
        unsigned long offset;
        struct skb_cb_overlay *sco;
        int need_to_notify = 0;
+       struct shared_info *shared_info = HYPERVISOR_shared_info;
 
        struct netrx_pending_operations npo = {
                .copy  = vif->grant_copy_op,
@@ -631,6 +634,9 @@ void xenvif_rx_action(struct xenvif *vif)
                vif->dev->stats.tx_bytes += skb->len;
                vif->dev->stats.tx_packets++;
 
+               shared_info->network_intensity[vif->domid]++;
+              printk(KERN_EMERG "RX ACTION: %d %ld\n", vif->domid, 
shared_info->network_intensity[vif->domid]);
+
                status = xenvif_check_gop(vif, sco->meta_slots_used, &npo);
 
                if (sco->meta_slots_used == 1)
@@ -1628,6 +1634,7 @@ static int xenvif_tx_submit(struct xenvif *vif)
        struct gnttab_copy *gop = vif->tx_copy_ops;
        struct sk_buff *skb;
        int work_done = 0;
+       struct shared_info *shared_info = HYPERVISOR_shared_info;
 
        while ((skb = __skb_dequeue(&vif->tx_queue)) != NULL) {
                struct xen_netif_tx_request *txp;
@@ -1687,6 +1694,9 @@ static int xenvif_tx_submit(struct xenvif *vif)
                vif->dev->stats.rx_bytes += skb->len;
                vif->dev->stats.rx_packets++;
 
+               shared_info->network_intensity[vif->domid]++;
+              printk(KERN_EMERG "TX ACTION: %d\n", vif->domid);
+
                work_done++;
 
                netif_receive_skb(skb);
diff --git a/include/xen/interface/xen.h b/include/xen/interface/xen.h
index 53ec416..11a3ef0 100644
--- a/include/xen/interface/xen.h
+++ b/include/xen/interface/xen.h
@@ -394,7 +394,7 @@ struct shared_info {
        struct pvclock_wall_clock wc;
 
        struct arch_shared_info arch;
-
+       unsigned long network_intensity[10];
 };
 
 /*

> Also you will need to state clearly what version the diff is based on.

Iâve used ubuntuâs kernel source hosted at: 

git://kernel.ubuntu.com/ubuntu/ubuntu-trusty.git

Last commit: b90e9899aad49b601a744f503edc8e484490b906

The problem is: dmesg shows increasing values of network_intensity counter, 
however when I try to access it from xen scheduler
itâs always 0.

Kind regards,
Marcin DÅugajczyk

_______________________________________________
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®.