]>
Commit | Line | Data |
---|---|---|
2532c0bb CW |
1 | From stable-bounces@linux.kernel.org Fri Jan 5 16:45:00 2007 |
2 | Message-Id: <200701060037.l060bW40013427@shell0.pdx.osdl.net> | |
3 | To: torvalds@osdl.org | |
4 | From: akpm@osdl.org | |
5 | Date: Fri, 05 Jan 2007 16:37:05 -0800 | |
6 | Cc: akpm@osdl.org, johnpol@2ka.mipt.ru, tony.luck@intel.com, stable@kernel.org, erikj@sgi.com, davem@davemloft.net | |
7 | Subject: connector: some fixes for ia64 unaligned access errors | |
8 | ||
9 | From: Erik Jacobson <erikj@sgi.com> | |
10 | ||
11 | On ia64, the various functions that make up cn_proc.c cause kernel | |
12 | unaligned access errors. | |
13 | ||
14 | If you are using these, for example, to get notification about all tasks | |
15 | forking and exiting, you get multiple unaligned access errors per process. | |
16 | ||
17 | Use put_unaligned() in the appropriate palces to fix this. | |
18 | ||
19 | Signed-off-by: Erik Jacobson <erikj@sgi.com> | |
20 | Cc: Evgeniy Polyakov <johnpol@2ka.mipt.ru> | |
21 | Cc: Tony Luck <tony.luck@intel.com> | |
22 | Cc: <stable@kernel.org> | |
23 | Cc: "David S. Miller" <davem@davemloft.net> | |
24 | Signed-off-by: Andrew Morton <akpm@osdl.org> | |
25 | Signed-off-by: Chris Wright <chrisw@sous-sol.org> | |
26 | --- | |
27 | ||
28 | drivers/connector/cn_proc.c | 11 ++++++----- | |
29 | 1 file changed, 6 insertions(+), 5 deletions(-) | |
30 | ||
31 | --- linux-2.6.19.1.orig/drivers/connector/cn_proc.c | |
32 | +++ linux-2.6.19.1/drivers/connector/cn_proc.c | |
33 | @@ -28,6 +28,7 @@ | |
34 | #include <linux/init.h> | |
35 | #include <linux/connector.h> | |
36 | #include <asm/atomic.h> | |
37 | +#include <asm/unaligned.h> | |
38 | ||
39 | #include <linux/cn_proc.h> | |
40 | ||
41 | @@ -60,7 +61,7 @@ void proc_fork_connector(struct task_str | |
42 | ev = (struct proc_event*)msg->data; | |
43 | get_seq(&msg->seq, &ev->cpu); | |
44 | ktime_get_ts(&ts); /* get high res monotonic timestamp */ | |
45 | - ev->timestamp_ns = timespec_to_ns(&ts); | |
46 | + put_unaligned(timespec_to_ns(&ts), (__u64 *)&ev->timestamp_ns); | |
47 | ev->what = PROC_EVENT_FORK; | |
48 | ev->event_data.fork.parent_pid = task->real_parent->pid; | |
49 | ev->event_data.fork.parent_tgid = task->real_parent->tgid; | |
50 | @@ -88,7 +89,7 @@ void proc_exec_connector(struct task_str | |
51 | ev = (struct proc_event*)msg->data; | |
52 | get_seq(&msg->seq, &ev->cpu); | |
53 | ktime_get_ts(&ts); /* get high res monotonic timestamp */ | |
54 | - ev->timestamp_ns = timespec_to_ns(&ts); | |
55 | + put_unaligned(timespec_to_ns(&ts), (__u64 *)&ev->timestamp_ns); | |
56 | ev->what = PROC_EVENT_EXEC; | |
57 | ev->event_data.exec.process_pid = task->pid; | |
58 | ev->event_data.exec.process_tgid = task->tgid; | |
59 | @@ -124,7 +125,7 @@ void proc_id_connector(struct task_struc | |
60 | return; | |
61 | get_seq(&msg->seq, &ev->cpu); | |
62 | ktime_get_ts(&ts); /* get high res monotonic timestamp */ | |
63 | - ev->timestamp_ns = timespec_to_ns(&ts); | |
64 | + put_unaligned(timespec_to_ns(&ts), (__u64 *)&ev->timestamp_ns); | |
65 | ||
66 | memcpy(&msg->id, &cn_proc_event_id, sizeof(msg->id)); | |
67 | msg->ack = 0; /* not used */ | |
68 | @@ -146,7 +147,7 @@ void proc_exit_connector(struct task_str | |
69 | ev = (struct proc_event*)msg->data; | |
70 | get_seq(&msg->seq, &ev->cpu); | |
71 | ktime_get_ts(&ts); /* get high res monotonic timestamp */ | |
72 | - ev->timestamp_ns = timespec_to_ns(&ts); | |
73 | + put_unaligned(timespec_to_ns(&ts), (__u64 *)&ev->timestamp_ns); | |
74 | ev->what = PROC_EVENT_EXIT; | |
75 | ev->event_data.exit.process_pid = task->pid; | |
76 | ev->event_data.exit.process_tgid = task->tgid; | |
77 | @@ -181,7 +182,7 @@ static void cn_proc_ack(int err, int rcv | |
78 | ev = (struct proc_event*)msg->data; | |
79 | msg->seq = rcvd_seq; | |
80 | ktime_get_ts(&ts); /* get high res monotonic timestamp */ | |
81 | - ev->timestamp_ns = timespec_to_ns(&ts); | |
82 | + put_unaligned(timespec_to_ns(&ts), (__u64 *)&ev->timestamp_ns); | |
83 | ev->cpu = -1; | |
84 | ev->what = PROC_EVENT_NONE; | |
85 | ev->event_data.ack.err = err; |