Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp1925191ybh; Tue, 14 Jul 2020 10:47:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx1lYijjbzgPnaeJuDHpPCt21yOENTSHDpspy/1TWIeZyAQJah7dBq60WqhdfsyIJvg5xT6 X-Received: by 2002:a17:906:f117:: with SMTP id gv23mr5407766ejb.528.1594748864617; Tue, 14 Jul 2020 10:47:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594748864; cv=none; d=google.com; s=arc-20160816; b=pl0t19HiwUW5MguAiCDXiNCfJvosYBHmyBfpZ3uzrjQq1nsA4gN72kQ+3TBQhn5g/z 0tPGPcJTE4Vbk6HxS6hnEt64ESVGc+//IG0kQ0R7NlOCa6+r+z/emA+SN9u9nYg4EpQp oLF4DQnPpa9043lyTXZXn3yggToqo+FZlZHiPTTHV3PQtJLuHn7JOOTPpj7F1vD8wJnW wf8sZ3fYPvUP8/5pvgQDeMexcAqWE6AHF4dgq655BBYMdBh086CTBAkbNp2D1Qho9CID 4b9Fbpya68JgJSbbO/PIkpFO05knZAIu9hRvozmBinxhs41hLZRaOUeQBvbLpXa7w8rT +Bdw== 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=7snyUBJGyHzoQjBo1mqrnF/NUq8/CLi/uZDcCik+7PM=; b=kDsHZMVfIqPpACoOr1R/3/2MzyjnjL2/qCUcaB9LGB+I20AxcNoPdtsJ2ux8XwbRUX 2wlLxVibJBg7TNvulsZAh8J5V1Pu1tuQ7P0dngTBsDhTlLRWDoXiUPhDS9ua9PwiwT81 sRtJtLG1UbI1kZeHkhKRy+AA6qIXJ6kXT4hAtr3nnLXyHm5mrRdb8JNy6f+AMT5Gx4O0 cKuBs5LlVlQpU/VnLGe+64hvMnNS5Ti14N8d2TYP5wNJ4JOb9eDWwPRZ9cIZqJIdzOcR Q0TZOpZeHk8TZrDcUKEjJH+GmwobmJEN4xHEULXXAp02ZUITFOrXN9wuxf0EMKMny6zO T2ZA== 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 f22si5713634edj.63.2020.07.14.10.47.22; Tue, 14 Jul 2020 10:47:44 -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 S1728942AbgGNRrR (ORCPT + 99 others); Tue, 14 Jul 2020 13:47:17 -0400 Received: from vps-vb.mhejs.net ([37.28.154.113]:35850 "EHLO vps-vb.mhejs.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728087AbgGNRrQ (ORCPT ); Tue, 14 Jul 2020 13:47:16 -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 1jvP1N-00030R-1X; Tue, 14 Jul 2020 19:47:13 +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> <0bf1376f-9e55-aecb-e03d-75b5fdf31339@maciej.szmigiero.name> <211fa8c0-3b09-fbb5-b376-bb10ee6e13e3@roeck-us.net> From: "Maciej S. Szmigiero" Autocrypt: addr=mail@maciej.szmigiero.name; prefer-encrypt=mutual; keydata= mQINBFpGusUBEADXUMM2t7y9sHhI79+2QUnDdpauIBjZDukPZArwD+sDlx5P+jxaZ13XjUQc 6oJdk+jpvKiyzlbKqlDtw/Y2Ob24tg1g/zvkHn8AVUwX+ZWWewSZ0vcwp7u/LvA+w2nJbIL1 N0/QUUdmxfkWTHhNqgkNX5hEmYqhwUPozFR0zblfD/6+XFR7VM9yT0fZPLqYLNOmGfqAXlxY m8nWmi+lxkd/PYqQQwOq6GQwxjRFEvSc09m/YPYo9hxh7a6s8hAP88YOf2PD8oBB1r5E7KGb Fv10Qss4CU/3zaiyRTExWwOJnTQdzSbtnM3S8/ZO/sL0FY/b4VLtlZzERAraxHdnPn8GgxYk oPtAqoyf52RkCabL9dsXPWYQjkwG8WEUPScHDy8Uoo6imQujshG23A99iPuXcWc/5ld9mIo/ Ee7kN50MOXwS4vCJSv0cMkVhh77CmGUv5++E/rPcbXPLTPeRVy6SHgdDhIj7elmx2Lgo0cyh uyxyBKSuzPvb61nh5EKAGL7kPqflNw7LJkInzHqKHDNu57rVuCHEx4yxcKNB4pdE2SgyPxs9 9W7Cz0q2Hd7Yu8GOXvMfQfrBiEV4q4PzidUtV6sLqVq0RMK7LEi0RiZpthwxz0IUFwRw2KS/ 9Kgs9LmOXYimodrV0pMxpVqcyTepmDSoWzyXNP2NL1+GuQtaTQARAQABtDBNYWNpZWogUy4g U3ptaWdpZXJvIDxtYWlsQG1hY2llai5zem1pZ2llcm8ubmFtZT6JAlQEEwEIAD4CGwMFCwkI BwIGFQoJCAsCBBYCAwECHgECF4AWIQRyeg1N257Z9gOb7O+Ef143kM4JdwUCXuTdbwUJBRTJ qgAKCRCEf143kM4Jd1y3D/9YKOQktnlcvZuAVU36SlR44n1x+P98z8a+s9X4+w+9aGZR+LF3 mL8yHZU8dSPii0SH794pG4CEFN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aXhe4EhCrH92GMuHcVcNlkumDdrX9kJiCrTosrI9mXX+PwYzQH8fjbuVn x03l6XlVeKiFl37prb19RoabEscBVF+qo5dJgics4cDEgh2BcL2o/dvz/L9OA9P13qi3WezT wVIr6UXMdljFlZtJds3lM8kciYHzzOPhCJUso+5+XTdsskw59+DKdf8+/Uex6slH2gpskeqe WPo5xzWbg+p1048AFCdlJgPEHNiB3aaP8e6+VkQkzIyRtcgyoQR8HTyjJdSL2jgKv8Ly5oxA KYo2YYv7Je7/xbBIP/y9EGPG41vH90lknZwgFs6iDEp49boj6MgSk5vXN9ibxfgVxIzelfNO YiQDaf+ZP0KhIHoWg0hJy7i6IF2XUTlg/4heSd0I3cVJypkF89gQr82bdkXf5DDHPBOR0N7M xbtTSGjTTxw5DGAYobE5CRocypoNzH7xSqQ3p523lhS9wDxx+5wP9AwCFrrVGMR6V2+OTixk WQddat1pyxP0u2qVz0L1QQ0rhS73wImbXwBItBr+4cP7hBmNWzHdvunpcEquWAzzEqEoHpqD mA== Message-ID: <180bb209-7e65-d0c9-4c7f-e16e976f5cd4@maciej.szmigiero.name> Date: Tue, 14 Jul 2020 19:47:07 +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: <211fa8c0-3b09-fbb5-b376-bb10ee6e13e3@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 19:14, Guenter Roeck wrote: > On 7/14/20 7:11 AM, Maciej S. Szmigiero wrote: >> 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. >> > > If the "16" is based on some SCSI standard, there should be > a define for it somewhere. The "model" field seems to contain just the raw SCSI INQUIRY "product identification" field, which is space-filled to 16 bytes, but is not NULL-terminated. The SCSI layer seems to just open-code the number 16 everywhere, can't see any specific define for this. > Otherwise, the comparison should > use strlen(sct_avoid_models[ctr]) and explain the reason. > In the latter case, it might possibly make sense to match > "TOSHIBA DT01ACA" to also catch later models. Will use strlen() for prefix matching and match on the "TOSHIBA DT01ACA" prefix then. > Thanks, > Guenter Thanks, Maciej