From owner-freebsd-stable@FreeBSD.ORG Thu Apr 4 01:05:27 2013 Return-Path: Delivered-To: freebsd-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id C29D14AC for ; Thu, 4 Apr 2013 01:05:27 +0000 (UTC) (envelope-from jdc@koitsu.org) Received: from qmta06.emeryville.ca.mail.comcast.net (qmta06.emeryville.ca.mail.comcast.net [IPv6:2001:558:fe2d:43:76:96:30:56]) by mx1.freebsd.org (Postfix) with ESMTP id A429ED74 for ; Thu, 4 Apr 2013 01:05:27 +0000 (UTC) Received: from omta21.emeryville.ca.mail.comcast.net ([76.96.30.88]) by qmta06.emeryville.ca.mail.comcast.net with comcast id KcyE1l0011u4NiLA6d5TFs; Thu, 04 Apr 2013 01:05:27 +0000 Received: from koitsu.strangled.net ([67.180.84.87]) by omta21.emeryville.ca.mail.comcast.net with comcast id Kd5S1l00T1t3BNj8hd5SEK; Thu, 04 Apr 2013 01:05:27 +0000 Received: by icarus.home.lan (Postfix, from userid 1000) id 832C173A1C; Wed, 3 Apr 2013 18:05:26 -0700 (PDT) Date: Wed, 3 Apr 2013 18:05:26 -0700 From: Jeremy Chadwick To: Matthias Andree Subject: Re: Any objections/comments on axing out old ATA stack? Message-ID: <20130404010526.GA66858@icarus.home.lan> References: <51536306.5030907@FreeBSD.org> <20130331130409.GO3178@equilibrium.bsdes.net> <515B25D8.7050902@FreeBSD.org> <515BF5AE.4050804@FreeBSD.org> <515CAA04.1050108@FreeBSD.org> <20130403233815.GA65719@icarus.home.lan> <515CC704.90302@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <515CC704.90302@FreeBSD.org> User-Agent: Mutt/1.5.21 (2010-09-15) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcast.net; s=q20121106; t=1365037527; bh=6KMV9MX9XtyQcKBuLMhAYtElbw73yRPlpG0rTWp8tOo=; h=Received:Received:Received:Date:From:To:Subject:Message-ID: MIME-Version:Content-Type; b=Gi+Lbo9t/DnlA6rXp3u6SvSpON/hmtszUVUX7RhgSEUj/ajujvGdBNbgRr5vLo3L5 jFjSG4TslSObP39yc7+h7InsidAiEpOuaC0PIe6IDVvokyXWzYjEh+/2btc8nGW/Jn gajQ4qU/89921Wqhim083ArzN13GULhHmQOcewqNCdVB0/z+NlB2VJ/5URE2Siz3cc zoG4XFSkn1QbLCWFzpU/28F7rcqekdlX/u2a7qOMlbPuFrz9aVj1UZJcmekW+ztXvF YLNNoRAuxzJdWlunIYHmgCTa6F6P1oRgzqVIwdkSzRC34QiVRGuguYXDLO+5BosWLE zEhVK4p9F4+4Q== Cc: Alexander Motin , freebsd-current@freebsd.org, freebsd-stable@freebsd.org X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Apr 2013 01:05:27 -0000 On Thu, Apr 04, 2013 at 02:19:16AM +0200, Matthias Andree wrote: > Am 04.04.2013 01:38, schrieb Jeremy Chadwick: > > ... > > > While skimming Linux libata code and commits in the past, the only > > glaringly obvious bug/issue I see is with SB600/SB700 chipsets (the > > hardware revision apparently matters) and port multiplier (PMP) support > > and soft resets. > > > > Are you using a port multiplier? I doubt it, but I have to ask. > > I am not using a PMP as far as I know (unless one is buried on my Asus > M4A78T-E main board). It would seem the drives are directly attached to > the south bridge's SATA ports. Then the answer is nope, you're not using a PM. Details: http://www.serialata.org/technology/port_multipliers.asp http://en.wikipedia.org/wiki/Port_multiplier > >> Why only my Samsung HDD drive triggers this but not the WD drive, I do > >> not know yet. > > > > Please provide "gpart show -p ada1" output, both here and in the PR, > > if you could. > > => 63 1953525105 ada1 MBR (931G) > 63 209714337 ada1s1 freebsd [active] (100G) > 209714400 800 - free - (400k) > 209715200 71680000 ada1s2 ntfs (34G) > 281395200 15405 - free - (7.5M) > 281410605 488263545 ada1s3 linux-data (232G) > 769674150 1183851018 - free - (564G) This is what I was worried about. Referring to your "camcontrol identify" output: > device model SAMSUNG HD103SI > sector size logical 512, physical 512, offset 0 Hear me out entirely on this one. My theory is that your hard disk actually uses 4096-byte sectors but is too old to provide ATA IDENTIFY semantics to delineate between logical vs. physical sector size. In other words, only logical is provided, thus logical=physical in the eyes of all software; smartctl will show you the exact same thing too. There are drives like this in the wild, both SSDs as well as MHDDs. For example, the Intel 320-series SSD behaves this way too (providing only logical size). Do not let the capacity/size of the drive be the deciding factor; your drive is 1TB, but I also have many 1TB MHDDs that use 4096-byte sectors. Seagate/Samsung's specification** for the HD103SI states, and I quote: "Byte per Sensor: 512 bytes". Yes, it says "Sensor". Whether or not this documentation is correct/accurate is unknown, and when vendors have typos in their own specification docs, I cannot help but to honour the possibility of the information being wrong. So I'm unsure if this drive uses 512-byte sectors or 4096-byte sectors. That said: in your "gpart show ada1" output, none of your partitions (FreeBSD, NTFS, nor Linux) appear to be aligned to 4096-byte boundaries. Ideally you'd want to have these aligned to 1MB or 2MByte boundaries in the case you ever move to an SSD. You're also using the MBR scheme, which does not tend to play well with alignment. Comparatively, your WD5002ABYS drive **does** use 512-byte sectors (I know this for a fact). The problem here is that I cannot guarantee you that alignment is the problem. The performance impact of writes to partitions which are non-aligned is quite high, and NCQ just exacerbates this problem. I would love to tell you "switch to GPT and follow Warren Block's document***" but if your NTFS partition is Windows and is a Windows version older than Windows 7 GPT is not supported. One piece of evidence that refutes my theory is that if Windows and/or Linux partition are something you boot into and use often, I would imagine NCQ would be used in both of those environments and would suffer from the same issue. Although Windows tends to hide all sorts of transient errors from the user (sigh), Linux tends to be like FreeBSD with regards to such issues (on the console anyway; you wouldn't see such messages normally inside of X). If you have the time and want to put forth the effort, I would recommend backing up all your data on ada1, zero the first and last 1MByte of the drive, and then try following Warren Block's guide. I'd just recommend doing this: gpart create -s gpt ada1 gpart add -t freebsd-ufs -b 2m ada1 newfs -U -j /dev/ada1p1 (or remove -j if you don't want to use SUJ) I picked an alignment value of 2MBytes since it's both 4K-aligned and is generally safe for things like newer SSDs that have larger NAND erase block size (I am not going to get into a discussion about that here, so please stay focused. :-) ) If the problem is gone after that (it should be easy to induce by writing tons and tons of data to the drive), then we can safely say that the drive uses 4096-byte sectors and need to add it to the quirks list in ata_da.c. If the problem remains after that, then further investigation is needed, and we can safely rule out alignment. Welcome to all the pain/effort one has to go through when troubleshooting things like this. :-) Another thing: in your PR you state: > - I am running with kern.cam.ada.default_timeout=5 which makes the > computer recover faster I can definitely imagine cases where a drive using NCQ but doing writes to a non-aligned partition could take longer than 5 seconds to respond to an ATA CDB (this is different than a SATA or AHCI layer timeout). I am not telling you "change this back to 30", but it might not be helping your situation at all given my above theory. Finally: could you please provide output from "smartctl -x /dev/ada1"? I would like to rule out any possibility of your drive having some other kind of issue that might cause it to go catatonic. Thanks. ** -- http://www.seagate.com/files/www-content/support-content/documentation/samsung/tech-specs/eco_greenf2.pdf *** -- http://www.wonkity.com/~wblock/docs/html/ssd.html -- | Jeremy Chadwick jdc@koitsu.org | | UNIX Systems Administrator http://jdc.koitsu.org/ | | Mountain View, CA, US | | Making life hard for others since 1977. PGP 4BD6C0CB |