From patchwork Wed Jan 3 17:51:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 10142693 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 80E0C6034B for ; Wed, 3 Jan 2018 17:51:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6F5742901A for ; Wed, 3 Jan 2018 17:51:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 63A2E29062; Wed, 3 Jan 2018 17:51:29 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B841E2901A for ; Wed, 3 Jan 2018 17:51:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750829AbeACRv1 (ORCPT ); Wed, 3 Jan 2018 12:51:27 -0500 Received: from esa5.hgst.iphmx.com ([216.71.153.144]:32976 "EHLO esa5.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750753AbeACRvZ (ORCPT ); Wed, 3 Jan 2018 12:51:25 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1515001886; x=1546537886; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-id:content-transfer-encoding: mime-version; bh=TwSGOHiEP7SjpgZyB//sJ0z8aJbiqOGjuhwZy1GQ9T0=; b=SfUt96LQOlQ6QDn4oWvg2a+v88uwK9jDASyt3UXA1Yk4AH7qVIKgu6O4 9En2fDYm6n7HlYEpW57u/Naz+VySf9Sp5pOZPtPopGDWxB7Qhjkj9pRE2 X8lVhOWQppzPS4dt2c7Y0DxPrTJ0ygJrGvh9036jljtCq1HfQyNWm31Ep y8YLsz8/jHRzqWdTz9XxacO3ywCUm7dNyYwuGi9Qyz5ijfgsGgx/eybS/ N+g6e1yT8wQFYttN8wjb7t+IrA/nEbd5IYB2qghrIvGfbr+HcJ2izGTmb XbKdtZDT1puvrb1jjXms1b0owenJbExohv04xc7zRgYb3s63JDHX63EJq w==; X-IronPort-AV: E=Sophos;i="5.45,503,1508774400"; d="scan'208";a="67660946" Received: from mail-sn1nam01lp0111.outbound.protection.outlook.com (HELO NAM01-SN1-obe.outbound.protection.outlook.com) ([207.46.163.111]) by ob1.hgst.iphmx.com with ESMTP; 04 Jan 2018 01:51:25 +0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sharedspace.onmicrosoft.com; s=selector1-wdc-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=TwSGOHiEP7SjpgZyB//sJ0z8aJbiqOGjuhwZy1GQ9T0=; b=lWsZ7N14fvZHrUV5DmDkaxvsuuKnsKOUCZ7H3DdikKIDOX3mQiXlGhDyblulckxDZq4TfyW8nEoh4G/fL8rbhecHfaxwVq89LWehSf4n3X7bpo8TomD/lPuVUiOrSpaFEuC5l1rmPY9PflWuAT5XzdZ8YSvT+dajSk5QC9qcy6A= Received: from CY1PR0401MB1536.namprd04.prod.outlook.com (10.163.19.154) by CY1PR0401MB1535.namprd04.prod.outlook.com (10.163.19.153) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.386.5; Wed, 3 Jan 2018 17:51:23 +0000 Received: from CY1PR0401MB1536.namprd04.prod.outlook.com ([10.163.19.154]) by CY1PR0401MB1536.namprd04.prod.outlook.com ([10.163.19.154]) with mapi id 15.20.0386.005; Wed, 3 Jan 2018 17:51:23 +0000 From: Bart Van Assche To: "terraluna977@gmail.com" CC: "linux-scsi@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linux-block@vger.kernel.org" Subject: Re: 4.15-rcX 32-bit SCSI suspend2ram warning Thread-Topic: 4.15-rcX 32-bit SCSI suspend2ram warning Thread-Index: AQHThLad9nGcKs1C4UmHcPMPS/nzq6NibYEA Date: Wed, 3 Jan 2018 17:51:22 +0000 Message-ID: <1515001882.2582.15.camel@wdc.com> References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Bart.VanAssche@wdc.com; x-originating-ip: [199.255.44.172] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; CY1PR0401MB1535; 7:yGqDAf3p3JpAvzhrHNF0SAeClcQBPon9jN4vH26y1XrvGa64OyROuw4yFN7pGNvkzh8etEUfrfrEaUvvDBPbeJB0HECnTdjiabRY2w2hirTm7QEbYDPjJxAps1y/AJRqh6bmidZZUypjBmLWnasO+a2y4uorBIkEmahuGnljs7B7w3KzJN0gKHFOz57oxff5Rh+Du5Ha/pUJxsY4cMoo52iDaa3u6G0h+OSxrXUp5fmq3CrE0WkImyqOhjzGgy41; 20:fRKT8NDbNSMHcl4kae17cnO36Q3nXVq+2MyL2zfryJDis773opZHD4/tIn1JR7cfufuK7/UuZ3OHxE01RV7s4Sp/nW4FQwpRCAeTeSsbkj9LlbYauOq73/USArrD/bIZnb5a+7wEAcuzcLfHSLunrMyfHUPDwuBsvTU68cjInNE= x-ms-exchange-antispam-srfa-diagnostics: SSOS; x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 36cb559c-919c-45f4-69f2-08d552d29a74 x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(48565401081)(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(5600026)(4604075)(3008032)(2017052603307)(7153060); SRVR:CY1PR0401MB1535; x-ms-traffictypediagnostic: CY1PR0401MB1535: wdcipoutbound: EOP-TRUE x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(6040470)(2401047)(5005006)(8121501046)(10201501046)(3002001)(3231023)(944501075)(93006095)(93001095)(6055026)(6041268)(20161123558120)(20161123562045)(20161123564045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011); SRVR:CY1PR0401MB1535; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:CY1PR0401MB1535; x-forefront-prvs: 0541031FF6 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(39860400002)(346002)(376002)(39380400002)(366004)(396003)(189003)(199004)(377424004)(52314003)(24454002)(72206003)(99286004)(25786009)(14454004)(3846002)(103116003)(4326008)(68736007)(478600001)(39060400002)(8936002)(6116002)(86362001)(2351001)(97736004)(345774005)(105586002)(6436002)(229853002)(3280700002)(6486002)(77096006)(5640700003)(2906002)(3660700001)(1361003)(15650500001)(54906003)(2501003)(36756003)(316002)(106356001)(66066001)(6512007)(1411001)(76176011)(8676002)(81156014)(5660300001)(81166006)(305945005)(7736002)(6246003)(59450400001)(6506007)(2900100001)(53936002)(102836004)(6916009)(2950100002); DIR:OUT; SFP:1102; SCL:1; SRVR:CY1PR0401MB1535; H:CY1PR0401MB1536.namprd04.prod.outlook.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; x-microsoft-antispam-message-info: ruFsTGQRfg6RRpug6G503s8cymRD0LHuBFmZkLzn21q2ASgILvyna6de+A5VdLUz2D+TqSCdKbzMKv82w2Ih1Q== spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-ID: <7C2700D7694FBF46AA810B75F242C8F5@namprd04.prod.outlook.com> MIME-Version: 1.0 X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-Network-Message-Id: 36cb559c-919c-45f4-69f2-08d552d29a74 X-MS-Exchange-CrossTenant-originalarrivaltime: 03 Jan 2018 17:51:22.9942 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: b61c8803-16f3-4c35-9b17-6f65f441df86 X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR0401MB1535 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Wed, 2018-01-03 at 12:16 -0500, Woody Suwalski wrote: > Starting with a 32-bit 4.15-rcX I have observed a warning in dmesg, > happening when the system goes to suspend2ram. If it is just a warning > - could we have it quiet'et down? (+linux-scsi) Thank you for having reported this. The comment above the warning that has been triggered is as follows: /* * It is allowed to call scsi_device_quiesce() multiple times from * the same context but concurrent scsi_device_quiesce() calls are * not allowed. */ WARN_ON_ONCE(sdev->quiesced_by && sdev->quiesced_by != current); That means that suppressing the warning would be wrong - it would hide the race condition but not fix it. Anyway, would it be possible to test the (entirely untested) patch below? Sorry but I currently don't have access to a test setup that triggers the SPI DV code. Thanks, Bart. -- 2.15.1 diff --git a/drivers/scsi/scsi_transport_spi.c b/drivers/scsi/scsi_transport_spi.c index 10ebb213ddb3..abd48cffb282 100644 --- a/drivers/scsi/scsi_transport_spi.c +++ b/drivers/scsi/scsi_transport_spi.c @@ -26,6 +26,7 @@ #include #include #include +#include #include #include "scsi_priv.h" #include @@ -1009,11 +1010,20 @@ spi_dv_device(struct scsi_device *sdev) u8 *buffer; const int len = SPI_MAX_ECHO_BUFFER_SIZE*2; + /* + * Because this function and the power management code both call + * scsi_device_quiesce(), it is not safe to perform domain validation + * while suspend or resume is in progress. Hence the + * lock/unlock_system_sleep() calls. + */ + lock_system_sleep(); + if (unlikely(spi_dv_in_progress(starget))) - return; + goto unlock; if (unlikely(scsi_device_get(sdev))) - return; + goto unlock; + spi_dv_in_progress(starget) = 1; buffer = kzalloc(len, GFP_KERNEL); @@ -1044,11 +1054,13 @@ spi_dv_device(struct scsi_device *sdev) spi_initial_dv(starget) = 1; - out_free: +out_free: kfree(buffer); - out_put: +out_put: spi_dv_in_progress(starget) = 0; scsi_device_put(sdev); +unlock: + unlock_system_sleep(); } EXPORT_SYMBOL(spi_dv_device);