From owner-freebsd-hackers@FreeBSD.ORG Thu May 21 18:42:11 2015 Return-Path: Delivered-To: hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 3B23A28A; Thu, 21 May 2015 18:42:11 +0000 (UTC) Received: from mail-vn0-x235.google.com (mail-vn0-x235.google.com [IPv6:2607:f8b0:400c:c0f::235]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id F294416AC; Thu, 21 May 2015 18:42:10 +0000 (UTC) Received: by vnbf1 with SMTP id f1so6612629vnb.2; Thu, 21 May 2015 11:42:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:cc:content-type; bh=/RzqSQO677fAj22aJUyJeaAQii+L3EV1LR75rUI2vCI=; b=uQMpD4LYNdihKO+A2tvqHNrL67x4zNylKuSQMFEKqJBn/7EDkxfRODmZ1kxWF2W1Z1 G0XzP2jrbhZXkDlBUWjbqw6+7TPGVlShgh6L0Ug2PyA7b0/HrF66eb3a1jhLtS1Teyt7 lVQQQzuw5brrHTTOEjG7Um44/8gGgKOmFvQ8uQoWrH2AULcJotoGhBRcdK4W0B7kjpLW iQG18NDzqVTg7W5URapkRwdGBPI0MwatmVGSA2L+MxVI1t/efQkqHGitA33FsBUp3Yla vEg1IvqCNfDjRDJEYTmRGg2zwW83XKSnx7FBb40HbMRg1To0QuBu8hIgv478aS+Ev29u Igxg== MIME-Version: 1.0 X-Received: by 10.52.60.227 with SMTP id k3mr3515047vdr.4.1432233729949; Thu, 21 May 2015 11:42:09 -0700 (PDT) Received: by 10.52.4.193 with HTTP; Thu, 21 May 2015 11:42:09 -0700 (PDT) Date: Thu, 21 May 2015 14:42:09 -0400 Message-ID: Subject: Botched NCQ on SSD - cannot disable? From: Neffi To: hackers@freebsd.org Cc: mav@freebsd.org, imp@freebsd.org X-Mailman-Approved-At: Thu, 21 May 2015 18:46:06 +0000 Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.20 X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 May 2015 18:42:11 -0000 I was discussing this issue in freenode/#freebsd and I was recommended to shoot an email to you fellows about it. I've got an Samsung 840 EVO SSD (model MZ-7TE250BW), which uses Samsung's own controller from what I can gather. I had issues of mass data corruption when used under Linux, and several programs crashing unexpectedly when used under FreeBSD. I've gone through 2 drives under warranty with the same issue before customer service suggested to disable drive queuing. After some research it seems as though this drive (and several other common SSDs) report that they support NCQ, but in fact are botched and will have all sorts of problems with NCQ enabled ranging from poor performance, to I/O stalls to data corruption. Sure enough the logs on Linux spit out something along the lines of: > ata1: exception Emask 0x0 SAct 0xf SErr 0x0 action 0x10 frozen > ata1.00: failed command: READ FPDMA QUEUED This happens several times when used on Linux, in the few hours leading up to total filesystem corruption. The recommendation in the Linux world is to disable NCQ on these drives, for which there is an easy boot-time tunable for it. This fixes the issue. No more data corruption. There doesn't seem to be a tunable for this anywhere on FreeBSD. camcontrol(8) mentions setting the tags used, but only between some hardcoded limits, with a default of 2 -- not sufficient to disable NCQ on the drive. It looks like presently the only option is to manually patch the quirks for this drive in the kernel and recompile before I can even install the system to the drive.