From owner-freebsd-current@FreeBSD.ORG Wed Nov 18 18:05:10 2009 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C478E106568D for ; Wed, 18 Nov 2009 18:05:10 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: from mail-bw0-f213.google.com (mail-bw0-f213.google.com [209.85.218.213]) by mx1.freebsd.org (Postfix) with ESMTP id 4656C8FC1A for ; Wed, 18 Nov 2009 18:05:09 +0000 (UTC) Received: by bwz5 with SMTP id 5so1607038bwz.3 for ; Wed, 18 Nov 2009 10:05:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:sender:message-id:date:from :user-agent:mime-version:to:cc:subject:references:in-reply-to :content-type:content-transfer-encoding; bh=VcZz42jstvRSw2zqPrpE0DQ0k9z57OfQIfoBa4AuS8c=; b=mwN2jJ0d0KRqwR+naqac24M6vEFNlAi15wTnnZI3z5Md+QIshhQ/aVm63f24ghMWC0 z0+xpoq3h5xsZQgCVXgQKi4q7O1tF7wDuXg2fc5Rd83IL2WHJRL3qeDT9Cpai0D5GP5G PwYTWbx+JpQmh/h6kFZ34etGCdzxFvVlkZnd0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; b=vANxLk4I/2btGoHqCF8cvo5gwebYNq9y4I4Ffm2Bs7TfC+/EcFrHRD6JyPsR1auUbo VJnCMAOnxk3i2BDH6waX0iGXIf+xch4FBqGIEVo/KXdDJfmtjZiQmH/rLRmpQ94QF48P ymiDYvpg/hE8JQ6REGsJs1OSHCuzQSLy+xZ0w= Received: by 10.204.34.78 with SMTP id k14mr1036219bkd.106.1258567508683; Wed, 18 Nov 2009 10:05:08 -0800 (PST) Received: from mavbook.mavhome.dp.ua (pc.mavhome.dp.ua [212.86.226.226]) by mx.google.com with ESMTPS id 14sm143891fxm.3.2009.11.18.10.05.07 (version=SSLv3 cipher=RC4-MD5); Wed, 18 Nov 2009 10:05:08 -0800 (PST) Sender: Alexander Motin Message-ID: <4B043751.7080302@FreeBSD.org> Date: Wed, 18 Nov 2009 20:05:05 +0200 From: Alexander Motin User-Agent: Thunderbird 2.0.0.23 (X11/20090901) MIME-Version: 1.0 To: Ivan Voras References: <4B042304.8060807@FreeBSD.org> In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: FreeBSD-Current Subject: Re: How do I use NCQ of Intel X25-E(SSD) on ahci(4)? X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Nov 2009 18:05:10 -0000 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: 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. -- Alexander Motin