From: Jens Axboe <axboe@suse.de>
To: gl@dsa-ac.de
Cc: James Bottomley <James.Bottomley@SteelEye.com>,
SCSI Mailing List <linux-scsi@vger.kernel.org>,
Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Subject: Re: [PATCH] dc395x: Fix support for highmem
Date: Thu, 17 Mar 2005 11:08:54 +0100 [thread overview]
Message-ID: <20050317100854.GA1860@suse.de> (raw)
In-Reply-To: <Pine.LNX.4.56.0503171011410.20956@pcgl.dsa-ac.de>
On Thu, Mar 17 2005, gl@dsa-ac.de wrote:
> Hi
>
> On Thu, 17 Mar 2005, Jens Axboe wrote:
>
> > On Wed, Mar 16 2005, Guennadi Liakhovetski wrote:
> > >
> > > On Wed, 16 Mar 2005, 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.
> > >
> > > Hm, what do you mean "illegal"? Could you explain why?
> >
> > You risk deadlocking.
>
> Emn, I am curious, would be nice to know details:-)
See the kmap implementation, mm/highmem.c:map_new_virtual() to be
precise. If you run out of entries while processing your sglist, you
will end up waiting on a free kmap entry for an sg entry that will not
become available before your previous kmaps are released => deadlock.
> > > One more fragment in the driver I wasn't sure about is this:
> > >
> > > unsigned long mask =
> > > ~((unsigned long)sg->length - 1) & PAGE_MASK;
> > > if ((sg_dma_address(sg) & mask) == (psge->address & mask)) {
> > >
> > > Is sg->length guaranteed to be something like a power of 2 or smaller
> > > than page? I thought about replacing the above with
> >
> > No, it's not guaranteed to be a power-of-2.
> >
> > > + if (sg_dma_address(sg) <= psge->address && sg_dma_address(sg) + psge->length > psge->address) {
> >
> > What is it trying to accomplish?
>
> So, I was not sure if the old check was correct, was it? The test is
> supposed to find the current sg-element.
When this happens, do you know how many bytes of io already completed?
Most sane drives do, so I would use that to find the current sg entry.
> >
> > > @@ -1020,11 +1022,11 @@
> > > reqlen, cmd->request_buffer, cmd->use_sg,
> > > srb->sg_count);
> > >
> > > - srb->virt_addr = page_address(sl->page);
> > > + srb->page = sl->page;
> > > + srb->offset = sl->offset;
> > > for (i = 0; i < srb->sg_count; i++) {
> > > - u32 busaddr = (u32)sg_dma_address(&sl[i]);
> > > - u32 seglen = (u32)sl[i].length;
> > > - sgp[i].address = busaddr;
> > > + u32 seglen = (u32)sg_dma_len(sl + i);
> > > + sgp[i].address = cpu_to_le32(0xffffffff & sg_dma_address(sl +i));
> > > sgp[i].length = seglen;
> > > srb->total_xfer_length += seglen;
> > > }
> >
> > I don't understand this change, why the cpu_to_le32?
>
> Well, I copied it from tmscsim:
>
> pSRB->SGBusAddr = cpu_to_le32(pci_dma_lo32(sg_dma_address(psgl)));
>
> I am somewhat confused. In both cases these are bus addresses, right? and
> sg_dma_address() gives already the bus address, so, both are wrong?
The only reason that would make sense is if ->SGBusAddr is passed to the
hardware and it requires LE encoding. If it is just driver internal use,
it doesn't make any sense.
> BTW, looking at tmscsim again, isn't this
>
> if( residual )
> {
> bval = DC390_read8 (ScsiFifo); /* get one residual byte */
> ptr = (u8 *) bus_to_virt( pSRB->SGBusAddr );
> *ptr = bval;
> pSRB->SGBusAddr++; xferCnt++;
> pSRB->TotalXferredLen++;
> pSRB->SGToBeXferLen--;
> }
>
> also a case for dma_map_atomic?
It breaks for iommu, for sure.
--
Jens Axboe
next prev parent reply other threads:[~2005-03-17 10:08 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
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 [this message]
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=20050317100854.GA1860@suse.de \
--to=axboe@suse.de \
--cc=James.Bottomley@SteelEye.com \
--cc=g.liakhovetski@gmx.de \
--cc=gl@dsa-ac.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