From: Mark Haverkamp <markh@osdl.org>
To: Mark Salyzyn <mark_salyzyn@adaptec.com>
Cc: Matthew Wilcox <willy@debian.org>,
Jeff Garzik <jgarzik@pobox.com>,
linux-scsi <linux-scsi@vger.kernel.org>,
James Bottomley <James.Bottomley@steeleye.com>
Subject: RE: [PATCH 1/3] 2.6.0 aacraid driver update
Date: Wed, 08 Oct 2003 07:23:02 -0700 [thread overview]
Message-ID: <1065622982.4840.11.camel@markh1.pdx.osdl.net> (raw)
In-Reply-To: <0998F43EAD645A47B3F6507196DD70EA256AA6@otcexc01.otc.adaptec.com>
On Wed, 2003-10-08 at 06:11, Salyzyn, Mark wrote:
> The scsicmd->SCp.ptr is `stealing' an unused member of the command to hold
> on to the physical address of an additional allocation that is part of the
> request so that when the command completes the memory can be `freed'.
>
> My recommendation is to allocate an additional structure to hold on to all
> classes of `theft' like this in the driver (my guess is there is more) and
> use the SCp.ptr to point to this allocation rather than try to `steal' more
> to make up the full length.
>
> Any wisdom of the list with regards to this?
>
> Sincerely -- Mark Salyzyn
>
I looked at the scsi_pointer struct yesterday and found that it already
has a dma_handle element that is the right type. I updated the code to
use SCp.dma_handle and removed all the casting. Does that sound OK?
This way we don't have to alloc another struct.
Mark.
> -----Original Message-----
> From: Mark Haverkamp [mailto:markh@osdl.org]
> Sent: Tuesday, October 07, 2003 5:51 PM
> To: Matthew Wilcox
> Cc: Jeff Garzik; linux-scsi; James Bottomley; Salyzyn, Mark
> Subject: Re: [PATCH 1/3] 2.6.0 aacraid driver update
>
>
> On Tue, 2003-10-07 at 14:39, Matthew Wilcox wrote:
> > On Tue, Oct 07, 2003 at 02:18:12PM -0700, Mark Haverkamp wrote:
> > > > > - pci_unmap_single(dev->pdev,
> (dma_addr_t)(ulong)scsicmd->SCp.ptr,
> > > > > + pci_unmap_single(dev->pdev, (dma_addr_t)(unsigned
> long)scsicmd->SCp.ptr,
> > > > > scsicmd->request_bufflen,
> > > > >
> scsi_to_pci_dma_dir(scsicmd->sc_data_direction));
> >
> > > I checked out this casting today. The function takes a dma_addr_t as
> > > the argument. You can't just pass the pointer in as is because:
> > >
> > > drivers/scsi/aacraid/aachba.c:690: warning: passing arg 2 of
> `pci_unmap_single'
> > > makes integer from pointer without a cast
> > >
> > > If you just cast the pointer to dma_addr_t you get:
> > >
> > > drivers/scsi/aacraid/aachba.c:688: warning: cast from pointer to integer
> of different size
> > >
> > > If you just cast to unsigned long, as in the code below, there aren't
> any warnings, but
> > > the wrong type is being passed to the function. So, I think that both
> the casts are
> > > needed.
> >
> > Oops, that's not true. Try it out yourself.
> >
> > int foo(short bar);
> >
> > int baz(void)
> > {
> > return foo(0x12345678);
> > }
> >
> > will truncate the argument to foo to 0x5678 before calling it by
> > implicitly casting to a short. So we can do just fine with:
> >
> > - pci_unmap_single(dev->pdev,
> (dma_addr_t)(ulong)scsicmd->SCp.ptr,
> > + pci_unmap_single(dev->pdev, (unsigned long)scsicmd->SCp.ptr,
> > scsicmd->request_bufflen,
> >
> scsi_to_pci_dma_dir(scsicmd->sc_data_direction));
> >
> > Now that all that casting is out of the way, we can see this driver isn't
> > highmem-safe as it's storing a dma_addr_t in a pointer ... yuck.
>
> Ok, I see now.
>
> Thanks,
> Mark.
--
Mark Haverkamp <markh@osdl.org>
next prev parent reply other threads:[~2003-10-08 14:23 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-10-08 13:11 [PATCH 1/3] 2.6.0 aacraid driver update Salyzyn, Mark
2003-10-08 13:55 ` Matthew Wilcox
2003-10-08 14:23 ` Mark Haverkamp [this message]
-- strict thread matches above, loose matches on Subject: below --
2003-10-08 14:26 Salyzyn, Mark
2003-10-06 21:21 Mark Haverkamp
2003-10-06 21:55 ` Jeff Garzik
2003-10-06 22:09 ` Mark Haverkamp
2003-10-06 22:24 ` Jeff Garzik
2003-10-07 21:18 ` Mark Haverkamp
2003-10-07 21:39 ` Matthew Wilcox
2003-10-07 21:50 ` Mark Haverkamp
2003-10-07 21:39 ` Jeff Garzik
2003-10-08 17:43 ` Mark Haverkamp
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=1065622982.4840.11.camel@markh1.pdx.osdl.net \
--to=markh@osdl.org \
--cc=James.Bottomley@steeleye.com \
--cc=jgarzik@pobox.com \
--cc=linux-scsi@vger.kernel.org \
--cc=mark_salyzyn@adaptec.com \
--cc=willy@debian.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