Webserver working for full website with LMP.
authorpravin@inf.ethz.ch <pravin@inf.ethz.ch>
Thu, 7 Nov 2013 13:16:40 +0000 (14:16 +0100)
committerpravin@inf.ethz.ch <pravin@inf.ethz.ch>
Thu, 7 Nov 2013 13:16:40 +0000 (14:16 +0100)
This version of code still does not work for UMP,
and also it does not work for httperf test.

Also, there is lot of commented out code which was helpful for me
in debugging the issue of randome page-fault.

19 files changed:
include/trace/trace.h
kernel/arch/x86_64/irq.c
kernel/dispatch.c
kernel/syscall.c
lib/barrelfish/arch/x86_64/debug.c
lib/barrelfish/dispatch.c
lib/barrelfish/domain.c
lib/lwip/src/barrelfish/idc_barrelfish.c
lib/lwip/src/core/ipv4/icmp.c
lib/lwip/src/core/pbuf.c
lib/net_queue_manager/net_soft_filters_srv_impl.c
lib/net_queue_manager/queue_manager.c
tools/harness/tests/webserver.py
trace_definitions/trace_defs.pleco
usr/drivers/e1000/e1000n.c
usr/drivers/e1000/e1000n_hwinit.c
usr/drivers/e10k/e10k_qdriver.c
usr/webserver/http_cache.c
usr/webserver/main.c

index beb97e9..fc28d0a 100644 (file)
@@ -41,7 +41,7 @@
  */
 #define TRACE_THREADS
 #define TRACE_CSWITCH
-#define NETWORK_LLSTACK_TRACE 1
+//#define NETWORK_LLSTACK_TRACE 1
 
 /* Trace only network related events
  * This will reduce the amount of events recorded, and hence allows
 #define TRACE_ONLY_SUB_NET 1
 #endif // CONFIG_TRACE && NETWORK_STACK_TRACE
 
-#if CONFIG_TRACE && NETWORK_STACK_BENCHMARK
-#define TRACE_ONLY_SUB_BNET 1
-#endif // CONFIG_TRACE && NETWORK_STACK_BENCHMARK
-
 #if CONFIG_TRACE && NETWORK_LLSTACK_TRACE
 #define TRACE_ONLY_LLNET 1
 #endif // CONFIG_TRACE && NETWORK_LLSTACK_TRACE
  * for every possible core ID, but this is now too large for sanity, so I've
  * limited it here. -AB 20111229
  */
-#define TRACE_COREID_LIMIT        64
+
+struct trace_buffer;
+
+#define TRACE_COREID_LIMIT        4
 #define TRACE_EVENT_SIZE          16
-#define TRACE_MAX_EVENTS          8000        // max number of events
+#define TRACE_MAX_EVENTS          30000        // max number of events
 #define TRACE_MAX_APPLICATIONS    128
-#define TRACE_PERCORE_BUF_SIZE    0x1ff00
-// (TRACE_EVENT_SIZE * TRACE_MAX_EVENTS + (sizeof (struct trace_buffer flags)))
+//#define TRACE_PERCORE_BUF_SIZE    0x1ff00
+#define TRACE_PERCORE_BUF_SIZE    (TRACE_EVENT_SIZE * TRACE_MAX_EVENTS + (sizeof (struct trace_buffer)))
 
 #define TRACE_BUF_SIZE (TRACE_COREID_LIMIT*TRACE_PERCORE_BUF_SIZE)    // Size of all trace buffers
 
