Received: by 2002:a05:6358:f14:b0:e5:3b68:ec04 with SMTP id b20csp3265102rwj; Mon, 19 Dec 2022 15:47:11 -0800 (PST) X-Google-Smtp-Source: AA0mqf52WwiO9fdAWkxOTY+618TJn8P2+Hg1axb7EriSKBmYkxHHr1iL/AMpmq7QXzrdZzLrqK8o X-Received: by 2002:a17:906:2716:b0:7c3:1c4d:7c89 with SMTP id z22-20020a170906271600b007c31c4d7c89mr21188897ejc.5.1671493631508; Mon, 19 Dec 2022 15:47:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671493631; cv=none; d=google.com; s=arc-20160816; b=Qw3biAaLf4B6kfMwzhdJnKQgRhqlgtCNc6A1q8dfGOHKPA+gIkWHWPWUGGC43TTZ4f OPbA3bcRi9SXI8qczmzxYWplRxPOGHsbqxIPVempORyKQiFxtHtzRNRx8VghjODuNA7A UcWHLmbijxqoa6PjB9Ih5HTpzOtWka089TMQ5x114dOIcGq09T7EpHUIfHpOUY7qTRKx 7JsB7rygRbRZuXwhIBfuHaexDZ2kX9ELFuA2heLfvZpFpPyaOEBHKkYPP20sAQPBaPRe Qodm5lzkzr2AGylccfWfYg/ArbaeHeUG0Jzi4dxs2EWnC1LY2qxDfF9Sxw7J7mk9J3bD MkzQ== 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 :organization:from:references:cc:to:content-language:subject :user-agent:mime-version:date:message-id:dkim-signature :wdcironportexception:ironport-sdr:ironport-sdr:dkim-signature; bh=ECzHKD874L/2s+q5yE96TXJkBaCiaKo5Ubu4WxCLDKE=; b=RX/uOOi8/990XWqvRQc9D6gYleGo0QcGjfDdYd4KMV9S/rC33r/q1ERT0rR7qNxxu7 fBHr3LUoL777aG6rYV9DsMIrOaie0jBmtAI4X3AMlAvdbznifElL5kmw+FTzqL9Fv3gn 4AJg0vOWoCGJb1g+ea/s2Qpo4LanEp1zj6lRbTo85oeQPSZ3/lA7vinll5fs1w0fsLvh Xw5vozyTdWWpp9VoE7iTpgEp57c2h+7WWEW7o6TaA3EDVgB5LOo4o9SsmZJlMY01Xpop 9aCtI2wF0l5fFNw8j22EsVwuI9WQdiNTv+0oIBqiaSj2eN5oBAMvK6J0je12MpfMrZ2p W8LA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@wdc.com header.s=dkim.wdc.com header.b=VE3xVl5S; dkim=pass header.i=@opensource.wdc.com header.s=dkim header.b=me+2UvV2; 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=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=opensource.wdc.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sg31-20020a170907a41f00b007b896cb991esi10589135ejc.207.2022.12.19.15.46.55; Mon, 19 Dec 2022 15:47:11 -0800 (PST) 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; dkim=fail header.i=@wdc.com header.s=dkim.wdc.com header.b=VE3xVl5S; dkim=pass header.i=@opensource.wdc.com header.s=dkim header.b=me+2UvV2; 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=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=opensource.wdc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232977AbiLSXD7 (ORCPT + 70 others); Mon, 19 Dec 2022 18:03:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55770 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232988AbiLSXCM (ORCPT ); Mon, 19 Dec 2022 18:02:12 -0500 Received: from esa6.hgst.iphmx.com (esa6.hgst.iphmx.com [216.71.154.45]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B4BB615F39 for ; Mon, 19 Dec 2022 15:00:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1671490858; x=1703026858; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=ECzHKD874L/2s+q5yE96TXJkBaCiaKo5Ubu4WxCLDKE=; b=VE3xVl5S59XHn3KF16mvBy3sfmdfe1ORCPcZkWPWRNv9ug8xCOkMRBv6 AadahkMikCVw41rL4cXVwu9RTldpH9rUmX1VAsan0KgVAyqc46kPh9wvq A8DqoDgYPeT2Z7b9+bT6UWoPybvqDeV78b1sJ3kkw+nklgCTrkOSHo815 nmW9dRZRU6/1Ud+YNZT+ckpvPeNAivITj6ReGZ5ONT/KOmqw+bzm0Wm51 x8KRWYioNavcX1Mo6k6ncLXV509o1efOcaamWu53acpOIVIOHrNwpqeks GhVl+0YAI1RQjmbi1X78R+ItIt5l3lLw6EGR2XGh1B5lPvfsg3igrbFwh A==; X-IronPort-AV: E=Sophos;i="5.96,257,1665417600"; d="scan'208";a="219253138" Received: from h199-255-45-15.hgst.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 20 Dec 2022 07:00:49 +0800 IronPort-SDR: aDgS5hJdo+GCauJrnoG/6dc5v9y9ANaRnR3FIfzFKfqZ3dUCWfiTgoBwRQ84fqc3l9Ix86Yrnj 4q1raowBcCiPo6zf+Wi6My6HZVpCURGDBvzRUMy8Lt5PmqGj9GWqFEoVhhJ7tITomxC2SYN/m7 x99Uv79P5z8VMRhgs/M3TWYDuP2qFTsCEZ+c0U4wwKD9QCa3lBhuQDlN1eFepFjJHfF8T9Lc02 ECSX9SzVC0gunVOleEwy7IwUGdI3OBHqI7udhMkZrNb6X/1xciXD9JNgjDAmeRssQJo71ZA2i+ bg4= Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 19 Dec 2022 14:13:19 -0800 IronPort-SDR: XsLIFWD0cT0HQcxLMrCvLZqT0Z62G31AtSYmatd4vIEB2Dg/gmti1Oe/krQz+Y+suGgyJW5qAO UvksgssOcOqp1Hg76tETXyI+xFW6FkAHvJj0SdmQ1OLDxj7VuBiaT+kCw7LcLkeUMYEgEXrL51 sS04LdXXE415yt1X8GPAqDWsa5k/8q6/zClDHNdKDrQ/Dzg9X07khelxgm5m32f3IrGVlpadO0 WLFh5ofwXVs5ssTa+udgiYHGxcXCb5MXVGHYEG+WchzovtilCjK9zsVaqeTcOyE8PuLcnARauR //I= WDCIronportException: Internal Received: from usg-ed-osssrv.wdc.com ([10.3.10.180]) by uls-op-cesaip02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 19 Dec 2022 15:00:49 -0800 Received: from usg-ed-osssrv.wdc.com (usg-ed-osssrv.wdc.com [127.0.0.1]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTP id 4NbZtm0Bkbz1Rx15 for ; Mon, 19 Dec 2022 15:00:47 -0800 (PST) Authentication-Results: usg-ed-osssrv.wdc.com (amavisd-new); dkim=pass reason="pass (just generated, assumed good)" header.d=opensource.wdc.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d= opensource.wdc.com; h=content-transfer-encoding:content-type :in-reply-to:organization:from:references:to:content-language :subject:user-agent:mime-version:date:message-id; s=dkim; t= 1671490846; x=1674082847; bh=ECzHKD874L/2s+q5yE96TXJkBaCiaKo5Ubu 4WxCLDKE=; b=me+2UvV2aY1MHUjEtnV2BXljahbxCr7z4uvHHA6KBbrnXDUez3d Oz6bUwywYmSFcCAa40sacJUC+8+Qmd8VFKYApHMx4Hq2zBnYWr+a8bsdXa0mFoGX Uij1pHUq7GkqTTE5Qm+7dJCSxb0S7+dwkW6sFseouLr1P+gqqtNnM8m3zCROE6h6 0TfuJVBZc/mTGn9vog47jFRGHv+hh2A2MOTcgNXdPAPy5VhZgUb6V/G5EXRicHjt XaEwT1h+ghp4wDVhWWnHuK4Rsgo9NMWXL+7y6GzzX2KYFyygv6dCt6K1+vy5VwyQ RzkAak8uiNAHcoVAULf69ZljDCVEsKqYRRw== X-Virus-Scanned: amavisd-new at usg-ed-osssrv.wdc.com Received: from usg-ed-osssrv.wdc.com ([127.0.0.1]) by usg-ed-osssrv.wdc.com (usg-ed-osssrv.wdc.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id QHYBFvrIVB5J for ; Mon, 19 Dec 2022 15:00:46 -0800 (PST) Received: from [10.225.163.106] (unknown [10.225.163.106]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTPSA id 4NbZtj0MVHz1RvLy; Mon, 19 Dec 2022 15:00:44 -0800 (PST) Message-ID: <4489f80f-9f39-8f3f-5d10-6b113131e65c@opensource.wdc.com> Date: Tue, 20 Dec 2022 08:00:43 +0900 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.5.1 Subject: Re: [PATCH V2] scsi: libsas: Directly kick-off EH when ATA device fell off Content-Language: en-US To: John Garry , Jason Yan , Xingui Yang , jejb@linux.ibm.com, martin.petersen@oracle.com, linux-ide@vger.kernel.org, hare@suse.com, hch@lst.de Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, linuxarm@huawei.com, prime.zeng@hisilicon.com, kangfenglong@huawei.com References: <20221216100327.7386-1-yangxingui@huawei.com> <565fcf28-ec53-8d74-00a3-94be8e5b60e4@oracle.com> <60ace19e-d029-f14d-9aac-d5cef83b5b64@huawei.com> <257dcd6c-2ffd-f518-9b13-c309348088d9@oracle.com> From: Damien Le Moal Organization: Western Digital Research In-Reply-To: <257dcd6c-2ffd-f518-9b13-c309348088d9@oracle.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-5.6 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,SPF_PASS autolearn=unavailable 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 12/20/22 00:55, John Garry wrote: > On 19/12/2022 15:28, Jason Yan wrote: >>>> +=C2=A0=C2=A0=C2=A0 if (test_bit(SAS_DEV_GONE, &dev->state) && dev_i= s_sata(dev)) >>>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 sas_ata_device_link_abor= t(dev, false); >>> >>> Firstly, I think that there is a bug in sas_ata_device_link_abort() -= >=20 >>> ata_link_abort() code in that the host lock in not grabbed, as the=20 >>> comment in ata_port_abort() mentions. Having said that, libsas had=20 >>> already some dodgy host locking usage - specifically dropping the loc= k=20 >>> for the queuing path (that's something else to be fixed up ... I thin= k=20 >> >> Taking big locks in queuing path is not a good idea. This will bring=20 >> down performance. >=20 > But it is expected that ata_qc_issue() should be called with that the=20 > host lock grabbed (and keep it). >=20 > I think that the reason libsas drops the lock is because some LLDD=20 > queuecommand CBs calls task_done() in some error paths. If we kept the=20 > lock held, then we could have a deadlock, for example: >=20 > sas_ata_qc_issue (has lock) -> lldd_execute_task() =3D=20 > pm8001_queue_command() -> task_done() =3D sas_ata_task_done() -> grab h= ost=20 > lock =3D> deadlock. That should be easily solvable using a workqueue for doing task_done(), n= o ? >=20 > Thanks, > John --=20 Damien Le Moal Western Digital Research