All of lore.kernel.org
 help / color / mirror / Atom feed
From: Philippe Gerum <rpm@xenomai.org>
To: Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org>
Cc: xenomai@xenomai.org
Subject: Re: [Xenomai-core] [RFC][patch] per-process data.
Date: Thu, 11 May 2006 14:53:27 +0200	[thread overview]
Message-ID: <446333C7.1070406@domain.hid> (raw)
In-Reply-To: <17505.58508.240692.324238@domain.hid>

Gilles Chanteperdrix wrote:
> The attached version of the patch do that.

Fine with me, please merge as you see fit. Details follow:

> +++ include/nucleus/ppd.h	2006-05-10 14:27:11.000000000 +0200
> @@ -0,0 +1,26 @@
> +#ifndef PPD_H
> +#define PPD_H
> +

Given that ppds are shadow-specific, I would move ppd.h's contents to 
shadow.h directly.

> +static unsigned
> +xnppd_lookup_inner(xnqueue_t **pq, xnppd_holder_t **pholder, xnppd_key_t *key)
> +{
> +    unsigned bucket = jhash2((uint32_t *)&key->mm,
> +                             sizeof(key->mm)/sizeof(uint32_t), 0);

GCC is likely going to wine on 64-bit archs for attempting to forge a 
type-punned pointer.

> +    xnppd_holder_t *ppd = NULL;
>      xnfeatinfo_t finfo;
>      u_long featmis;
>      int muxid;
> @@ -981,18 +1115,39 @@
>         chance to call xnpod_init(). */
>  
>      if (muxtable[muxid].eventcb) {
> -        int err = muxtable[muxid].eventcb(XNSHADOW_CLIENT_ATTACH);
> +        xnlock_get_irqsave(&nklock, s);
> +        ppd = xnppd_lookup(muxid, curr->mm);
> +        xnlock_put_irqrestore(&nklocks, s);
>

Looks racy to release the nucleus lock that early before actually using 
the found value, if another thread from the same process manages to 
preempt the caller and interleave a binding request on its own (would be 
stupid, I agree, but hey, most of our day-to-day job is to implement 
LARTs pretending that we are "innovating" somehow, so...)

>  
> +/* Call with nklock locked irqs off. */
> +xnppd_holder_t *xnppd_get(unsigned muxid)
> +{
> +    if (xnpod_userspace_p())
> +        return xnppd_lookup(muxid - 1, current->mm);
> +
> +    return NULL;
> +}

Same remark than previously regarding shadow.h, all the xnppd_* services 
are truely shadow-related  services, so calling them 
xnshadow_ppd*something() would be more accurate.

-- 

Philippe.


  reply	other threads:[~2006-05-11 12:53 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-05-07 18:00 [Xenomai-core] [RFC][patch] per-process data Gilles Chanteperdrix
2006-05-07 21:15 ` Jan Kiszka
2006-05-07 23:04   ` Gilles Chanteperdrix
2006-05-08 10:18     ` Dmitry Adamushko
2006-05-08 12:47       ` Gilles Chanteperdrix
2006-05-08 13:05     ` Jan Kiszka
2006-05-08 12:51 ` Gilles Chanteperdrix
2006-05-08 13:14   ` Gilles Chanteperdrix
2006-05-08 13:51   ` Philippe Gerum
2006-05-09 17:49     ` Gilles Chanteperdrix
2006-05-09 22:09       ` Philippe Gerum
2006-05-10 13:03         ` Gilles Chanteperdrix
2006-05-11 12:53           ` Philippe Gerum [this message]
2006-05-11 14:03             ` Gilles Chanteperdrix
2006-05-11 14:12               ` 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=446333C7.1070406@domain.hid \
    --to=rpm@xenomai.org \
    --cc=gilles.chanteperdrix@xenomai.org \
    --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.