[okl4-developer] okl4_pd_attr_setconstructrootpd() function -> problem solved

crisvlad crisvlad74 at yahoo.com
Sat Oct 31 02:42:35 EST 2009


Hello there,

Finally the pds_zones example works for gumstix (pxa machines). 
The changes that I've made both to this example's main.c and some other file
consists of:
=> For the main.c file within: /examples/pds_zones/src:
 -> The get_root_weaved_objects() and create_root_pd() and must be called in
this order and not in the order we initially have;
 -> In create_root_pd() function:
    > The root protection-domain has to be privileged, so its privileged
attribute must be 1;
    > The fields virtmem_pool, kclistid_pool and kspaceid_pool in the attr
variable of type okl4_pd_attr_t must be initialised, so they all have to be
equal to: root_virtmem_pool,
    root_kclist_pool and root_kspace_pool respectively:
        attr.virtmem_pool = root_virtmem_pool;
        attr.kclistid_pool = root_kclist_pool;
        attr.kspaceid_pool = root_kspace_pool; 
    Note: Based on these observations, I could say that the missing library
function okl4_pd_attr_setconstructrootpd() should deal with these last two
steps inside create_root_pd() function.

    > The alignment for the children threads' stack is little-endian
ALIGNED(32) (I've also tried ALIGNED(8) and I didn't have problems);
    > After calling okl4_zone_attr_setmaxpds() we must say something like:
        zone_attr.kspaceid_pool = root_kspace_pool;
      otherwise we get an assertion error in:
libs/okl4/src/micro/zone_create.c, line 137:
        Assertion failed: XOR(attr->kspaceid.raw != ~0UL,
attr->kspaceid_pool)

=> For an external file: 
    > The OKL4_ZONE_ALIGNMENT alignment macro inside:
/libs/okl4/include/micro/zone.h must be set to either 0x1000 or 0x2000; this
example didn't work for this macro set either to 0x10000 (64KB) or to the
default 0x100000 (1MB alignment). If this is not the case, based on the
computation for the virtual-address' range and base the zone must cover, we
will have an assertion error like:
       Assertion failed: attr->range.base % OKL4_ZONE_ALIGNMENT == 0,
function okl4_zone_create, file libs/okl4/src/micro/zone_create.c, line 119.

The following macros must be set (my compilation was done using KERNEL=micro
and BUILD=debug):
   OKL4_KERNEL_MICRO, ENDIAN_LITTLE and ARM_SHARED_DOMAINS.

In the pds_zones example, when the threads in every protection-domain are
started, we do not have access to the serial server inside them. At least
this was my conclusion since no messages
could be seen at the stdout (whereas every thread's entry routine uses
printf and all the other printfs in the main.c could be seen at the output).
For this issue I used some improvisation, by constructing a small printing
function based on L4_KDB_PrintChar().

My compilation and simulation commands were:
>> Compilation:
./tools/build.py machine=gumstix2 project=examples example=pds_zones
TOOLCHAIN=gnu_arm_eabi_toolchain PYFREEZE=false
pistachio.TOOLCHAIN=gnu_arm_toolchain pistachio.enter_kdb=true
kdb_serial=True BUILD_DIR=build_pds_zones

>> Simulation:
skyeye -c tools/sim_config/gumstix.skyeye -e
build_pds_zones/images/image.boot

It all works now. Of course, the external modification mentioned above must
be reverted for some other architectures or eventually guarded somehow in
order not to modify it repeatedly.
If there are any comments/observations please make them publicly available.

Regards,
Vlad.


crisvlad wrote:
> 
> Hi,
> 
>  I'm trying to compile the pds_zone example inside /example folder, in
> order to see how a shared-memory mechanism should be implemented in OKL4
> v3. and I get:
> examples/pds_zones/src/main.c:113: warning: implicit declaration of
> function 'okl4_pd_attr_setconstructrootpd'
> examples/pds_zones/src/main.c:113: warning: nested extern declaration of
> 'okl4_pd_attr_setconstructrootpd'
> 
>  As I have seen on this forum (there is a message posted by Alexandre
> Courbot) and from documentation I have (section B-21.34 in 'OKL4 Library
> Reference Manual',  Document Number:  OK 40292:2008 (revision 2), Software
> Version: 3.0, Date: October 13, 2008 which is marked as Draft)  the
> function above appears in there but has absolutely no reference below its
> name.
> 
>  I've tried to bypass this function, and I imagined that inside it some
> fields of the okl4_pd_attr structure should be initialized, namely those
> that are not touched by okl4_pd_attr_init(). Thus I put some more lines
> into okl4_pd_attr_init() function (in ./okl4/src/micro/pd_attr_init.c):
>  attr->virtmem_pool = NULL; 
>  attr->kclistid_pool = NULL; 
>  attr->kspaceid_pool = NULL;
> 
>  Additionally, I reversed the call order between 
> get_root_weaved_objects() and create_root_pd(). If I didn't do that, the
> following message should appear:
> Assertion failed: attr->virtmem_pool, function okl4_pd_create, file
> libs/okl4/src/micro/pd_create.c, line 409
> This says that some field inside attr structure (of type okl4_pd_attr_t)
> is not initialized, so remains NULL.
> 
>  Now, after all these changes my error is somewhere inside the
> okl4_zone_create() in ./okl4/src/micro/zone_create.c:
> Assertion failed: attr->range.size % OKL4_ZONE_ALIGNMENT == 0, function
> okl4_zone_create, file libs/okl4/src/micro/zone_create.c, line 115
> 
>  My questions are:
>  - is the example pds_zone an official one (therefore can be questioned
> upon, so supported)?
>  - why am I getting that assertion failed (what would the size of that
> zone be?)
> 
>  Any other comment related to this shared memory technique would be very
> useful.
> 


-----
~ Mr. Vlad Grosu ~
Software Programmer/Designer
VMX / UPB / Romania
crisvlad74 at yahoo.com
-- 
View this message in context: http://n2.nabble.com/okl4-pd-attr-setconstructrootpd-function-problem-tp3712011p3919699.html
Sent from the OKL4 Community Forum mailing list archive at Nabble.com.



More information about the Developer mailing list