* Re: Unaligned traps et al
@ 1999-08-18 21:50 Jano Lukac
1999-08-18 22:10 ` Sean Hunter
0 siblings, 1 reply; 9+ messages in thread
From: Jano Lukac @ 1999-08-18 21:50 UTC (permalink / raw)
To: axp-list
Hi,
The programming stuff is way beyond me, so please don't berate for my
ignorance.
--- Sean Hunter <sean@uncarved.co.uk> wrote:
<snip>
> For those who don't know, its possible (as Michal told me, and rth's
> code snippet demonstrated) to exercise a small degree of control over
> what the kernel does when an app encounters an unaligned access. In
> particular, you can turn off the message, tell the kernel not to fix
> the access (this sounds like a bad idea), or (more usefully) get the
> kernel to send the app a SIGBUS, causing it to dump core. You can
> then plug the coredump into your favourite debugger and fix the
> access.
So this means for the "regular" user (assuming an alpha linux system) that any
time there was this unaligned trap, the program would core dump? Therefore a
non-programmer-type person (like me) would be unable to continue using many
programs intended for x86 which were compiled on his/her alpha because of this.
That seems a little counter-productive to me, but might in fact spur some
programmer-types to finally fix other programs ;)
Good day,
Jano
_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Unaligned traps et al
1999-08-18 21:50 Unaligned traps et al Jano Lukac
@ 1999-08-18 22:10 ` Sean Hunter
0 siblings, 0 replies; 9+ messages in thread
From: Sean Hunter @ 1999-08-18 22:10 UTC (permalink / raw)
To: axp-list
On Wed, Aug 18, 1999 at 02:50:44PM -0700, Jano Lukac wrote:
> Hi,
>
> The programming stuff is way beyond me, so please don't berate for my
> ignorance.
>
> --- Sean Hunter <sean@uncarved.co.uk> wrote:
> <snip>
> > For those who don't know, its possible (as Michal told me, and rth's
> > code snippet demonstrated) to exercise a small degree of control over
> > what the kernel does when an app encounters an unaligned access. In
> > particular, you can turn off the message, tell the kernel not to fix
> > the access (this sounds like a bad idea), or (more usefully) get the
> > kernel to send the app a SIGBUS, causing it to dump core. You can
> > then plug the coredump into your favourite debugger and fix the
> > access.
>
> So this means for the "regular" user (assuming an alpha linux system) that any
> time there was this unaligned trap, the program would core dump? Therefore a
> non-programmer-type person (like me) would be unable to continue using many
> programs intended for x86 which were compiled on his/her alpha because of this.
> That seems a little counter-productive to me, but might in fact spur some
> programmer-types to finally fix other programs ;)
>
The idea is that you would have your alpha working exactly as it now
does, whereas I (and others like me) would have a simple way to turn
on debugging which would allow us to fix a lot of nasty unaligned
traps that make your alpha slower than it should be.
We can then post patches, and when you upgrade your apps, the traps go
away, and your box speeds up. You don't have to suffer any breakage,
and get the benefit of our hard work, whereas we can do the debugging
we want, easier.
Sean
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Unaligned traps et al
@ 1999-08-19 9:52 Christian Groessler
1999-08-19 10:12 ` Sean Hunter
0 siblings, 1 reply; 9+ messages in thread
From: Christian Groessler @ 1999-08-19 9:52 UTC (permalink / raw)
To: axp-list; +Cc: Sean Hunter
Hi,
On 8/18/99 10:23:49 PM Sean Hunter wrote:
>
>The trouble is, you need to use setsysinfo to get your program to do
>this, which is fine for stuff you're writing, but a pain for other
>programs. What I propose is to set up a sysctl so that it will
>automatically set this behaviour as desired. This means that normally
>you just leave this as is, bit if you feel like doing a spot o'
>debugging you can echo "some_magic" >> /proc/sys/kernel/uac_control,
>and all newly-started process will automatically have the correct
>behaviour set in the tss, and will SIGBUS and coredump on encountering
>the unaligned trap. Similarly, if you attempting to show a prototype
>port to your boss, and don't what to be embarrassed by the unaligned
>traps you haven't fixed yet, you echo some magic to the same place to
>turn the messages off.
The following program creates a subshell and all programs
started from therein will SIGBUS on unaligned accesses.
----------------------
/* 28-May-98, chris */
#ifndef __linux__
#include <sys/sysinfo.h>
#else
#include <asm/sysinfo.h>
#include <asm/unistd.h>
static int setsysinfo(unsigned long op, void *buffer, unsigned long size,
int *start, void *arg, unsigned long flag)
{
syscall(__NR_osf_setsysinfo, op, buffer, size, start, arg, flag);
}
#endif
void trap_unaligned(void)
{
unsigned int buf[2];
buf[0] = SSIN_UACPROC;
buf[1] = UAC_SIGBUS | UAC_NOPRINT;
setsysinfo(SSI_NVPAIRS, buf, 1, 0, 0, 0);
}
int main(int ac)
{
trap_unaligned();
printf("creating subshell with SIGBUS setting!\n");
execl("/bin/bash","/bin/bash",(char *)0);
return(0); /* not reached */
}
----------------------
regards,
chris
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: Unaligned traps et al
1999-08-19 9:52 Christian Groessler
@ 1999-08-19 10:12 ` Sean Hunter
0 siblings, 0 replies; 9+ messages in thread
From: Sean Hunter @ 1999-08-19 10:12 UTC (permalink / raw)
To: Christian Groessler; +Cc: axp-list
YUP. I realised shortly after my post last night that this was the
answer. I rolled my own this morning, and have made a one-line kernel
patch to get SIGBUS to cause a core dump, for ease of debugging.
My method yesterday was hopelessly baroque.
Sean
On Thu, Aug 19, 1999 at 10:52:55AM +0100, Christian Groessler wrote:
[a wrapper to deliver sigbus on unaligned]
^ permalink raw reply [flat|nested] 9+ messages in thread
* RE: Unaligned traps et al
@ 1999-08-18 16:38 Paul Jakma
0 siblings, 0 replies; 9+ messages in thread
From: Paul Jakma @ 1999-08-18 16:38 UTC (permalink / raw)
To: 'axp-list@redhat.com'
> 5)Is milo still under active development? I can't get it to build
> against new kernels, which is a pain, because the version I use
> doesn't have the best driver for my scsi card.
the latest milo source are at ftp://genie.ucd.ie/pub/alpha
regards,
paul.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Unaligned traps et al
@ 1999-08-18 13:47 Sean Hunter
1999-08-18 16:26 ` Dan Morrill
[not found] ` <199908181556.JAA28448@ellpspace.math.ualberta.ca>
0 siblings, 2 replies; 9+ messages in thread
From: Sean Hunter @ 1999-08-18 13:47 UTC (permalink / raw)
To: axp-list
OK, I've had an Alpha for about six months or so, and I'd like to do a
bit more development on it (instead of my intel boxes).
I've submitted a few kernel patches (some of which have been accepted
8^) ), but I actually think the user-space tools are in a worse state
than the kernel, and would like to help. I have a few questions for
the alpha gurus:
1)A lot of programs (eg rh6 ping) cause the occasional "unaligned
trap". I understand that these are caused by instructions that are
not aligned correctly in memory, and that that means the processor has
to do some special magic to run them, which slows stuff down. How do
I find and eliminate the error?
2)I can't get xemacs to build. Any hints?
3)Mozilla seems pretty shaky. Is there a "healthy" milestone build
that works OK on alpha? I don't use the mail components, but just
want a browser for the odd times when "lynx" doesn't tell all.
4)Any joy with emm-x86 on the 2.2.x series kernels?
5)Is milo still under active development? I can't get it to build
against new kernels, which is a pain, because the version I use
doesn't have the best driver for my scsi card.
Thanks for any/all replies.
Sean
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: Unaligned traps et al
1999-08-18 13:47 Sean Hunter
@ 1999-08-18 16:26 ` Dan Morrill
[not found] ` <199908181556.JAA28448@ellpspace.math.ualberta.ca>
1 sibling, 0 replies; 9+ messages in thread
From: Dan Morrill @ 1999-08-18 16:26 UTC (permalink / raw)
To: axp-list
On Wed, 18 Aug 1999, Sean Hunter wrote:
> I've submitted a few kernel patches (some of which have been accepted
Heh... you're doing better than I am. :)
> 1)A lot of programs (eg rh6 ping) cause the occasional "unaligned
> trap".
The net-tools package (which includes ping, traceroute, etc.) has already been
fixed. Check updates.redhat.com.
The other big offender, as near as I can tell, is X, but it seems much better
in RH 6.0 than in 5.x.
> 3)Mozilla seems pretty shaky.
Mozilla is pretty shaky on every platform. The xptcall port has been finished
for the Alpha, so at this point it again has parity with all the other Linuces.
Mozilla on the Alpha will come together when Mozilla in general does,
or at least not far behind.
I built a CVS snapshot last week, and it's getting there. It was mostly
usable as a browser. I don't know how stable the milestones are since I don't
pay attention to them and build from CVS when I want to.
I can't help you with the other topics. :)
Dan Morrill
Computer Scientist, Physicist
^ permalink raw reply [flat|nested] 9+ messages in thread[parent not found: <199908181556.JAA28448@ellpspace.math.ualberta.ca>]
* Re: Unaligned traps et al
[not found] ` <199908181556.JAA28448@ellpspace.math.ualberta.ca>
@ 1999-08-18 21:23 ` Sean Hunter
1999-08-18 23:11 ` Richard Henderson
0 siblings, 1 reply; 9+ messages in thread
From: Sean Hunter @ 1999-08-18 21:23 UTC (permalink / raw)
To: Michal Jaegermann; +Cc: axp-list
Thanks for your rousing call to "go buy a clue". Results follow.
On Wed, Aug 18, 1999 at 09:56:48AM -0600, Michal Jaegermann wrote:
> >
> > 1)A lot of programs (eg rh6 ping)
[stuff incl useful snippet of code re unaligned snipped]
I had a feeling that this was a FAQ, but searching the FAQ didn't
uncover it. Perhaps I should submit this to the FAQ...
Anyway, you've got me thing about a possibly useful kernel patch. I'm
going to send this to the list first to get people's opinions. I'm
going to have a go at writing this iover the next couple of weeks if
people think it would be a good idea. (I have done a few similar
things in the past).
For those who don't know, its possible (as Michal told me, and rth's
code snippet demonstrated) to exercise a small degree of control over
what the kernel does when an app encounters an unaligned access. In
particular, you can turn off the message, tell the kernel not to fix
the access (this sounds like a bad idea), or (more usefully) get the
kernel to send the app a SIGBUS, causing it to dump core. You can
then plug the coredump into your favourite debugger and fix the
access.
The trouble is, you need to use setsysinfo to get your program to do
this, which is fine for stuff you're writing, but a pain for other
programs. What I propose is to set up a sysctl so that it will
automatically set this behaviour as desired. This means that normally
you just leave this as is, bit if you feel like doing a spot o'
debugging you can echo "some_magic" >> /proc/sys/kernel/uac_control,
and all newly-started process will automatically have the correct
behaviour set in the tss, and will SIGBUS and coredump on encountering
the unaligned trap. Similarly, if you attempting to show a prototype
port to your boss, and don't what to be embarrassed by the unaligned
traps you haven't fixed yet, you echo some magic to the same place to
turn the messages off.
Thoughts?
Sean
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: Unaligned traps et al
1999-08-18 21:23 ` Sean Hunter
@ 1999-08-18 23:11 ` Richard Henderson
0 siblings, 0 replies; 9+ messages in thread
From: Richard Henderson @ 1999-08-18 23:11 UTC (permalink / raw)
To: Michal Jaegermann, axp-list
On Wed, Aug 18, 1999 at 10:23:49PM +0100, Sean Hunter wrote:
> The trouble is, you need to use setsysinfo to get your program to do
> this, which is fine for stuff you're writing, but a pain for other
> programs. What I propose is to set up a sysctl so that it will
> automatically set this behaviour as desired. This means that normally
> you just leave this as is, bit if you feel like doing a spot o'
> debugging you can echo "some_magic" >> /proc/sys/kernel/uac_control...
The DU syscall allows to set the system default too --
#define SSIN_UACSYS 4 /* set system printing on/off */
#define SSIN_UACPARNT 5 /* set parent proc on/off */
#define SSIN_UACPROC 6 /* set current proc on/off */
I only implemented the SSIN_UACPROC case. If you'd like to
implement the rest, be my guest. ;-)
I don't remember at the moment, but I believe that the value is
(or should be) inherited across exec. (Guessed from SSIN_UACPARNT --
you run a program which changes your shell's default, then run
another program which inherits the value.)
r~
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~1999-08-19 12:36 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1999-08-18 21:50 Unaligned traps et al Jano Lukac
1999-08-18 22:10 ` Sean Hunter
-- strict thread matches above, loose matches on Subject: below --
1999-08-19 9:52 Christian Groessler
1999-08-19 10:12 ` Sean Hunter
1999-08-18 16:38 Paul Jakma
1999-08-18 13:47 Sean Hunter
1999-08-18 16:26 ` Dan Morrill
[not found] ` <199908181556.JAA28448@ellpspace.math.ualberta.ca>
1999-08-18 21:23 ` Sean Hunter
1999-08-18 23:11 ` Richard Henderson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox