Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How do I use NCQ of Intel X25-E(SSD) on ahci(4)?

3 views
Skip to first unread message

Norikatsu Shigemura

unread,
Nov 18, 2009, 10:47:59 AM11/18/09
to Alexander Motin, freebsd...@freebsd.org, Norikatsu Shigemura
Hi Alexander!

I have a Intel 64GB SSD(X25-E) and a Western Digital Caviar Green
1TB HDD (WD10EADS), and use them on ahci(4). ahci(4) can use NCQ
of WD10EADS, but doesn't use NCQ of X25-E.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FreeBSD 9.0-CURRENT #107: Thu Nov 19 00:13:30 JST 2009
no...@nadesico.ninth-nine.com:/usr/obj/usr/src/sys/NADESICO amd64
:
ahci0: <ATI IXP700 AHCI SATA controller> port 0xa000-0xa007,0x9000-0x9003,0x8000-0x8007,0x7000-0x7003,0x6000-0x600f mem 0xfb8fe400-0xfb8fe7ff irq 22 at device 17.0 on pci0
ahci0: [ITHREAD]
ahci0: AHCI v1.10 with 6 3Gbps ports, Port Multiplier supported
ahcich0: <AHCI channel> at channel 0 on ahci0
ahcich0: [ITHREAD]
ahcich1: <AHCI channel> at channel 1 on ahci0
ahcich1: [ITHREAD]
ahcich2: <AHCI channel> at channel 2 on ahci0
ahcich2: [ITHREAD]
ahcich3: <AHCI channel> at channel 3 on ahci0
ahcich3: [ITHREAD]
ahcich4: <AHCI channel> at channel 4 on ahci0
ahcich4: [ITHREAD]
ahcich5: <AHCI channel> at channel 5 on ahci0
ahcich5: [ITHREAD]
:
(aprobe0:ahcich0:0:0:0): SIGNATURE: 0000
(aprobe0:ahcich1:0:0:0): SIGNATURE: 0000
(aprobe0:ahcich2:0:0:0): SIGNATURE: 0000
(aprobe0:ahcich3:0:0:0): SIGNATURE: 0000
:
ada0 at ahcich0 bus 0 scbus0 target 0 lun 0
ada0: <SSDSA2SH064G1GC INTEL 045C8790> ATA/ATAPI-7 SATA 2.x device
ada0: 300.000MB/s transfers
ada0: 61057MB (125045424 512 byte sectors: 16H 63S/T 16383C)
ada1 at ahcich1 bus 0 scbus1 target 0 lun 0
ada1: <WDC WD10EADS-00L5B1 01.01A01> ATA/ATAPI-8 SATA 2.x device
ada1: 300.000MB/s transfers
ada1: Command Queueing enabled
ada1: 953869MB (1953525168 512 byte sectors: 16H 63S/T 16383C)
;
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

I confirmed X25-E disabled NCQ.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# camcontrol tags ada0
(pass0:ahcich0:0:0:0): device openings: 2
# camcontrol tags ada1
(pass1:ahcich1:0:0:0): device openings: 32
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

According to 'camcontrol identify ada0' and Intel's documentation[*],
X25-E supports NCQ.

[*] http://www.intel.com/design/flash/nand/extreme/index.htm

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# camcontrol identify ada0
pass0: <SSDSA2SH064G1GC INTEL 045C8790> ATA/ATAPI-7 SATA 2.x device
pass0: 300.000MB/s transfers

protocol ATA/ATAPI-7 SATA 2.x
device model SSDSA2SH064G1GC INTEL
firmware revision 045C8790
serial number CVEM9024016B064KGN
WWN 500151795879a64e
cylinders 16383
heads 16
sectors/track 63
sector size logical 512, physical 512, offset 0
LBA supported 125045424 sectors
LBA48 supported 125045424 sectors
PIO supported PIO4
DMA supported WDMA2 UDMA6
overlap not supported
media RPM non-rotating