@@ -552,16 +551,26 @@ static inline errval_t trace_event(uint16_t subsys, uint16_t event, uint32_t arg
 {
 #ifdef CONFIG_TRACE
 
-       //Recording the events only on the core 1
-       if (get_my_core_id() != 1) {
-            return SYS_ERR_OK;
-       }
+    // Only record network and kernel subsystem
+    if (subsys != TRACE_SUBSYS_NNET && subsys != TRACE_SUBSYS_KERNEL) {
+        return SYS_ERR_OK;
+    }
 
     // Check if the subsystem is enabled, i.e. we log events for it
     if (!trace_is_subsys_enabled(subsys)) {
         return SYS_ERR_OK;
     }
 
+
+    //Recording the events only on the core 1
+    // WARNING: Be very careful about using get_my_core_id function
+    // as this function depends on working of disp pointers and they dont work
+    // in thread disabled mode when you are about to return to kernel with
+    // sys_yield.
+    if (get_my_core_id() != 1) {
+        return SYS_ERR_OK;
+    }
+
     struct trace_event ev;
     ev.timestamp = TRACE_TIMESTAMP();
     ev.u.ev.subsystem = subsys;
index 3878c31..37c4095 100644 (file)
@@ -384,10 +384,6 @@ static struct cte irq_dispatch[NDISPATCH];
 #define TRACE_ETHERSRV_MODE 1
 #endif // CONFIG_TRACE && NETWORK_STACK_TRACE
 
-#if CONFIG_TRACE && NETWORK_STACK_BENCHMARK
-#define TRACE_N_BM 1
-#endif // CONFIG_TRACE && NETWORK_STACK_BENCHMARK
-
 /**
  * \brief Send interrupt notification to user-space listener.
  *
@@ -411,10 +407,9 @@ static void send_user_interrupt(int irq)
     if (irq == 0) {
 //     printf("packet interrupt: %d: count %"PRIu32"\n", irq, pkt_interrupt_count);
         ++pkt_interrupt_count;
-#if TRACE_N_BM
-#include<trace/trace.h>
-    trace_event(TRACE_SUBSYS_BNET, TRACE_EVENT_BNET_I, pkt_interrupt_count);
-#endif // TRACE_N_BM
+#if NETWORK_STACK_TRACE
+    trace_event(TRACE_SUBSYS_NNET, TRACE_EVENT_NNET_UIRQ, pkt_interrupt_count);
+#endif // NETWORK_STACK_TRACE
 /*
         if (pkt_interrupt_count >= 60){
             printf("interrupt number %"PRIu32"\n", pkt_interrupt_count);
@@ -608,6 +603,7 @@ static void copy_cpu_frame_to_dispatcher(
     disp_save_area->rip = cpu_save_area[X86_SAVE_RIP];
 }
 
+extern uint64_t dispatch_counter;
 /**
  * \brief Handles user-mode exceptions
  *
@@ -678,6 +674,10 @@ static __attribute__ ((used))
                disabled ? " WHILE DISABLED" : "", DISP_NAME_LEN,
                disp->name, fault_address, rip, rsp, error);
 
+        printk(LOG_WARN, "user page fault after dispatch %"PRIu64" \n",
+                dispatch_counter);
+
+
         /* sanity-check that the trap handler saved in the right place */
         assert((disabled && disp_save_area == dispatcher_get_trap_save_area(handle))
                || (!disabled && disp_save_area == dispatcher_get_enabled_save_area(handle)));
@@ -816,9 +816,9 @@ static __attribute__ ((used)) void handle_irq(int vector)
         apic_unmask_timer();
     }
 
-#if TRACE_ONLY_LLNET
-    trace_event(TRACE_SUBSYS_LLNET, TRACE_EVENT_LLNET_IRQ, vector);
-#endif // TRACE_ONLY_LLNET
+#if TRACE_ETHERSRV_MODE
+    trace_event(TRACE_SUBSYS_NNET, TRACE_EVENT_NNET_IRQ, vector);
+#endif // TRACE_ETHERSRV_MODE
 
     // APIC timer interrupt: handle in kernel and reschedule
     if (vector == APIC_TIMER_INTERRUPT_VECTOR) {
index 9f88f46..b285c4e 100644 (file)
@@ -179,6 +179,7 @@ struct dcb *run_next = NULL;
 #endif // CONFIG_TRACE && NETWORK_STACK_BENCHMARK
 
 
+uint64_t dispatch_counter = 0;
 
 void __attribute__ ((noreturn)) dispatch(struct dcb *dcb)
 {
@@ -246,20 +247,35 @@ void __attribute__ ((noreturn)) dispatch(struct dcb *dcb)
 
     assert(disp != NULL);
     disp->systime = kernel_now;
-
+    dispatch_counter++;
     if (dcb->disabled) {
+/*
+        if (disp->name[0] == 'w' && disp->name[1] == 'e') {
+            printk(LOG_WARN, "resume %.*s at 0x%" PRIx64 ", counter %"PRIu64"\n",
+                    DISP_NAME_LEN, disp->name,
+                    (uint64_t)registers_get_ip(disabled_area), dispatch_counter);
+        }
+*/
         debug(SUBSYS_DISPATCH, "resume %.*s at 0x%" PRIx64 "\n", DISP_NAME_LEN,
               disp->name, (uint64_t)registers_get_ip(disabled_area));
         assert(dispatcher_is_disabled_ip(handle,
                                          registers_get_ip(disabled_area)));
         resume(disabled_area);
     } else {
-        debug(SUBSYS_DISPATCH, "dispatch %.*s\n", DISP_NAME_LEN, disp->name);
+            debug(SUBSYS_DISPATCH, "dispatch %.*s\n", DISP_NAME_LEN, disp->name);
+/*
+        if (disp->name[0] == 'w' && disp->name[1] == 'e') {
+            uintptr_t arg = get_dispatcher_shared_generic(dcb_current->disp)->udisp;
+            printk(LOG_WARN, "dispatch %.*s, %"PRIxLVADDR", handle %"PRIxPTR", counter %"PRIu64"\n",
+                    DISP_NAME_LEN, disp->name, disp->dispatcher_run, arg,
+                    dispatch_counter);
+        }
+*/
         assert(disp->dispatcher_run != 0);
         disp->disabled = 1;
         execute(disp->dispatcher_run);
     }
-}
+} // end function: dispatch
 
 /**
  * \brief Transfer cap from 'send' to 'ep', according to 'msg'.
index e137e3f..d662494 100644 (file)
@@ -491,7 +491,10 @@ struct sysret sys_yield(capaddr_t target)
     if (!disp->haswork && disp->lmp_delivered == disp->lmp_seen
         && (wakeup == 0 || wakeup > kernel_now)) {
 
-    trace_event(TRACE_SUBSYS_KERNEL, TRACE_EVENT_KERNEL_SCHED_REMOVE,
+         trace_event(TRACE_SUBSYS_NNET, TRACE_EVENT_NNET_SCHED_REMOVE,
+            (uint32_t)(lvaddr_t)dcb_current & 0xFFFFFFFF);
+
+        trace_event(TRACE_SUBSYS_KERNEL, TRACE_EVENT_KERNEL_SCHED_REMOVE,
                 151);
 
     /*
@@ -520,7 +523,7 @@ struct sysret sys_yield(capaddr_t target)
             panic("invalid type in yield cap");
         }
 
-        trace_event(TRACE_SUBSYS_BNET, TRACE_EVENT_BNET_YIELD,
+        trace_event(TRACE_SUBSYS_NNET, TRACE_EVENT_NNET_YIELD,
             (uint32_t)(lvaddr_t)target_dcb & 0xFFFFFFFF);
         make_runnable(target_dcb);
         dispatch(target_dcb);
index 41f3853..1b28ea7 100644 (file)
@@ -69,7 +69,8 @@ void debug_call_chain(arch_registers_state_t *archregs)
  */
 void debug_print_save_area(arch_registers_state_t *state)
 {
-#define P(x) debug_printf("%16lx "#x"\n", (uintptr_t)state->x);
+//#define P(x) debug_printf("%16lx "#x"\n", (uintptr_t)state->x);
+#define P(x) printf("%16lx "#x"\n", (uintptr_t)state->x);
 
     P(rip);
     P(rsp);
@@ -97,9 +98,9 @@ void debug_print_save_area(arch_registers_state_t *state)
 
 void debug_return_addresses(void)
 {
-    debug_printf("return address = %p\n", __builtin_return_address(0));
-    debug_printf("return address = %p\n", __builtin_return_address(1));
-    debug_printf("return address = %p\n", __builtin_return_address(2));
-    debug_printf("return address = %p\n", __builtin_return_address(3));
-    debug_printf("return address = %p\n", __builtin_return_address(4));
+    printf("return address = %p\n", __builtin_return_address(0));
+    printf("return address = %p\n", __builtin_return_address(1));
+    printf("return address = %p\n", __builtin_return_address(2));
+    printf("return address = %p\n", __builtin_return_address(3));
+    printf("return address = %p\n", __builtin_return_address(4));
 }
index e694dd5..9d32da8 100644 (file)
@@ -336,6 +336,8 @@ void disp_pagefault(dispatcher_handle_t handle, lvaddr_t fault_address,
     thread_run_disabled(handle);
 }
 
+extern void *ret_addrs[4];
+
 /**
  * \brief Disabled page fault entry point
  *
@@ -361,13 +363,33 @@ void disp_pagefault_disabled(dispatcher_handle_t handle, lvaddr_t fault_address,
     if(fault_address == 0) {
         assert_print("NULL pointer dereferenced!\n");
     }
+    static char str1[1024];
+    snprintf(str1, 1024, " %.*s: my returns ret0 %p, ret1 %p, ret2 %p \n",
+             DISP_NAME_LEN, disp->name
+             , ret_addrs[0], ret_addrs[1], ret_addrs[2] );
+
+    assert_print(str1);
+
+    snprintf(str1, 1024, " %.*s: ret0 %p, ret1 %p, ret2 %p ret3 %p \n",
+             DISP_NAME_LEN, disp->name
+             , __builtin_return_address(0)
+             , __builtin_return_address(1)
+             , __builtin_return_address(2)
+             , __builtin_return_address(3) );
+
 
+
+    assert_print(str1);
+    assert_print("testing if print works with assert_print\n");
+    printf("testing if print works with printf\n");
     assert_disabled(disp->disabled);
 
+
     debug_print_save_area(regs);
 
     // disabled by AB, because we can get into a loop of disabled pagefaults
-    // debug_dump(regs);
+    debug_dump(regs);
+    debug_return_addresses();
     for(;;);
 }
 
index 17e2a3c..6dbfacd 100644 (file)
@@ -885,11 +885,11 @@ errval_t domain_thread_create_on_varstack(coreid_t core_id,
     } else {
         struct domain_state *domain_state = get_domain_state();
         errval_t err;
-    
+
         if (domain_state->b[core_id] == NULL) {
             return LIB_ERR_NO_SPANNED_DISP;
         }
-    
+
         struct interdisp_binding *b = domain_state->b[core_id];
         err = b->tx_vtbl.create_thread(b, NOP_CONT,
                                        (genvaddr_t)(uintptr_t)start_func,
@@ -898,7 +898,7 @@ errval_t domain_thread_create_on_varstack(coreid_t core_id,
         if (err_is_fail(err)) {
             return err;
         }
-    
+
         return SYS_ERR_OK;
     }
 }
@@ -921,11 +921,18 @@ void disp_set_core_id(coreid_t core_id)
     disp->core_id = core_id;
 }
 
+
+void *ret_addrs[4] = {NULL, NULL, NULL, NULL} ;
+
 /**
  * \brief returns the core_id stored in disp_priv struct
  */
 coreid_t disp_get_core_id(void)
 {
+             ret_addrs[0] = __builtin_return_address(0);
+             ret_addrs[1] = __builtin_return_address(1);
+             ret_addrs[2] = __builtin_return_address(2);
+
     dispatcher_handle_t handle = curdispatcher();
     struct dispatcher_generic* disp = get_dispatcher_generic(handle);
     return disp->core_id;
@@ -989,7 +996,7 @@ void set_monitor_blocking_rpc_client(struct monitor_blocking_rpc_client *st)
 }
 
 /**
- * \brief Returns the blocking rpc monitor client binding on the 
+ * \brief Returns the blocking rpc monitor client binding on the
  * dispatcher priv
  */
 struct monitor_blocking_rpc_client *get_monitor_blocking_rpc_client(void)
index 6243f1d..132be00 100644 (file)
@@ -131,9 +131,9 @@ uint64_t idc_send_packet_to_network_driver(struct pbuf *p)
     perform_lwip_work();
 
 
-#if TRACE_ONLY_LLNET
-        trace_event(TRACE_SUBSYS_LLNET, TRACE_EVENT_LLNET_LWIPTX, 0);
-#endif // TRACE_ONLY_LLNET
+#if LWIP_TRACE_MODE
+        trace_event(TRACE_SUBSYS_NNET, TRACE_EVENT_NNET_LWIPTX, 0);
+#endif // LWIP_TRACE_MODE
 
     LWIPBF_DEBUG("%s: idc_send_packet_to_network_driver: called\n", disp_name());
 
@@ -295,15 +295,20 @@ uint8_t get_driver_benchmark_state(int direction,
 // antoinek: Might need to reenable this when we enable multi threaded lwip
 // again
 //bool lwip_in_packet_received = false;
-
+static uint64_t incoming_packet_count = 0;
 static void handle_incoming(size_t idx, size_t len)
 {
     struct pbuf *p;
 
-#if TRACE_ONLY_LLNET
-        trace_event(TRACE_SUBSYS_LLNET, TRACE_EVENT_LLNET_LWIPRX, 0);
-#endif // TRACE_ONLY_LLNET
+#if LWIP_TRACE_MODE
+        trace_event(TRACE_SUBSYS_NNET, TRACE_EVENT_NNET_LWIPRX, 0);
+#endif // LWIP_TRACE_MODE
 
+    ++incoming_packet_count;
+    LWIPBF_DEBUG
+    //printf
+        ("%s:handle_incoming: incoming packet no %"PRIu64": len %"PRIu64"\n",
+            disp_name(), incoming_packet_count, len);
 
     // Get the pbuf for this index
     p = mem_barrelfish_get_pbuf(idx);
index e0e939c..a97e2a9 100644 (file)
@@ -108,12 +108,6 @@ void icmp_input(struct pbuf *p, struct netif *inp)
     ICMP_STATS_INC(icmp.recv);
     snmp_inc_icmpinmsgs();
 
-//  printf("ICMP packet came in\n");
-#if LWIP_TRACE_MODE
-    trace_event(TRACE_SUBSYS_NET, TRACE_EVENT_NET_AI_P,
-                (uint32_t) ((uint64_t) p));
-#endif // LWIP_TRACE_MODE
-
     iphdr = p->payload;
     hlen = IPH_HL(iphdr) * 4;
     if (pbuf_header(p, -hlen) || (p->tot_len < sizeof(u16_t) * 2)) {
@@ -256,11 +250,6 @@ void icmp_input(struct pbuf *p, struct netif *inp)
                 if (icmp_notifier != NULL) {
                     icmp_notifier(p);
                 }
-#if LWIP_TRACE_MODE
-                trace_event(TRACE_SUBSYS_NET, TRACE_EVENT_NET_AO_C,
-                            (uint32_t) ((uint64_t) p));
-#endif // LWIP_TRACE_MODE
-
                 ret = ip_output_if(p, &(iphdr->src), IP_HDRINCL,
                                    ICMP_TTL, 0, IP_PROTO_ICMP, inp);
                 if (ret != ERR_OK) {
index bd2ab54..ea32570 100644 (file)
 #include <string.h>
 #include <assert.h>
 #include <trace/trace.h>
+#include <trace_definitions/trace_defs.h>
+
+
+/* Enable tracing based on the global settings. */
+#if CONFIG_TRACE && NETWORK_STACK_TRACE
+#define LWIP_TRACE_MODE 1
+#endif // CONFIG_TRACE && NETWORK_STACK_TRACE
+
 
 
 #define SIZEOF_STRUCT_PBUF        LWIP_MEM_ALIGN_SIZE(sizeof(struct pbuf))
@@ -206,10 +214,6 @@ uint16_t free_pbuf_pool_count(void)
  */
 struct pbuf *pbuf_alloc(pbuf_layer layer, u16_t length, pbuf_type type)
 {
-#if TRACE_ONLY_LLNET
-        trace_event(TRACE_SUBSYS_LLNET, TRACE_EVENT_LLNET_LWIPPBA1, 0);
-#endif // TRACE_ONLY_LLNET
-
     struct pbuf *p, *q, *r;
     u16_t offset;
     s32_t rem_len;              /* remaining length */
@@ -384,9 +388,9 @@ struct pbuf *pbuf_alloc(pbuf_layer layer, u16_t length, pbuf_type type)
 /*
   LWIP_DEBUGF(PBUF_DEBUG | LWIP_DBG_TRACE | 3, ("pbuf_alloc(length=%"U16_F") == %p\n", length, (void *)p));
 */
-#if TRACE_ONLY_LLNET
-        trace_event(TRACE_SUBSYS_LLNET, TRACE_EVENT_LLNET_LWIPPBA2, 0);
-#endif // TRACE_ONLY_LLNET
+#if LWIP_TRACE_MODE
+        trace_event(TRACE_SUBSYS_NNET, TRACE_EVENT_NNET_LWIPPBA2, (uint32_t)(uintptr_t)p);
+#endif // LWIP_TRACE_MODE
 
     return p;
 }
@@ -613,13 +617,10 @@ u8_t pbuf_header(struct pbuf *p, s16_t header_size_increment)
  */
 u8_t pbuf_free(struct pbuf * p)
 {
-#if TRACE_ONLY_LLNET
-        trace_event(TRACE_SUBSYS_LLNET, TRACE_EVENT_LLNET_LWIPPBF1, 0);
-#endif // TRACE_ONLY_LLNET
-
     u16_t type;
     struct pbuf *q;
     u8_t count;
+    struct pbuf *p_bak = p;
 
     if (p == NULL) {
         LWIP_ASSERT("p != NULL", p != NULL);
@@ -716,9 +717,9 @@ u8_t pbuf_free(struct pbuf * p)
     /* return number of de-allocated pbufs */
 //    printf("pbuf_free: finished with [%p] and count %"PRIu8"\n", p, count);
 
-#if TRACE_ONLY_LLNET
-        trace_event(TRACE_SUBSYS_LLNET, TRACE_EVENT_LLNET_LWIPPBF2, 0);
-#endif // TRACE_ONLY_LLNET
+#if LWIP_TRACE_MODE
+        trace_event(TRACE_SUBSYS_NNET, TRACE_EVENT_NNET_LWIPPBF2, (uint32_t)(uintptr_t)p_bak);
+#endif // LWIP_TRACE_MODE
 
     return count;
 }
index 916b3a3..770621c 100644 (file)
@@ -1100,7 +1100,7 @@ static bool handle_application_packet(void *packet, size_t len)
         total_processing_time = 0;
         total_rx_datasize = 0;
         g_cl = cl;
-        trace_event(TRACE_SUBSYS_BNET, TRACE_EVENT_BNET_START, 0);
+        trace_event(TRACE_SUBSYS_NNET, TRACE_EVENT_NNET_START, 0);
     }
 
     if (filter->paused) {
@@ -1273,7 +1273,6 @@ out:
 } // end function: sf_process_received_packet_lo
 
 
-
 void sf_process_received_packet(void *opaque, size_t pkt_len, bool is_last)
 {
     void *pkt_data;
@@ -1317,7 +1316,8 @@ void sf_process_received_packet(void *opaque, size_t pkt_len, bool is_last)
     // check for application specific packet
     if (handle_application_packet(pkt_data, pkt_len)) {
         ETHERSRV_DEBUG
-          ("application specific packet.. len %"PRIu64"\n", pkt_len);
+        //printf
+            ("application specific packet.. len %"PRIu64"\n", pkt_len);
         goto out;
     }
 
index ef5573f..5a78710 100755 (executable)
@@ -759,22 +759,6 @@ bool copy_packet_to_user(struct buffer_descriptor *buffer,
 
     if (!is_enough_space_in_queue(cl->q)) {
 
-    /* FIXME: stop the trace. */
-#if TRACE_ETHERSRV_MODE
-    trace_event(TRACE_SUBSYS_NET, TRACE_EVENT_NET_STOP, 0);
-       char *trace_buf_area = malloc(CONSOLE_DUMP_BUFLEN);
-       assert(trace_buf_area);
-       size_t used_bytes = 0;
-        trace_dump_core(trace_buf_area, CONSOLE_DUMP_BUFLEN, &used_bytes, NULL,
-                disp_get_core_id(),  true, true);
-        printf("The lenght of the dump is %zu\n", used_bytes);
-//        trace_dump(trace_buf_area, CONSOLE_DUMP_BUFLEN, NULL);
-        printf("\n%s\n", "dump trac buffers: Start");
-       printf("\n%s\n", trace_buf_area);
-        printf("\n%s\n", "dump trac buffers: Stop");
-        trace_reset_all();
-#endif // TRACE_ETHERSRV_MODE
-
         printf("[%s] Dropping packet as app [%d] is not processing packets"
                 "fast enough.  Cont queue is almost full [%d], pkt count [%"PRIu64"]\n",
                 disp_name(), cl->cl_no, queue_free_slots(cl->q), sent_packets);
@@ -810,7 +794,7 @@ bool copy_packet_to_user(struct buffer_descriptor *buffer,
 #if TRACE_ETHERSRV_MODE
     uint32_t pkt_location = (uint32_t) ((uintptr_t) data);
 
-    trace_event(TRACE_SUBSYS_NET, TRACE_EVENT_NET_NI_PKT_CPY, pkt_location);
+    trace_event(TRACE_SUBSYS_NNET, TRACE_EVENT_NNET_NI_PKT_CPY, pkt_location);
 #endif // TRACE_ETHERSRV_MODE
 
     // Handle raw interface
index 35e8c0b..7528579 100644 (file)
@@ -14,6 +14,10 @@ from results import ResultsBase, PassFailResult, RowResults
 
 
 WEBSERVER_TEST_FILES=['index.html', 'barrelfish.gif', 'barrelfish_sosp09.pdf']
+WEBSERVER_TEST_FILES=['index.html', 'barrelfish.gif', 'nevill-master-capabilities.pdf']
+#        'nevill-master-capabilities.pdf']
+#'razavi-master-performanceisolation.pdf']
+
 WEBSERVER_TIMEOUT=5 # seconds
 TEST_LOG_NAME = 'testlog.txt'
 
@@ -45,15 +49,16 @@ class WebCommon(TestCommon):
     def get_modules(self, build, machine):
         cardName = "e1000"
         modules = super(WebCommon, self).get_modules(build, machine)
-        modules.add_module("e1000n", ["core=%d" % machine.get_coreids()[0]]) # 1
-        modules.add_module("NGD_mng", ["core=%d" % machine.get_coreids()[0], #2
+        modules.add_module("e1000n", ["core=%d" % machine.get_coreids()[1]]) # 1
+        modules.add_module("NGD_mng", ["core=%d" % machine.get_coreids()[1], #2
                                     "cardname=%s"%cardName])
-        modules.add_module("netd", ["core=%d" % machine.get_coreids()[0], #2
+        modules.add_module("netd", ["core=%d" % machine.get_coreids()[1], #2
                                    "cardname=%s"%cardName])
         nfsip = socket.gethostbyname(siteconfig.get('WEBSERVER_NFS_HOST'))
-        modules.add_module("webserver", ["core=%d" % machine.get_coreids()[0], #2
+        modules.add_module("webserver", ["core=%d" % machine.get_coreids()[1], #2
                                cardName, nfsip,
                                          siteconfig.get('WEBSERVER_NFS_PATH')])
+#                                         siteconfig.get('WEBSERVER_NFS_TEST_PATH')])
         return modules
 
     def process_line(self, line):
index 95de183..ff41d1d 100644 (file)
@@ -199,75 +199,36 @@ subsystem barriers {
 
 };
 
-/* Following constants are used in network subsystem. */
-subsystem net {
-
- event START              "",
- event STOP               "",
- event NI_AI               "added, 0",
- event NI_I                "added, 0",
- event NI_A                "added, pkt data location",
- event NI_FILTER_FRAG      "added, pkt data location",
- event NI_FILTER_EX_1      "added, pkt data location",
- event NI_ARP              "added, pkt data location",
- event NI_FILTER_EX_2      "added, pkt data location",
- event NI_PKT_CPY_1        "added, pkt data location",
- event NI_PKT_CPY_2        "added, pkt data location",
- event NI_PKT_CPY_3        "added, pkt data location",
- event NI_PKT_CPY_4        "added, pkt data location",
-
- event NI_PKT_CPY          "added, pkt data location",
- event NI_P                "added, pbuf_id",
- event NI_S                "added, pbuf_id",
- event AI_A                "added, pbuf_id",
- event AI_P                "added, pbuf_addr",
- event AO_C                "added, pbuf_addr",
- event AO_Q                "added, pbuf_addr",
- event AO_S                "added, pbuf_addr (as client_data )",
- event NO_A                "added, client_data (pbuf_address in lwip)",
- event NO_S                "added, e1000n.c client_data (pbuf_address in lwip)",
-
-/* FIXME: Add the timings of when does NIC gets TX_done */
- event NO_TXD              "yet to add",
- event AIR_R               "added, pbuf_addr (TX DONE in app)",
-
-/* Response flow */
- event AOR_S               "added, pbuf_id ( register_pbuf from APP)",
- event NIR_REG_PBUF        "commented pbuf_id ( register_pbuf in NIC)",
-};
-
-subsystem multihop {
-
- event BENCH_START              "",
- event BENCH_STOP               "",
- event MESSAGE_SEND             "",
- event MESSAGE_RECEIVE          "",
-
-};
-
-/* Following constants are used in network benchmark. */
-subsystem bnet {
-
- event START               "",
- event STOP                "",
- event DRV_SEE             "",
- event APP_SEE             "",
- event DRV_INT             "",
- event DRV_POLL            "",
- event YIELD               "",
- event I                   "",
-
-};
-
 /* Following constans are used for profiling modified stack */
 subsystem nnet {
 
  event START               "",
  event STOP                "",
+ event RXESVAPPFDONE       "Ethersrv app filtered",
+
  event RXDRVSEE            "Driver saw pkg (RX)",
  event RXESVSEE            "Ethersrv saw pkg",
  event RXESVFRGDONE        "Ethersrv checked frag",
- event RXESVAPPFDONE       "Ethersrv app filtered",
+ event LWIPTX              "LWIP idc_send_packet_to_network_driver",
+ event SCHED_REMOVE        "Process marked non-runnable",
+ event IRQ                 "interrupt in kernelspace",
+ event UIRQ                "interrupt in kernelspace for userspace",
+ event NO_S                "e1000 packet send",
+ event NI_I                "e1000 interrupt arrived",
+
+ event YIELD               "process yielded",
+
+ event LWIPPBF2            "LWIP pbuf freed",
+ event LWIPPBA2            "LWIP pbuf Allocated",
+
+ event NI_PKT_CPY          "Queue manager packet copy",
+event DRV_POLL             "e1000 polling",
+ event DRV_SEE             "handled packet",
+ event DRVTXDONE           "TX buffer reclamation",
+ event DRVRX               "checking for new packets",
+ event WEBEVENTLOOP        "Webserver event loop",
+
+
  event RXESVAPPCSTART      "Ethersrv app c2u started",
  event RXESVCOPIED         "Ethersrv copied pkg",
  event RXESVSPPDONE        "Ethersrv spp produce done",
@@ -275,6 +236,7 @@ subsystem nnet {
  event RXLWIINCOM          "LWIP handle_incoming_",
  event RXLWIRECH           "LWIP call rec_handler",
  event RXAPPRCV            "APP received",
+ event LWIPRX              "LWIP handle incoming",
 
  event TXAPPSNT            "APP sent",
  event TXLWISEE            "LWIP idc_send_packet",
@@ -298,30 +260,18 @@ subsystem nnet {
  event TX_MEMP             "tx pbuf memp start",
  event TX_MEMP_D           "tx pbuf memp done",
 
-};
 
 
-subsystem llnet {
-/* Constant for low-level networking trace */
- event START             "",
- event STOP              "",
- event IRQ              "",
- event LMPDISP          "",
+};
+
 
- event DRVIRQ           "",
- event DRVRX            "",
- event DRVTXADD         "",
- event DRVTXDONE        "",
 
- event LWIPPBA1         "",
- event LWIPPBA2         "",
- event LWIPPBF1         "",
- event LWIPPBF2         "",
- event LWIPRX           "",
- event LWIPTX           "",
+subsystem multihop {
 
- event APPRX            "",
- event APPTX            "",
+ event BENCH_START              "",
+ event BENCH_STOP               "",
+ event MESSAGE_SEND             "",
+ event MESSAGE_RECEIVE          "",
 
 };
 
index 9580cc2..c072ca2 100644 (file)
 #define TRACE_ETHERSRV_MODE 1
 #endif // CONFIG_TRACE && NETWORK_STACK_TRACE
 
-#if CONFIG_TRACE && NETWORK_STACK_BENCHMARK
-#define TRACE_N_BM 1
-#endif // CONFIG_TRACE && NETWORK_STACK_BENCHMARK
-
 #define MAX_ALLOWED_PKT_PER_ITERATION   (0xff)  // working value
 /* Transmit and receive buffers must be multiples of 8 */
 #define DRIVER_RECEIVE_BUFFERS      (1024 * 8)
@@ -307,7 +303,7 @@ static bool handle_free_TX_slot_fn(void)
 
     /* Actual place where packet is sent.  Adding trace_event here */
 #if TRACE_ETHERSRV_MODE
-    trace_event(TRACE_SUBSYS_NET, TRACE_EVENT_NET_NO_S,
+    trace_event(TRACE_SUBSYS_NNET, TRACE_EVENT_NNET_NO_S,
                 (uint32_t)ether_transmit_index);
 #endif
 
@@ -420,12 +416,12 @@ static void print_rx_bm_stats(bool stop_trace)
 
     cts = rdtsc();
 
-#if TRACE_N_BM
+#if TRACE_ETHERSRV_MODE
     if (stop_trace) {
         /* stopping the tracing */
-        trace_event(TRACE_SUBSYS_BNET, TRACE_EVENT_BNET_STOP, 0);
+        trace_event(TRACE_SUBSYS_NNET, TRACE_EVENT_NNET_STOP, 0);
     }
-#endif
+#endif // TRACE_ETHERSRV_MODE
 
     running_time = cts - g_cl->start_ts;
     E1000_PRINT("D:I:%u: RX speed = [%"PRIu64"] packets "
@@ -456,10 +452,10 @@ static uint64_t handle_multiple_packets(uint64_t upper_limit)
     while (handle_next_received_packet()) {
         ++total_rx_p_count;
 
-#if TRACE_N_BM
-        trace_event(TRACE_SUBSYS_BNET, TRACE_EVENT_BNET_DRV_SEE,
+#if TRACE_ETHERSRV_MODE
+        trace_event(TRACE_SUBSYS_NNET, TRACE_EVENT_NNET_DRV_SEE,
                     total_rx_p_count);
-#endif
+#endif // TRACE_ETHERSRV_MODE
 
         if (total_rx_datasize > PACKET_SIZE_LIMIT) {
             if (!benchmark_complete) {
@@ -522,9 +518,9 @@ static void polling_loop(void)
             no_work = false;
         }
 
-#if TRACE_N_BM
-        trace_event(TRACE_SUBSYS_BNET, TRACE_EVENT_BNET_DRV_POLL, poll_count);
-#endif
+#if TRACE_ETHERSRV_MODE
+        trace_event(TRACE_SUBSYS_NNET, TRACE_EVENT_NNET_DRV_POLL, poll_count);
+#endif // TRACE_ETHERSRV_MODE
 
         if (handle_multiple_packets(MAX_ALLOWED_PKT_PER_ITERATION) > 0) {
             no_work = false;
@@ -671,16 +667,12 @@ static void e1000_interrupt_handler_fn(void *arg)
     e1000_intreg_t icr = e1000_icr_rd(e1000_device.device);
 
 #if TRACE_ETHERSRV_MODE
-    trace_event(TRACE_SUBSYS_NET, TRACE_EVENT_NET_NI_I, interrupt_counter);
+    trace_event(TRACE_SUBSYS_NNET, TRACE_EVENT_NNET_NI_I, interrupt_counter);
 #endif
 
 //    printf("#### interrupt handler called: %"PRIu64"\n", interrupt_counter);
     ++interrupt_counter;
 
-#if TRACE_N_BM
-    trace_event(TRACE_SUBSYS_BNET, TRACE_EVENT_BNET_DRV_INT,
-                interrupt_counter);
-#endif
     if (e1000_intreg_lsc_extract(icr) != 0) {
         if (e1000_check_link_up(&e1000_device)) {
             e1000_auto_negotiate_link(&e1000_device);
index a86f449..cc649e3 100644 (file)
@@ -821,11 +821,11 @@ void e1000_hwinit(e1000_device_t *dev, struct device_mem *bar_info,
      */
     if (dev->mac_type == e1000_82575 || dev->mac_type == e1000_82576) {
         e1000_eitr_interval_wrf(dev->device, 0, 5580);
-        //e1000_eitr_interval_wrf(dev->device, 0, 0);
+        //e1000_eitr_interval_wrf(dev->device, 0, 10);
     }
     else {
         e1000_itr_interval_wrf(dev->device, 5580);
-        //e1000_itr_interval_wrf(dev->device, 0);
+        //e1000_itr_interval_wrf(dev->device, 10);
     }
 
     /* Enable interrupts */
index 1f9b502..4b53632 100644 (file)
 // Enable Debugging for intialization code
 #define INITDEBUG_ENABLE 0
 
+#if CONFIG_TRACE && NETWORK_STACK_TRACE
+#define TRACE_ETHERSRV_MODE 1
+#endif // CONFIG_TRACE && NETWORK_STACK_TRACE
+
 
 
 
@@ -217,9 +221,9 @@ static errval_t transmit_pbuf_list_fn(struct driver_buffer *buffers,
     }
 
     e10k_queue_bump_txtail(q);
-#if TRACE_ONLY_LLNET
-    trace_event(TRACE_SUBSYS_LLNET, TRACE_EVENT_LLNET_DRVTXADD, 0);
-#endif // TRACE_ONLY_LLNET
+#if TRACE_ETHERSRV_MODE
+    trace_event(TRACE_SUBSYS_NNET, TRACE_EVENT_NNET_DRV_SEE, 0);
+#endif // TRACE_ETHERSRV_MODE
 
     return SYS_ERR_OK;
 }
@@ -243,9 +247,9 @@ static bool handle_free_tx_slot_fn(void)
 
     //stats_dump();
 
-#if TRACE_ONLY_LLNET
-        trace_event(TRACE_SUBSYS_LLNET, TRACE_EVENT_LLNET_DRVTXDONE, 0);
-#endif // TRACE_ONLY_LLNET
+#if TRACE_ETHERSRV_MODE
+        trace_event(TRACE_SUBSYS_NNET, TRACE_EVENT_NNET_DRVTXDONE, 0);
+#endif // TRACE_ETHERSRV_MODE
 
     handle_tx_done(op);
 
@@ -299,9 +303,9 @@ static size_t check_for_new_packets(void)
     // arrive faster than they can be processed.
     count = 0;
     while (e10k_queue_get_rxbuf(q, &op, &len, &last) == 0) {
-#if TRACE_ONLY_LLNET
-        trace_event(TRACE_SUBSYS_LLNET, TRACE_EVENT_LLNET_DRVRX, 0);
-#endif // TRACE_ONLY_LLNET
+#if TRACE_ETHERSRV_MODE
+        trace_event(TRACE_SUBSYS_NNET, TRACE_EVENT_NNET_DRVRX, 0);
+#endif // TRACE_ETHERSRV_MODE
 
         DEBUG("New packet (q=%d)\n", qi);
 
@@ -643,9 +647,9 @@ void qd_interrupt(bool is_rx, bool is_tx)
 {
     size_t count;
 
-#if TRACE_ONLY_LLNET
-    trace_event(TRACE_SUBSYS_LLNET, TRACE_EVENT_LLNET_DRVIRQ, 0);
-#endif // TRACE_ONLY_LLNET
+#if TRACE_ETHERSRV_MODE
+    trace_event(TRACE_SUBSYS_NNET, TRACE_EVENT_NNET_NI_I, 0);
+#endif // TRACE_ETHERSRV_MODE
 
     if (is_rx) {
         count = check_for_new_packets();
index f93234f..5ff824d 100644 (file)
@@ -35,7 +35,7 @@
 
 /* Enable tracing only when it is globally enabled */
 #if CONFIG_TRACE && NETWORK_STACK_TRACE
-#define ENABLE_WEB_TRACING 1
+//#define ENABLE_WEB_TRACING 1
 #endif // CONFIG_TRACE && NETWORK_STACK_TRACE
 
 //#define MAX_NFS_READ       14000
@@ -488,6 +488,23 @@ static void readdir_callback(void *arg, struct nfs_client *client,
 
     // FIXME: start here the measurement of file loading time
 
+    // FIXME: Start the trace
+#if ENABLE_WEB_TRACING
+    printf("Starting tracing\n");
+
+    errval_t err = trace_control(TRACE_EVENT(TRACE_SUBSYS_NNET,
+                                    TRACE_EVENT_NNET_START, 0),
+                        TRACE_EVENT(TRACE_SUBSYS_NNET,
+                                    TRACE_EVENT_NNET_STOP, 0), 0);
+    if(err_is_fail(err)) {
+        USER_PANIC_ERR(err, "trace_control failed");
+    }
+    trace_event(TRACE_SUBSYS_NNET, TRACE_EVENT_NNET_START, 0);
+#else // ENABLE_WEB_TRACING
+    printf("Tracing not enabled\n");
+#endif // ENABLE_WEB_TRACING
+
+
     last_ts = rdtsc();
 //    lwip_benchmark_control(1, BMS_START_REQUEST, 0, 0);
     // initiate a lookup for every entry
@@ -557,13 +574,18 @@ static void handle_cache_load_done(void)
     cache_loading_phase = false;
 
     // lwip_benchmark_control(1, BMS_STOP_REQUEST, 0, 0);
+    //
     // Report the cache loading time
-    printf("Cache loading time %"PU"\n", in_seconds(rdtsc() - last_ts));
+
+    uint64_t total_loading_time = rdtsc() - last_ts;
+    printf("Cache loading time %"PU", %"PRIu64"\n",
+            in_seconds(total_loading_time), total_loading_time);
+
 //    lwip_print_interesting_stats();
 
     /* stop the trace. */
 #if ENABLE_WEB_TRACING
-    trace_event(TRACE_SUBSYS_NET, TRACE_EVENT_NET_STOP, 0);
+    trace_event(TRACE_SUBSYS_NNET, TRACE_EVENT_NNET_STOP, 0);
 
     char *trace_buf_area = malloc(CONSOLE_DUMP_BUFLEN);
     assert(trace_buf_area);
@@ -577,6 +599,9 @@ static void handle_cache_load_done(void)
     trace_reset_all();
 //    abort();
 
+    printf("Cache loading time %"PU", %"PRIu64"\n",
+            in_seconds(total_loading_time), total_loading_time);
+
 #endif // ENABLE_WEB_TRACING
 
 
@@ -621,23 +646,6 @@ err_t http_cache_init(struct ip_addr server, const char *path,
     struct timer *cache_timer;      /* timer for triggering cache timeouts */
     init_callback = callback;
 
-
-    // FIXME: Start the trace
-#if ENABLE_WEB_TRACING
-    printf("Starting tracing\n");
-
-    errval_t err = trace_control(TRACE_EVENT(TRACE_SUBSYS_NET,
-                                    TRACE_EVENT_NET_START, 0),
-                        TRACE_EVENT(TRACE_SUBSYS_NET,
-                                    TRACE_EVENT_NET_STOP, 0), 0);
-    if(err_is_fail(err)) {
-        USER_PANIC_ERR(err, "trace_control failed");
-    }
-    trace_event(TRACE_SUBSYS_NET, TRACE_EVENT_NET_START, 0);
-#else // ENABLE_WEB_TRACING
-    printf("Tracing not enabled\n");
-#endif // ENABLE_WEB_TRACING
-
     DEBUGPRINT ("nfs_mount calling.\n");
     my_nfs_client = nfs_mount(server, path, mount_callback, NULL);
     DEBUGPRINT ("nfs_mount calling done.\n");
index 67b128a..62ae44d 100644 (file)
@@ -23,6 +23,8 @@
 #include <lwip/tcp.h>
 #include <netif/bfeth.h>
 #include <contmng/netbench.h>
+#include <trace/trace.h>
+#include <trace_definitions/trace_defs.h>
 
 #include "webserver_network.h"
 #include "webserver_debug.h"
@@ -71,6 +73,7 @@ int main(int argc, char**argv)
 
     DEBUGPRINT("Init finished.\n");
 
+    uint32_t eventcount = 0;
     struct waitset *ws = get_default_waitset();
     while (1) {
         // check for any event without blocking
@@ -92,9 +95,9 @@ int main(int argc, char**argv)
             DEBUG_ERR(err, "in event_dispatch");
             break;
         }
-
+        eventcount++;
 #if ENABLE_WEB_TRACING
-    trace_event(TRACE_SUBSYS_NET, TRACE_EVENT_NET_STOP, 0);
+    trace_event(TRACE_SUBSYS_NNET, TRACE_EVENT_NNET_WEBEVENTLOOP, eventcount);
 #endif // ENABLE_WEB_TRACING
 
     } // end while: infinite