Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp7089943rwb; Wed, 23 Nov 2022 01:52:45 -0800 (PST) X-Google-Smtp-Source: AA0mqf6AKC4VpLUQ6nxJ1Di4HuyIKMk2qQw+SUmIyPhGPgL2flTy+GB3aOuwuV60wUECv4jKEFm4 X-Received: by 2002:a17:906:be9:b0:78d:3e11:1036 with SMTP id z9-20020a1709060be900b0078d3e111036mr23738313ejg.76.1669197165589; Wed, 23 Nov 2022 01:52:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669197165; cv=none; d=google.com; s=arc-20160816; b=mIbcKkJpvvPWO8MtwD0NU/zIOGKD6bcQ1kt//vUkO0aNbAO+BOxsHXXLYbJDwnf12J laSbqkUEJR3DHrk1ykh0lJpjolWL7S/emArFSg+S2OU+EK2cpFPpk4Kl7Fiuikt/Kv91 NXAMw6VZxcgsVgjYbemTxY/94WKU/tS9BD0r8Yu7DloPIDAPdD3IjD2XCaW2sSL9Q2zM wedhKtjqV4A7kfi+QYug2/XPfl+V6JrsJXK8gNEEZ1NV2CG9xEDEFTLrIPk5vJNTR045 GLu1OobEAV+FLXD546h1MhZa1I07Kn1Epl+/NLU0H/vX0zipUKp5cr1q0ngNFs68wVe9 0Xfg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=wHed+5qsoNRfgm5HzbV5rq5eqU2Eoij756sk0MFjYTc=; b=UOIe6fiQQp6IYcn0wdMVrd53EnANZex0Gmwz7GNiOPmJXuml6NajjTNqL1luUoGQtn mfgLWVX1MBADQbvhy02zbXpW8l1hs+FWS38O/Z24oYxIELxVzbu6pkhsV3dnJU7E9JEU OmolFBZhTfG2Iq1WdH2Sr7jQvSnfOUao2xH4BappcGQ2nBlknaHz+lTGZKGO9Z7qnL7t U5sf1kp2VrO4OUBPm5cnwv0mAO8kgWdb0Q/MLpxNb7lHLTpiK7htsrrNHMsXZvQLUNMV q5dCUVtXA2LapKgFlGzRlodyljhCs6Tl3J3NFNdilVVDyDP/zHN1z2iN9vC4xiszADLN 2tZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cirrus.com header.s=PODMain02222019 header.b=lMrWZLPD; 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=REJECT sp=REJECT dis=NONE) header.from=cirrus.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qf35-20020a1709077f2300b007ade22f401bsi17843093ejc.759.2022.11.23.01.52.21; Wed, 23 Nov 2022 01:52:45 -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=pass header.i=@cirrus.com header.s=PODMain02222019 header.b=lMrWZLPD; 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=REJECT sp=REJECT dis=NONE) header.from=cirrus.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237868AbiKWJim (ORCPT + 89 others); Wed, 23 Nov 2022 04:38:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56876 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237865AbiKWJiX (ORCPT ); Wed, 23 Nov 2022 04:38:23 -0500 Received: from mx0b-001ae601.pphosted.com (mx0a-001ae601.pphosted.com [67.231.149.25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 32D7E64570 for ; Wed, 23 Nov 2022 01:36:06 -0800 (PST) Received: from pps.filterd (m0077473.ppops.net [127.0.0.1]) by mx0a-001ae601.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 2AN7bePZ029400; Wed, 23 Nov 2022 03:35:55 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cirrus.com; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : in-reply-to; s=PODMain02222019; bh=wHed+5qsoNRfgm5HzbV5rq5eqU2Eoij756sk0MFjYTc=; b=lMrWZLPDNBeOKrD9JKdE87iemvauRqrpbUbZsVfxThc2+2bdU2sVMDkmYSQ1Di9tYQ4i EPFHKea5tGRK9e3yJdv/Q9Z3lgIaR/GTmwFAYjrAimhB5QRbKf5da+UpJzvWswEEFcj7 E+ynamyYDaRkR4ja5p4WofhRsY7q1JjTjaYh36nqNdmOdOF0K/Gv3KTHiOuBhXxp2qRG U8l1XCwOD8GQx7AiSHSHW13J/jDjlzALLaByAycm7glZvugxSmeHXo1bdsq/jZoY02Dr demBpFz0dZ8dJXCtGAfaGb5Kj99RjwdROrDiUFxU36WTL91SRqp9dELO0DkVsqsvEQGo jQ== Received: from ediex01.ad.cirrus.com ([84.19.233.68]) by mx0a-001ae601.pphosted.com (PPS) with ESMTPS id 3kxwe6vpa5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 23 Nov 2022 03:35:55 -0600 Received: from ediex02.ad.cirrus.com (198.61.84.81) by ediex01.ad.cirrus.com (198.61.84.80) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.20; Wed, 23 Nov 2022 03:35:47 -0600 Received: from ediswmail.ad.cirrus.com (198.61.86.93) by anon-ediex02.ad.cirrus.com (198.61.84.81) with Microsoft SMTP Server id 15.2.1118.20 via Frontend Transport; Wed, 23 Nov 2022 03:35:47 -0600 Received: from ediswmail.ad.cirrus.com (ediswmail.ad.cirrus.com [198.61.86.93]) by ediswmail.ad.cirrus.com (Postfix) with ESMTP id 6EE11477; Wed, 23 Nov 2022 09:35:47 +0000 (UTC) Date: Wed, 23 Nov 2022 09:35:47 +0000 From: Charles Keepax To: Richard Fitzgerald CC: , , , , , , Subject: Re: [PATCH] soundwire: bus_type: Avoid lockdep assert in sdw_drv_probe() Message-ID: <20221123093547.GC105268@ediswmail.ad.cirrus.com> References: <20221121162453.1834170-1-rf@opensource.cirrus.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <20221121162453.1834170-1-rf@opensource.cirrus.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-Proofpoint-ORIG-GUID: iGXtesuZiytKFN4IDNvRloRAlC8H0Xi2 X-Proofpoint-GUID: iGXtesuZiytKFN4IDNvRloRAlC8H0Xi2 X-Proofpoint-Spam-Reason: safe X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,SPF_PASS 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 Mon, Nov 21, 2022 at 04:24:52PM +0000, Richard Fitzgerald wrote: > Don't hold sdw_dev_lock while calling the peripheral driver > probe() and remove() callbacks. > > Holding sdw_dev_lock around the probe() and remove() calls > causes a theoretical mutex inversion which lockdep will > assert on. The peripheral driver probe will probably register > a soundcard, which will take ALSA and ASoC locks. During > normal operation a runtime resume suspend can be triggered > while these locks are held and will then take sdw_dev_lock. > > It's not necessary to hold sdw_dev_lock when calling the > probe() and remove(), it is only used to prevent the bus core > calling the driver callbacks if there isn't a driver or the > driver is removing. > > If sdw_dev_lock is held while setting and clearing the > 'probed' flag this is sufficient to guarantee the safety of > callback functions. > > The potential race of a bus event happening while probe() is > executing is the same as the existing race of the bus event > handler taking the mutex first and processing the event > before probe() can run. In both cases the event has already > happened before the driver is probed and ready to accept > callbacks. > > Signed-off-by: Richard Fitzgerald > --- Reviewed-by: Charles Keepax Thanks, Charles