public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Matthew Wilcox <matthew@wil.cx>
To: Jens Axboe <axboe@suse.de>
Cc: James Bottomley <James.Bottomley@SteelEye.com>,
	SCSI Mailing List <linux-scsi@vger.kernel.org>,
	g.liakhovetski@gmx.de
Subject: Re: [PATCH] dc395x: Fix support for highmem
Date: Wed, 16 Mar 2005 16:48:06 +0000	[thread overview]
Message-ID: <20050316164806.GO21986@parcelfarce.linux.theplanet.co.uk> (raw)
In-Reply-To: <20050316160447.GU7842@suse.de>

On Wed, Mar 16, 2005 at 05:04:47PM +0100, Jens Axboe wrote:
> The kmap() isn't just inefficient, it's a problem to iterate over the sg
> list and kmap all the pages. That is illegal.
> 
> But it's not so tricky to get right, if the punting just happens in the
> isr. Basically just iterate over every sg entry left ala:
> 
>         for (i = start; i < sg_entries; i++) {
>                 unsigned long flags;
>                 char *ptr;
> 
>                 local_irq_save(flags);
>                 ptr = kmap_atomic(sg->page, KM_BIO_SRC_IRQ);
> 
>                 /* transfer to/from ptr + sg->offset, sg->length bytes */
> 
>                 kunmap_atomic(ptr, KM_BIO_SRC_IRQ);
>                 local_irq_restore(flags);
>         }
> 
> I _think_ the sg->length field is universally called so, you should not
> use sg->dma_length/sg_dma_len() or sg_dma_address(), as we are outside
> the work of the iommu at this point.

Documentation/DMA-mapping.txt agrees with you:

                        Platform Issues

1) Struct scatterlist requirements.

   Struct scatterlist must contain, at a minimum, the following
   members:

        struct page *page;
        unsigned int offset;
        unsigned int length;

Would you mind writing up a change to DMA-mapping.txt that explains why
one would need to do the kmap solution you outline above?  If it needs
to be done for IDE and one SCSI driver, I bet it needs to be done for
more devices, and it'd be a handy place to refer to.

I'm a bit confused why the approach outlined in DMA-mapping.txt doesn't
work for this driver.  Is it because you don't find out until you're
in the interrupt handler that you need to map the sg-list and you can't
call pci_map_sg() from interrupt context?

-- 
"Next the statesmen will invent cheap lies, putting the blame upon 
the nation that is attacked, and every man will be glad of those
conscience-soothing falsities, and will diligently study them, and refuse
to examine any refutations of them; and thus he will by and by convince 
himself that the war is just, and will thank God for the better sleep 
he enjoys after this process of grotesque self-deception." -- Mark Twain

  reply	other threads:[~2005-03-16 16:48 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <200503160209.j2G29cAf010870@hera.kernel.org>
2005-03-16  7:58 ` [PATCH] dc395x: Fix support for highmem Jens Axboe
2005-03-16 15:13   ` James Bottomley
2005-03-16 16:04     ` Jens Axboe
2005-03-16 16:48       ` Matthew Wilcox [this message]
2005-03-16 16:53         ` Jens Axboe
2005-03-16 17:02           ` Christoph Hellwig
2005-03-16 17:04             ` Jens Axboe
2005-03-16 18:44               ` Mike Christie
2005-03-16 18:53                 ` iSCSI and scatterlists Matthew Wilcox
2005-03-16 19:59                   ` Dmitry Yusupov
2005-03-16 18:53                 ` [PATCH] dc395x: Fix support for highmem Jens Axboe
2005-03-20  9:14               ` Christoph Hellwig
2005-03-20 20:51                 ` Guennadi Liakhovetski
2005-03-21  7:55                   ` Jens Axboe
     [not found]                     ` <7044.1111398919@www16.gmx.net>
2005-03-21 10:38                       ` gl
2005-03-21 10:44                         ` Jens Axboe
2005-03-21 11:00                           ` gl
2005-03-30 21:22                             ` Guennadi Liakhovetski
2005-03-30 22:13                               ` James Bottomley
2005-03-31  8:58                                 ` gl
2005-04-09 22:48                                   ` Guennadi Liakhovetski
2005-04-21 21:49                                     ` Guennadi Liakhovetski
2005-04-22 11:36                                       ` Jens Axboe
2005-04-23  9:35                                         ` Guennadi Liakhovetski
2005-04-23 10:06                                           ` Guennadi Liakhovetski
2005-04-23 19:01                                             ` James Bottomley
2005-04-24  0:22                                               ` Guennadi Liakhovetski
2005-04-24 14:31                                                 ` Guennadi Liakhovetski
2005-04-24 22:11                                                 ` James Bottomley
2005-04-25 19:56                                                   ` Guennadi Liakhovetski
2005-03-16 20:24       ` Guennadi Liakhovetski
2005-03-17  7:40         ` Jens Axboe
     [not found]           ` <22734.1111050528@www13.gmx.net>
2005-03-17  9:41             ` gl
2005-03-17 10:08               ` Jens Axboe
2005-03-17 10:56                 ` gl
2005-03-17 20:51                   ` Guennadi Liakhovetski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050316164806.GO21986@parcelfarce.linux.theplanet.co.uk \
    --to=matthew@wil.cx \
    --cc=James.Bottomley@SteelEye.com \
    --cc=axboe@suse.de \
    --cc=g.liakhovetski@gmx.de \
    --cc=linux-scsi@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox