From: James Bottomley <James.Bottomley@steeleye.com>
To: Roland Dreier <roland@topspin.com>
Cc: linux-kernel@vger.kernel.org, linux-scsi@vger.kernel.org
Subject: Re: [PATCH] 2.4 use __dma_buffer in scsi.h
Date: Wed, 12 Jun 2002 22:17:59 -0400 [thread overview]
Message-ID: <200206130218.g5D2Hx302994@localhost.localdomain> (raw)
> Use __dma_buffer macro to align sense_buffer member of Scsi_Cmnd.
[...]
> - unsigned char sense_buffer[SCSI_SENSE_BUFFERSIZE]; /* obtained by REQUEST SENSE
> + unsigned char sense_buffer[SCSI_SENSE_BUFFERSIZE] __dma_buffer; /* obtained by REQUEST SENSE
This is actually unnecessary. We've already had this discussion on the parisc
mailing lists (over a year ago, I think).
The SCSI subsystem is designed with this type of cache incoherency problem in
mind. The Scsi_Cmnd structure has an ownership model to forestall cache line
bouncing. The idea is that when you want to dma to/from components of a
Scsi_Cmnd, you can only do it when the ownership is SCSI_OWNER_LOW_LEVEL,
which guarantees that nothing in the mid layer will touch the command and
trigger an incoherency (at least until it times out). The low level driver is
supposed to know about the cache incoherency problem, and so avoids touching
the structure between cache line invalidation/writeback and DMA completion,
thus, with a correctly implemented driver, there should be no possibility of
DMA corruption.
Each of the Scsi_Cmnd blocks is individually allocated with kmalloc, so
they're guaranteed to be non-interfering when it comes to DMA.
Incidentally, if you're really going to insist on padding the structure, some
drivers also use the cmnd element to DMA the command from, so that should be
aligned as well. But I think the best course of action is to fix any low
level drivers that are not following the cache rules rather than expanding
Scsi_Cmnd.
James Bottomley
next reply other threads:[~2002-06-13 2:18 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-06-13 2:17 James Bottomley [this message]
2002-06-13 17:42 ` Roland Dreier
2002-06-13 17:52 ` James Bottomley
-- strict thread matches above, loose matches on Subject: below --
2002-06-13 0:24 Roland Dreier
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=200206130218.g5D2Hx302994@localhost.localdomain \
--to=james.bottomley@steeleye.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=roland@topspin.com \
/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
all inboxes | Powered by JetHome®