Feature Support Enable Value Vendor
read ahead yes yes
write cache yes yes
flush cache yes yes
Native Command Queuing (NCQ) yes 30/0x1E
Tagged Command Queuing (TCQ) no no 30/0x1E
SMART yes yes
microcode download yes yes
security yes no
power management yes yes
advanced power management no no 0/0x00
automatic acoustic management no no 0/0x00 0/0x00
media status notification no no
power-up in Standby no no
write-read-verify no no 0/0x0
unload yes yes
free-fall no no
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# camcontrol identify ada1
pass1: <WDC WD10EADS-00L5B1 01.01A01> ATA/ATAPI-8 SATA 2.x device
pass1: 300.000MB/s transfers

protocol ATA/ATAPI-8 SATA 2.x
device model WDC WD10EADS-00L5B1
firmware revision 01.01A01
serial number WD-WCAU45664302
WWN 50014ee257aa350
cylinders 16383
heads 16
sectors/track 63
sector size logical 512, physical 512, offset 0
LBA supported 268435455 sectors
LBA48 supported 1953525168 sectors
PIO supported PIO4
DMA supported WDMA2 UDMA6
overlap not supported

Feature Support Enable Value Vendor
read ahead yes yes
write cache yes yes
flush cache yes yes
Native Command Queuing (NCQ) yes 31/0x1F
Tagged Command Queuing (TCQ) no no 31/0x1F
SMART yes yes
microcode download yes yes
security yes no
power management yes yes
advanced power management no no 0/0x00
automatic acoustic management yes yes 254/0xFE 128/0x80
media status notification no no
power-up in Standby yes no
write-read-verify no no 0/0x0
unload no no
free-fall no no
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

To use NCQ of X25-E, what should I report to you?
_______________________________________________
freebsd...@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-curre...@freebsd.org"

Alexander Motin

unread,
Nov 18, 2009, 11:39:26 AM11/18/09
to Norikatsu Shigemura, freebsd...@freebsd.org
Hi.

Norikatsu Shigemura wrote:
> I have a Intel 64GB SSD(X25-E) and a Western Digital Caviar Green
> 1TB HDD (WD10EADS), and use them on ahci(4). ahci(4) can use NCQ
> of WD10EADS, but doesn't use NCQ of X25-E.
>

> # camcontrol identify ada0
> pass0: <SSDSA2SH064G1GC INTEL 045C8790> ATA/ATAPI-7 SATA 2.x device
> pass0: 300.000MB/s transfers
>

> Native Command Queuing (NCQ) yes 30/0x1E

Here is the reason ^^^

This drive support less tags (31) then your AHCI controller does (32).
Support for such case is not implemented yet. As temporary solution you
may limit controller to use only 31 tag, then NCQ will be used. All you
need is to go to ahci.c and change line
ch->numslots = ...;
to
ch->numslots = min(31, ...);

--
Alexander Motin

Ivan Voras

unread,
Nov 18, 2009, 12:00:16 PM11/18/09
to freebsd...@freebsd.org
Alexander Motin wrote:
> Hi.
>
> Norikatsu Shigemura wrote:
>> I have a Intel 64GB SSD(X25-E) and a Western Digital Caviar Green
>> 1TB HDD (WD10EADS), and use them on ahci(4). ahci(4) can use NCQ
>> of WD10EADS, but doesn't use NCQ of X25-E.
>>
>> # camcontrol identify ada0
>> pass0: <SSDSA2SH064G1GC INTEL 045C8790> ATA/ATAPI-7 SATA 2.x device
>> pass0: 300.000MB/s transfers
>>
>> Native Command Queuing (NCQ) yes 30/0x1E
>
> Here is the reason ^^^
>
> This drive support less tags (31) then your AHCI controller does (32).
> Support for such case is not implemented yet. As temporary solution you
> may limit controller to use only 31 tag, then NCQ will be used. All you
> need is to go to ahci.c and change line
> ch->numslots = ...;
> to
> ch->numslots = min(31, ...);

I know next to nothing about AHCI and drivers so this might be obviously
wrong but wouldn't a quick (i.e. MFC-able) obvious temporary fix be to say

numslots = min(get_minimum_tags_of_all_drives(), ...)

?

Norikatsu Shigemura

unread,
Nov 18, 2009, 12:15:15 PM11/18/09
to Alexander Motin, freebsd...@freebsd.org, Norikatsu Shigemura
Hi Alexander.

