public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Erik Jacobson <erikj@sgi.com>
To: Andrew Morton <akpm@osdl.org>
Cc: Erik Jacobson <erikj@sgi.com>,
	linux-kernel@vger.kernel.org, guillaume.thouvenin@bull.net,
	matthltc@us.ibm.com
Subject: Re: [PATCH] connector: Some fixes for ia64 unaligned access errors
Date: Wed, 13 Dec 2006 00:08:29 -0600	[thread overview]
Message-ID: <20061213060829.GA1409@sgi.com> (raw)
In-Reply-To: <20061212183826.6edb3a3f.akpm@osdl.org>

Hi.  I didn't want to leave this hanging and it stayed in my head so I
thought I'd better just finish it and test it.

I tried out this patch and it got rid of all three unaligned acces errors
I was seeing with process connectors and the patch is indeed much smaller.

I ran our container daemon program in debug mode to be sure the forks
and exits still worked right when the patch was applied and all seemed
well.

I applied this patch to x86_64 as well as a sanity check and it seems
working fine.

Things look good to me.  I'm ok if you prefer this patch, or the one
already in -mm.

Signed-off-by: Erik Jacobson <erikj@sgi.com>
---

 cn_proc.c |   11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
--- linux.orig/drivers/connector/cn_proc.c	2006-12-12 23:03:31.000000000 -0600
+++ linux/drivers/connector/cn_proc.c	2006-12-12 23:06:34.243535000 -0600
@@ -28,6 +28,7 @@
 #include <linux/init.h>
 #include <linux/connector.h>
 #include <asm/atomic.h>
+#include <asm/unaligned.h>
 
 #include <linux/cn_proc.h>
 
@@ -60,7 +61,7 @@
 	ev = (struct proc_event*)msg->data;
 	get_seq(&msg->seq, &ev->cpu);
 	ktime_get_ts(&ts); /* get high res monotonic timestamp */
-	ev->timestamp_ns = timespec_to_ns(&ts);
+	put_unaligned(timespec_to_ns(&ts), (__u64 *) &ev->timestamp_ns);
 	ev->what = PROC_EVENT_FORK;
 	ev->event_data.fork.parent_pid = task->real_parent->pid;
 	ev->event_data.fork.parent_tgid = task->real_parent->tgid;
@@ -88,7 +89,7 @@
 	ev = (struct proc_event*)msg->data;
 	get_seq(&msg->seq, &ev->cpu);
 	ktime_get_ts(&ts); /* get high res monotonic timestamp */
-	ev->timestamp_ns = timespec_to_ns(&ts);
+	put_unaligned(timespec_to_ns(&ts), (__u64 *) &ev->timestamp_ns);
 	ev->what = PROC_EVENT_EXEC;
 	ev->event_data.exec.process_pid = task->pid;
 	ev->event_data.exec.process_tgid = task->tgid;
@@ -124,7 +125,7 @@
 	     	return;
 	get_seq(&msg->seq, &ev->cpu);
 	ktime_get_ts(&ts); /* get high res monotonic timestamp */
-	ev->timestamp_ns = timespec_to_ns(&ts);
+	put_unaligned(timespec_to_ns(&ts), (__u64 *) &ev->timestamp_ns);
 
 	memcpy(&msg->id, &cn_proc_event_id, sizeof(msg->id));
 	msg->ack = 0; /* not used */
@@ -146,7 +147,7 @@
 	ev = (struct proc_event*)msg->data;
 	get_seq(&msg->seq, &ev->cpu);
 	ktime_get_ts(&ts); /* get high res monotonic timestamp */
-	ev->timestamp_ns = timespec_to_ns(&ts);
+	put_unaligned(timespec_to_ns(&ts), (__u64 *) &ev->timestamp_ns);
 	ev->what = PROC_EVENT_EXIT;
 	ev->event_data.exit.process_pid = task->pid;
 	ev->event_data.exit.process_tgid = task->tgid;
@@ -181,7 +182,7 @@
 	ev = (struct proc_event*)msg->data;
 	msg->seq = rcvd_seq;
 	ktime_get_ts(&ts); /* get high res monotonic timestamp */
-	ev->timestamp_ns = timespec_to_ns(&ts);
+	put_unaligned(timespec_to_ns(&ts), (__u64 *) &ev->timestamp_ns);
 	ev->cpu = -1;
 	ev->what = PROC_EVENT_NONE;
 	ev->event_data.ack.err = err;

      reply	other threads:[~2006-12-13  6:18 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-12-07 23:22 [PATCH] connector: Some fixes for ia64 unaligned access errors Erik Jacobson
2006-12-09  3:20 ` Pete Zaitcev
2006-12-09  7:47   ` Matt Helsley
2006-12-09 21:09   ` Erik Jacobson
2006-12-10  2:34     ` Pete Zaitcev
2006-12-11 23:52       ` Matt Helsley
2006-12-12  1:29         ` Pete Zaitcev
2006-12-12  1:50           ` David Miller
2006-12-12  3:09             ` Matt Helsley
2006-12-12  3:41               ` David Miller
2006-12-12  2:07           ` Chen, Kenneth W
2006-12-11 23:52 ` Matt Helsley
2006-12-12 17:54   ` Erik Jacobson
2006-12-13  0:45     ` Andrew Morton
2006-12-13  2:31       ` Erik Jacobson
2006-12-13  2:38         ` Andrew Morton
2006-12-13  6:08           ` Erik Jacobson [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20061213060829.GA1409@sgi.com \
    --to=erikj@sgi.com \
    --cc=akpm@osdl.org \
    --cc=guillaume.thouvenin@bull.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matthltc@us.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox