Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp4516389pxb; Tue, 25 Jan 2022 12:04:13 -0800 (PST) X-Google-Smtp-Source: ABdhPJxSIbz74oo82ptfihXQNG52p8pKbO9Mz4g+W/UciHfcN77aWWS8ngEfeNRB2b9+1uRAPNGe X-Received: by 2002:aa7:db8b:: with SMTP id u11mr22325795edt.180.1643141053553; Tue, 25 Jan 2022 12:04:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643141053; cv=none; d=google.com; s=arc-20160816; b=zN5/wWVk+FdvI0Qs72/WmYgkb1HDGNEXG7dBpX6QsQbGmMZM888O/qQKdgrL6fi53O Zr5J3bGW0o5G3YCX2FRojusV1VnljetTBXrbOBbPC4A5zVUha0RebT6txP77HleyNzDn h3VPWaYlA5Hod2QF94Qyn1opH4xD+moyia1g9wx3qdlwOhJsMSUOlH3gfZWB/HLIJUzk Uq9/c0XhWJ5jevP8h/JKgoHqZ3BTXhaadJWRS4JK0DGvqQuiNqUfsosY953KrjcIXeuA v+nBcUuTqgG+t4wsoPdiBIRuLSHPfWfmwqmD56lMw5vTIn3KaPrX743MydBfSM+q/Zvl Y7oQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=4xfA8wTIvQYDbPWoz4nyYEs/tAiP/v85UBHIi3yN4b4=; b=M05hynXcVj1cmigilL6auLjxOFReo8zZ4h1P43kYrL+ld2bzfVXUgp/F1yGyGV0a2D iPBg9OyW4aBD7kHVZCr8LbEhor8bgMkS4iR6HolCcS9+Rz0dajT/AnqWiCAPQ2bTS1G8 P+SIpa+UN+YJbfAmnYKLLcdtaIEqcok2zECeIvNI4KHNa3nYaJMm9Oc5ggZJA4glB5k1 5L9IrlMoakb+bhOz/mQLPb5NumBjGzfUs56x47WoNlr40WC1lm8MaUydEOj601II+SGz le4emiOxzc+prwQvVf5TJEPf+TxTBLohBypkzTnk9bMfrNbUSNk5uYF8df0JSm+43bSb 3T8A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=KqUU5wAl; 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 gt40si2606952ejc.86.2022.01.25.12.03.48; Tue, 25 Jan 2022 12:04:13 -0800 (PST) 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; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=KqUU5wAl; 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 S1387693AbiAYOSr (ORCPT + 99 others); Tue, 25 Jan 2022 09:18:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34514 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1578185AbiAYOPX (ORCPT ); Tue, 25 Jan 2022 09:15:23 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9032BC061776; Tue, 25 Jan 2022 06:15:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=4xfA8wTIvQYDbPWoz4nyYEs/tAiP/v85UBHIi3yN4b4=; b=KqUU5wAlLQG3UKIBcaVwFEIuC3 brO+yuSHJyXmCAd/VkS8FEPB6lBLR03VHAChehNZLHd9+aZ2O2NysgfMiAApGo+12aA8euXcSHl6e cUVlqBlo+IhUEcF5xI7kBy2eE4eg9BdBT8J5rGhKOV4WuSRblwNAOW1Pjr1nnaNameoNSd5Jq2EBu B2JYZ4reyMRAoRgqp8AfFtQMzFv8eXUPkfW7xGKnHZjfM7XfYrH9XjaP7HVgmnj2xwlfAlVUl5sGB vzV/SN/aIepRD2bo09q7oTW5tUGNoTDUZ31tM78ls+ZdU+/OJEzk9V3pFw/FYJE+aTryBjdXd+ea8 r4TGA9MQ==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1nCMb8-002vNp-Ar; Tue, 25 Jan 2022 14:15:02 +0000 Date: Tue, 25 Jan 2022 14:15:02 +0000 From: Matthew Wilcox To: John Garry Cc: jejb@linux.ibm.com, martin.petersen@oracle.com, artur.paszkiewicz@intel.com, jinpu.wang@cloud.ionos.com, chenxiang66@hisilicon.com, Ajish.Koshy@microchip.com, yanaijie@huawei.com, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-scsi@vger.kernel.org, linuxarm@huawei.com, liuqi115@huawei.com, Viswas.G@microchip.com, damien.lemoal@opensource.wdc.com Subject: Re: [PATCH 05/16] scsi: libsas: Add struct sas_tmf_task Message-ID: References: <1643110372-85470-1-git-send-email-john.garry@huawei.com> <1643110372-85470-6-git-send-email-john.garry@huawei.com> <6b31b15c-98d9-ee07-0092-cbcc5f5c71fe@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <6b31b15c-98d9-ee07-0092-cbcc5f5c71fe@huawei.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jan 25, 2022 at 02:05:11PM +0000, John Garry wrote: > On 25/01/2022 13:37, Matthew Wilcox wrote: > > > Also add an interim force phy id field for hisi_sas driver, which will be > > > removed once the STP "TMF" code is factored out. > > > > > > Even though some LLDDs (pm8001) use a u32 for the tag, u16 should be > > > enough. > > ... because pm8001 limits the number of tags to 1024. > > . > > Sure, but the pm8001 HW does has a 32b field, which is strange as the SAS > spec defines a 16b field in the task management Function information unit > "tag of task to be managed" field. My point is that it's only safe because the pm8001 driver already limits it to smaller than u16. Seeing language like "should be enough" made me think you'd just assumed that it would be. Seeing a line like: u32 tag = 0xdeadbeef, rc = 0, n_elem = 0; made me think it might not be; perhaps 0xdeadbeef was being used as a flag value somewhere in the driver. For example ... drivers/scsi/pm8001/pm8001_hwi.c: int rc, tag = 0xdeadbeef; drivers/scsi/pm8001/pm8001_sas.c: u32 tag = 0xdeadbeef, rc = 0, n_elem = 0; drivers/scsi/pm8001/pm8001_sas.c: u32 tag = 0xdeadbeef; drivers/scsi/pm8001/pm80xx_hwi.c: if (ibutton0 == 0xdeadbeef && ibutton1 == 0xdeadbeef) { drivers/scsi/pm8001/pm80xx_hwi.c: int rc, tag = 0xdeadbeef; That doesn't seem to be the case though; as far as I can tell the tag value is never checked against 0xdeadbeef.