All of lore.kernel.org
 help / color / mirror / Atom feed
* unaligned access
@ 2007-02-22  7:10 sathesh babu
  2007-02-22  7:53 ` Rajat Jain
  0 siblings, 1 reply; 13+ messages in thread
From: sathesh babu @ 2007-02-22  7:10 UTC (permalink / raw)
  To: linux-mips, sathesh babu

[-- Attachment #1: Type: text/plain, Size: 445 bytes --]

Hi,
    I have ported linux-2.6.12 kernel on MIPS processor.I would like to 
print the warning messges whenenver kernel or user code  try to access 
unaligned address ( including proceor ID ).
  Is there any configuration option  avaliable in the kernel to view 
the unaligned address?
   
  Thanks in advance.
   
  Regards,
  Sathesh


 				
---------------------------------
 Here’s a new way to find what you're looking for - Yahoo! Answers 

[-- Attachment #2: Type: text/html, Size: 622 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: unaligned access
  2007-02-22  7:10 unaligned access sathesh babu
@ 2007-02-22  7:53 ` Rajat Jain
  2007-02-22  9:18   ` sathesh babu
  0 siblings, 1 reply; 13+ messages in thread
From: Rajat Jain @ 2007-02-22  7:53 UTC (permalink / raw)
  To: sathesh babu; +Cc: linux-mips

On 2/22/07, sathesh babu <sathesh_edara2003@yahoo.co.in> wrote:
> Hi,
>     I have ported linux-2.6.12 kernel on MIPS processor.I would like to
> print the warning messges whenenver kernel or user code  try to access
> unaligned address ( including proceor ID ).
>   Is there any configuration option  avaliable in the kernel to view
> the unaligned address?

Ummm ... not sure about MIPS, but in i386, exception 17 is raised for
every unaligned access. alignment_check() is invoked for every such
access.

Regards,

Rajat

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: unaligned access
  2007-02-22  7:53 ` Rajat Jain
@ 2007-02-22  9:18   ` sathesh babu
  2007-02-22 15:06       ` Kevin D. Kissell
  0 siblings, 1 reply; 13+ messages in thread
From: sathesh babu @ 2007-02-22  9:18 UTC (permalink / raw)
  To: Rajat Jain; +Cc: linux-mips

