From patchwork Tue Jun 20 03:36:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AceLan Kao X-Patchwork-Id: 1796889 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20221208 header.b=cODsnAJS; dkim-atps=neutral Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4QlXPw4g2Pz20Xf for ; Tue, 20 Jun 2023 13:37:23 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1qBSB2-0004Z9-3N; Tue, 20 Jun 2023 03:37:08 +0000 Received: from mail-pg1-f171.google.com ([209.85.215.171]) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1qBSAz-0004VX-AA for kernel-team@lists.ubuntu.com; Tue, 20 Jun 2023 03:37:05 +0000 Received: by mail-pg1-f171.google.com with SMTP id 41be03b00d2f7-543cc9541feso2195971a12.2 for ; Mon, 19 Jun 2023 20:37:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687232222; x=1689824222; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:sender:from:to:cc:subject:date:message-id:reply-to; bh=vh/P4idTcboE7eMc84XNLbjDNHQY9hUu83hRLOr/KTY=; b=cODsnAJScYXhOrMjRs4PLGAeAYkPUVqTdFrNEzGnzf/BHbx6bZ+FoPo8871s45DXqH Wt1r7RPB/2XjEMHFXju9cttc2SE4hOBcNtFxUNeAleaF43tIGfWflYx33EuwDClDiILE rR5+1V3Hgfrwvz3k9baHPWsraAeirJnieENzugLzyC0Ywg5fBY3s2c/0IF/eSVFd1Pv9 3vQsagIJPBDllSzxctO61QQuDLjl5UVlvQlN5KTtcQG3OPB/nvVcHCCAam06FSjbaoWB LPoFH58KyQ/WGa/M086eUFVwkRIL+ahxIaxt6umPq32O74BoDgobNGQ4m06mtxy029U3 KJHQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687232222; x=1689824222; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:sender:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=vh/P4idTcboE7eMc84XNLbjDNHQY9hUu83hRLOr/KTY=; b=jNDxitnxhw8c0FpD2gCQ8F18xl0P7YekyIFU+Bhe3ENHHTx8tu4B608jLhTBPmlq/a gt8JYCkdugMIiItE3FCeVg1x+NwOOhA6JUZjhjflxp3TqKIf+B/v7CwqSS1Jv1D3JUGS QtOchUqUQhJDizwIsfWQXyOAZ/I2MulVk1eSbGLtqHyG7ErHFTuy1tld5fm4EcLaIh8h k90hOH9vOz4cKR9zlKOY4Z0loVYNjrBSNkjIhpnlEzVdTvefhCiHf1VGCchfJa501bEX Ga9GPDwfTBThT6dyJ56NR0ZCl2fMKaoet8IH0GHz+ayZUIaCMEh9WqDseqafPM8Qiipa 0XRw== X-Gm-Message-State: AC+VfDzYULo1o3OCbpIJb0NMW6ggmNBzldQaQNZBGOSDGde4e1vuiO8P PCs/C5zxPoG3xtjCORLoBNpQU1tXg7Y= X-Google-Smtp-Source: ACHHUZ6EKSlTMUfRoMbBAB/dhQwF/EKuZ4U4pd61tCU7t3XWwbfnW/djyTla6KKabv0mbFL6OEqsBQ== X-Received: by 2002:a05:6a21:7890:b0:11f:1aa2:666b with SMTP id bf16-20020a056a21789000b0011f1aa2666bmr9907908pzc.32.1687232222063; Mon, 19 Jun 2023 20:37:02 -0700 (PDT) Received: from localhost (220-135-95-34.hinet-ip.hinet.net. [220.135.95.34]) by smtp.gmail.com with ESMTPSA id i14-20020a170902c94e00b001ae2b94701fsm518808pla.21.2023.06.19.20.37.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Jun 2023 20:37:01 -0700 (PDT) From: AceLan Kao To: kernel-team@lists.ubuntu.com Subject: [PATCH 0/1][SRU][J][L][M] A deadlock issue in scsi rescan task while resuming from S3 Date: Tue, 20 Jun 2023 11:36:58 +0800 Message-Id: <20230620033659.136024-1-acelan.kao@canonical.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Received-SPF: pass client-ip=209.85.215.171; envelope-from=acelan@gmail.com; helo=mail-pg1-f171.google.com X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: "Chia-Lin Kao (AceLan)" BugLink: https://launchpad.net/bugs/2018566 [Impact] During the S3 stress test, the system sometimes hangs when resuming. This is due to the SCSI rescan task being unable to acquire the mutex lock during the resumption from S3. The mutex lock has already been acquired by EH and is waiting for the device to be ready for a rescan. Unfortunately, the mutex lock is never released by either party, leading to a deadlock. [Fix] Kaiheng submitted a patch to fix this issue which defers the rescan if the disk is still suspended so the resume process of the disk device can proceed. https://patchwork.ozlabs.org/project/linux-ide/patch/20230502150435.423770-2-kai.heng.feng@canonical.com/ Since the patch has not been accepted by the upstream yet, so submit it to the OEM kernel for now. The similiar patch has been included in v6.4-rc7, backport this to generic ubuntu kernels. 6aa0365a3c85 ata: libata-scsi: Avoid deadlock on rescan after device resume [Test] Verified on the machines by me and ODM. [Where problems could occur] It only defers the rescan task, and should not have any impact to current systems. Damien Le Moal (1): ata: libata-scsi: Avoid deadlock on rescan after device resume drivers/ata/libata-core.c | 3 ++- drivers/ata/libata-eh.c | 2 +- drivers/ata/libata-scsi.c | 22 +++++++++++++++++++++- include/linux/libata.h | 2 +- 4 files changed, 25 insertions(+), 4 deletions(-) Acked-by: Stefan Bader Acked-by: Tim Gardner Acked-by: Andrei Gherzan