Joel Soete | 1 Jul 2008 16:29
Picon
Favicon

About iommu-helpers.h: where can I find detailed info on the scatter list programming?

Hello Grant,

I am looking for such kind of reference because I am totally ignorant on this
subject (as well as many others ;-) ) and didn't find yet the good entry point?

Re-reading ccio-dma code for the n*1000 time, I noticed your comment:
/* Fast path single entry scatterlists */
if (nents == 1) {
[snip]

This comment make me thought: it's just a shortcut and the rest of the code
would just slowdown operation?

No?

In fact the 2 drivers (sba and ccio) without this hunk of code make panicing
the boot. 
For the ccio: some where in the initialization of the first scsi drive (no
more info)
For the sba: seems nearly at the same place but with addtional message
[snip]
sym0: <895a> rev 0x1 at pci 0000:00:0f.0 irq 20
sym0: PA-RISC Firmware, ID 7, Fast-40, LVD, parity checking
sym0: SCSI BUS has been reset.
scsi0 : sym-2.2.3
Kernel panic - not syncing:
/Extra/linux-current-trace/drivers/parisc/sba_iommu.c: I/O MMU  <at>  0000a000 is
out of mapping resources   

Is it normal?
(Continue reading)

Grant Grundler | 2 Jul 2008 06:28
Favicon

Re: in ccio_io_pdir_entry(),BUG_ON() seems to break gcc-4.2 optimization?

On Mon, Jun 30, 2008 at 06:28:36PM +0000, Joel Soete wrote:
...
> 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?

> 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 majordomo <at> vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Joel Soete | 2 Jul 2008 20:01
Picon
Favicon

Re: in ccio_io_pdir_entry(),BUG_ON() seems to break gcc-4.2 optimization?


Grant Grundler wrote:
> On Mon, Jun 30, 2008 at 06:28:36PM +0000, Joel Soete wrote:
> ...
>> 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?
> 
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

(Continue reading)

Grant Grundler | 7 Jul 2008 17:28
Favicon

Re: in ccio_io_pdir_entry(),BUG_ON() seems to break gcc-4.2 optimization?

On Wed, Jul 02, 2008 at 06:01:45PM +0000, Joel Soete wrote:
>> 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?

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
--
To unsubscribe from this list: send the line "unsubscribe linux-parisc" in
the body of a message to majordomo <at> vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
(Continue reading)

Joel Soete | 8 Jul 2008 11:04
Picon
Favicon

Re: in ccio_io_pdir_entry(),BUG_ON() seems to break gcc-4.2 optimization?

[...]
> 
> 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.
> 
Good catch, in fact I would just have to save the read+write constraint on pa;
i.e this seems to make the drill:

        __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)
        );

comparing produced objdump:
00000000 <ccio_io_pdir_entry>:           00000000 <ccio_io_pdir_entry>:
 0: 00 19 58 20  mtsp r25,sr1             0: 00 19 58 20  mtsp r25,sr1
 4: 23 80 0e 01  ldil L%-10000000,ret0    4: 23 80 0e 01  ldil L%-10000000,ret0
 8: 0b 98 0a 1c  add,l r24,ret0,ret0      8: 0b 98 0a 1c  add,l r24,ret0,ret0
 c: d7 97 0c 14  depw r23,31,12,ret0      c: d7 97 0c 14  depw r23,31,12,ret0
10: 0f 5c 12 88  stw ret0,4(r26)       | 10: 34 13 00 00  ldi 0,r19
14: 07 00 53 18  lci r0(sr1,r24),r24   | 14: 0f 5c 12 88  stw ret0,4(r26)
18: d3 18 1a 74  extrw,u r24,19,12,r24 | 18: 07 00 53 1c  lci r0(sr1,r24),ret0
1c: 34 1c 00 00  ldi 0,ret0            | 1c: d3 9c 1a 74  extrw,u ret0,19,12,ret0
20: d7 98 0e 14  depw r24,15,12,ret0   | 20: d6 7c 0e 14  depw ret0,15,12,r19
24: 0f 5c 12 80  stw ret0,0(r26)       | 24: 0f 53 12 80  stw r19,0(r26)
28: 07 40 12 80  fdc r0(r26)             28: 07 40 12 80  fdc r0(r26)
(Continue reading)

Helge Deller | 8 Jul 2008 22:06
X-Face
Picon
Picon

[PATCH] drop superfluous .align 16

This .align 16 is misplaced and should be in front of the ENTRY(lws_lock_start).
Works because of pure luck since we have a .align PAGE_SIZE before it instead.

Signed-off-by: Helge Deller <deller <at> gmx.de>

--- a/arch/parisc/kernel/syscall.S
+++ b/arch/parisc/kernel/syscall.S
 <at>  <at>  -640,7 +640,6  <at>  <at>  END(sys_call_table64)
 	.align	PAGE_SIZE
 ENTRY(lws_lock_start)
 	/* lws locks */