On Wed, 18 Nov 2009 18:38:28 +0200
Alexander Motin <m...@freebsd.org> wrote:
> > Native Command Queuing (NCQ) yes 30/0x1E
>
> Here is the reason ^^^
> This drive support less tags (31) then your AHCI controller does (32).
> Support for such case is not implemented yet. As temporary solution you
> may limit controller to use only 31 tag, then NCQ will be used. All you
> need is to go to ahci.c and change line
> ch->numslots = ...;
> to
> ch->numslots = min(31, ...);

Oops, OK! I confirmed following patch:


- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

--- sys/dev/ahci/ahci.c.orig 2009-11-17 22:25:07.474418000 +0900
+++ sys/dev/ahci/ahci.c 2009-11-19 02:00:22.193688908 +0900
@@ -779,7 +779,7 @@
ch->caps = ctlr->caps;
ch->caps2 = ctlr->caps2;
ch->quirks = ctlr->quirks;
- ch->numslots = ((ch->caps & AHCI_CAP_NCS) >> AHCI_CAP_NCS_SHIFT) + 1,
+ ch->numslots = min(31, ((ch->caps & AHCI_CAP_NCS) >> AHCI_CAP_NCS_SHIFT) + 1),
mtx_init(&ch->mtx, "AHCI channel lock", NULL, MTX_DEF);
resource_int_value(device_get_name(dev),
device_get_unit(dev), "pm_level", &ch->pm_level);


- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

ahci(4) can use NCQ of X25-E.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

ada0 at ahcich0 bus 0 scbus0 target 0 lun 0

ada0: <SSDSA2SH064G1GC INTEL 045C8790> ATA/ATAPI-7 SATA 2.x device
ada0: 300.000MB/s transfers
ada0: Command Queueing enabled


ada0: 61057MB (125045424 512 byte sectors: 16H 63S/T 16383C)

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

# camcontrol tags ada0
(pass0:ahcich0:0:0:0): device openings: 31


- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Thank you!

Alexander Motin

unread,
Nov 18, 2009, 1:05:50 PM11/18/09
to Ivan Voras, FreeBSD-Current
Ivan Voras wrote:

> Alexander Motin wrote:
>> Norikatsu Shigemura wrote:
>>> I have a Intel 64GB SSD(X25-E) and a Western Digital Caviar Green
>>> 1TB HDD (WD10EADS), and use them on ahci(4). ahci(4) can use NCQ
>>> of WD10EADS, but doesn't use NCQ of X25-E.
>>>
>>> # camcontrol identify ada0
>>> pass0: <SSDSA2SH064G1GC INTEL 045C8790> ATA/ATAPI-7 SATA 2.x device
>>> pass0: 300.000MB/s transfers
>>> Native Command Queuing (NCQ) yes 30/0x1E
>>
>> Here is the reason ^^^
>>
>> This drive support less tags (31) then your AHCI controller does (32).
>> Support for such case is not implemented yet. As temporary solution you
>> may limit controller to use only 31 tag, then NCQ will be used. All you
>> need is to go to ahci.c and change line
>> ch->numslots = ...;
>> to
>> ch->numslots = min(31, ...);
>
> I know next to nothing about AHCI and drivers so this might be obviously
> wrong but wouldn't a quick (i.e. MFC-able) obvious temporary fix be to say
>
> numslots = min(get_minimum_tags_of_all_drives(), ...)
> ?

Problem is that SIM driver has no idea about devices capabilities, and
also doesn't have method to resize queue after attach. In SCSI case,
tags are random and only simultaneous number of request is limited, and
this is handled fine by CAM. SATA NCQ is more restrictive, allowing to
use only tags 0..(N-1). I am planning to make XPT inform SIM about
supported tags for each device, to allow SIM to use that information
while scheduling requests. I didn't do it yet, just because most of
devices able to handle all 32 tags possible on SATA. This Intel SSD is
one of rare exceptions.

Ivan Voras

unread,
Nov 18, 2009, 4:30:26 PM11/18/09
to Alexander Motin, FreeBSD-Current
2009/11/18 Alexander Motin <m...@freebsd.org>:
> Ivan Voras wrote:

