Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
LOFAR
Manage
Activity
Members
Labels
Plan
Issues
Wiki
Jira issues
Open Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
RadioObservatory
LOFAR
Commits
839731d1
Commit
839731d1
authored
16 years ago
by
John Romein
Browse files
Options
Downloads
Patches
Plain Diff
bug 225:
Fixed race condition. Hopefully, the interrupt version works reliably now.
parent
2ddd1cc2
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
RTCP/FCNP/src/fcnp_ion.cc
+35
-27
35 additions, 27 deletions
RTCP/FCNP/src/fcnp_ion.cc
with
35 additions
and
27 deletions
RTCP/FCNP/src/fcnp_ion.cc
+
35
−
27
View file @
839731d1
#include
<lofar_config.h>
#if defined HAVE_BGP_ION
#include
<fcntl.h>
#include
<sys/file.h>
#include
<sys/mman.h>
...
...
@@ -112,6 +116,22 @@ static Semaphore recvSema(1); // could have used mutex, but this is slower!???
static
volatile
bool
stop
,
stopped
;
static
void
setAffinity
()
{
cpu_set_t
cpu_set
;
CPU_ZERO
(
&
cpu_set
);
for
(
unsigned
cpu
=
1
;
cpu
<
4
;
cpu
++
)
CPU_SET
(
cpu
,
&
cpu_set
);
if
(
sched_setaffinity
(
0
,
sizeof
cpu_set
,
&
cpu_set
)
!=
0
)
{
std
::
cerr
<<
"WARNING: sched_setaffinity failed"
<<
std
::
endl
;
perror
(
"sched_setaffinity"
);
}
}
// Reading the tree status words seems to be expensive. These wrappers
// minimize the number of status word reads. Do not read/send packets
// without consulting these functions!
...
...
@@ -327,14 +347,15 @@ static void handleWriteRequest(RequestPacket *request, char *ptr, size_t bytesTo
static
void
*
pollThread
(
void
*
)
{
RequestPacket
request
__attribute__
((
aligned
(
16
)));
unsigned
nrInterrupts
=
0
;
//setAffinity();
while
(
!
stop
)
{
_BGP_TreePtpHdr
header
;
_BGP_TreePtpHdr
header
;
RequestPacket
request
__attribute__
((
aligned
(
16
)));
unsigned
nrInterrupts
=
0
;
if
(
useInterrupts
)
{
if
(
!
checkForIncomingPacket
())
{
if
(
useInterrupts
)
{
while
(
!
stop
)
{
/*if (!checkForIncomingPacket())*/
{
// not thread safe!
int
word
;
read
(
fd
,
&
word
,
sizeof
word
);
// wait for Irq packet
...
...
@@ -350,7 +371,12 @@ static void *pollThread(void *)
}
recvSema
.
up
();
}
else
{
}
std
::
clog
<<
"received "
<<
nrInterrupts
<<
" vc0 interrupts"
<<
std
::
endl
;
stopped
=
true
;
}
else
{
while
(
!
stop
)
{
if
(
checkForIncomingPacket
())
{
_bgp_vcX_pkt_receive
(
&
header
.
word
,
&
request
,
vc0
);
assert
(
header
.
Irq
);
...
...
@@ -372,10 +398,6 @@ static void *pollThread(void *)
}
}
if
(
useInterrupts
)
std
::
clog
<<
"received "
<<
nrInterrupts
<<
" vc0 interrupts"
<<
std
::
endl
;
stopped
=
true
;
return
0
;
}
...
...
@@ -468,22 +490,6 @@ void writeUnaligned(unsigned rankInPSet, const void *ptr, size_t size)
#endif
static
void
setAffinity
()
{
cpu_set_t
cpu_set
;
CPU_ZERO
(
&
cpu_set
);
for
(
unsigned
cpu
=
1
;
cpu
<
4
;
cpu
++
)
CPU_SET
(
cpu
,
&
cpu_set
);
if
(
sched_setaffinity
(
0
,
sizeof
cpu_set
,
&
cpu_set
)
!=
0
)
{
std
::
cerr
<<
"WARNING: sched_setaffinity failed"
<<
std
::
endl
;
perror
(
"sched_setaffinity"
);
}
}
static
void
openVC0
()
{
fd
=
open
(
"/dev/tree0"
,
O_RDWR
);
...
...
@@ -620,3 +626,5 @@ void end()
}
}
// namespace FCNP_ION
#endif // defined HAVE_BGP_ION
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment