All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg Gallagher <greg@embeddedgreg.com>
To: Jeff Webb <w1@codecraftsmen.org>
Cc: "xenomai@xenomai.org" <xenomai@xenomai.org>
Subject: Re: select() unblocks when no data to read()
Date: Thu, 9 May 2019 21:37:41 -0400	[thread overview]
Message-ID: <CALLqZ8RdpTNzdTSnn7yGosKAEYyLGh6-eoi6PzPrzRPs3jAdNA@mail.gmail.com> (raw)
In-Reply-To: <Wc_l4MYuhmN-h0Z9zuurZ_MxUaMovQA6xNvZE6EMmf7-zD8ZywQlT_X6AovXAczK01iesjy5RdARBztqwtsVxOhOBSgF3CNpXy2z8lpjU-g=@codecraftsmen.org>

On Thu, May 9, 2019 at 9:26 PM Jeff Webb <w1@codecraftsmen.org> wrote:
>
>
> ‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
> On Thursday, May 9, 2019 9:19 AM, Greg Gallagher <greg@embeddedgreg.com> wrote:
>
> > On Tue, May 7, 2019 at 9:54 PM Jeff Webb via Xenomai
> > xenomai@xenomai.org wrote:
> >
> > > I am having trouble using select() to perform a timed wait on a UDD file descriptor to detect interrupts from a custom PCI card. After some searching, I came across this thread from 2017 that describes my exact issue:
> > > https://xenomai.org/pipermail/xenomai/2017-July/037494.html
> > > I am using x86-64 instead of ARM, but I am having the same trouble. The original poster did a great job of describing the problem, so I won't repeat it. If I use only read() without select(), things work as expected, but I need to implement a timeout.
> > > It sounds like Philippe was going to look into the issue further. Has any progress on this issue been made since the last post in this thread?
> > > Thanks,
> > > -Jeff Webb
> >
> > There was a fix posted to the list a while ago but it wasn't a patch
> > it was the whole c file. I don't think a patch was ever made, I'll
> > see if I can dig it up.
>
> Thanks for looking into it, Greg.  I must have missed that post.  The original poster's solution of adding this line:
>
>   rtdm_event_clear(&ur->pulse);
>
> just before the return statement in udd_read_rt() is working for me.  Philippe mentioned that this might be racy, but maybe it's okay (or maybe not?) if there are no shared interrupts and interrupts are unmasked by the userspace application after the read completes.
>
> -Jeff
>

Here's the thread:
https://www.xenomai.org/pipermail/xenomai/2018-May/038934.html

I'm not sure if that will solve your issue, I can make a patch
tomorrow if that's easier and you can test it out.  I haven't dug to
far into this but I don't mind taking a look if that will help.

-Greg


  reply	other threads:[~2019-05-10  1:37 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-08  1:53 select() unblocks when no data to read() Jeff Webb
2019-05-09 14:19 ` Greg Gallagher
2019-05-10  1:26   ` Jeff Webb
2019-05-10  1:37     ` Greg Gallagher [this message]
2019-05-22 13:02       ` Jeff Webb
2019-05-10  8:24     ` Philippe Gerum
2019-05-22 13:06       ` Jeff Webb

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=CALLqZ8RdpTNzdTSnn7yGosKAEYyLGh6-eoi6PzPrzRPs3jAdNA@mail.gmail.com \
    --to=greg@embeddedgreg.com \
    --cc=w1@codecraftsmen.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.