>> I know next to nothing about AHCI and drivers so this might be obviously
>> wrong but wouldn't a quick (i.e. MFC-able) obvious temporary fix be to say
>>
>> numslots = min(get_minimum_tags_of_all_drives(), ...)
>> ?
>
> Problem is that SIM driver has no idea about devices capabilities, and
> also doesn't have method to resize queue after attach. In SCSI case,
> tags are random and only simultaneous number of request is limited, and
> this is handled fine by CAM. SATA NCQ is more restrictive, allowing to
> use only tags 0..(N-1). I am planning to make XPT inform SIM about
> supported tags for each device, to allow SIM to use that information
> while scheduling requests. I didn't do it yet, just because most of
> devices able to handle all 32 tags possible on SATA. This Intel SSD is
> one of rare exceptions.

Ok, (still thinking about something that could be MFC-able in an
emergency), how about adding a loader tunable integer instead of "32"?

Alexander Motin

unread,
Dec 14, 2009, 6:28:38 AM12/14/09
to Ivan Voras, FreeBSD-Current
Ivan Voras wrote:
> 2009/11/18 Alexander Motin <m...@freebsd.org>:
>> Ivan Voras wrote:
>
>>> I know next to nothing about AHCI and drivers so this might be obviously
>>> wrong but wouldn't a quick (i.e. MFC-able) obvious temporary fix be to say
>>>
>>> numslots = min(get_minimum_tags_of_all_drives(), ...)
>>> ?
>> Problem is that SIM driver has no idea about devices capabilities, and
>> also doesn't have method to resize queue after attach. In SCSI case,
>> tags are random and only simultaneous number of request is limited, and
>> this is handled fine by CAM. SATA NCQ is more restrictive, allowing to
>> use only tags 0..(N-1). I am planning to make XPT inform SIM about
>> supported tags for each device, to allow SIM to use that information
>> while scheduling requests. I didn't do it yet, just because most of
>> devices able to handle all 32 tags possible on SATA. This Intel SSD is
>> one of rare exceptions.
>
> Ok, (still thinking about something that could be MFC-able in an
> emergency), how about adding a loader tunable integer instead of "32"?

Just for note, it is already fixed and merged.

--
Alexander Motin

Ivan Voras

unread,
Dec 14, 2009, 6:47:06 AM12/14/09
to Alexander Motin, FreeBSD-Current
2009/12/14 Alexander Motin <m...@freebsd.org>:

> Ivan Voras wrote:
>> 2009/11/18 Alexander Motin <m...@freebsd.org>:
>>> Ivan Voras wrote:
>>
>>>> I know next to nothing about AHCI and drivers so this might be obviously
>>>> wrong but wouldn't a quick (i.e. MFC-able) obvious temporary fix be to say
>>>>
>>>> numslots = min(get_minimum_tags_of_all_drives(), ...)
>>>> ?
>>> Problem is that SIM driver has no idea about devices capabilities, and
>>> also doesn't have method to resize queue after attach. In SCSI case,
>>> tags are random and only simultaneous number of request is limited, and
>>> this is handled fine by CAM. SATA NCQ is more restrictive, allowing to
>>> use only tags 0..(N-1). I am planning to make XPT inform SIM about
>>> supported tags for each device, to allow SIM to use that information
>>> while scheduling requests. I didn't do it yet, just because most of
>>> devices able to handle all 32 tags possible on SATA. This Intel SSD is
>>> one of rare exceptions.
>>
>> Ok, (still thinking about something that could be MFC-able in an
>> emergency), how about adding a loader tunable integer instead of "32"?
>
> Just for note, it is already fixed and merged.

Thank you!

Wes Peters

unread,
Dec 15, 2009, 4:37:41 AM12/15/09
to Norikatsu Shigemura, Alexander Motin, freebsd...@freebsd.org
On Wed, Nov 18, 2009 at 7:46 AM, Norikatsu Shigemura <no...@freebsd.org> wrote:
> Hi Alexander!
>
> � � � �I have a Intel 64GB SSD(X25-E) and a Western Digital Caviar Green
> � � � �1TB HDD (WD10EADS), and use them on ahci(4). �ahci(4) can use NCQ
> � � � �of WD10EADS, but doesn't use NCQ of X25-E.

How useful is NCQ on an SSD? Isn't the primary thrust of NCQ to allow
the disk to reorder writes to optimize the seek pattern?

--
Against stupidity the very gods Themselves contend in vain.
Friedrich Schiller

Thomas Backman

