Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
34596dc9
Commit
34596dc9
authored
Sep 30, 2006
by
Andi Kleen
Committed by
Andi Kleen
Sep 30, 2006
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PATCH] Define vsyscall cache as blob to make clearer that user space shouldn't use it
Signed-off-by:
Andi Kleen
<
ak@suse.de
>
parent
120b1142
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
13 deletions
+15
-13
arch/x86_64/kernel/vsyscall.c
arch/x86_64/kernel/vsyscall.c
+4
-4
include/linux/getcpu.h
include/linux/getcpu.h
+7
-5
kernel/sys.c
kernel/sys.c
+4
-4
No files found.
arch/x86_64/kernel/vsyscall.c
View file @
34596dc9
...
...
@@ -155,8 +155,8 @@ vgetcpu(unsigned *cpu, unsigned *node, struct getcpu_cache *tcache)
We do this here because otherwise user space would do it on
its own in a likely inferior way (no access to jiffies).
If you don't like it pass NULL. */
if
(
tcache
&&
tcache
->
t0
==
(
j
=
__jiffies
))
{
p
=
tcache
->
t1
;
if
(
tcache
&&
tcache
->
blob
[
0
]
==
(
j
=
__jiffies
))
{
p
=
tcache
->
blob
[
1
]
;
}
else
if
(
__vgetcpu_mode
==
VGETCPU_RDTSCP
)
{
/* Load per CPU data from RDTSCP */
rdtscp
(
dummy
,
dummy
,
p
);
...
...
@@ -165,8 +165,8 @@ vgetcpu(unsigned *cpu, unsigned *node, struct getcpu_cache *tcache)
asm
(
"lsl %1,%0"
:
"=r"
(
p
)
:
"r"
(
__PER_CPU_SEG
));
}
if
(
tcache
)
{
tcache
->
t0
=
j
;
tcache
->
t1
=
p
;
tcache
->
blob
[
0
]
=
j
;
tcache
->
blob
[
1
]
=
p
;
}
if
(
cpu
)
*
cpu
=
p
&
0xfff
;
...
...
include/linux/getcpu.h
View file @
34596dc9
#ifndef _LINUX_GETCPU_H
#define _LINUX_GETCPU_H 1
/* Cache for getcpu() to speed it up. Results might be
upto a jiffi
e
/* Cache for getcpu() to speed it up. Results might be
a short tim
e
out of date, but will be faster.
User programs should not refer to the contents of this structure.
It is only a cache for vgetcpu(). It might change in future kernels.
I repeat they should not refer to it. If they do they will break
in future kernels.
It is only a private cache for vgetcpu(). It will change in future kernels.
The user program must store this information per thread (__thread)
If you want 100% accurate information pass NULL instead. */
struct
getcpu_cache
{
unsigned
long
t0
;
unsigned
long
t1
;
unsigned
long
res
[
4
];
unsigned
long
blob
[
128
/
sizeof
(
long
)];
};
#endif
kernel/sys.c
View file @
34596dc9
...
...
@@ -2083,12 +2083,12 @@ asmlinkage long sys_getcpu(unsigned __user *cpup, unsigned __user *nodep,
* padding
*/
unsigned
long
t0
,
t1
;
get_user
(
t0
,
&
cache
->
t0
);
get_user
(
t1
,
&
cache
->
t1
);
get_user
(
t0
,
&
cache
->
blob
[
0
]
);
get_user
(
t1
,
&
cache
->
blob
[
1
]
);
t0
++
;
t1
++
;
put_user
(
t0
,
&
cache
->
t0
);
put_user
(
t1
,
&
cache
->
t1
);
put_user
(
t0
,
&
cache
->
blob
[
0
]
);
put_user
(
t1
,
&
cache
->
blob
[
1
]
);
}
return
err
?
-
EFAULT
:
0
;
}
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