Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
P
PPSi
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
50
Issues
50
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
PPSi
Commits
73ebe33f
Commit
73ebe33f
authored
Nov 20, 2018
by
Adam Wujek
💬
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
arch-wrs: add verbosity when double lock/unlock of shmem
Signed-off-by:
Adam Wujek
<
adam.wujek@cern.ch
>
parent
68e640ea
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
27 additions
and
18 deletions
+27
-18
hal_shmem.h
arch-wrs/include/libwr/hal_shmem.h
+1
-2
shmem.h
arch-wrs/include/libwr/shmem.h
+6
-3
shmem.c
arch-wrs/shmem.c
+19
-12
wr-api.h
proto-ext-whiterabbit/wr-api.h
+1
-1
No files found.
arch-wrs/include/libwr/hal_shmem.h
View file @
73ebe33f
...
...
@@ -119,8 +119,7 @@ struct hal_temp_sensors {
};
/* This is the overall structure stored in shared memory */
#define HAL_SHMEM_VERSION 10
/* Version 10 because of adding sfp_dom_raw
has_sfp_diag and read_sfp_diag */
#define HAL_SHMEM_VERSION 11
/* Version 11, changed wrs_shm_head */
struct
hal_shmem_header
{
int
nports
;
...
...
arch-wrs/include/libwr/shmem.h
View file @
73ebe33f
...
...
@@ -35,6 +35,9 @@ struct wrs_shm_head {
unsigned
sequence
;
/* If we need consistency, this is it. LSB bit
* informs whether shmem is locked already */
unsigned
version
;
/* Version of the data structure */
const
char
*
last_write_caller
;
/* Function of the last wrs_shm_write
* call */
int
last_write_line
;
/* Line of the last wrs_shm_write call */
unsigned
data_size
;
/* Size of it (for binary dumps) */
};
...
...
@@ -81,11 +84,11 @@ void *wrs_shm_follow(struct wrs_shm_head *head, void *ptr);
#define WRS_SHM_WRITE_BEGIN 1
#define WRS_SHM_WRITE_END 0
/* A helper to pass the name of
caller function
*/
/* A helper to pass the name of
a caller function and a line of the call
*/
#define wrs_shm_write(headptr, flags) wrs_shm_write_caller(headptr, flags, \
__func__)
__func__
, __LINE__
)
extern
void
wrs_shm_write_caller
(
struct
wrs_shm_head
*
head
,
int
flags
,
const
char
*
caller
);
const
char
*
caller
,
int
line
);
/* A reader can rely on the sequence number (in the <linux/seqlock.h> way) */
extern
unsigned
wrs_shm_seqbegin
(
struct
wrs_shm_head
*
head
);
...
...
arch-wrs/shmem.c
View file @
73ebe33f
...
...
@@ -216,7 +216,7 @@ void *wrs_shm_follow(struct wrs_shm_head *head, void *ptr)
/* Before and after writing a chunk of data, act on sequence and stamp */
void
wrs_shm_write_caller
(
struct
wrs_shm_head
*
head
,
int
flags
,
const
char
*
caller
)
const
char
*
caller
,
int
line
)
{
char
*
msg
=
"Wrong parameter"
;
...
...
@@ -233,29 +233,36 @@ void wrs_shm_write_caller(struct wrs_shm_head *head, int flags,
pr_debug
(
"caller of a function wrs_shm_write is %s, called for
\"
%s
\"
"
"with the flag
\"
%s
\"\n
"
,
caller
,
head
->
name
,
msg
);
(
void
)
*
msg
;
/* if pr_debug() is empty, we'd have "unused variable" */
head
->
sequence
+=
2
;
if
(
flags
==
WRS_SHM_WRITE_BEGIN
)
{
if
(
head
->
sequence
&
WRS_SHM_LOCK_MASK
)
pr_error
(
"Trying to lock already locked shmem on the "
"write end! Sequence number is %d. The caller"
" of wrs_shm_write is %s
\n
"
,
head
->
sequence
,
caller
);
pr_error
(
"Trying to lock already locked shmem! "
"The sequence number is %d. The current "
"caller of wrs_shm_write is %s (line %d), "
"previous caller %s (line %d)
\n
"
,
head
->
sequence
,
caller
,
line
,
head
->
last_write_caller
,
head
->
last_write_line
);
head
->
sequence
|=
WRS_SHM_LOCK_MASK
;
head
->
last_write_caller
=
caller
;
head
->
last_write_line
=
line
;
}
if
(
flags
==
WRS_SHM_WRITE_END
)
{
/* At end-of-writing update the timestamp too */
head
->
stamp
=
get_monotonic_sec
();
if
(
!
(
head
->
sequence
&
WRS_SHM_LOCK_MASK
))
pr_error
(
"Trying to unlock already unlocked shmem on "
"the write begin! Sequence number is %d. The "
"caller of wrs_shm_write is %s
\n
"
,
head
->
sequence
,
caller
);
pr_error
(
"Trying to unlock already unlocked shmem! "
"The sequence number is %d. The current "
"caller of wrs_shm_write is %s (line %d), "
"previous caller %s (line %d)
\n
"
,
head
->
sequence
,
caller
,
line
,
head
->
last_write_caller
,
head
->
last_write_line
);
head
->
sequence
&=
~
WRS_SHM_LOCK_MASK
;
head
->
last_write_caller
=
caller
;
head
->
last_write_line
=
line
;
}
return
;
}
...
...
proto-ext-whiterabbit/wr-api.h
View file @
73ebe33f
...
...
@@ -11,7 +11,7 @@
/* Please increment WRS_PPSI_SHMEM_VERSION if you change any exported data
* structure */
#define WRS_PPSI_SHMEM_VERSION 3
0
/* added HAL_PORT_STATE_RESET to hal
*/
#define WRS_PPSI_SHMEM_VERSION 3
1
/* changed wrs_shm_head
*/
/* Don't include the Following when this file is included in assembler. */
#ifndef __ASSEMBLY__
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment