Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp2008157rwr; Sat, 6 May 2023 03:09:39 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5W0xhRxCQvczKL/JHei0BxL3R7E3BzAlK2+VV6wyFtl1a8/HS6ao2MNigoRdRUNceFkE37 X-Received: by 2002:a17:903:11cc:b0:1aa:f616:f5a5 with SMTP id q12-20020a17090311cc00b001aaf616f5a5mr4442807plh.29.1683367779145; Sat, 06 May 2023 03:09:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683367779; cv=none; d=google.com; s=arc-20160816; b=kIOcG4hT5tPnETfD+jNmNMJPu25Z6cFdvu0Zd30XjNANTD4jphEGm7GvygMk7HQK/A wpW8CEgZe+nkk5Lk6EZQ7cNias6LXxRIn2c5IO6w8Ulkm0/vkN//arImNOhu18+C/kHD 1D5f4EsG+ItxUmSHB1qYcnMC0BcpnVutEiMoRV1G6ZWh1w4CShmbmtAUdIMnX1Tu/UuC ZyF3h4LCLh3JQR99Z329UTs2fsroi127gfLfKc+EHAeXKnD0tcw3vwzqEwHB8JMNLx4r zXclsbcpUraaI+79MNL9CmcOEN6YPmGw9ROGRsIkSF+DcNlw2k7xdhGgpbcdcoHHlh0R 3SIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=w6Zr/2uJuHIaa48IOcYLi1XKjI16NfM5FQ2ufRLlMuA=; b=QTg46vdVl5yEl9kLapOO4f0lXMwGADchHI6KxrnU3Uglwel1ZMZzusnLQWsFmfwNk3 +2Hl0/I98Qujrc4rIztW9PlkdT/Kjt0MY4JNPavGFjh1YAjDNaYk6NAUNmeojzfZeteF bnNP+38f/Axlnz8hSMAms6oSLAxHzud3JB/59uhltuNylM0IdrMOb1gbZZFQV6IAQo9O d5TSiuTDuDxknVdVjbS4Ff1IzsAauQ3iT1imgdB8NAvv/x0C+VY4k7ROqbjucYWE0iVb vNGMrUuzPAjkyGdHF+p1Xn4dpl1tTZVneREmzVb+9tObw4mprmZEMW6ovHIzz/V1M/0Y wcVA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d21-20020a170902aa9500b001a55571febesi3399219plr.277.2023.05.06.03.09.24; Sat, 06 May 2023 03:09:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230493AbjEFJ5T (ORCPT + 99 others); Sat, 6 May 2023 05:57:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59792 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230000AbjEFJ5S (ORCPT ); Sat, 6 May 2023 05:57:18 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2EFD946AA; Sat, 6 May 2023 02:57:16 -0700 (PDT) Received: from dggpemm500012.china.huawei.com (unknown [172.30.72.56]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4QD2ws0ZtNzsRBP; Sat, 6 May 2023 17:55:25 +0800 (CST) Received: from [10.67.101.126] (10.67.101.126) by dggpemm500012.china.huawei.com (7.185.36.89) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Sat, 6 May 2023 17:57:13 +0800 Message-ID: Date: Sat, 6 May 2023 17:57:13 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.3.1 Subject: Re: [PATCH v2] ata: libata-scsi: Fix get identity data failed Content-Language: en-CA To: John Garry , Damien Le Moal , , , CC: , , , , References: <20230505025712.19438-1-yangxingui@huawei.com> <291f1d97-9195-45ac-8e12-058f5c797277@kernel.org> <1b703656-e966-63f8-19dd-33e4e9914676@huawei.com> From: yangxingui In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.67.101.126] X-ClientProxiedBy: dggpemm100015.china.huawei.com (7.185.36.61) To dggpemm500012.china.huawei.com (7.185.36.89) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-8.5 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2023/5/5 17:51, John Garry wrote: > On 05/05/2023 10:14, yangxingui wrote: >>> hmmm... is it really acceptable that libata is referencing libsas? I >>> didn't think that it would be. libsas uses libata, not the other way >>> around. >> Yeah, I didn't expect that either. Is there any other way? If so, is >> patch v1 OK? > > I still think that we can do better than v1. OK > >>> >>>>>   #include >>>>>   #include >>>>>   #include >>>>> @@ -2745,10 +2746,17 @@ static struct ata_device >>>>> *__ata_scsi_find_dev(struct ata_port *ap, >>>>>    *    Associated ATA device, or %NULL if not found. >>>>>    */ >>>>>   struct ata_device * >>>>> -ata_scsi_find_dev(struct ata_port *ap, const struct scsi_device >>>>> *scsidev) >>>> Why drop the const ? >>>> >>>>> +ata_scsi_find_dev(struct ata_port *ap, struct scsi_device *scsidev) >>>>>   { >>>>> -    struct ata_device *dev = __ata_scsi_find_dev(ap, scsidev); >>>>> +    struct ata_device *dev; >>>>> + >>>>> +    if (ap->flags & ATA_FLAG_SAS_HOST) { >>> >>> And this is SAS host. Not necessarily libsas (even though with ipr >>> libata usage gone, it would be the only user). >> Add a new flag only for libsas? > > No, because of previous reason. > > Please remind me - at what point do we error within ata_scsi_find_dev() > and return NULL for a libsas host? The scsi_host_template filled by libsas and call ata_scsi_find_dev() has this problem. After sas_change_queue_depth() is fixed, only sas_ioctl() has this problem now. > > Note: it would be good to include that commit message for future reference. > > Maybe we could add a method to ata_port_operations to do this lookup. I > assume that is abusing ata_port_operations purpose, since it's mostly > for HW methods. > > Or do we actually use sdev->hostdata for libata or libsas? If not, maybe > we could store the struct ata_device pointer there. Well, it might be a way. Thanks, Xingui . > > I'm just thinking out loud now... > > Thanks, > John > > > .