Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp1780410ybh; Tue, 14 Jul 2020 07:12:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz2pKzpT0g9Q7VkdC8CO8Q5Qag7FLBUzFgrELA3D8QvpNlhNOeqGbjWCA/7JSKICqVO72HF X-Received: by 2002:a17:906:c35a:: with SMTP id ci26mr4411850ejb.451.1594735967708; Tue, 14 Jul 2020 07:12:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594735967; cv=none; d=google.com; s=arc-20160816; b=qABUj0KRyv4c+IJZIJ2zSvvJE0amH5xkLh8yniglNorv+HPalgyXqcQoMd8M5ilVGO m3qTge/Orc80hAMYani/rK9HhsatqAI5oH5wnxZYt5CYA07DaZE6lOGYYTvVrYS9efrz 4SKByQgKN2aqy1JTsVjOpr1owT+bio0eSI+WFoi5MkjiUI2mOuLlw50ecaKPQzIuyqZZ cbPCGEhJyybK2PfTtvlzvc1o3syvEA4ObsTcOUyL2p4Qxury1Ae2fum8hD/rycH+utOh OAqXB+TOtw9JRqtaGOlJxB3HAJ7QgocEmGQvvLE4dFhxmitpXHIcQHc5cRU+T1wUbxJe teYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:autocrypt:from:references:cc:to:subject; bh=DXUE5xBg2QauT92+hD6Crge+2Akj1fH64EjThE7DZ+M=; b=tztrt6930fGveFXxH2sunx1aDMioMl+zD9gwdeamAySFuGG8D8TACm7/flDy2kZyKF tLE3Z6hPRwOsEcBQfzwFukLwK6y9VsY71Y+ESgyH/SESzWfiBa/Qa4Rn6AOF7VY98UFZ n8LuoqsQpOW1jRJ6BQJ0xpu+PZSjW82Gn+a2UiaPj3Z6Ou5LwcRBlRBtQDWoBhYeoi6A RiEShyI/IQKzCB/qGtLKbvPdTfovIWp2c/digUXXlSCLw/Oydu4sBitoZSsLheA82G+v pdgpkU5hy1YB5WVQKYGKOfDcEzCdPGrwepu7eMvrHX/WJJ1VHgx9x6mMmkw8U5bG4E4y 1zTg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id co28si11141163edb.540.2020.07.14.07.12.24; Tue, 14 Jul 2020 07:12:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728144AbgGNOLz (ORCPT + 99 others); Tue, 14 Jul 2020 10:11:55 -0400 Received: from vps-vb.mhejs.net ([37.28.154.113]:51252 "EHLO vps-vb.mhejs.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728187AbgGNOLy (ORCPT ); Tue, 14 Jul 2020 10:11:54 -0400 Received: from MUA by vps-vb.mhejs.net with esmtps (TLS1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.93.0.4) (envelope-from ) id 1jvLev-0002OD-6U; Tue, 14 Jul 2020 16:11:49 +0200 Subject: Re: [PATCH v2] hwmon: (drivetemp) Avoid SCT usage on Toshiba DT01ACA family drives To: Guenter Roeck Cc: Jean Delvare , linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org References: <8325438e25a3a5a7e6d12ef6ede8f4350e4c65be.1594500029.git.mail@maciej.szmigiero.name> <50fb6686-5d36-ccb6-4620-c516472c6c0f@roeck-us.net> From: "Maciej S. Szmigiero" Autocrypt: addr=mail@maciej.szmigiero.name; prefer-encrypt=mutual; keydata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2o/dvz/L9OA9P13qi3WezT wVIr6UXMdljFlZtJds3lM8kciYHzzOPhCJUso+5+XTdsskw59+DKdf8+/Uex6slH2gpskeqe WPo5xzWbg+p1048AFCdlJgPEHNiB3aaP8e6+VkQkzIyRtcgyoQR8HTyjJdSL2jgKv8Ly5oxA KYo2YYv7Je7/xbBIP/y9EGPG41vH90lknZwgFs6iDEp49boj6MgSk5vXN9ibxfgVxIzelfNO YiQDaf+ZP0KhIHoWg0hJy7i6IF2XUTlg/4heSd0I3cVJypkF89gQr82bdkXf5DDHPBOR0N7M xbtTSGjTTxw5DGAYobE5CRocypoNzH7xSqQ3p523lhS9wDxx+5wP9AwCFrrVGMR6V2+OTixk WQddat1pyxP0u2qVz0L1QQ0rhS73wImbXwBItBr+4cP7hBmNWzHdvunpcEquWAzzEqEoHpqD mA== Message-ID: <0bf1376f-9e55-aecb-e03d-75b5fdf31339@maciej.szmigiero.name> Date: Tue, 14 Jul 2020 16:11:43 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.9.0 MIME-Version: 1.0 In-Reply-To: <50fb6686-5d36-ccb6-4620-c516472c6c0f@roeck-us.net> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 14.07.2020 16:02, Guenter Roeck wrote: > On 7/11/20 1:41 PM, Maciej S. Szmigiero wrote: >> It has been observed that Toshiba DT01ACA family drives have >> WRITE FPDMA QUEUED command timeouts and sometimes just freeze until >> power-cycled under heavy write loads when their temperature is getting >> polled in SCT mode. The SMART mode seems to be fine, though. >> >> Let's make sure we don't use SCT mode for these drives then. >> >> While only the 3 TB model was actually caught exhibiting the problem let's >> play safe here to avoid data corruption and extend the ban to the whole >> family. >> >> Fixes: 5b46903d8bf3 ("hwmon: Driver for disk and solid state drives with temperature sensors") >> Cc: stable@vger.kernel.org >> Signed-off-by: Maciej S. Szmigiero >> --- >> >> Notes: >> This behavior was observed on two different DT01ACA3 drives. >> >> Usually, a series of queued WRITE FPDMA QUEUED commands just time out, >> but sometimes the whole drive freezes. Merely disconnecting and >> reconnecting SATA interface cable then does not unfreeze the drive. >> >> One has to disconnect and reconnect the drive power connector for the >> drive to be detected again (suggesting the drive firmware itself has >> crashed). >> >> This only happens when the drive temperature is polled very often (like >> every second), so occasional SCT usage via smartmontools is probably >> safe. >> >> Changes from v1: >> 'SCT blacklist' -> 'SCT avoid models' >> >> drivers/hwmon/drivetemp.c | 37 +++++++++++++++++++++++++++++++++++++ >> 1 file changed, 37 insertions(+) >> >> diff --git a/drivers/hwmon/drivetemp.c b/drivers/hwmon/drivetemp.c >> index 0d4f3d97ffc6..da9cfcbecc96 100644 >> --- a/drivers/hwmon/drivetemp.c >> +++ b/drivers/hwmon/drivetemp.c >> @@ -285,6 +285,36 @@ static int drivetemp_get_scttemp(struct drivetemp_data *st, u32 attr, long *val) >> return err; >> } >> >> +static const char * const sct_avoid_models[] = { >> +/* >> + * These drives will have WRITE FPDMA QUEUED command timeouts and sometimes just >> + * freeze until power-cycled under heavy write loads when their temperature is >> + * getting polled in SCT mode. The SMART mode seems to be fine, though. >> + * >> + * While only the 3 TB model was actually caught exhibiting the problem >> + * let's play safe here to avoid data corruption and ban the whole family. >> + */ >> + "TOSHIBA DT01ACA0", >> + "TOSHIBA DT01ACA1", >> + "TOSHIBA DT01ACA2", >> + "TOSHIBA DT01ACA3", >> +}; >> + >> +static bool drivetemp_sct_avoid(struct drivetemp_data *st) >> +{ >> + struct scsi_device *sdev = st->sdev; >> + unsigned int ctr; >> + >> + if (!sdev->model) >> + return false; >> + >> + for (ctr = 0; ctr < ARRAY_SIZE(sct_avoid_models); ctr++) >> + if (strncmp(sdev->model, sct_avoid_models[ctr], 16) == 0) > > Why strncmp, and why length 16 ? Both strings are, as far as I can see, > 0 terminated. A fixed length only asks for trouble later on as more models > are added to the list. The first 16 bytes of sdev->model contain the model number, the rest seems to be the drive serial number. There is no NULL separator between them. See how the SCSI device model is printed for the sysfs "model" attribute: https://elixir.bootlin.com/linux/v5.8-rc4/source/drivers/scsi/scsi_sysfs.c#L654 > Also, please use "!" instead of "== 0". Will do. Thanks, Maciej