Unmapped buffers: to be merged in several days
Konstantin Belousov
kostikbel at gmail.com
Mon Mar 11 18:25:02 UTC 2013
On Mon, Mar 11, 2013 at 10:59:36AM +0100, Dag-Erling Sm??rgrav wrote:
> Konstantin Belousov <kostikbel at gmail.com> writes:
> > The ahci(4) and md(4) is converted to accept unmapped BIO requests.
> > Other drivers and geom classes get the compat mapped BIOs, the
> > transient mapping is established by the geom down thread. The KVA
> > for the transient maping the carved from the buffer map, up to 10%
> > of which is repurposed to the transient bio KVA. The hope is that
> > the rest of drivers and geom classes will be converted to accept
> > unmapped i/o shortly, making the transient map unused.
>
> Could you briefly summarize what needs to be done to convert a driver?
There are different kind of drivers, each kind requires its own
approach, and got different ground work done to ease the transition.
For the geom classes, if the provider does not require access to the
bio data, the conversion is as easy as setting the G_PF_ACCEPT_UNMAPPED
in the flags. Look for the example in the sys/geom/part/g_part.c, which
marks all gpart providers as accepting unmapped bios.
If the class does need to access the bio data, to be marked
unmapped-processing, the class should be rewritten. Now, the class
should verify is the bio passed is mapped or not, and process the pages
passed in the bio_ma array instead of bio_data. The involved example is
sys/dev/md/md.c.
For the disk(9) drivers, the flag to set is DISKFLAG_UNMAPPED_BIO. Again,
the driver should be inspected before the flag is set.
For the CAM-backed HBAs, there is a support provided to make the
convertion trivial. If the hardware uses dma to perform the i/o
and the driver uses busdma(9) to prepare the dma-able buffers for
the dma engine, all the driver author needs is to ensure that
bus_dmamap_load_ccb(9) function is used to handle the buffer load, and
set the PIM_UNMAPPED flag.
Most of the drivers were converted already to use load_ccb() during the
Jeff' physbio work. For an examples of the trivial conversion, look at
the sys/dev/ahci/ahci.c and sys/dev/siis/siis.c. I was conservative
on setting the PIM_UNMAPPED for the untested drivers, but the only work
that is needed is testing.
Quite non-trivial driver to convert is ad(4), either CAMified or not.
The issue is that even the drive that uses DMA could fall back to
the PIO mode at runtime, requiring driver access to the potentially
unmapped data. There are some preparations done for providing easy to
use transient mapping KPI for such drivers, but it is not in the state
where it could be usefully applied to the task, yet.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 834 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/freebsd-arch/attachments/20130311/22022bd4/attachment.sig>
More information about the freebsd-arch
mailing list