Red Hat axp-list: Linux on Alpha (1995-2022)
 help / color / mirror / Atom feed
* unaligned access sin sys_swapon()
@ 2000-04-15  1:11 Thorsten Kranzkowski
  2000-04-16 20:11 ` Richard Henderson
  0 siblings, 1 reply; 4+ messages in thread
From: Thorsten Kranzkowski @ 2000-04-15  1:11 UTC (permalink / raw)
  To: Richard Henderson; +Cc: linux-alpha mailing list, axp-list mailing list


Hello!
This is an Alpha AXPpxi33, ev4
gcc 2.96 (egcs-20000410)
kernel 2.3.99-pre5

I get an unaligned access in sys_swapon():

[from /proc/cpuinfo]:
kernel unaligned acc    : 10 (pc=fffffc0000346384,va=fffffc0007c8fff6)

[from System.map]:
fffffc0000345bc0 T get_swaparea_info
fffffc0000345e10 T is_swap_partition
fffffc0000345e80 T sys_swapon
fffffc00003468c0 T si_swapinfo
fffffc00003469d0 T swap_duplicate

[gcc invocation]:
gcc -D__KERNEL__ -I/usr/src/linux-2.3.99-pre5-work/include -Wall 
-Wstrict-prototypes -O2 -fomit-frame-pointer  -fno-strict-aliasing 
-pipe -mno-fp-regs -ffixed-8 -mcpu=ev4 -Wa,-mev6   
-c -o swapfile.o swapfile.c

[disassembled from swapfile.o]:

    16e8:       1f 04 ff 47     nop
    16ec:       00 00 e0 2f     unop
/usr/src/linux-2.3.99-pre5-work/mm/swapfile.c:700
    16f0:       fa 1f ef b3     stl     zero,8186(fp)
/usr/src/linux-2.3.99-pre5-work/mm/swapfile.c:704
    16f4:       01 00 ff 24     ldah    t6,1(zero)
/usr/src/linux-2.3.99-pre5-work/mm/swapfile.c:700
    16f8:       fc 1f 2f a0     ldl     t0,8188(fp)
/usr/src/linux-2.3.99-pre5-work/mm/swapfile.c:701
    16fc:       11 04 ff 47     clr     a1
/usr/src/linux-2.3.99-pre5-work/mm/swapfile.c:704
    1700:       01 00 bf 20     lda     t4,1(zero)
/usr/src/linux-2.3.99-pre5-work/mm/swapfile.c:700
    1704:       f6 1f ef b3     stl     zero,8182(fp)	<-------- this is the
							     unaligned access
/usr/src/linux-2.3.99-pre5-work/mm/swapfile.c:704
    1708:       ff ff e7 20     lda     t6,-1(t6)
/usr/src/linux-2.3.99-pre5-work/mm/swapfile.c:700
    170c:       21 76 3e 48     zapnot  t0,0xf3,t0
    1710:       fc 1f 2f b0     stl     t0,8188(fp)
/usr/src/linux-2.3.99-pre5-work/mm/swapfile.c:702
    1714:       20 00 e9 b3     stl     zero,32(s0)
/usr/src/linux-2.3.99-pre5-work/mm/swapfile.c:703
    1718:       24 00 e9 b3     stl     zero,36(s0)
    171c:       00 00 e0 2f     unop

[from swapfile.c]:
698:	switch (swap_header_version) {
699:	case 1:
700:		memset(((char *) swap_header)+PAGE_SIZE-10,0,10);
701:		j = 0;
702:		p->lowest_bit = 0;
703:		p->highest_bit = 0;
704:		for (i = 1 ; i < 8*PAGE_SIZE ; i++) {
705:			if (test_bit(i,(char *) swap_header)) {


So memset tries to fill the last 10 bytes of a page with '0'. But 2 of the
3 stl insns use an unaligned address!

				      ...this page... | ...next page...
[0]	[1] 	....	[8176]	[8180]	[8184]	[8188]|	[8192]
0123	4567 	....	0123	4567	89ab	cdef  |	0123
						      |
16f0::					  WW	WW 	unaligned write
16f8::				  		RRRR	aligned read
1704::				  WW	WW		unaligned write
1710::						..WW	aligned write


From asm-alpha/string.h it appears thet memset is in fact __builtin_memset 
in this case. Is this a gcc problem or did I miss something?


Bye,
Thorsten

-- 
| Thorsten Kranzkowski        Internet: dl8bcu@gmx.net                        |
| Mobile: ++49 170 1876134       Snail: Niemannsweg 30, 49201 Dissen, Germany |
| Ampr: dl8bcu@db0lj.#rpl.deu.eu, dl8bcu@marvin.dl8bcu.ampr.org [44.130.8.19] |


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

* Re: unaligned access sin sys_swapon()
  2000-04-15  1:11 unaligned access sin sys_swapon() Thorsten Kranzkowski
@ 2000-04-16 20:11 ` Richard Henderson
  2000-04-18 10:20   ` Ivan Kokshaysky
  0 siblings, 1 reply; 4+ messages in thread
From: Richard Henderson @ 2000-04-16 20:11 UTC (permalink / raw)
  To: Richard Henderson, linux-alpha mailing list,
	axp-list mailing list

On Sat, Apr 15, 2000 at 01:11:36AM +0000, Thorsten Kranzkowski wrote:
> >From asm-alpha/string.h it appears thet memset is in fact __builtin_memset 
> in this case. Is this a gcc problem or did I miss something?

It sure appears to be a gcc problem.  I'll look into it.


r~


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

* Re: unaligned access sin sys_swapon()
  2000-04-16 20:11 ` Richard Henderson