-	.align 16
 	.rept 16
 	/* Keep locks aligned at 16-bytes */
 	.word 1
--
To unsubscribe from this list: send the line "unsubscribe linux-parisc" in
the body of a message to majordomo <at> vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Carlos O'Donell | 9 Jul 2008 14:14
Gravatar

Re: [PATCH] drop superfluous .align 16

On Tue, Jul 8, 2008 at 4:06 PM, Helge Deller <deller <at> gmx.de> wrote:
> This .align 16 is misplaced and should be in front of the ENTRY(lws_lock_start).
> Works because of pure luck since we have a .align PAGE_SIZE before it instead.

This is not true, the .align 16 aligns almost any object in the
subsection including .word.

However, it is superfluous since we have a .align PAGE_SIZE, but I was
probably being safe in the event that someone put an object before
lws_lock_start.

> Signed-off-by: Helge Deller <deller <at> gmx.de>
>
> --- a/arch/parisc/kernel/syscall.S
> +++ b/arch/parisc/kernel/syscall.S
>  <at>  <at>  -640,7 +640,6  <at>  <at>  END(sys_call_table64)
>        .align  PAGE_SIZE
>  ENTRY(lws_lock_start)
>        /* lws locks */
> -       .align 16
>        .rept 16
>        /* Keep locks aligned at 16-bytes */
>        .word 1

Cheers,
Carlos.
--
To unsubscribe from this list: send the line "unsubscribe linux-parisc" in
the body of a message to majordomo <at> vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
(Continue reading)

Helge Deller | 9 Jul 2008 21:50
Picon
Picon

Re: [PATCH] drop superfluous .align 16

Carlos O'Donell wrote:
> On Tue, Jul 8, 2008 at 4:06 PM, Helge Deller <deller <at> gmx.de> wrote:
>> This .align 16 is misplaced and should be in front of the ENTRY(lws_lock_start).
>> Works because of pure luck since we have a .align PAGE_SIZE before it instead.
> 
> This is not true, the .align 16 aligns almost any object in the
> subsection including .word.

Sure, but it does not take care of lws_lock_start itself.

> However, it is superfluous since we have a .align PAGE_SIZE, but I was
> probably being safe in the event that someone put an object before
> lws_lock_start.

What I mean is, that the lws_lock_start label should start at 16byte 
boundary, right? (it is due to the .align PAGE_SIZE).
Now, if e.g. the .word555 (see below) would be in there, then
lws_lock_start would be at PAGE_SIZE+4, while the .word1 would start at 
PAGE_SIZE+16, which is wrong for accessing the lws_lock_start variables, 
where the first entry should be "1".

Example:
        .align  PAGE_SIZE
        .word 5555  <<<- think this would be here.
ENTRY(lws_lock_start)
       /* lws locks */
      .align 16
      .rept 16
      /* Keep locks aligned at 16-bytes */
      .word 1
(Continue reading)

Carlos O'Donell | 9 Jul 2008 22:22
Gravatar

Re: [PATCH] drop superfluous .align 16

On Wed, Jul 9, 2008 at 3:50 PM, Helge Deller <deller <at> gmx.de> wrote:
> So, I still think it would be better to remove the .align16, or
> alternatively to move it in front of ENTRY(lws_lock_start) [to be on the
> safe side].
>
> Am I really that wrong?

No, you are absolutely right. I forgot the locks are referenced via
lws_lock_start, and the symbol needs to be aligned. Sorry, I thought
there was another symbol elsewhere.

Signed-off-by: Carlos O'Donell <carlos <at> systemhalted.org>

Cheers,
Carlos.
--
To unsubscribe from this list: send the line "unsubscribe linux-parisc" in
the body of a message to majordomo <at> vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

John David Anglin | 9 Jul 2008 22:55
Picon

Re: [PATCH] drop superfluous .align 16

> On Wed, Jul 9, 2008 at 3:50 PM, Helge Deller <deller <at> gmx.de> wrote:
> > So, I still think it would be better to remove the .align16, or
> > alternatively to move it in front of ENTRY(lws_lock_start) [to be on the
> > safe side].
> >
> > Am I really that wrong?
> 
> No, you are absolutely right. I forgot the locks are referenced via
> lws_lock_start, and the symbol needs to be aligned. Sorry, I thought
> there was another symbol elsewhere.

This would be clearer if there was an ENTRY_ALIGNED macro (e.g.,
ENTRY_ALIGNED(lws_lock_start, 16)).  It's probably overkill though.

Dave
--

-- 
J. David Anglin                                  dave.anglin <at> nrc-cnrc.gc.ca
National Research Council of Canada              (613) 990-0752 (FAX: 952-6602)
--
To unsubscribe from this list: send the line "unsubscribe linux-parisc" in
the body of a message to majordomo <at> vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Gmane