[pok-devel] Proposing a patch to sched.c

[ Thread Index | Date Index | More lists.tuxfamily.org/pok-devel Archives ]


Dear POK users and contributors, 
We propose to integrate the following functionality in POK concerning inter-partition communications. 
The purpose is to propose alternatives to the default flushing policy. This proposal is the outcome of a joint
work in our research group with Etienne Borde and Laurent Pautet.

Up to now the flushing policy cannot be configured and consist in a periodic flush at each Major Frame beginning.
In industry two other configurations are often considered: 
Pol1: Periodic flush with a period dividing the Major Frame.
Pol2: Systematic flush of partition outgoing ports when leaving its scheduling slot. 

We propose the following code to handle these two additional semantics and handle their selection. The code is still compatible with ocarina (the default policy is still the one used before). 

Even if we do not propose to update ocarina to handle pre processor macro definition to activate them, we 
take advantage of this proposal to inform you that we are developing an Eclipse plug-in integrated with the OSATE  framework to handle pok code generation. If you are interested we can provide you access to the current state of the project.  

More detail on the patch : 
Files affected : sched.c 
Optional : new example directory with model integrating properties used in our code generation framework to activate the different policies. 

You can find attached the diff of the affected file with the latest revision of POK (#44). 

Pol1 is activated when the following macro is defined : 
POK_FLUSH_PERIOD
You need to bind it to a value dividing Major Frame duration (should be checked / enforced at code generation time) 

Pol2 will be activated when the following macro is defined : 
POK_NEEDS_FLUSH_ON_WINDOWS
No particular value is required 

If none are defined the default behavior is enforced. 
We 'd like to know your point of view about integrating these functionalities, as is or with limited modifications, in POK trunk. 

Best regards, 
Thomas ROBERT
-------------------
Lecturer, 
Telecom ParisTech - Département INFRES 
46 rue Barrault, 75634 Paris Cedex 13
France.
-------------------
tel : (+33) (0) 145817749
-------------------

Index: sched.c
===================================================================
--- sched.c	(révision 44)
+++ sched.c	(copie de travail)
@@ -68,6 +68,9 @@
 uint32_t          prev_current_thread;
 pok_sched_t       pok_global_sched;
 uint64_t          pok_sched_next_deadline;
+uint64_t          pok_sched_next_flush; // variable used to handle distinguished
+                                 //flushing period, i.e. distinct from MAF 
+                                 //and from partition slot boundaries
 uint64_t          pok_sched_next_major_frame;
 uint8_t           pok_sched_current_slot = 0; /* Which slot are we executing at this time ?*/
 uint32_t	         current_thread = KERNEL_THREAD;
@@ -111,6 +114,7 @@
    pok_sched_current_slot        = 0;
    pok_sched_next_major_frame    = POK_CONFIG_SCHEDULING_MAJOR_FRAME;
    pok_sched_next_deadline       = pok_sched_slots[0];
+   pok_sched_next_flush		 = 0;
    pok_current_partition         = pok_sched_slots_allocation[0];
 }
 
@@ -136,15 +140,30 @@
 
   if (pok_sched_next_deadline <= now)
   {
-      /* Here, we change the partition */
-#  if defined (POK_NEEDS_PORTS_SAMPLING) || defined (POK_NEEDS_PORTS_QUEUEING)
-    if (pok_sched_next_major_frame <= now)
+    //Handling interpartition flushing policy
+#if defined (POK_NEEDS_PORTS_SAMPLING) || defined (POK_NEEDS_PORTS_QUEUEING)
+#if defined (POK_FLUSH_PERIOD)
+    //Flush periodically all partition ports periodically such that
+    // Flush periodicity is a multiple of POK time base. 
+    if (pok_sched_next_flush <= now){
+    pok_sched_next_flush += POK_FLUSH_PERIOD;
+    pok_port_flushall();
+    }
+#elif defined (POK_NEEDS_FLUSH_ON_WINDOWS) 
+  //Flush only the ports of the partition that just finished its slot
+    if ((pok_sched_next_deadline<=now)) 
     {
+      pok_port_flush_partition (pok_current_partition);
+    }
+#else // activate default flushing policy at each Major Frame beginning
+  if (pok_sched_next_major_frame <= now)
+    {
       pok_sched_next_major_frame = pok_sched_next_major_frame +	POK_CONFIG_SCHEDULING_MAJOR_FRAME;
       pok_port_flushall();
-    }
-#  endif /* defined (POK_NEEDS_PORTS....) */
-
+      }
+#endif
+#endif
+      /* Here, we change the partition */
     pok_sched_current_slot = (pok_sched_current_slot + 1) % POK_CONFIG_SCHEDULING_NBSLOTS;
     pok_sched_next_deadline = pok_sched_next_deadline + pok_sched_slots[pok_sched_current_slot];
 /*


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/