unread,
Dec 15, 2009, 4:42:59 AM12/15/09
to Wes Peters, FreeBSD current
On Dec 15, 2009, at 10:36 AM, Wes Peters wrote:

> On Wed, Nov 18, 2009 at 7:46 AM, Norikatsu Shigemura <no...@freebsd.org> wrote:
>> Hi Alexander!
>>
>> I have a Intel 64GB SSD(X25-E) and a Western Digital Caviar Green
>> 1TB HDD (WD10EADS), and use them on ahci(4). ahci(4) can use NCQ
>> of WD10EADS, but doesn't use NCQ of X25-E.
>
> How useful is NCQ on an SSD? Isn't the primary thrust of NCQ to allow
> the disk to reorder writes to optimize the seek pattern?

http://en.wikipedia.org/wiki/NCQ#NCQ_in_Solid-State_Drives :)

Regards,
Thmas_______________________________________________

Alexander Motin

unread,
Dec 15, 2009, 10:03:21 AM12/15/09
to Wes Peters, freebsd...@freebsd.org, Norikatsu Shigemura
Wes Peters wrote:
> On Wed, Nov 18, 2009 at 7:46 AM, Norikatsu Shigemura <no...@freebsd.org> wrote:
>> I have a Intel 64GB SSD(X25-E) and a Western Digital Caviar Green
>> 1TB HDD (WD10EADS), and use them on ahci(4). ahci(4) can use NCQ
>> of WD10EADS, but doesn't use NCQ of X25-E.
>
> How useful is NCQ on an SSD? Isn't the primary thrust of NCQ to allow
> the disk to reorder writes to optimize the seek pattern?

Many SSDs have several flash channels. Multiple parallel requests
running allow controller to effectively use them in parallel. On my OCZ
Vertex I am receiving about 30% speedup from using NCQ on many short
read requests. If you look into Intel SSD's datasheet, you'll also see
that all benchmarks are provided for maximal request queue.

--
Alexander Motin

Dag-Erling Smørgrav

unread,
Dec 16, 2009, 8:15:10 AM12/16/09
to Wes Peters, Alexander Motin, freebsd...@freebsd.org, Norikatsu Shigemura
Wes Peters <barna...@gmail.com> writes:
> How useful is NCQ on an SSD?

*extremely* useful. The X25 is old (as SSDs go), yet it still blows the
competition out of the water on real-world (non-sequential) workloads,
precisely because it supports NCQ and most of its competitors don't.

DES
--
Dag-Erling Smørgrav - d...@des.no

Norikatsu Shigemura

unread,
Dec 20, 2009, 11:00:18 AM12/20/09
to Alexander Motin, FreeBSD-Current, Norikatsu Shigemura, Ivan Voras
Hi mav!

On Mon, 14 Dec 2009 13:27:21 +0200
Alexander Motin <m...@freebsd.org> wrote:
> >> while scheduling requests. I didn't do it yet, just because most of
> >> devices able to handle all 32 tags possible on SATA. This Intel SSD is
> >> one of rare exceptions.
> > Ok, (still thinking about something that could be MFC-able in an
> > emergency), how about adding a loader tunable integer instead of "32"?
> Just for note, it is already fixed and merged.

Thank you! Yes, I confirmed!

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ada0 at ahcich0 bus 0 scbus0 target 0 lun 0

ada0: <SSDSA2SH064G1GC INTEL 045C8790> ATA-7 SATA 2.x device
ada0: 300.000MB/s transfers (SATA 2.x, UDMA6, PIO size 8192bytes)


ada0: Command Queueing enabled
ada0: 61057MB (125045424 512 byte sectors: 16H 63S/T 16383C)

ada1 at ahcich1 bus 0 scbus1 target 0 lun 0

ada1: <WDC WD10EADS-00L5B1 01.01A01> ATA-8 SATA 2.x device
ada1: 300.000MB/s transfers (SATA 2.x, UDMA6, PIO size 8192bytes)
ada1: Command Queueing enabled
ada1: 953869MB (1953525168 512 byte sectors: 16H 63S/T 16383C)


- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# camcontrol tags ada0
(pass0:ahcich0:0:0:0): device openings: 31

# camcontrol tags ada1
(pass1:ahcich1:0:0:0): device openings: 32


- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

0 new messages