From nobody Mon Feb 19 11:29:28 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4TdgLL0jT1z5BWrx for ; Mon, 19 Feb 2024 11:29:46 +0000 (UTC) (envelope-from cglogic@protonmail.com) Received: from mail-40138.protonmail.ch (mail-40138.protonmail.ch [185.70.40.138]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "protonmail.com", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4TdgLK5cB5z4rXv; Mon, 19 Feb 2024 11:29:45 +0000 (UTC) (envelope-from cglogic@protonmail.com) Authentication-Results: mx1.freebsd.org; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1708342183; x=1708601383; bh=3GOD66GUPPafzimTGaHIIJc0n5kxMUfoVKYlw7WWbkI=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector; b=s1LDpEo/5KGQX1sdpKAyV13eRU4FTPBCQywIqvb+ouceDnY+y0xUiCXNSdtaQi6Ff 8fby8kXyRyyf072RiqI7C6v9dgXAtqpMB0iFmEGZjY+y6EPKiSt9AGG6nxRwy4jAAI EENGLniziHGCTfBxFjnx/7v/98hLHSJMD6+9yKpjE4t0eC6LkToB6ftSCCcpUmunkH WzxNorI7AE/AzMdh2BbDMJ7vbf5DuD5vbpsy7XN5/Dgok9fTsFyxZ/Fy9uzNDrnhlZ p3fS43L2OttmjZiQJgTRlczwCv+qIpJOIMcMy04wsdTHnICM5FNNIIu1WUicf2gJp8 +lROLNaaiJv7w== Date: Mon, 19 Feb 2024 11:29:28 +0000 To: Andriy Gapon From: cglogic Cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: c01af41c3c8f - main - ata_da: add quirk to disable NCQ TRIM for Samsung 860/870 SSDs Message-ID: In-Reply-To: References: Feedback-ID: 25313618:user:proton List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spamd-Bar: ---- X-Rspamd-Queue-Id: 4TdgLK5cB5z4rXv X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:62371, ipnet:185.70.40.0/24, country:CH] On Monday, February 19th, 2024 at 1:03 PM, Andriy Gapon w= rote: > On 19/02/2024 12:47, cglogic wrote: >=20 > > Hello Andriy, > >=20 > > I use ZFS with autotrim enabled on Samsung 860 PRO connected to Intel A= HCI SATA controller for 9 years without any issue. >=20 >=20 > I think that it was released in 2018? You are right, it's 9 years old computer, SSD was added later. >=20 > > Can I disable this quirk locally or have I revert the patch to continue= use NCQ TRIM with this SSD? >=20 >=20 > I don't think that there is a way to disable the quirk, so you'll have to= revert. > Note that ATA TRIM is still enabled, it's only NCQ TRIM that got disabled= . From my understanding ATA TRIM is non-queued TRIM as opposed to NCQ TRIM. With only ATA TRIM enabled, drive will have increased latency when large am= ount of files deleted. However I'm not sure how ZFS handles TRIMs, maybe it groups several TRIMs a= nd then sends when drive is idle. Another question is how this affects TRIM enabled swap partition. In general, if I'm correct here, disabling NCQ TRIM should not be an issue = for desktop usage, except for large git repository updates, etc. >=20 > > On Monday, February 19th, 2024 at 12:09 PM, Andriy Gapon avg@FreeBSD.or= g wrote: > >=20 > > > The branch main has been updated by avg: > > >=20 > > > URL: https://cgit.FreeBSD.org/src/commit/?id=3Dc01af41c3c8fdd570764ff= 9b6bfbad6ac9ca1664 > > >=20 > > > commit c01af41c3c8fdd570764ff9b6bfbad6ac9ca1664 > > > Author: Andriy Gapon avg@FreeBSD.org > > >=20 > > > AuthorDate: 2024-02-19 10:08:12 +0000 > > > Commit: Andriy Gapon avg@FreeBSD.org > > >=20 > > > CommitDate: 2024-02-19 10:08:12 +0000 > > >=20 > > > ata_da: add quirk to disable NCQ TRIM for Samsung 860/870 SSDs > > >=20 > > > NCQ TRIM for Samsung 860/870 SSDs results in data corruption on syste= ms > > > with some SATA controllers. > > >=20 > > > This can be easily reproduced using ZFS which uses TRIM and is able t= o > > > detect block content changes. > > >=20 > > > Linux bug report for this issue: > > > https://bugzilla.kernel.org/show_bug.cgi?id=3D201693 > > >=20 > > > Since at present we can not limit a quirk based on the contorller / S= IM, > > > apply the quirk in all cases. > > >=20 > > > Reviewed by: imp > > > MFC after: 2 weeks > > > Differential Revision: https://reviews.freebsd.org/D43961 > > > --- > > > sys/cam/ata/ata_da.c | 16 ++++++++++++++++ > > > 1 file changed, 16 insertions(+) > > >=20 > > > diff --git a/sys/cam/ata/ata_da.c b/sys/cam/ata/ata_da.c > > > index f5d3aeca9329..d4a591943307 100644 > > > --- a/sys/cam/ata/ata_da.c > > > +++ b/sys/cam/ata/ata_da.c > > > @@ -727,6 +727,22 @@ static struct ada_quirk_entry ada_quirk_table[] = =3D > > > { T_DIRECT, SIP_MEDIA_FIXED, "", "Samsung SSD 850", "" }, > > > /quirks/ADA_Q_4K | ADA_Q_NCQ_TRIM_BROKEN > > > }, > > > + { > > > + / > > > + * Samsung 860 SSDs > > > + * 4k optimised, NCQ TRIM broken (normal TRIM fine) > > > + / > > > + { T_DIRECT, SIP_MEDIA_FIXED, "", "Samsung SSD 860*", "" }, > > > + /quirks/ADA_Q_4K | ADA_Q_NCQ_TRIM_BROKEN > > > + }, > > > + { > > > + / > > > + * Samsung 870 SSDs > > > + * 4k optimised, NCQ TRIM broken (normal TRIM fine) > > > + / > > > + { T_DIRECT, SIP_MEDIA_FIXED, "", "Samsung SSD 870*", "" }, > > > + /quirks/ADA_Q_4K | ADA_Q_NCQ_TRIM_BROKEN > > > + }, > > > { > > > / > > > * Samsung SM863 Series SSDs (MZ7KM*) >=20 >=20 > -- > Andriy Gapon