in ccio_io_pdir_entry(),BUG_ON() seems to break gcc-4.2 optimization?
Just for remind:
Quoted 2 lines · Joel Soete
[snip]
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
But this time, it seems not consider assembly:
asm volatile ("lci %%r0(%%sr1, %1), %0" : "=r" (ci) : "r" (vba)); asm volatile ("extru %1,19,12,%0" : "+r" (ci) : "r" (ci)); asm volatile ("depw %1,15,12,%0" : "+r" (pa) : "r" (ci));as a 'volatile' block and insert line 1c:
This seems to make better what I want:
__asm__ __volatile__ (
"lci %%r0(%%sr1, %2), %0\n"
"\textru %0,19,12,%0\n"
"\tdepw %0,15,12,%1\n"
: "+r" (ci), "+r" (pa)
: "r" (vba)
: "memory"
);in <ccio_map_sg>
200: 06 80 53 13 lci r0(sr1,r20),r19 | 200: 08 1a 02 54 copy r26,r20
204: d2 73 1a 74 extrw,u r19,19,12,r19 | 204: 06 a0 53 14 lci
r0(sr1,r21),r20
208: 08 1a 02 5c copy r26,ret0 | 208: d2 94 1a 74 extrw,u
r20,19,12,r20
20c: d7 93 0e 14 depw r19,15,12,ret0 | 20c: d7 94 0e 14 depw
r20,15,12,ret0
210: 0e dc 12 80 stw ret0,0(r22) 210: 0e dc 12 80 stw ret0,0(r22)
214: 06 c0 12 80 fdc r0(r22) 214: 06 c0 12 80 fdc r0(r22)
218: 00 00 04 00 sync 218: 00 00 04 00 sync
J.
PS: I don't yet understand why kernel panicing when I try to get rid to reserve 'ci' variable and use in place a gr as r19 (even if clobbered), the produced object seems ok but resulting kernel panicing (even after a full rebuild after a make distclean???)
Quoted 14 lines · Joel Soete
Just for remind:
Quoted 2 lines · Joel Soete
[snip]
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
But this time, it seems not consider assembly:
asm volatile ("lci %%r0(%%sr1, %1), %0" : "=r" (ci) : "r" (vba)); asm volatile ("extru %1,19,12,%0" : "+r" (ci) : "r" (ci)); asm volatile ("depw %1,15,12,%0" : "+r" (pa) : "r" (ci));as a 'volatile' block and insert line 1c:
Quoted 8 lines
This seems to make better what I want:
__asm__ __volatile__ ( "lci %%r0(%%sr1, %2), %0\n" "\textru %0,19,12,%0\n" "\tdepw %0,15,12,%1\n" : "+r" (ci), "+r" (pa) : "r" (vba) : "memory"
Why the "memory"? This asm code isn't modifying memory at all.
Quoted 15 lines
);in <
ccio_map_sg>
200: 06 80 53 13 lci r0(sr1,r20),r19 | 200: 08 1a 02 54 copy r26,r20
204: d2 73 1a 74 extrw,u r19,19,12,r19 | 204: 06 a0 53 14 lci
r0(sr1,r21),r20
208: 08 1a 02 5c copy r26,ret0 | 208: d2 94 1a 74 extrw,u
r20,19,12,r20
20c: d7 93 0e 14 depw r19,15,12,ret0 | 20c: d7 94 0e 14 depw
r20,15,12,ret0
210: 0e dc 12 80 stw ret0,0(r22) 210: 0e dc 12 80 stw ret0,0(r22)
214: 06 c0 12 80 fdc r0(r22) 214: 06 c0 12 80 fdc r0(r22)
218: 00 00 04 00 sync 218: 00 00 04 00 sync
Quoted 6 lines
J.
PS: I don't yet understand why kernel panicing when I try to get rid to reserve 'ci' variable and use in place a gr as r19 (even if clobbered), the produced object seems ok but resulting kernel panicing (even after a full rebuild after a make distclean???)
What's wrong with "ci" variable? It's just another register. C compiler will allocate it and then we pass it to the asm().
And are you sure it's ok to use r19?
hth,
grant
Quoted 1 line
Hello Grant,
Quoted 24 lines · Grant Grundler
Quoted 14 lines · Joel Soete
Just for remind:
Quoted 2 lines · Joel Soete
[snip]
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
But this time, it seems not consider assembly:
asm volatile ("lci %%r0(%%sr1, %1), %0" : "=r" (ci) : "r" (vba)); asm volatile ("extru %1,19,12,%0" : "+r" (ci) : "r" (ci)); asm volatile ("depw %1,15,12,%0" : "+r" (pa) : "r" (ci));as a 'volatile' block and insert line 1c:
Quoted 8 lines
This seems to make better what I want:
__asm__ __volatile__ ( "lci %%r0(%%sr1, %2), %0\n" "\textru %0,19,12,%0\n" "\tdepw %0,15,12,%1\n" : "+r" (ci), "+r" (pa) : "r" (vba) : "memory"
Quoted 2 lines
Why the "memory"? This asm code isn't modifying memory at all.
well I certainly still have wrongly understand what "memory" clobber means but for me "pa" is a memory location modified (the plus sign in '"+r" (pa)' and that either after 64bit computation or 32bit initialization pa=0). But your comment make me fill I am again wrong (well definitively C is not my language ;-) .)
Quoted 15 lines
Quoted 15 lines
);in <
ccio_map_sg>
200: 06 80 53 13 lci r0(sr1,r20),r19 | 200: 08 1a 02 54 copy r26,r20
204: d2 73 1a 74 extrw,u r19,19,12,r19 | 204: 06 a0 53 14 lci
r0(sr1,r21),r20
208: 08 1a 02 5c copy r26,ret0 | 208: d2 94 1a 74 extrw,u
r20,19,12,r20
20c: d7 93 0e 14 depw r19,15,12,ret0 | 20c: d7 94 0e 14 depw
r20,15,12,ret0
210: 0e dc 12 80 stw ret0,0(r22) 210: 0e dc 12 80 stw ret0,0(r22)
214: 06 c0 12 80 fdc r0(r22) 214: 06 c0 12 80 fdc r0(r22)
218: 00 00 04 00 sync 218: 00 00 04 00 sync
Quoted 8 lines
Quoted 6 lines
J.
PS: I don't yet understand why kernel panicing when I try to get rid to reserve 'ci' variable and use in place a gr as r19 (even if clobbered), the produced object seems ok but resulting kernel panicing (even after a full rebuild after a make distclean???)
What's wrong with "ci" variable? It's just another register.
well the idea is that "ci" variable is just there as a tmp variable just used in this asm code, right. so why not simply get rid of its declaration (btw save a line of code ;-)) and just use a common temporay reg as r19?
but what I show above is just a 'diff -y' between a objdump's hunk of ccio-dma.o:
on the left side what gcc produce with the original code (3 different asm lines) (this kernel was well booting fine) on the right side what same compile produce with new code (1 asm line).
Otoh, based on my few knowldge on parisc asm, it seems to me that something like:
__asm__ __volatile__ (
"lci %%r0(%%sr1, %1), %%r19\n"
"\textru %%r19,19,12,%%r19\n"
"\tdepw %%r19,15,12,%0\n"
: "+r" (pa)
: "r" (vba)
: "r19")would do the same job, but all my test results was a panicing kernel???
(even thought if I am diffing 2 objdump of the only ccio-dma.o, it looks like gr are just used differently. but may be did I missed another wrong stuff).
That said, nothing of that help to fixe ccio-dma driver issue ;-(
My latest hope is relayfs to grab more debug info (I just need a bit more free time).
Quoted 4 lines
C compiler will allocate it and then we pass it to the
asm().And are you sure it's ok to use r19?
yes that was the only lines, I was working on.
Tx,
J.
Quoted 5 lines
hth,
grant
Quoted 25 lines
Quoted 24 lines · Grant Grundler
Quoted 22 lines · Joel Soete
Just for remind:
Quoted 2 lines · Joel Soete
[snip]
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
But this time, it seems not consider assembly:
asm volatile ("lci %%r0(%%sr1, %1), %0" : "=r" (ci) : "r" (vba)); asm volatile ("extru %1,19,12,%0" : "+r" (ci) : "r" (ci)); asm volatile ("depw %1,15,12,%0" : "+r" (pa) : "r" (ci));as a 'volatile' block and insert line 1c:
This seems to make better what I want:
__asm__ __volatile__ ( "lci %%r0(%%sr1, %2), %0\n" "\textru %0,19,12,%0\n" "\tdepw %0,15,12,%1\n" : "+r" (ci), "+r" (pa) : "r" (vba) : "memory"
Quoted 4 lines
Quoted 2 lines
Why the "memory"? This asm code isn't modifying memory at all.
well I certainly still have wrongly understand what "memory" clobber means but for me "pa" is a memory location modified (the plus sign in '"+r" (pa)' and that either after 64bit computation or 32bit initialization pa=0).
The "+r" constraint indicates a register operand that is both read and written. However, "ci" and "pa" are not read, so the constraints for them should be "=r". None of the instructions modify memory, so the "memory" clobber is unnecessary.
Quoted 1 line
so why not simply get rid of its declaration (btw save a line of code ;-)) and just use a common temporay reg as r19?
r19 is the pic register in 64-bit mode and can't be used without saving and restoring it.
Dave
Signature · 2 lines
J. David Anglin [email protected] National Research Council of Canada (613) 990-0752 (FAX: 952-6602)
On Sat, Jun 28, 2008 at 10:26:25PM +0000, Joel Soete wrote:
...
Quoted 5 lines
Quoted 1 line
What's wrong with "ci" variable? It's just another register.
well the idea is that "ci" variable is just there as a tmp variable just used in this asm code, right.
so why not simply get rid of its declaration (btw save a line of code ;-)) and just use a common temporay reg as r19?
No - don't do that. Let the compiler do the work of allocating registers. It's really good at it. :) Much better than you and I combined. :) All we need to do is tell the compiler we need a register.
cheers,
grant
Hello Grant,
Quoted 8 lines · Grant Grundler
On Sat, Jun 28, 2008 at 10:26:25PM +0000, Joel Soete wrote:
...Quoted 3 lines
Quoted 1 line
What's wrong with "ci" variable? It's just another register.
well the idea is that "ci" variable is just there as a tmp variable just used in this asm code, right. so why not simply get rid of its declaration (btw save a line of code ;-)) and just use a common temporay reg as r19?
No - don't do that. Let the compiler do the work of allocating registers. It's really good at it. :) Much better than you and I combined. :)
You and gcc already prove it to me ;-)
Quoted 2 lines
All we need to do is tell the compiler we need a register.
Ok
Taken also into account of David remarks, here is the latest stuff tested with success:
__asm__ __volatile__ (
"lci %%r0(%%sr1, %2), %0\n"
"\textru %0,19,12,%0\n"
"\tdepw %0,15,12,%1\n"
: "=r" (ci), "=r" (pa)
: "r" (vba)
);Tx to all for kind comments, they learn me a lot ;-)
J.
Quoted 8 lines
cheers,
grant
--
To unsubscribe from this list: send the line "unsubscribe linux-parisc" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
On Mon, Jun 30, 2008 at 06:28:36PM +0000, Joel Soete wrote:
...
Quoted 10 lines
Taken also into account of David remarks, here is the latest stuff tested with success:
__asm__ __volatile__ ( "lci %%r0(%%sr1, %2), %0\n" "\textru %0,19,12,%0\n" "\tdepw %0,15,12,%1\n" : "=r" (ci), "=r" (pa) : "r" (vba) );
So can you remind me (and Kyle) why this is better than what is there now?
Quoted 1 line
Tx to all for kind comments, they learn me a lot ;-)
welcome! :)
grant
Quoted 12 lines · Grant Grundler
On Mon, Jun 30, 2008 at 06:28:36PM +0000, Joel Soete wrote:
...Quoted 9 lines
Taken also into account of David remarks, here is the latest stuff tested with success:
__asm__ __volatile__ ( "lci %%r0(%%sr1, %2), %0\n" "\textru %0,19,12,%0\n" "\tdepw %0,15,12,%1\n" : "=r" (ci), "=r" (pa) : "r" (vba) );
Quoted 3 lines
So can you remind me (and Kyle) why this is better than what is there now?
mmm may be because gcc consider it now as only 1 'volatile' instruction:
in <ccio_map_sg>
-----------< Original code > --------------+------------< New stuff >-----------------
200: 06 80 53 13 lci r0(sr1,r20),r19 | 200: 08 1a 02 54 copy r26,r20 204: d2 73 1a 74 extrw,u r19,19,12,r19 | 204: 06 a0 53 14 lci r0(sr1,r21),r20 208: 08 1a 02 5c copy r26,ret0 | 208: d2 94 1a 74 extrw,u r20,19,12,r20 20c: d7 93 0e 14 depw r19,15,12,ret0 | 20c: d7 94 0e 14 depw r20,15,12,ret0 210: 0e dc 12 80 stw ret0,0(r22) 210: 0e dc 12 80 stw ret0,0(r22) 214: 06 c0 12 80 fdc r0(r22) 214: 06 c0 12 80 fdc r0(r22) 218: 00 00 04 00 sync 218: 00 00 04 00 sync
thought?
Quoted 11 lines
Quoted 1 line
Tx to all for kind comments, they learn me a lot ;-)
welcome! :)
grant
--
To unsubscribe from this list: send the line "unsubscribe linux-parisc" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 15 lines · Joel Soete
Quoted 2 lines
So can you remind me (and Kyle) why this is better than what is there now?
mmm may be because gcc consider it now as only 1 'volatile' instruction:
in <
ccio_map_sg>
-----------< Original code > --------------+------------< New stuffQuoted 1 line
-----------------
200: 06 80 53 13 lci r0(sr1,r20),r19 | 200: 08 1a 02 54 copy r26,r20 204: d2 73 1a 74 extrw,u r19,19,12,r19 | 204: 06 a0 53 14 lci r0(sr1,r21),r20 208: 08 1a 02 5c copy r26,ret0 | 208: d2 94 1a 74 extrw,u r20,19,12,r20 20c: d7 93 0e 14 depw r19,15,12,ret0 | 20c: d7 94 0e 14 depw r20,15,12,ret0 210: 0e dc 12 80 stw ret0,0(r22) 210: 0e dc 12 80 stw ret0,0(r22) 214: 06 c0 12 80 fdc r0(r22) 214: 06 c0 12 80 fdc r0(r22) 218: 00 00 04 00 sync 218: 00 00 04 00 sync
Quoted 1 line
thought?
I'm not comfortable "New stuff" version is correct.
In "New Stuff", r20 gets clobbered and values copied from r26 are lost. That's not the case in the original code. "depw" only replaces 12 bits of "ret0" in the original code.
thanks,
grant