[-- Attachment #1: Type: text/plain, Size: 1705 bytes --]

Thanks Rajan.
   
  In case of arm processor, the alignment trap behavior can be changed by simply echo a number into  /proc/sys/debug/alignment 
   
  bit             behavior when set
---             -----------------
  0               A user process performing an unaligned memory access
                will cause the kernel to print a message indicating
                process name, pid, pc, instruction, address, and the
                fault code.
  1               The kernel will attempt to fix up the user process
                performing the unaligned access.  This is of course
                slow (think about the floating point emulator) and
                not recommended for production use.
  2               The kernel will send a SIGBUS signal to the user process
                performing the unaligned access.

I would like to know  Is there similar type of implimentation avalilable for MIPS processor in linux-2.6.12 kernel to view or log the unaligned access addresses and corresponding processor ID.
   
  Regards,
  Sathesh
   
  
Rajat Jain <rajat.noida.india@gmail.com> wrote:
  On 2/22/07, sathesh babu wrote:
> Hi,
> I have ported linux-2.6.12 kernel on MIPS processor.I would like to
> print the warning messges whenenver kernel or user code try to access
> unaligned address ( including proceor ID ).
> Is there any configuration option avaliable in the kernel to view
> the unaligned address?

Ummm ... not sure about MIPS, but in i386, exception 17 is raised for
every unaligned access. alignment_check() is invoked for every such
access.

Regards,

Rajat



 				
---------------------------------
 Here’s a new way to find what you're looking for - Yahoo! Answers 

[-- Attachment #2: Type: text/html, Size: 3075 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: unaligned access
@ 2007-02-22 15:06       ` Kevin D. Kissell
  0 siblings, 0 replies; 13+ messages in thread
From: Kevin D. Kissell @ 2007-02-22 15:06 UTC (permalink / raw)
  To: sathesh babu, Rajat Jain; +Cc: linux-mips

[-- Attachment #1: Type: text/plain, Size: 2531 bytes --]

Default behavior in MIPS is to silently fix up and emulate.  A MIPS-specific
system call (sys_sysmips with the command argument of MIPS_FIXADE
and a parameter agument of zero) allows for this to be overridden, so that 
such accesses will be fatal.  It looks as if there was once support to log the events 
to syslog, independently of whether or not they were fixed up, but it doesn't look to me 
as if that still works in 2.6.x kernels.

            Regards,

            Kevin K.
  ----- Original Message ----- 
  From: sathesh babu 
  To: Rajat Jain 
  Cc: linux-mips@linux-mips.org 
  Sent: Thursday, February 22, 2007 10:18 AM
  Subject: Re: unaligned access


  Thanks Rajan.

  In case of arm processor, the alignment trap behavior can be changed by simply echo a number into  /proc/sys/debug/alignment 

  bit             behavior when set
  ---             -----------------
  0               A user process performing an unaligned memory access
                  will cause the kernel to print a message indicating
                  process name, pid, pc, instruction, address, and the
                  fault code.
  1               The kernel will attempt to fix up the user process
                  performing the unaligned access.  This is of course
                  slow (think about the floating point emulator) and
                  not recommended for production use.
  2               The kernel will send a SIGBUS signal to the user process
                  performing the unaligned access.

  I would like to know  Is there similar type of implimentation avalilable for MIPS processor in linux-2.6.12 kernel to view or log the unaligned access addresses and corresponding processor ID.

  Regards,
  Sathesh


  Rajat Jain <rajat.noida.india@gmail.com> wrote:
    On 2/22/07, sathesh babu wrote:
    > Hi,
    > I have ported linux-2.6.12 kernel on MIPS processor.I would like to
    > print the warning messges whenenver kernel or user code try to access
    > unaligned address ( including proceor ID ).
    > Is there any configuration option avaliable in the kernel to view
    > the unaligned address?

    Ummm ... not sure about MIPS, but in i386, exception 17 is raised for
    every unaligned access. alignment_check() is invoked for every such
    access.

    Regards,

    Rajat






------------------------------------------------------------------------------
  Here's a new way to find what you're looking for - Yahoo! Answers 

[-- Attachment #2: Type: text/html, Size: 5625 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: unaligned access
@ 2007-02-22 15:06       ` Kevin D. Kissell
  0 siblings, 0 replies; 13+ messages in thread
From: Kevin D. Kissell @ 2007-02-22 15:06 UTC (permalink / raw)
  To: sathesh babu, Rajat Jain; +Cc: linux-mips

[-- Attachment #1: Type: text/plain, Size: 2531 bytes --]

Default behavior in MIPS is to silently fix up and emulate.  A MIPS-specific
system call (sys_sysmips with the command argument of MIPS_FIXADE
and a parameter agument of zero) allows for this to be overridden, so that 
such accesses will be fatal.  It looks as if there was once support to log the events 
to syslog, independently of whether or not they were fixed up, but it doesn't look to me 
as if that still works in 2.6.x kernels.

            Regards,

            Kevin K.
  ----- Original Message ----- 
  From: sathesh babu 
  To: Rajat Jain 
  Cc: linux-mips@linux-mips.org 
  Sent: Thursday, February 22, 2007 10:18 AM
  Subject: Re: unaligned access


  Thanks Rajan.

  In case of arm processor, the alignment trap behavior can be changed by simply echo a number into  /proc/sys/debug/alignment 

  bit             behavior when set
  ---             -----------------
  0               A user process performing an unaligned memory access
                  will cause the kernel to print a message indicating
                  process name, pid, pc, instruction, address, and the
                  fault code.
  1               The kernel will attempt to fix up the user process
                  performing the unaligned access.  This is of course
                  slow (think about the floating point emulator) and
                  not recommended for production use.
  2               The kernel will send a SIGBUS signal to the user process
                  performing the unaligned access.

  I would like to know  Is there similar type of implimentation avalilable for MIPS processor in linux-2.6.12 kernel to view or log the unaligned access addresses and corresponding processor ID.

  Regards,
  Sathesh


  Rajat Jain <rajat.noida.india@gmail.com> wrote:
    On 2/22/07, sathesh babu wrote:
    > Hi,
    > I have ported linux-2.6.12 kernel on MIPS processor.I would like to
    > print the warning messges whenenver kernel or user code try to access
    > unaligned address ( including proceor ID ).
    > Is there any configuration option avaliable in the kernel to view
    > the unaligned address?

    Ummm ... not sure about MIPS, but in i386, exception 17 is raised for
    every unaligned access. alignment_check() is invoked for every such
    access.

    Regards,

    Rajat






------------------------------------------------------------------------------
  Here's a new way to find what you're looking for - Yahoo! Answers 

[-- Attachment #2: Type: text/html, Size: 5625 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: unaligned access
  2007-02-22 15:06       ` Kevin D. Kissell
  (?)
@ 2007-02-23  3:06       ` Ralf Baechle
  2007-02-23  3:36         ` Atsushi Nemoto
  2007-02-23  9:48         ` sathesh babu
  -1 siblings, 2 replies; 13+ messages in thread
From: Ralf Baechle @ 2007-02-23  3:06 UTC (permalink / raw)
  To: Kevin D. Kissell; +Cc: sathesh babu, Rajat Jain, linux-mips

On Thu, Feb 22, 2007 at 04:06:57PM +0100, Kevin D. Kissell wrote:

> Default behavior in MIPS is to silently fix up and emulate.  A MIPS-specific
> system call (sys_sysmips with the command argument of MIPS_FIXADE
> and a parameter agument of zero) allows for this to be overridden, so that 
> such accesses will be fatal.  It looks as if there was once support to log the events 
> to syslog, independently of whether or not they were fixed up, but it doesn't look to me 
> as if that still works in 2.6.x kernels.

There used to be a configuration option to allow logging which was a
leftover from the times when I implemented the unaligned emulation.  I
did never find it useful later on, so I removed that in almost 9 years
ago and nobody missed it since :-)

But I don't mind putting it back, controllable by sysctl if there is any
demand for it.

  Ralf

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: unaligned access
  2007-02-23  3:06       ` Ralf Baechle
@ 2007-02-23  3:36         ` Atsushi Nemoto
  2007-02-23  8:18             ` Kevin D. Kissell
  2007-02-23  9:48         ` sathesh babu
  1 sibling, 1 reply; 13+ messages in thread
From: Atsushi Nemoto @ 2007-02-23  3:36 UTC (permalink / raw)
  To: ralf; +Cc: kevink, sathesh_edara2003, rajat.noida.india, linux-mips

On Fri, 23 Feb 2007 03:06:45 +0000, Ralf Baechle <ralf@linux-mips.org> wrote:
> There used to be a configuration option to allow logging which was a
> leftover from the times when I implemented the unaligned emulation.  I
> did never find it useful later on, so I removed that in almost 9 years
> ago and nobody missed it since :-)
> 
> But I don't mind putting it back, controllable by sysctl if there is any
> demand for it.

Sometimes I want to know a value of unaligned_instructions variable,
to make sure nobody is causing such exceptions.  I just wanted to know
the statistics and did not want to control it, but showing name of the
process and PC would help to find out who is guilty.  I wonder if
anybody really want to handle the exception manually.

So how about this interface?

1. echo show > /sys/kernel/unaligned_action

Show register dump and processor name at each unaligned exception,
using show_regs() or someting.

2. echo quiet > /sys/kernel/unaligned_action

Siliently fixup unaligned exceptions.

3. cat /sys/kernel/unaligned_instructions

Print unaligned_instructions variable.


Creating files in /sys/kernel is fairly simple:

	subsys_create_file(&kernel_subsys, &foo_attr);

Any comments?
---
Atsushi Nemoto

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: unaligned access
@ 2007-02-23  8:18             ` Kevin D. Kissell
  0 siblings, 0 replies; 13+ messages in thread
From: Kevin D. Kissell @ 2007-02-23  8:18 UTC (permalink / raw)
  To: ralf, Atsushi Nemoto; +Cc: sathesh_edara2003, rajat.noida.india, linux-mips

> So how about this interface?
> 
> 1. echo show > /sys/kernel/unaligned_action
> 
> Show register dump and processor name at each unaligned exception,
> using show_regs() or someting.
> 
> 2. echo quiet > /sys/kernel/unaligned_action
> 
> Siliently fixup unaligned exceptions.
> 
> 3. cat /sys/kernel/unaligned_instructions
> 
> Print unaligned_instructions variable.
> 
> 
> Creating files in /sys/kernel is fairly simple:
> 
> subsys_create_file(&kernel_subsys, &foo_attr);
> 
> Any comments?

One thing about the current, system-call based interface that is kind-of
cool, and different from both what you propose and what was described
as being implemented for ARM, is that Ralf's scheme is per-thread.
I don't know if that power really outweighs the ease-of-use aspect
of being able to manipuate it from the shell command line, but it's 
not something to throw away lightly.  I have no issues with moving
the log data, should it be resurrected, from syslog to /sys/kernel/whatever,
though.

            Regards,

            Kevin K.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: unaligned access
@ 2007-02-23  8:18             ` Kevin D. Kissell
  0 siblings, 0 replies; 13+ messages in thread
From: Kevin D. Kissell @ 2007-02-23  8:18 UTC (permalink / raw)
  To: ralf, Atsushi Nemoto; +Cc: sathesh_edara2003, rajat.noida.india, linux-mips

> So how about this interface?
> 
> 1. echo show > /sys/kernel/unaligned_action
> 
> Show register dump and processor name at each unaligned exception,
> using show_regs() or someting.
> 
> 2. echo quiet > /sys/kernel/unaligned_action
> 
> Siliently fixup unaligned exceptions.
> 
> 3. cat /sys/kernel/unaligned_instructions
> 
> Print unaligned_instructions variable.
> 
> 
> Creating files in /sys/kernel is fairly simple:
> 
> subsys_create_file(&kernel_subsys, &foo_attr);
> 
> Any comments?

One thing about the current, system-call based interface that is kind-of
cool, and different from both what you propose and what was described
as being implemented for ARM, is that Ralf's scheme is per-thread.
I don't know if that power really outweighs the ease-of-use aspect
of being able to manipuate it from the shell command line, but it's 
not something to throw away lightly.  I have no issues with moving
the log data, should it be resurrected, from syslog to /sys/kernel/whatever,
though.

            Regards,

            Kevin K.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: unaligned access
  2007-02-23  3:06       ` Ralf Baechle
  2007-02-23  3:36         ` Atsushi Nemoto
@ 2007-02-23  9:48         ` sathesh babu
  1 sibling, 0 replies; 13+ messages in thread
From: sathesh babu @ 2007-02-23  9:48 UTC (permalink / raw)
  To: Ralf Baechle, Kevin D. Kissell; +Cc: sathesh babu, Rajat Jain, linux-mips

[-- Attachment #1: Type: text/plain, Size: 1313 bytes --]

It would be good idea to know which process hitting unaligned access and PC.
  So that we can try to fix unaligned access when it causes the  performance bottleneck.
   
  Could you please share details about logging the unaligned accesses using sysctl.
   
  Thanks in advance
   
  Regards,
  Sathesh

Ralf Baechle <ralf@linux-mips.org> wrote:
  On Thu, Feb 22, 2007 at 04:06:57PM +0100, Kevin D. Kissell wrote:

> Default behavior in MIPS is to silently fix up and emulate. A MIPS-specific
> system call (sys_sysmips with the command argument of MIPS_FIXADE
> and a parameter agument of zero) allows for this to be overridden, so that 
> such accesses will be fatal. It looks as if there was once support to log the events 
> to syslog, independently of whether or not they were fixed up, but it doesn't look to me 
> as if that still works in 2.6.x kernels.

There used to be a configuration option to allow logging which was a
leftover from the times when I implemented the unaligned emulation. I
did never find it useful later on, so I removed that in almost 9 years
ago and nobody missed it since :-)

But I don't mind putting it back, controllable by sysctl if there is any
demand for it.

Ralf



 				
---------------------------------
 Here’s a new way to find what you're looking for - Yahoo! Answers 

[-- Attachment #2: Type: text/html, Size: 1718 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: unaligned access
  2007-02-23  8:18             ` Kevin D. Kissell
  (?)
@ 2007-02-23 15:12             ` Atsushi Nemoto
  -1 siblings, 0 replies; 13+ messages in thread
From: Atsushi Nemoto @ 2007-02-23 15:12 UTC (permalink / raw)
  To: kevink; +Cc: ralf, sathesh_edara2003, rajat.noida.india, linux-mips

On Fri, 23 Feb 2007 09:18:59 +0100, "Kevin D. Kissell" <kevink@mips.com> wrote:
> One thing about the current, system-call based interface that is kind-of
> cool, and different from both what you propose and what was described
> as being implemented for ARM, is that Ralf's scheme is per-thread.
> I don't know if that power really outweighs the ease-of-use aspect
> of being able to manipuate it from the shell command line, but it's 
> not something to throw away lightly.  I have no issues with moving
> the log data, should it be resurrected, from syslog to /sys/kernel/whatever,
> though.

Well, /sys/kernel method can coexist with per-thread FIXADE method.
We can use /sys/kernel (or something) to change default action.  And
sysmips() or something can be used to override it.

---
Atsushi Nemoto

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: unaligned access
  2007-02-23  8:18             ` Kevin D. Kissell
  (?)
  (?)
@ 2007-02-23 16:18             ` Ralf Baechle
  2007-02-23 16:29               ` Maciej W. Rozycki
  -1 siblings, 1 reply; 13+ messages in thread
From: Ralf Baechle @ 2007-02-23 16:18 UTC (permalink / raw)
  To: Kevin D. Kissell
  Cc: Atsushi Nemoto, sathesh_edara2003, rajat.noida.india, linux-mips

On Fri, Feb 23, 2007 at 09:18:59AM +0100, Kevin D. Kissell wrote:

> One thing about the current, system-call based interface that is kind-of
> cool, and different from both what you propose and what was described
> as being implemented for ARM, is that Ralf's scheme is per-thread.
> I don't know if that power really outweighs the ease-of-use aspect
> of being able to manipuate it from the shell command line, but it's 
> not something to throw away lightly.  I have no issues with moving
> the log data, should it be resurrected, from syslog to /sys/kernel/whatever,
> though.

There are two different things here that need to be sorted out - but for
years nobody noticed so this never really did show up on the radar:

 o sysmips is really a compatibility interface meant to support software
   that did originate on IRIX, RISC/os and maybe even MIPS/os.  But
   sysmips(MIPS_FIXADE,...) is a new operation that I came up with for
   Linux.  So I'd like this interface to die.
 o sysmips(MIPS_FIXADE, ...) does control only the fixup operation of the
   kernel on a per thread base.  Loggin is not controlled by it; that was
   available in the dark past only as a compile time option.
 o The MIPS_FIXADE setting is inherited across clone and fork.  I could
   almost bet no software relying on this feature is actually explicitly
   enabling it.  Maybe the default should be off to make programmers
   aware of this kind of issue in their code?
 o The MIPS_FIXADE setting is valid for both kernel and user mode.  So if
   for example the TCP stack is taking an unaligned exception to process
   an incoming packet, it will look at the setting of the process that just
   happens to be running on the CPU.
 o I think it would be handy to have a method to externally control the
   MIPS_FIXADE setting of a process.
 o Logging unaligned accesses is a dangerous thing; it can easily reach
   a DoS-like volume.

  Ralf

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: unaligned access
  2007-02-23 16:18             ` Ralf Baechle
@ 2007-02-23 16:29               ` Maciej W. Rozycki
  0 siblings, 0 replies; 13+ messages in thread
From: Maciej W. Rozycki @ 2007-02-23 16:29 UTC (permalink / raw)
  To: Ralf Baechle
  Cc: Kevin D. Kissell, Atsushi Nemoto, sathesh_edara2003,
	rajat.noida.india, linux-mips

On Fri, 23 Feb 2007, Ralf Baechle wrote:

>  o Logging unaligned accesses is a dangerous thing; it can easily reach
>    a DoS-like volume.

 Providing a damn good incentive to fix your broken software?

  Maciej

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2007-02-24  3:21 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-22  7:10 unaligned access sathesh babu
2007-02-22  7:53 ` Rajat Jain
2007-02-22  9:18   ` sathesh babu
2007-02-22 15:06     ` Kevin D. Kissell
2007-02-22 15:06       ` Kevin D. Kissell
2007-02-23  3:06       ` Ralf Baechle
2007-02-23  3:36         ` Atsushi Nemoto
2007-02-23  8:18           ` Kevin D. Kissell
2007-02-23  8:18             ` Kevin D. Kissell
2007-02-23 15:12             ` Atsushi Nemoto
2007-02-23 16:18             ` Ralf Baechle
2007-02-23 16:29               ` Maciej W. Rozycki
2007-02-23  9:48         ` sathesh babu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.