Received: by 10.223.164.202 with SMTP id h10csp4841838wrb; Tue, 21 Nov 2017 00:10:28 -0800 (PST) X-Google-Smtp-Source: AGs4zMbHNj1GiqsUQY3Hs/UEnmHJlWxSbnwhdMrupsDxTm55l3+emnR9tJycb3I2Fu+bd6Zi56Bs X-Received: by 10.84.213.144 with SMTP id g16mr16776442pli.339.1511251827990; Tue, 21 Nov 2017 00:10:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511251827; cv=none; d=google.com; s=arc-20160816; b=D81OArev7qn6kHe2oy5v6t17dJyz2jY1TumLf8TS3c5Z1vCz5P8OxKNCPYNNenSbW7 xSdDLEtmEgq4SlRC/w+nnPbOgjtAZounL9snTON/WMRstyonliwpG8gpBYh2i5TFKc4t LDJBYVGaSnuJ7LxqEXyRD/qnr7QyamcP7fAqNTKQD2h6WepUlx0/xOgQMlk0MZVDM6qm WK5jftzEDkmeUkRv3E3uPCZM/spmh1boe29Kkj8bhTQ48yQr/DGJewYFlw9g28Q4YPRP CYU+pi22+7r4VoRnFRBMzOVfKlBc5fus2ko8O7cUkMOUqMJt5HuiGA7G+jSunnkOSTnW MOew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:spamdiagnosticmetadata :spamdiagnosticoutput:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature:arc-authentication-results; bh=V6akWp+UDFahDkeVNGLLwnrGigQ21apVTvRHmARXRtQ=; b=PTQ1KRgnMkKn+Ak+WSNvqppAFiLp/q28t6W8xze2prObpF1JlKzXAM2tBNhfl+iAh3 TGW21B/aPYo0F/59EmmTeWVZ3FqOf/WP2zgGG/t0qccD/ck8XYf9TlUjkdmRnGSaZhzf 6KWWmWD/lGAP/NS5gg8M5FPINwP5l1nq0RiZ3blhZtzIp+/lrHhXRrtLGq9j13R2JHmy mVZvjTGS9jEynQ9ODghDmTC9UgyyU50F8FkIpFcH5z8IG66gaARsp613M4W4/oJ9vtoe pBqBWQWHkYwww/A5S94+39ZWJW1U32gzEvNZ+1R0kW5hSPTdAVMUei8DISKjKoOe9Ou3 SenQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=selector1 header.b=CdiDXH1K; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=virtuozzo.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e39si3166380plg.511.2017.11.21.00.10.16; Tue, 21 Nov 2017 00:10:27 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=selector1 header.b=CdiDXH1K; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=virtuozzo.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751413AbdKUIJX (ORCPT + 73 others); Tue, 21 Nov 2017 03:09:23 -0500 Received: from mail-ve1eur01on0136.outbound.protection.outlook.com ([104.47.1.136]:21342 "EHLO EUR01-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751181AbdKUIJV (ORCPT ); Tue, 21 Nov 2017 03:09:21 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=V6akWp+UDFahDkeVNGLLwnrGigQ21apVTvRHmARXRtQ=; b=CdiDXH1KVJVRzBr80wqD85q6Bad6fRnqOGVcJvaqaSDT+XW1TQw6W+08+Wv6no90BFh+HLQM+uhHimc1jDi8cxth+43+JdN5ghUnsOOKBZ+pfS8acag9xW0bcffZ94Tg1n2ZaCI7SNbTxH67LeQiaZYUOB7pPW5M+CyZDgB0VrM= Received: from [172.16.24.163] (195.214.232.6) by DB5PR08MB0965.eurprd08.prod.outlook.com (2603:10a6:0:13::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.239.5; Tue, 21 Nov 2017 08:09:17 +0000 Subject: Re: [PATCH] scsi/eh: fix hang adding ehandler wakeups after decrementing host_busy To: Stuart Hayes Cc: "James E . J . Bottomley" , "Martin K . Petersen" , Christoph Hellwig , linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, Konstantin Khorenko , devel@openvz.org References: <20170905125424.15412-1-ptikhomirov@virtuozzo.com> <496d6c6e-565b-9ebb-59b4-d4b17e0d9a62@virtuozzo.com> <9941b46c-72be-e171-2e4b-cb12ac5c439d@gmail.com> From: Pavel Tikhomirov Message-ID: <753b79c1-1127-c431-e411-1ff47eea0e98@virtuozzo.com> Date: Tue, 21 Nov 2017 11:09:14 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: <9941b46c-72be-e171-2e4b-cb12ac5c439d@gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-Originating-IP: [195.214.232.6] X-ClientProxiedBy: HE1PR0901CA0065.eurprd09.prod.outlook.com (2603:10a6:3:45::33) To DB5PR08MB0965.eurprd08.prod.outlook.com (2603:10a6:0:13::20) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 643d9ea2-f059-493b-896d-08d530b72a15 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001)(4534020)(4602075)(7168020)(4627115)(201703031133081)(201702281549075)(2017052603258);SRVR:DB5PR08MB0965; X-Microsoft-Exchange-Diagnostics: 1;DB5PR08MB0965;3:IrTIDaoQ2tZxdEQaT0iz1hEOMPPi7f61X2Y4x0aF6vWqH9vbhtiORnSwt+p5y9Z11blBMmZVoRGfmounWHwTNACnTYpxbNZsc1e5KBDQkMeDrYTxi+zWouN7WYBELBTQqpyMb8DwN16Qoh0gKqajmLxcyyXgeuExqKnerU5ksU4Lwq5gIPdKZhe6D/QtsxpJJVeFxWf2yptahSZh9/FXcCFMUaTiUb1l1Y4Ou5d+y4PpAemwJu3RMFSzrbQdWnpq;25:uR63MUYfTHrxIg4qtTjt0du11GnikEWKKYKRl9ZJw6mBH6FaVGiCJEafF/EuTF4PVOSbI6UQ++w6WwVs8/gcbOj0JYbGzxv+azZZAo6d9Xo5b0/LCzMFqkRFlPjXXj0kiF17ZcoK6iG3355WFfu5UrpBKWmoHQIXXwO6Ha+SG1/47UP6mDc/1AouBcxubYuzchC3D/i+3039KVOTcTixW16nxaw/3ZmudV9HrRT/AWGi3FxJq16B2S0tublojTSCPODD2Tz2aJZ0HZI3oyz9dMA7JVzb6T1H40OlmNczj0vjPcvtR8jK/zl5NY2+JXpps/2t4+rIN58ccMD72qhdlw==;31:PC5Dz7fH5LobshaV7y/XOMFLp26etob6FUcZazNTtizvLF3tfd9O8wXzZyvu/5V3CqNtYpaMhBfjLv5lvs/3sl/VE7gJGXb70jRpKe0iyLYQ2apVY50XwvYWZy0Y8HUyCMLdGVTkBR1Ag/djmcS2GX8I9OtjmUPfF63HCGdptFQXL8vWPL2jLBk8C98nytSSuEzYCxfyZ92iupau3LdgF/blR2H06qGCGMkvO1GdI+8= X-MS-TrafficTypeDiagnostic: DB5PR08MB0965: X-Microsoft-Exchange-Diagnostics: 1;DB5PR08MB0965;20:5xcBMKue4zpD4z1iinld/kxhvj0aR8lWuCcQxp2d0J3Q40yb4Ovu3dKX/9d9nxU1HDF82IL0DTx1LCJOqrzyIuMN0TMBkHCh317Q34FMPeGXgvdJ048YWRxM5c/O1N+eHrTAA0NySbxWB4Pe6gI7o/j2dqEe/8j5DmOvRREXo8nsYgr8O6kxXwrRfPF8Zz7xK7+B/bsuiSoFjIFugTLkt3U63aAi82et49229XuLqskaTPO69fKEKPiGs9SJ9pCyQk70W7HeTYRhPOMwy6SVP2GbYYw8LL50xwppCNSZdrTNjt1NDlcCxJmSXgXNsXYWJOALDShFBZ59ATjogMqFfARrKYXbB17ZO2sEnpVEr+aRKivPrEC3Y44xMJzMCxzp0o/QeP+pgPtJGA5fckcPL+2OE41J8PYtGvuBXLrmSOE=;4:qgLwCXDh+HLvsDhI7M4lCUT90OVU9aQhQVinIiSPiK3CXiNsuhhmTNR3wkJHllJz4dDefmfM96uePfgktLBoauKxNcx9zM7p2jouUk/gkCRjlNZ/Ytlp+xKIUyI4jXOBNFEKPsNoyO9+rkm1SbuvvgUNPNjt7r5DCmjK9ifV3vZ6rkUB1R8ENna0r/pF381v787vS2u2mUCB2mFq046vkHZo4DwqhDT9xSFu0FHrGZtWLXcuCzBh8P7P7+RQ3OR1Zsw0msLva+tt3Kx8Lvl8p1ZAFEm1oUGzHKSQGcGyfOoL6sGdsspzh0abr/SYcsX6 X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(6538939549742); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(5005006)(8121501046)(100000703101)(100105400095)(93006095)(93001095)(3231022)(3002001)(10201501046)(6041248)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123558100)(20161123560025)(20161123555025)(20161123562025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095);SRVR:DB5PR08MB0965;BCL:0;PCL:0;RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095);SRVR:DB5PR08MB0965; X-Forefront-PRVS: 049897979A X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(6009001)(6049001)(376002)(346002)(24454002)(199003)(189002)(53936002)(16576012)(7736002)(305945005)(81166006)(81156014)(31696002)(54906003)(77096006)(6486002)(966005)(478600001)(101416001)(6306002)(8676002)(316002)(86362001)(33646002)(107886003)(53546010)(97736004)(6246003)(39060400002)(2870700001)(4326008)(229853002)(58126008)(64126003)(16526018)(2906002)(6116002)(3846002)(83506002)(47776003)(67846002)(50466002)(25786009)(8936002)(36756003)(68736007)(5660300001)(66066001)(65956001)(65806001)(50986999)(6666003)(31686004)(105586002)(55236003)(76176999)(54356999)(65826007)(106356001)(23676003)(189998001)(6916009)(2950100002)(3714002);DIR:OUT;SFP:1102;SCL:1;SRVR:DB5PR08MB0965;H:[172.16.24.163];FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; Received-SPF: None (protection.outlook.com: virtuozzo.com does not designate permitted sender hosts) Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=ptikhomirov@virtuozzo.com; X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtEQjVQUjA4TUIwOTY1OzIzOjVVbzczblVjR0hldFNpZEJoV1VrTjZPWDJ1?= =?utf-8?B?Q0hoQ045WUxhSWt0M2ZMdnZ4cncyeURiOTZFZGFvMmNlL1RvdUNkdUJtZzBX?= =?utf-8?B?ZE5iNytVaHdEZVJ3R3BaR2VnSjJhbWJsdndCYUZqRVZub3RnVGNmWGJ1Wk1L?= =?utf-8?B?aTNNSW1XdytUQ3NVVzF0b2VWU3N2Q3hDOVNlcUxqQy9jaTZCRnNsYXZ5RllQ?= =?utf-8?B?blpKeml0TUJtMVBmTG1MdW9mSmdRekwyTWc5aWtCNWo2cmZwU0JuakhuMmEz?= =?utf-8?B?QmYwWG1KdkxSK2p3NitzaUVScDdFRW55S0IzR1dLajVJbHZaSTlrMHY4d1Jk?= =?utf-8?B?a2d5OWZXekdPOXpXNFJOcXYvRjdvcTB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LYw4sp1YX8o4NAGN8831dcWjNybDxRM4f6PYMOJ3HULBaCERRoecwKgrH4BGd+4W79yUPl2SXnI1NmQKWNdDEgOqXy7aGRJuNTy4oHwBivrK1CncQlT835XxFVvbgf3ZHPYGQJlqG0XvauRyQj2qGo6HDWdPmj/XqjO5wnh+AWVGAwNC4eoLyip7REjG7GjpLJ/eva5rsPDQm+jE/4F+VKPmoH+qYvBt0=;5:BvJWB3g8yZHALEF/5YfypM56RaBvA8Nss0EEyiE6TveNBur1RwScKHoMB+dw0lYhcL+Re0XAstRFj/4JifZ85QfT0jik4HUayV2B5hOS4rmJCWhhin1CfRqkA9cKndddVkByv8LFkTAmrNIFLRzGDuYJHjabFhv0wD0Rd+bTwbs=;24:a3LPlBKYWFMSfVwmLS7B8tl9iEMazsGpIyuzc08e07bQE7gJdf4i0aLUrMH5O4oBJeWX3DI0BEptvJ1LBCSqcn3gXFIOQYdeyisOG5p9G0A=;7:f+5rMMPQhckUHDrxd9IoQffgCRlNVhDeMDVwR2JSCPSrTXaucDFY65bFMMrSAFk9aB40bWa/pJzi+IwPQ1UEOd9us+BQGBPoSXcPLBHf/KOl+BQuhS3NeVWbaMlVa5uEippKRPpwFTxB+4HkKDxWZff9jzc71GY7hPA0eBzR9C7WDykI9mO+7RQ54Zo6EEgreSb3ifK7SIAhDQKW+UMuckADKlNWj+QJPYbeUB6oATWzOdVL8DGpn4+qyZcQ9qyd SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;DB5PR08MB0965;20:ALO2LddybJ5VCEPglXZ7yi4QI/UZC9wZdpISYUugSHwska2yfk9i1/gS6KaOoT74vQkvxTRBP9PwCA5cLtu14A8LF8pmYqvbEu2MIvKnjW/09EO3Suj8wFNDWf9ZvC17OO9gsPA4WeMu8b4CEc+JuDVtQ71DmHxnZ3ZDTXvtkQA= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Nov 2017 08:09:17.8183 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 643d9ea2-f059-493b-896d-08d530b72a15 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB5PR08MB0965 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org My patch should also fix your issue too, please see explanation in reply to your patch. Do your testing show that it doesn't? Thanks, Pavel. On 11/21/2017 09:10 AM, Stuart Hayes wrote: > Pavel, > > It turns out that the error handler on our systems was not getting woken up for a different reason... I submitted a patch earlier today that fixes the issue I were seeing (I CCed you on the patch). > > Before I got my hands on the failing system and was able to root cause it, I was pretty sure that your patch was going to fix our issue, because after I examined the code paths, I couldn't find any other reason that the error handler would not get woken up. I tried forcing the bug that your patch fixes to occur, by compiling in some mdelay()s in a key place or two in the scsi code, but it never failed for me that way. With my patch, several systems that previously failed in 10 minutes or less successfully ran for many days. > > Thanks, > Stuart > > On 11/9/2017 8:54 AM, Pavel Tikhomirov wrote: >>> Are there any issues with this patch (https://patchwork.kernel.org/patch/9938919/) that Pavel Tikhomirov submitted back in September?  I am willing to help if there's anything I can do to help get it accepted. >> >> Hi, Stuart, I asked James Bottomley about the patch status offlist and it seems that the problem is - patch lacks testing and review. I would highly appreciate review from your side and anyone who wants to participate! >> >> And if you can confirm that the patch solves the problem on your environment with no side effects please add "Tested-by:" tag also. >> >> Thanks, Pavel >> >> On 09/05/2017 03:54 PM, Pavel Tikhomirov wrote: >>> We have a problem on several our nodes with scsi EH. Imagine such an >>> order of execution of two threads: >>> >>> CPU1 scsi_eh_scmd_add        CPU2 scsi_host_queue_ready >>> /* shost->host_busy == 1 initialy */ >>> >>>                 if (shost->shost_state == SHOST_RECOVERY) >>>                     /* does not get here */ >>>                     return 0; >>> >>> lock(shost->host_lock); >>> shost->shost_state = SHOST_RECOVERY; >>> >>>                 busy = shost->host_busy++; >>>                 /* host->can_queue == 1 initialy, busy == 1 >>>                  * - go to starved label */ >>>                 lock(shost->host_lock) /* wait */ >>> >>> shost->host_failed++; >>> /* shost->host_busy == 2, shost->host_failed == 1 */ >>> call scsi_eh_wakeup(shost) { >>>     if (host_busy == host_failed) { >>>         /* does not get here */ >>>         wake_up_process(shost->ehandler) >>>     } >>> } >>> unlock(shost->host_lock) >>> >>>                 /* acquire lock */ >>>                 shost->host_busy--; >>> >>> Finaly we do not wakeup scsi_error_handler and all other commands >>> coming will hang as we are in never ending recovery state as there >>> is no one left to wakeup handler. >>> >>> So scsi disc in these host becomes unresponsive and all bio on node >>> hangs. (We trigger these problem when scsi cmnds to DVD drive timeout.) >>> >>> Main idea of the fix is to try to do wake up every time we decrement >>> host_busy or increment host_failed(the latter is already OK). >>> >>> Now the very *last* one of busy threads getting host_lock after >>> decrementing host_busy will see all write operations on host's >>> shost_state, host_busy and host_failed completed thanks to implied >>> memory barriers on spin_lock/unlock, so at the time of busy==failed >>> we will trigger wakeup in at least one thread. (Thats why putting >>> recovery and failed checks under lock) >>> >>> Signed-off-by: Pavel Tikhomirov >>> --- >>>   drivers/scsi/scsi_lib.c | 21 +++++++++++++++++---- >>>   1 file changed, 17 insertions(+), 4 deletions(-) >>> >>> diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c >>> index f6097b89d5d3..6c99221d60aa 100644 >>> --- a/drivers/scsi/scsi_lib.c >>> +++ b/drivers/scsi/scsi_lib.c >>> @@ -320,12 +320,11 @@ void scsi_device_unbusy(struct scsi_device *sdev) >>>       if (starget->can_queue > 0) >>>           atomic_dec(&starget->target_busy); >>>   +    spin_lock_irqsave(shost->host_lock, flags); >>>       if (unlikely(scsi_host_in_recovery(shost) && >>> -             (shost->host_failed || shost->host_eh_scheduled))) { >>> -        spin_lock_irqsave(shost->host_lock, flags); >>> +             (shost->host_failed || shost->host_eh_scheduled))) >>>           scsi_eh_wakeup(shost); >>> -        spin_unlock_irqrestore(shost->host_lock, flags); >>> -    } >>> +    spin_unlock_irqrestore(shost->host_lock, flags); >>>         atomic_dec(&sdev->device_busy); >>>   } >>> @@ -1503,6 +1502,13 @@ static inline int scsi_host_queue_ready(struct request_queue *q, >>>       spin_unlock_irq(shost->host_lock); >>>   out_dec: >>>       atomic_dec(&shost->host_busy); >>> + >>> +    spin_lock_irq(shost->host_lock); >>> +    if (unlikely(scsi_host_in_recovery(shost) && >>> +             (shost->host_failed || shost->host_eh_scheduled))) >>> +        scsi_eh_wakeup(shost); >>> +    spin_unlock_irq(shost->host_lock); >>> + >>>       return 0; >>>   } >>>   @@ -1964,6 +1970,13 @@ static blk_status_t scsi_queue_rq(struct blk_mq_hw_ctx *hctx, >>>     out_dec_host_busy: >>>       atomic_dec(&shost->host_busy); >>> + >>> +    spin_lock_irq(shost->host_lock); >>> +    if (unlikely(scsi_host_in_recovery(shost) && >>> +             (shost->host_failed || shost->host_eh_scheduled))) >>> +        scsi_eh_wakeup(shost); >>> +    spin_unlock_irq(shost->host_lock); >>> + >>>   out_dec_target_busy: >>>       if (scsi_target(sdev)->can_queue > 0) >>>           atomic_dec(&scsi_target(sdev)->target_busy); >>> >> > > --- > This email has been checked for viruses by Avast antivirus software. > https://www.avast.com/antivirus > From 1584654933741250528@xxx Tue Nov 21 06:11:50 +0000 2017 X-GM-THRID: 1577704452897311330 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread