All of lore.kernel.org
 help / color / mirror / Atom feed
From: Philippe Gerum <rpm@xenomai.org>
To: "Kiszka, Jan" <jan.kiszka@siemens.com>
Cc: xenomai@xenomai.org
Subject: Re: [Xenomai] [Xenomai-git] Jan Kiszka : cobalt/kernel: Fix invalidation of cond shadow
Date: Wed, 13 Jan 2016 19:44:07 +0100	[thread overview]
Message-ID: <56969AF7.6040505@xenomai.org> (raw)
In-Reply-To: <E1aJQEe-0006t5-UO@sd-51317.xenomai.org>

On 01/13/2016 07:33 PM, git repository hosting wrote:
> Module: xenomai-jki
> Branch: for-forge
> Commit: b7d37dab571df0c0cd42aae094c3d5d1bc71db80
> URL:    http://git.xenomai.org/?p=xenomai-jki.git;a=commit;h=b7d37dab571df0c0cd42aae094c3d5d1bc71db80
> 
> Author: Jan Kiszka <jan.kiszka@siemens.com>
> Date:   Wed Jan 13 19:31:23 2016 +0100
> 
> cobalt/kernel: Fix invalidation of cond shadow
> 
> pthread_cond_destroy fails to invalidate also the shadow object. This
> can cause spurious -EBUSY errors on re-initialization of the very same
> shadow as condition variable later on.
> 
> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
> 
> ---
> 
>  kernel/cobalt/posix/cond.c |    2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/kernel/cobalt/posix/cond.c b/kernel/cobalt/posix/cond.c
> index 7e115cf..84ae8fd 100644
> --- a/kernel/cobalt/posix/cond.c
> +++ b/kernel/cobalt/posix/cond.c
> @@ -117,6 +117,8 @@ static inline int pthread_cond_destroy(struct cobalt_cond_shadow *cnd)
>  
>  	cobalt_cond_reclaim(&cond->resnode, s); /* drops lock */
>  
> +	cobalt_mark_deleted(cnd);
> +
>  	return 0;
>  }
>  
>

cobalt_cond_reclaim() invalidates the shadow object already. Did you
observe -EBUSY already? If so, maybe a rescheduling happens early when
flushing the synchro object, before the invalidation takes place in that
routine.

i.e.

diff --git a/kernel/cobalt/posix/cond.c b/kernel/cobalt/posix/cond.c
index 7e115cf..3f81b47 100644
--- a/kernel/cobalt/posix/cond.c
+++ b/kernel/cobalt/posix/cond.c
@@ -414,8 +414,8 @@ void cobalt_cond_reclaim(struct cobalt_resnode
*node, spl_t s)
 	cond = container_of(node, struct cobalt_cond, resnode);
 	xnregistry_remove(node->handle);
 	cobalt_del_resource(node);
-	xnsynch_destroy(&cond->synchbase);
 	cobalt_mark_deleted(cond);
+	xnsynch_destroy(&cond->synchbase);
 	xnlock_put_irqrestore(&nklock, s);

 	cobalt_umm_free(&cobalt_ppd_get(cond->attr.pshared)->umm,

-- 
Philippe.


       reply	other threads:[~2016-01-13 18:44 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <E1aJQEe-0006t5-UO@sd-51317.xenomai.org>
2016-01-13 18:44 ` Philippe Gerum [this message]
2016-01-13 19:42   ` [Xenomai] [Xenomai-git] Jan Kiszka : cobalt/kernel: Fix invalidation of cond shadow Jan Kiszka
2016-01-14  8:46     ` Philippe Gerum
2016-01-15 13:59       ` Jan Kiszka
2016-01-16 17:00         ` Philippe Gerum

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=56969AF7.6040505@xenomai.org \
    --to=rpm@xenomai.org \
    --cc=jan.kiszka@siemens.com \
    --cc=xenomai@xenomai.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.