Skip to contentSkip to conversation

perf: Use ACCESS_ONCE() instead of volatile cast

PATCH Applied Pranith Kumar 4 participants 4 messages Sep 23, 2014 – Sep 27, 2014 perf events

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 perf: Use ACCESS_ONCE() instead of volatile cast

Use ACCESS_ONCE() instead of the cast to volatile and read. This is just a style change which is reader friendly.

---
 tools/perf/util/session.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/util/session.h +1 -1
index 8dd41ca..ffb4404 100644
@@ -126,5 +126,5 @@ int __perf_session__set_tracepoints_handlers(struct perf_session *session,
 
 extern volatile int session_done;
 
-#define session_done()	(*(volatile int *)(&session_done))
+#define session_done()	ACCESS_ONCE(session_done)
 #endif /* __PERF_SESSION_H */
Signature · 1 line
2.1.0
maintainer Acked-by on v1 1/1
#1 lore raw

Hi Pranith,

Quoted 4 lines · Pranith Kumar

Use ACCESS_ONCE() instead of the cast to volatile and read. This is just a style change which is reader friendly.

Thanks,
Namhyung

Quoted 15 lines
---
 tools/perf/util/session.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/util/session.h +1 -1
index 8dd41ca..ffb4404 100644
@@ -126,5 +126,5 @@ int __perf_session__set_tracepoints_handlers(struct perf_session *session,
 
 extern volatile int session_done;
 
-#define session_done()	(*(volatile int *)(&session_done))
+#define session_done()	ACCESS_ONCE(session_done)
 #endif /* __PERF_SESSION_H */
#3 lore raw

[tip:perf/core] perf tools: Use ACCESS_ONCE() instead of volatile cast

In reply to Pranith Kumar
perf tools: Use ACCESS_ONCE() instead of volatile cast
Commit-ID:  1da34daf24823f19cfd56c97973334cd95635926
Gitweb:     http://git.kernel.org/tip/1da34daf24823f19cfd56c97973334cd95635926
Author:     Pranith Kumar <[email protected]>
AuthorDate: Tue, 23 Sep 2014 10:55:08 -0400
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Fri, 26 Sep 2014 12:36:03 -0300

perf tools: Use ACCESS_ONCE() instead of volatile cast

Use ACCESS_ONCE() instead of the cast to volatile and read. This is just a style change which is reader friendly.

---
 tools/perf/util/session.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/util/session.h +1 -1
index 8dd41ca..ffb4404 100644
@@ -126,5 +126,5 @@ int __perf_session__set_tracepoints_handlers(struct perf_session *session,
 
 extern volatile int session_done;
 
-#define session_done()	(*(volatile int *)(&session_done))
+#define session_done()	ACCESS_ONCE(session_done)
 #endif /* __PERF_SESSION_H */