[Xenomai-git] Philippe Gerum : alchemy/task: fix for pshared mode
Module: xenomai-3 Branch: next Commit: 5a8419295dbc562eb4b3c5ef054e38a94a1f3933 URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=5a8419295dbc562eb4b3c5ef054e38a94a1f3933 Author: Philippe Gerum Date: Mon Jun 1 17:33:56 2015 +0200 alchemy/task: fix for pshared mode --- include/alchemy/task.h |2 +- lib/alchemy/task.c |6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/alchemy/task.h b/include/alchemy/task.h index cc3e3c0..c3e8671 100644 --- a/include/alchemy/task.h +++ b/include/alchemy/task.h @@ -52,7 +52,7 @@ typedef struct RT_TASK RT_TASK; struct RT_TASK_MCB { int flowid; int opcode; - void *data; + dref_type(void *) data; ssize_t size; }; diff --git a/lib/alchemy/task.c b/lib/alchemy/task.c index 327e916..0fc1c33 100644 --- a/lib/alchemy/task.c +++ b/lib/alchemy/task.c @@ -1746,7 +1746,7 @@ ssize_t rt_task_send_timed(RT_TASK *task, wait->reply.data = mcb_r->data; wait->reply.size = mcb_r->size; } else { - wait->reply.data = NULL; + wait->reply.data = __moff(NULL); wait->reply.size = 0; } @@ -1904,7 +1904,7 @@ int rt_task_receive_timed(RT_TASK_MCB *mcb_r, } if (mcb_s->size > 0) - memcpy(mcb_r->data, mcb_s->data, mcb_s->size); + memcpy(__mptr(mcb_r->data), __mptr(mcb_s->data), mcb_s->size); /* The flow identifier is always strictly positive. */ ret = mcb_s->flowid; @@ -2030,7 +2030,7 @@ int rt_task_reply(int flowid, RT_TASK_MCB *mcb_s) ret = 0; mcb_r->size = size; if (size > 0) - memcpy(mcb_r->data, mcb_s->data, size); + memcpy(__mptr(mcb_r->data), __mptr(mcb_s->data), size); } mcb_r->flowid = flowid; ___ Xenomai-git mailing list Xenomai-git@xenomai.org http://xenomai.org/mailman/listinfo/xenomai-git
[Xenomai-git] Philippe Gerum : psos/rn: fix for pshared mode
Module: xenomai-3 Branch: next Commit: 839f84c121fd2ef2140e4bd87c14e95af57a1b37 URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=839f84c121fd2ef2140e4bd87c14e95af57a1b37 Author: Philippe Gerum Date: Mon Jun 1 17:29:59 2015 +0200 psos/rn: fix for pshared mode --- lib/psos/rn.c |6 +++--- lib/psos/rn.h |2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/psos/rn.c b/lib/psos/rn.c index e665b33..f87e19e 100644 --- a/lib/psos/rn.c +++ b/lib/psos/rn.c @@ -264,7 +264,7 @@ starve: timespec = NULL; wait = threadobj_prepare_wait(struct psos_rn_wait); - wait->ptr = NULL; + wait->ptr = __moff(NULL); wait->size = size; ret = syncobj_wait_grant(&rn->sobj, timespec, &syns); @@ -279,7 +279,7 @@ starve: goto out; } - *segaddr = wait->ptr; + *segaddr = __mptr(wait->ptr); done: syncobj_unlock(&rn->sobj, &syns); out: @@ -329,7 +329,7 @@ u_long rn_retseg(u_long rnid, void *segaddr) if (seg) { rn->busynr++; rn->usedmem += heapobj_validate(&rn->hobj, seg); - wait->ptr = seg; + wait->ptr = __moff(seg); syncobj_grant_to(&rn->sobj, thobj); } } diff --git a/lib/psos/rn.h b/lib/psos/rn.h index 43dd7a1..1a026a0 100644 --- a/lib/psos/rn.h +++ b/lib/psos/rn.h @@ -41,7 +41,7 @@ struct psos_rn { struct psos_rn_wait { size_t size; - void *ptr; + dref_type(void *) ptr; }; extern struct pvcluster psos_rn_table; ___ Xenomai-git mailing list Xenomai-git@xenomai.org http://xenomai.org/mailman/listinfo/xenomai-git
[Xenomai-git] Philippe Gerum : psos/queue: fix for pshared mode
Module: xenomai-3 Branch: next Commit: dbd55fc1296f04cb8e229f2879fb5a07d106ec32 URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=dbd55fc1296f04cb8e229f2879fb5a07d106ec32 Author: Philippe Gerum Date: Mon Jun 1 17:29:52 2015 +0200 psos/queue: fix for pshared mode --- lib/psos/queue.c |4 ++-- lib/psos/queue.h |2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/psos/queue.c b/lib/psos/queue.c index c3a27ae..42d0130 100644 --- a/lib/psos/queue.c +++ b/lib/psos/queue.c @@ -258,7 +258,7 @@ static u_long __q_send_inner(struct psos_queue *q, unsigned long flags, if (bytes > maxbytes) bytes = maxbytes; if (bytes > 0) - memcpy(wait->ptr, buffer, bytes); + memcpy(__mptr(wait->ptr), buffer, bytes); wait->size = bytes; goto done; } @@ -462,7 +462,7 @@ retry: timespec = NULL; wait = threadobj_prepare_wait(struct psos_queue_wait); - wait->ptr = buffer; + wait->ptr = __moff(buffer); wait->size = msglen; ret = syncobj_wait_grant(&q->sobj, timespec, &syns); diff --git a/lib/psos/queue.h b/lib/psos/queue.h index 0493a8a..4ca4389 100644 --- a/lib/psos/queue.h +++ b/lib/psos/queue.h @@ -43,7 +43,7 @@ struct psos_queue { struct psos_queue_wait { size_t size; - void *ptr; + dref_type(void *) ptr; }; extern struct cluster psos_queue_table; ___ Xenomai-git mailing list Xenomai-git@xenomai.org http://xenomai.org/mailman/listinfo/xenomai-git
[Xenomai-git] Philippe Gerum : vxworks/queue: fix for pshared mode
Module: xenomai-3 Branch: next Commit: 3dcf37c47f6624dbee6c03a446a51a1eb79775bf URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=3dcf37c47f6624dbee6c03a446a51a1eb79775bf Author: Philippe Gerum Date: Mon Jun 1 17:31:28 2015 +0200 vxworks/queue: fix for pshared mode --- lib/vxworks/msgQLib.c |4 ++-- lib/vxworks/msgQLib.h |2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/vxworks/msgQLib.c b/lib/vxworks/msgQLib.c index 087dbf6..aa0b71c 100644 --- a/lib/vxworks/msgQLib.c +++ b/lib/vxworks/msgQLib.c @@ -219,7 +219,7 @@ retry: timespec = NULL; wait = threadobj_prepare_wait(struct wind_queue_wait); - wait->ptr = buffer; + wait->ptr = __moff(buffer); wait->size = maxNBytes; ret = syncobj_wait_grant(&mq->sobj, timespec, &syns); @@ -285,7 +285,7 @@ STATUS msgQSend(MSG_Q_ID msgQId, const char *buffer, UINT bytes, if (bytes > maxbytes) bytes = maxbytes; if (bytes > 0) - memcpy(wait->ptr, buffer, bytes); + memcpy(__mptr(wait->ptr), buffer, bytes); wait->size = bytes; goto done; } diff --git a/lib/vxworks/msgQLib.h b/lib/vxworks/msgQLib.h index 2c31268..f6a1749 100644 --- a/lib/vxworks/msgQLib.h +++ b/lib/vxworks/msgQLib.h @@ -39,7 +39,7 @@ struct wind_mq { struct wind_queue_wait { size_t size; - void *ptr; + dref_type(void *) ptr; }; #endif /* _VXWORKS_MSGQLIB_H */ ___ Xenomai-git mailing list Xenomai-git@xenomai.org http://xenomai.org/mailman/listinfo/xenomai-git
[Xenomai-git] Philippe Gerum : alchemy/buffer: fix for pshared mode
Module: xenomai-3 Branch: next Commit: cfa4722707ccacadea29fad6f567585a629ead09 URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=cfa4722707ccacadea29fad6f567585a629ead09 Author: Philippe Gerum Date: Mon Jun 1 17:15:18 2015 +0200 alchemy/buffer: fix for pshared mode --- lib/alchemy/buffer.c | 14 -- lib/alchemy/buffer.h |2 +- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/lib/alchemy/buffer.c b/lib/alchemy/buffer.c index ca4817e..d9d7c98 100644 --- a/lib/alchemy/buffer.c +++ b/lib/alchemy/buffer.c @@ -153,7 +153,7 @@ static void buffer_finalize(struct syncobj *sobj) bcb = container_of(sobj, struct alchemy_buffer, sobj); registry_destroy_file(&bcb->fsobj); - xnfree(bcb->buf); + xnfree(__mptr(bcb->buf)); xnfree(bcb); } fnref_register(libalchemy, buffer_finalize); @@ -216,6 +216,7 @@ int rt_buffer_create(RT_BUFFER *bf, const char *name, struct alchemy_buffer *bcb; struct service svc; int sobj_flags = 0; + void *buf; int ret; if (threadobj_irq_p()) @@ -232,12 +233,13 @@ int rt_buffer_create(RT_BUFFER *bf, const char *name, goto fail; } - bcb->buf = xnmalloc(bufsz); - if (bcb == NULL) { + buf = xnmalloc(bufsz); + if (buf == NULL) { ret = __bt(-ENOMEM); goto fail_bufalloc; } + bcb->buf = __moff(buf); generate_name(bcb->name, name, &buffer_namegen); bcb->mode = mode; bcb->bufsz = bufsz; @@ -276,7 +278,7 @@ fail_register: registry_destroy_file(&bcb->fsobj); syncobj_uninit(&bcb->sobj); fail_syncinit: - xnfree(bcb->buf); + xnfree(buf); fail_bufalloc: xnfree(bcb); fail: @@ -500,7 +502,7 @@ redo: n = bcb->bufsz - rdoff; else n = rbytes; - memcpy(p, bcb->buf + rdoff, n); + memcpy(p, __mptr(bcb->buf) + rdoff, n); p += n; rdoff = (rdoff + n) % bcb->bufsz; rbytes -= n; @@ -716,7 +718,7 @@ ssize_t rt_buffer_write_timed(RT_BUFFER *bf, else n = rbytes; - memcpy(bcb->buf + wroff, p, n); + memcpy(__mptr(bcb->buf) + wroff, p, n); p += n; wroff = (wroff + n) % bcb->bufsz; rbytes -= n; diff --git a/lib/alchemy/buffer.h b/lib/alchemy/buffer.h index beb1f5b..3c99d0c 100644 --- a/lib/alchemy/buffer.h +++ b/lib/alchemy/buffer.h @@ -31,7 +31,7 @@ struct alchemy_buffer { struct clusterobj cobj; size_t bufsz; int mode; - void *buf; + dref_type(void *) buf; size_t rdoff; size_t wroff; size_t fillsz; ___ Xenomai-git mailing list Xenomai-git@xenomai.org http://xenomai.org/mailman/listinfo/xenomai-git
[Xenomai-git] Philippe Gerum : alchemy/queue: fix for pshared mode
Module: xenomai-3 Branch: next Commit: 343b9407582993821c9e72a59bad525d6a082f16 URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=343b9407582993821c9e72a59bad525d6a082f16 Author: Philippe Gerum Date: Mon Jun 1 17:25:37 2015 +0200 alchemy/queue: fix for pshared mode --- lib/alchemy/queue.c |4 ++-- lib/alchemy/queue.h |2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/alchemy/queue.c b/lib/alchemy/queue.c index f53bc7a..42f82c7 100644 --- a/lib/alchemy/queue.c +++ b/lib/alchemy/queue.c @@ -654,7 +654,7 @@ int rt_queue_write(RT_QUEUE *queue, if (size > usersz) size = usersz; if (size > 0) - memcpy(wait->userbuf, buf, size); + memcpy(__mptr(wait->userbuf), buf, size); wait->usersz = size; syncobj_grant_to(&qcb->sobj, waiter); ret = 1; @@ -981,7 +981,7 @@ wait: } wait = threadobj_prepare_wait(struct alchemy_queue_wait); - wait->userbuf = buf; + wait->userbuf = __moff(buf); wait->usersz = size; wait->msg = NULL; diff --git a/lib/alchemy/queue.h b/lib/alchemy/queue.h index 04c3c15..8aa3327 100644 --- a/lib/alchemy/queue.h +++ b/lib/alchemy/queue.h @@ -50,7 +50,7 @@ struct alchemy_queue_msg { struct alchemy_queue_wait { struct alchemy_queue_msg *msg; - void *userbuf; + dref_type(void *) userbuf; size_t usersz; }; ___ Xenomai-git mailing list Xenomai-git@xenomai.org http://xenomai.org/mailman/listinfo/xenomai-git
[Xenomai-git] Philippe Gerum : alchemy/heap: fix for pshared mode
Module: xenomai-3 Branch: next Commit: 9c4b95fec77088312a27fad3cafb9b55b616036d URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=9c4b95fec77088312a27fad3cafb9b55b616036d Author: Philippe Gerum Date: Mon Jun 1 17:23:50 2015 +0200 alchemy/heap: fix for pshared mode --- lib/alchemy/heap.c | 15 +-- lib/alchemy/heap.h |4 ++-- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/lib/alchemy/heap.c b/lib/alchemy/heap.c index 38ffc26..10b7f83 100644 --- a/lib/alchemy/heap.c +++ b/lib/alchemy/heap.c @@ -245,7 +245,7 @@ int rt_heap_create(RT_HEAP *heap, generate_name(hcb->name, name, &heap_namegen); hcb->mode = mode; hcb->size = heapsz; - hcb->sba = NULL; + hcb->sba = __moff(NULL); if (mode & H_PRIO) sobj_flags = SYNCOBJ_PRIO; @@ -432,7 +432,7 @@ int rt_heap_alloc_timed(RT_HEAP *heap, goto out; if (hcb->mode & H_SINGLE) { - p = hcb->sba; + p = __mptr(hcb->sba); if (p) goto done; if (size > 0 && size != hcb->size) { @@ -444,7 +444,7 @@ int rt_heap_alloc_timed(RT_HEAP *heap, ret = -ENOMEM; goto done; } - hcb->sba = p; + hcb->sba = __moff(p); goto done; } @@ -467,7 +467,7 @@ int rt_heap_alloc_timed(RT_HEAP *heap, goto out; } } else - p = wait->ptr; + p = __mptr(wait->ptr); threadobj_finish_wait(); done: @@ -509,6 +509,7 @@ int rt_heap_free(RT_HEAP *heap, void *block) struct syncstate syns; struct service svc; int ret = 0; + void *ptr; CANCEL_DEFER(svc); @@ -534,9 +535,11 @@ int rt_heap_free(RT_HEAP *heap, void *block) */ syncobj_for_each_grant_waiter_safe(&hcb->sobj, thobj, tmp) { wait = threadobj_get_wait(thobj); - wait->ptr = heapobj_alloc(&hcb->hobj, wait->size); - if (wait->ptr) + ptr = heapobj_alloc(&hcb->hobj, wait->size); + if (ptr) { + wait->ptr = __moff(ptr); syncobj_grant_to(&hcb->sobj, thobj); + } } done: put_alchemy_heap(hcb, &syns); diff --git a/lib/alchemy/heap.h b/lib/alchemy/heap.h index 909454d..e76e36f 100644 --- a/lib/alchemy/heap.h +++ b/lib/alchemy/heap.h @@ -33,13 +33,13 @@ struct alchemy_heap { struct clusterobj cobj; int mode; size_t size; - void *sba; + dref_type(void *) sba; struct fsobj fsobj; }; struct alchemy_heap_wait { size_t size; - void *ptr; + dref_type (void *) ptr; }; #define heap_magic 0x8a8aebeb ___ Xenomai-git mailing list Xenomai-git@xenomai.org http://xenomai.org/mailman/listinfo/xenomai-git
[Xenomai-git] Philippe Gerum : boilerplate, copperplate: fix syncluster in pshared mode
Module: xenomai-3 Branch: next Commit: 7544214e94c387496cf118960130c48e85687655 URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=7544214e94c387496cf118960130c48e85687655 Author: Philippe Gerum Date: Mon Jun 1 16:52:34 2015 +0200 boilerplate, copperplate: fix syncluster in pshared mode --- include/boilerplate/scope.h | 26 include/copperplate/cluster.h |9 - include/copperplate/threadobj.h |6 +-- lib/boilerplate/hash.c|4 -- lib/copperplate/cluster.c | 19 - lib/copperplate/heapobj-pshared.c | 79 +++-- lib/copperplate/threadobj.c |2 +- 7 files changed, 80 insertions(+), 65 deletions(-) diff --git a/include/boilerplate/scope.h b/include/boilerplate/scope.h index 9e551ae..ae71063 100644 --- a/include/boilerplate/scope.h +++ b/include/boilerplate/scope.h @@ -31,10 +31,15 @@ extern void *__main_heap; int pshared_check(void *heap, void *addr); -#define dref_type(t) memoff_t -#define __memoff(base, addr) ((caddr_t)(addr) - (caddr_t)(base)) -#define __memptr(base, off)((caddr_t)(base) + (off)) -#define __memchk(base, addr) pshared_check(base, addr) +#define dref_type(t) memoff_t + +#define __memoff(__base, __addr) ((caddr_t)(__addr) - (caddr_t)(__base)) +#define __memptr(__base, __off)((caddr_t)(__base) + (__off)) +#define __memchk(__base, __addr) pshared_check(__base, __addr) + +#define __moff(__p)__memoff(__main_heap, __p) +#define __mptr(__off) __memptr(__main_heap, __off) +#define __mchk(__p)__memchk(__main_heap, __p) #define mutex_scope_attribute PTHREAD_PROCESS_SHARED #define sem_scope_attribute1 @@ -47,10 +52,15 @@ int pshared_check(void *heap, void *addr); #define __main_heapNULL -#define dref_type(t) __typeof__(t) -#define __memoff(base, addr) (addr) -#define __memptr(base, off)(off) -#define __memchk(base, addr) 1 +#define dref_type(t) __typeof__(t) + +#define __memoff(__base, __addr) (__addr) +#define __memptr(__base, __off)(__off) +#define __memchk(__base, __addr) 1 + +#define __moff(__p)(__p) +#define __mptr(__off) (__off) +#define __mchk(__p)1 #define mutex_scope_attribute PTHREAD_PROCESS_PRIVATE #define sem_scope_attribute0 diff --git a/include/copperplate/cluster.h b/include/copperplate/cluster.h index af7dfee..c29d6f2 100644 --- a/include/copperplate/cluster.h +++ b/include/copperplate/cluster.h @@ -155,7 +155,14 @@ pid_t pvclusterobj_cnode(const struct pvclusterobj *cobj) #endif /* !CONFIG_XENO_PSHARED */ struct syncluster_wait_struct { - const char *name; + union { + struct { + dref_type(char *) name; + } shared; + struct { + const char *name; + } private; + }; }; #ifdef __cplusplus diff --git a/include/copperplate/threadobj.h b/include/copperplate/threadobj.h index edc4d6c..4562dcb 100644 --- a/include/copperplate/threadobj.h +++ b/include/copperplate/threadobj.h @@ -179,7 +179,7 @@ struct threadobj { struct holder wait_link; int wait_status; int wait_prio; - void *wait_union; + dref_type(void *) wait_union; size_t wait_size; timer_t periodic_timer; @@ -496,14 +496,14 @@ static inline int threadobj_get_errno(struct threadobj *thobj) struct threadobj *__thobj = threadobj_current();\ assert(__thobj != NULL);\ assert(sizeof(typeof(T)) <= __thobj->wait_size);\ - __thobj->wait_union;\ + (void *)__mptr(__thobj->wait_union);\ }) #define threadobj_finish_wait()do { } while (0) static inline void *threadobj_get_wait(struct threadobj *thobj) { - return thobj->wait_union; + return __mptr(thobj->wait_union); } static inline const char *threadobj_get_name(struct threadobj *thobj) diff --git a/lib/boilerplate/hash.c b/lib/boilerplate/hash.c index 35fcf73..aa35fa4 100644 --- a/lib/boilerplate/hash.c +++ b/lib/boilerplate/hash.c @@ -44,10 +44,6 @@ c -= a; c -= b; c ^= (b>>15); \ } -#define __moff(__p)__memoff(__main_heap, __p) -#define __mptr(__p)__memptr(__main_heap, __p) -#define __mchk(__p)__memchk(__main_heap, __p) - static inline int store_key(struct hashobj *obj, const void *key, size_t len, const struct hash_operations *hops); diff --git a/lib/copperplate/cluster.c b/lib/copperplate/cluster.c index 7353aa8..9355d94 100644 --- a/lib/copperplate/cluster.c +++ b/lib/copperplate/cluster.c @@ -255,9 +255,8 @@ redo: hobj = hash_search(&main_catalog, name, strlen(name), &hash_operations); if (hobj)
[Xenomai-git] Philippe Gerum : copperplate/heapobj: fix build issue
Module: xenomai-3 Branch: next Commit: 2f7cf7e116968d13bf20bddf233ed813ef0d9c13 URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=2f7cf7e116968d13bf20bddf233ed813ef0d9c13 Author: Philippe Gerum Date: Mon Jun 1 13:39:44 2015 +0200 copperplate/heapobj: fix build issue --- lib/copperplate/heapobj-malloc.c |1 + 1 file changed, 1 insertion(+) diff --git a/lib/copperplate/heapobj-malloc.c b/lib/copperplate/heapobj-malloc.c index 60894eb..b77cf09 100644 --- a/lib/copperplate/heapobj-malloc.c +++ b/lib/copperplate/heapobj-malloc.c @@ -110,6 +110,7 @@ void *pvheapobj_alloc(struct heapobj *hobj, size_t size) { struct pool_header *ph = hobj->pool; struct block_header *bh; + void *ptr; write_lock(&ph->lock); ___ Xenomai-git mailing list Xenomai-git@xenomai.org http://xenomai.org/mailman/listinfo/xenomai-git
[Xenomai-git] Philippe Gerum : copperplate/heapobj: fix build issue
Module: xenomai-3 Branch: master Commit: 2f7cf7e116968d13bf20bddf233ed813ef0d9c13 URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=2f7cf7e116968d13bf20bddf233ed813ef0d9c13 Author: Philippe Gerum Date: Mon Jun 1 13:39:44 2015 +0200 copperplate/heapobj: fix build issue --- lib/copperplate/heapobj-malloc.c |1 + 1 file changed, 1 insertion(+) diff --git a/lib/copperplate/heapobj-malloc.c b/lib/copperplate/heapobj-malloc.c index 60894eb..b77cf09 100644 --- a/lib/copperplate/heapobj-malloc.c +++ b/lib/copperplate/heapobj-malloc.c @@ -110,6 +110,7 @@ void *pvheapobj_alloc(struct heapobj *hobj, size_t size) { struct pool_header *ph = hobj->pool; struct block_header *bh; + void *ptr; write_lock(&ph->lock); ___ Xenomai-git mailing list Xenomai-git@xenomai.org http://xenomai.org/mailman/listinfo/xenomai-git
[Xenomai-git] Philippe Gerum : cobalt/synch: restrict imbalance signal to debug mode
Module: xenomai-3 Branch: master Commit: c8894bc29d13a816979fad642760b48f77bcd0cc URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=c8894bc29d13a816979fad642760b48f77bcd0cc Author: Philippe Gerum Date: Mon May 25 10:41:15 2015 +0200 cobalt/synch: restrict imbalance signal to debug mode --- include/cobalt/kernel/thread.h |5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/include/cobalt/kernel/thread.h b/include/cobalt/kernel/thread.h index 335f2e1..6f6fad8 100644 --- a/include/cobalt/kernel/thread.h +++ b/include/cobalt/kernel/thread.h @@ -489,8 +489,9 @@ static inline int xnthread_put_resource(struct xnthread *thread) { if (xnthread_test_state(thread, XNWEAK|XNDEBUG)) { if (unlikely(thread->res_count == 0)) { - xnthread_signal(thread, SIGDEBUG, - SIGDEBUG_RESCNT_IMBALANCE); + if (IS_ENABLED(CONFIG_XENO_OPT_DEBUG_USER)) + xnthread_signal(thread, SIGDEBUG, + SIGDEBUG_RESCNT_IMBALANCE); return -EPERM; } thread->res_count--; ___ Xenomai-git mailing list Xenomai-git@xenomai.org http://xenomai.org/mailman/listinfo/xenomai-git
[Xenomai-git] Philippe Gerum : copperplate/heapobj: fix build issue
Module: xenomai-3 Branch: next Commit: 22a230ddbf874ed289b6c4606c5851193b422164 URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=22a230ddbf874ed289b6c4606c5851193b422164 Author: Philippe Gerum Date: Mon Jun 1 13:35:34 2015 +0200 copperplate/heapobj: fix build issue --- lib/copperplate/cluster.c| 16 ++-- lib/copperplate/heapobj-malloc.c |1 + 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/lib/copperplate/cluster.c b/lib/copperplate/cluster.c index 7353aa8..b19d1c8 100644 --- a/lib/copperplate/cluster.c +++ b/lib/copperplate/cluster.c @@ -91,6 +91,7 @@ #include #include #include +#include #include "copperplate/heapobj.h" #include "copperplate/cluster.h" #include "copperplate/syncobj.h" @@ -257,6 +258,7 @@ redo: if (hobj) { d = container_of(hobj, struct syndictionary, hobj); ret = 0; + printf("existing cluster %s found at %p\n", name, sc); goto out; } @@ -277,6 +279,7 @@ redo: xnfree(d); goto redo; } + printf("new cluster %s at %p\n", name, sc); out: sc->d = d; @@ -299,19 +302,25 @@ int syncluster_addobj(struct syncluster *sc, const char *name, ret = hash_enter_probe(&sc->d->table, name, strlen(name), &cobj->hobj, &hash_operations); + printf("entering object %s => %d\n", name, ret); if (ret) goto out; - if (!syncobj_grant_wait_p(&sc->d->sobj)) + if (!syncobj_grant_wait_p(&sc->d->sobj)) { + printf("no waiter on cluster %Zu\n", + mainheap_ref(&sc->d->sobj, uintptr_t)); goto out; + } /* * Wake up all threads waiting for this key to appear in the * dictionary. */ syncobj_for_each_grant_waiter_safe(&sc->d->sobj, thobj, tmp) { wait = threadobj_get_wait(thobj); - if (*wait->name == *name && strcmp(wait->name, name) == 0) + if (*wait->name == *name && strcmp(wait->name, name) == 0) { + printf("signaling %s\n", thobj->name); syncobj_grant_to(&sc->d->sobj, thobj); + } } out: syncobj_unlock(&sc->d->sobj, &syns); @@ -368,7 +377,10 @@ int syncluster_findobj(struct syncluster *sc, wait = threadobj_prepare_wait(struct syncluster_wait_struct); wait->name = name; } + printf("(waiting for %s to show up on cluster sobj %Zu)\n", name, + mainheap_ref(&sc->d->sobj, uintptr_t)); ret = syncobj_wait_grant(&sc->d->sobj, timeout, &syns); + printf("(back from wait %d)\n", ret); if (ret) { if (ret == -EIDRM) goto out; diff --git a/lib/copperplate/heapobj-malloc.c b/lib/copperplate/heapobj-malloc.c index 60894eb..b77cf09 100644 --- a/lib/copperplate/heapobj-malloc.c +++ b/lib/copperplate/heapobj-malloc.c @@ -110,6 +110,7 @@ void *pvheapobj_alloc(struct heapobj *hobj, size_t size) { struct pool_header *ph = hobj->pool; struct block_header *bh; + void *ptr; write_lock(&ph->lock); ___ Xenomai-git mailing list Xenomai-git@xenomai.org http://xenomai.org/mailman/listinfo/xenomai-git
[Xenomai-git] Philippe Gerum : copperplate/heapobj: fix build issue
Module: xenomai-3 Branch: master Commit: 22a230ddbf874ed289b6c4606c5851193b422164 URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=22a230ddbf874ed289b6c4606c5851193b422164 Author: Philippe Gerum Date: Mon Jun 1 13:35:34 2015 +0200 copperplate/heapobj: fix build issue --- lib/copperplate/cluster.c| 16 ++-- lib/copperplate/heapobj-malloc.c |1 + 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/lib/copperplate/cluster.c b/lib/copperplate/cluster.c index 7353aa8..b19d1c8 100644 --- a/lib/copperplate/cluster.c +++ b/lib/copperplate/cluster.c @@ -91,6 +91,7 @@ #include #include #include +#include #include "copperplate/heapobj.h" #include "copperplate/cluster.h" #include "copperplate/syncobj.h" @@ -257,6 +258,7 @@ redo: if (hobj) { d = container_of(hobj, struct syndictionary, hobj); ret = 0; + printf("existing cluster %s found at %p\n", name, sc); goto out; } @@ -277,6 +279,7 @@ redo: xnfree(d); goto redo; } + printf("new cluster %s at %p\n", name, sc); out: sc->d = d; @@ -299,19 +302,25 @@ int syncluster_addobj(struct syncluster *sc, const char *name, ret = hash_enter_probe(&sc->d->table, name, strlen(name), &cobj->hobj, &hash_operations); + printf("entering object %s => %d\n", name, ret); if (ret) goto out; - if (!syncobj_grant_wait_p(&sc->d->sobj)) + if (!syncobj_grant_wait_p(&sc->d->sobj)) { + printf("no waiter on cluster %Zu\n", + mainheap_ref(&sc->d->sobj, uintptr_t)); goto out; + } /* * Wake up all threads waiting for this key to appear in the * dictionary. */ syncobj_for_each_grant_waiter_safe(&sc->d->sobj, thobj, tmp) { wait = threadobj_get_wait(thobj); - if (*wait->name == *name && strcmp(wait->name, name) == 0) + if (*wait->name == *name && strcmp(wait->name, name) == 0) { + printf("signaling %s\n", thobj->name); syncobj_grant_to(&sc->d->sobj, thobj); + } } out: syncobj_unlock(&sc->d->sobj, &syns); @@ -368,7 +377,10 @@ int syncluster_findobj(struct syncluster *sc, wait = threadobj_prepare_wait(struct syncluster_wait_struct); wait->name = name; } + printf("(waiting for %s to show up on cluster sobj %Zu)\n", name, + mainheap_ref(&sc->d->sobj, uintptr_t)); ret = syncobj_wait_grant(&sc->d->sobj, timeout, &syns); + printf("(back from wait %d)\n", ret); if (ret) { if (ret == -EIDRM) goto out; diff --git a/lib/copperplate/heapobj-malloc.c b/lib/copperplate/heapobj-malloc.c index 60894eb..b77cf09 100644 --- a/lib/copperplate/heapobj-malloc.c +++ b/lib/copperplate/heapobj-malloc.c @@ -110,6 +110,7 @@ void *pvheapobj_alloc(struct heapobj *hobj, size_t size) { struct pool_header *ph = hobj->pool; struct block_header *bh; + void *ptr; write_lock(&ph->lock); ___ Xenomai-git mailing list Xenomai-git@xenomai.org http://xenomai.org/mailman/listinfo/xenomai-git
[Xenomai-git] Philippe Gerum : cobalt/kernel: increase default size of UMM areas to 64k
Module: xenomai-3 Branch: master Commit: f0c2bc8564de83ca102de745df184dffae83b8d3 URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=f0c2bc8564de83ca102de745df184dffae83b8d3 Author: Philippe Gerum Date: Fri May 29 09:22:43 2015 +0200 cobalt/kernel: increase default size of UMM areas to 64k Copperplate-based applications may create significantly more mutexes and condvars internally than pure POSIX ones. Increase the default size suggested for the UMM areas those objects are allocated from. --- kernel/cobalt/Kconfig |8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/kernel/cobalt/Kconfig b/kernel/cobalt/Kconfig index 9c754f5..27b4a4a 100644 --- a/kernel/cobalt/Kconfig +++ b/kernel/cobalt/Kconfig @@ -284,7 +284,7 @@ config XENO_OPT_SYS_HEAPSZ config XENO_OPT_PRIVATE_HEAPSZ int "Size of private heap (Kb)" - default 32 + default 64 help The Cobalt kernel implements fast IPC mechanisms within the @@ -293,11 +293,11 @@ config XENO_OPT_PRIVATE_HEAPSZ process. This option can be used to set the size of this per-process heap. - 32k is considered a large enough size for common use cases. + 64k is considered a large enough size for common use cases. config XENO_OPT_SHARED_HEAPSZ int "Size of shared heap (Kb)" - default 32 + default 64 help The Cobalt kernel implements fast IPC mechanisms between @@ -306,7 +306,7 @@ config XENO_OPT_SHARED_HEAPSZ processes. This option can be used to set the size of this system-wide heap. - 32k is considered a large enough size for common use cases. + 64k is considered a large enough size for common use cases. config XENO_OPT_NRTIMERS int "Maximum number of POSIX timers per process" ___ Xenomai-git mailing list Xenomai-git@xenomai.org http://xenomai.org/mailman/listinfo/xenomai-git