@ 2000-04-18 10:20   ` Ivan Kokshaysky
  2000-04-18 20:47     ` Thorsten Kranzkowski
  0 siblings, 1 reply; 4+ messages in thread
From: Ivan Kokshaysky @ 2000-04-18 10:20 UTC (permalink / raw)
  To: axp-list; +Cc: Richard Henderson, linux-alpha mailing list

On Sun, Apr 16, 2000 at 01:11:21PM -0700, Richard Henderson wrote:
> It sure appears to be a gcc problem.  I'll look into it.
> 

I don't know is it related bug or no, but the example below
prints "0" if compiled without BWX.
The bug still present in the 20000417 snapshot.

Ivan.


void foo(void * aaa)
{
}

int main()
{
	short tst[4] = { 1,2,3,4 };

	foo(tst);
	printf("%d\n", tst[3]);
	return 0;
}


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

* Re: unaligned access sin sys_swapon()
  2000-04-18 10:20   ` Ivan Kokshaysky
@ 2000-04-18 20:47     ` Thorsten Kranzkowski
  0 siblings, 0 replies; 4+ messages in thread
From: Thorsten Kranzkowski @ 2000-04-18 20:47 UTC (permalink / raw)
  To: axp-list; +Cc: Richard Henderson, linux-alpha mailing list

On Tue, Apr 18, 2000 at 02:20:41PM +0400, Ivan Kokshaysky wrote:
> On Sun, Apr 16, 2000 at 01:11:21PM -0700, Richard Henderson wrote:
> > It sure appears to be a gcc problem.  I'll look into it.
> I don't know is it related bug or no, but the example below
> prints "0" if compiled without BWX.
> The bug still present in the 20000417 snapshot.
> 
> Ivan.
> 
> 
> void foo(void * aaa)
> {
> }
> 
> int main()
> {
> 	short tst[4] = { 1,2,3,4 };
> 
> 	foo(tst);
> 	printf("%d\n", tst[3]);
> 	return 0;
> }

Alpha AXPpci33, ev4 - bo BWX at all :-) ......
20000410 snapshot

Marvin:~/src$ gcc -o foo foo.c
Marvin:~/src$ ./foo
4
Marvin:~/src$ gcc -O -o foo foo.c
Marvin:~/src$ ./foo
0
Marvin:~/src$


Bye,
Thorsten

-- 
| Thorsten Kranzkowski        Internet: dl8bcu@gmx.net                        |
| Mobile: ++49 170 1876134       Snail: Niemannsweg 30, 49201 Dissen, Germany |
| Ampr: dl8bcu@db0lj.#rpl.deu.eu, dl8bcu@marvin.dl8bcu.ampr.org [44.130.8.19] |


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

end of thread, other threads:[~2000-04-18 21:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2000-04-15  1:11 unaligned access sin sys_swapon() Thorsten Kranzkowski
2000-04-16 20:11 ` Richard Henderson
2000-04-18 10:20   ` Ivan Kokshaysky
2000-04-18 20:47     ` Thorsten Kranzkowski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox