Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2290563rwd; Wed, 14 Jun 2023 00:15:59 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4Xkpu24TCGyCsfCpAE+QV6LWPx6gpX+kIPbo/vOtyvSNqSjYe5rzf7Ys6n8jVvoGuTbslm X-Received: by 2002:a17:906:fe03:b0:974:1eb9:f750 with SMTP id wy3-20020a170906fe0300b009741eb9f750mr13047885ejb.36.1686726958762; Wed, 14 Jun 2023 00:15:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686726958; cv=none; d=google.com; s=arc-20160816; b=fZ+56GgBZdJBq0IXCkBmE6XNx8o2Z5EvPV90Hw8+DmIVOhEdF5Swxpbb5rRspWIJfK LK78E1GcceiBlQWrQLBWgh94xH2xvWVOfrsCR5HpDRWyI4DA+WhKSgcXlpDp4qVLOnsi +DA31vbQZtseHL5Kwmcz0eyB1PGerw6RqfEuS4JHwMTqJRcrT6KHCsFRfaHPWQIZ5kqQ tm/UFvd7YLtGUVpVor/7zZu/Xzcl0w0X3t5ywWK80sxtR0slS5MpF2ImR9/6RDROy/CN TQJMF4oAoJ/mW+kyuzCniGLK894+87a/D39ZywgPdcxAEU/qAYw9p1P0GriKVJegBtYt LKuA== 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:dkim-signature:dkim-signature; bh=bWmUJHf0Ey81BHg4FfOq6OnR1lg1RZH8qrzAxru/q4U=; b=sU8j+bo0P/sVrRu0h25/7ZEL023CtD1TFbo8UGimU00Y47m0naOXgMy5b6kzP529Nr 096a5px5EdNOiVYba9rXvx0M1FKdzSG2xH1jOn5JqJyIualfI7iCOHcRcpBJIoBCqpfj HS4VcTQv3vq4sHUWNfrTl4kPLMk4t/dN+eyHbIN4UmqMB2w6TQVQqwAdXWTqq8J3W8lG cbeZD+Nu2J5X+OX//wjvxoZ1YHxn/dDxXPncDc9K1pbeUY+JZrPrO3RCDBZeyWugSYZV Z1bvu9BSj2etiVg/0tx5ePboywkUoeapP3w85AoFaG1dtbEDWTAwM/JIJ9tmwgnolHcy 0N5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=Ae78GTKg; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=IhtnPGz1; 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=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s10-20020a170906354a00b0097463652667si7745450eja.139.2023.06.14.00.15.32; Wed, 14 Jun 2023 00:15:58 -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; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=Ae78GTKg; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=IhtnPGz1; 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=NONE sp=NONE dis=NONE) header.from=suse.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234554AbjFNG5S (ORCPT + 99 others); Wed, 14 Jun 2023 02:57:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55494 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229943AbjFNG5Q (ORCPT ); Wed, 14 Jun 2023 02:57:16 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9B1B91984; Tue, 13 Jun 2023 23:57:15 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 227072188D; Wed, 14 Jun 2023 06:57:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1686725834; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=bWmUJHf0Ey81BHg4FfOq6OnR1lg1RZH8qrzAxru/q4U=; b=Ae78GTKgCZZmGqmGNhaYT00kHkTw7C22ZCo648dDhJ5Hznq86Qcl4UTSqguQZZMN1B5u2+ fQVBGbjxDDMK3J4Kzj8D6BBud5Y3rlLwToB8VxsOCRc7c/N6CwY8KWxXUaXM7B2YMc+n2m zamjj2L8XPwxE1yYbor492aRMNRvVtg= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1686725834; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=bWmUJHf0Ey81BHg4FfOq6OnR1lg1RZH8qrzAxru/q4U=; b=IhtnPGz1B/nlr8hDByMU5YnbQ+jLtCqO6A1zC0rheblThcV4vMvhPDAZGiCZqV2PEaAj7a eyODkgpoYD5GMNDQ== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id F30541357F; Wed, 14 Jun 2023 06:57:12 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id TXZdOshkiWS9DAAAMHmgww (envelope-from ); Wed, 14 Jun 2023 06:57:12 +0000 Message-ID: <37ed36f0-6f72-115c-85fb-62ef5ad72e76@suse.de> Date: Wed, 14 Jun 2023 08:57:12 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 Subject: Re: Fwd: Waking up from resume locks up on sr device Content-Language: en-US To: Damien Le Moal , Joe Breuer , Bart Van Assche , Bagas Sanjaya , Pavel Machek Cc: "Rafael J. Wysocki" , Len Brown , Greg Kroah-Hartman , Kees Cook , Tony Luck , "Guilherme G. Piccoli" , Thorsten Leemhuis , "James E.J. Bottomley" , "Martin K. Petersen" , Phillip Potter , Linux Power Management , Linux Kernel Mailing List , Linux Hardening , Linux Regressions , Linux SCSI , Alan Stern , Dan Williams , Hannes Reinecke , Adrian Hunter , Martin Kepplinger , Kai-Heng Feng References: <2d1fdf6d-682c-a18d-2260-5c5ee7097f7d@gmail.com> <5513e29d-955a-f795-21d6-ec02a2e2e128@gmail.com> <07d6e2e7-a50a-8cf4-5c5d-200551bd6687@gmail.com> <02e4f87a-80e8-dc5d-0d6e-46939f2c74ac@acm.org> <84f1c51c-86f9-04b3-0cd1-f685ebee7592@kernel.org> From: Hannes Reinecke In-Reply-To: <84f1c51c-86f9-04b3-0cd1-f685ebee7592@kernel.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.5 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_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 6/14/23 06:49, Damien Le Moal wrote: > On 6/11/23 18:05, Joe Breuer wrote: >> I'm the reporter of this issue. >> >> I just tried this patch against 6.3.4, and it completely fixes my >> suspend/resume issue. >> >> The optical drive stays usable after resume, even suspending/resuming >> during playback of CDDA content works flawlessly and playback resumes >> seamlessly after system resume. >> >> So, from my perspective: Good one! > > In place of Bart's fix, could you please try this patch ? > > diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c > index b80e68000dd3..a81eb4f882ab 100644 > --- a/drivers/ata/libata-eh.c > +++ b/drivers/ata/libata-eh.c > @@ -4006,9 +4006,32 @@ static void ata_eh_handle_port_resume(struct > ata_port *ap) > /* tell ACPI that we're resuming */ > ata_acpi_on_resume(ap); > > - /* update the flags */ > spin_lock_irqsave(ap->lock, flags); > + > + /* Update the flags */ > ap->pflags &= ~(ATA_PFLAG_PM_PENDING | ATA_PFLAG_SUSPENDED); > + > + /* > + * Resuming the port will trigger a rescan of the ATA device(s) > + * connected to it. Before scheduling the rescan, make sure that > + * the associated scsi device(s) are fully resumed as well. > + */ > + ata_for_each_link(link, ap, HOST_FIRST) { > + ata_for_each_dev(dev, link, ENABLED) { > + struct scsi_device *sdev = dev->sdev; > + > + if (!sdev) > + continue; > + if (scsi_device_get(sdev)) > + continue; > + > + spin_unlock_irqrestore(ap->lock, flags); > + device_pm_wait_for_dev(&ap->tdev, > + &sdev->sdev_gendev); > + scsi_device_put(sdev); > + spin_lock_irqsave(ap->lock, flags); > + } > + } > spin_unlock_irqrestore(ap->lock, flags); > } > #endif /* CONFIG_PM */ > > Thanks ! > Well; not sure if that'll work out. The whole reason why we initial a rescan is that we need to check if the ports are still connected, and whether the devices react. So we can't iterate the ports here as this is the very thing which gets checked during EH. We really should claim resume to be finished as soon as we can talk with the HBA, and kick off EH asynchronously to let it finish the job after resume has completed. Cheers, Hannes -- Dr. Hannes Reinecke Kernel Storage Architect hare@suse.de +49 911 74053 688 SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg HRB 36809 (AG Nürnberg), Geschäftsführer: Ivo Totev, Andrew Myers, Andrew McDonald, Martje Boudien Moerman