Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp17620109rwd; Tue, 27 Jun 2023 05:42:16 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7/sck6Wrr9YbUszyKmSSCbPr0UKpWr1TAHzfgKCasrbOoRh0t0K4IZgvd5hy+rpwIZwIJ5 X-Received: by 2002:a2e:2c0f:0:b0:2b4:765b:f6f0 with SMTP id s15-20020a2e2c0f000000b002b4765bf6f0mr17495825ljs.28.1687869735960; Tue, 27 Jun 2023 05:42:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687869735; cv=none; d=google.com; s=arc-20160816; b=mKMH++sU51k8t3UU3yLFS01FqE16ZnUPBUTcGMGBiSxtenh5Jrb5SYVU0/owLakdh6 luFZgM/U3f+4IeqyQVFpXS9k4qbMm1rIf/ZTs3ONChAdziUVGNfIUZ5+P6cszQzkm7Vt +ttWHEIY6KL4IPoXd/r+He9hbNIp4LTlMCpAW4sMgzRy7mnUULrzVmq2SATIen4ZAhpE sBDG1I3S971i1OCnEMYsuryEHVEXvu4asXldtkmzFKgQ9+rt/jVwwRmdIJqPi5sb7TUu Q7d0qidSXVewNtVPDZ6EV5qi4/EwKFNmCgQL4WR84tTdLLEL8YclwE2nhXPUTACbnZlS Ct8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=fDgEXlhTD4u8fEfAv0rtldp2XRqOyVB/WnpGR/b7zuY=; fh=qTi87Ndq2kRqanzdbGFDYpLKVbINCHXhMt+579slEUE=; b=ZpDOEEcbXDbF1H26v0vxf7iCaNq1EUVi2YTpQevg944N+0qwPy7mfs0b5zVSd8wwao 8m7F1kW69n+7qAaBhVk+rAIUNWyLHcy92ZioT1yc4BaHcgiciSl/X+gMXRSPxMFshD4r btww1ePNCrvOVVd95T1M9YLADc3lGariBVo2osQk+rqp+3jnzmHQ4ArwjAH7FjyaXkIA /BTlw6sXSfA4E3dE83zBOJymHnA6E/QADAk7wRHD732ZLUBeFtFvpJfav7rl6iU5q0Zl YLuIUvLMclYKLgk0H3AGA+xZmATmyZHNRInWAXO0X8VVoWVrTgZZR67lCg+yFRqL15dW 8LXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=FDNmeXnH; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o2-20020aa7d3c2000000b0051be93bd984si3637203edr.283.2023.06.27.05.41.50; Tue, 27 Jun 2023 05:42:15 -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=@gmail.com header.s=20221208 header.b=FDNmeXnH; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230365AbjF0L5w (ORCPT + 99 others); Tue, 27 Jun 2023 07:57:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57966 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229567AbjF0L5v (ORCPT ); Tue, 27 Jun 2023 07:57:51 -0400 Received: from mail-oi1-x232.google.com (mail-oi1-x232.google.com [IPv6:2607:f8b0:4864:20::232]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A43B2E69; Tue, 27 Jun 2023 04:57:50 -0700 (PDT) Received: by mail-oi1-x232.google.com with SMTP id 5614622812f47-39e86b3da59so3994694b6e.3; Tue, 27 Jun 2023 04:57:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687867070; x=1690459070; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=fDgEXlhTD4u8fEfAv0rtldp2XRqOyVB/WnpGR/b7zuY=; b=FDNmeXnHd+jw7p8jw+HL89Z2tgcnVnU2TeHJA+En7NebFcfeLWwBwC7W4gGnqWuWL2 EDnwOFhdIZRlxIhITOhdSWKZq0lIRNNPsfLANcWwVCY4A+n9Ig54yZIG7XnOUAiaFrch KvbZwdu2Gc22uqoix+94OU7wgCLq+Boq3qhU89Z3OUKgvj3BvmHGo2wOKjavSy7g+5y9 /1gCeBNYqAvsCAYOcxLOQOhcaHFuYE2D9hMdpDoZO6sGv9S/FIXAYPpisdoczKDITULq LXvKeTHR2wba1RcMNidfKDLBJfVTpBFaPyeTS45zXPyLDYcUmJmjfIu2fKg0kdN0OH9X rCiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687867070; x=1690459070; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=fDgEXlhTD4u8fEfAv0rtldp2XRqOyVB/WnpGR/b7zuY=; b=QYdRlzpXRf6JZ/QrUFNji5XTAj0YRy46dXIuh/XYuJsiTUrLmS1EcHVfscq3fA1hh8 Yh1hQC7zHb88yDCfM9fjZFeGZIx7FhIpx44h/RFNrRjHD8MojCZHIubosuPDoebTS6/j jacR9wQuph3mEf4VrWYZVsgc1MDysPGHoTSuygZHPzV98/w54fInsxxU0W2wgc4D2AY8 zcB0i8wv2n/h5fd1DgXU9Kq8R9lbeluA8kOJx0EvT0lG0toNggb/ficcA1OIjJI1JT1f 5wmWhnawWSRO6es6GPMiNiS2fKSQ0ioEo1DNWyDvg3EoVG0MSfsPrp6F6oz3O14qHn7H xVrw== X-Gm-Message-State: AC+VfDz75oTCswEoXmUVAQjv5CDjYTo1mUbhQNV4Gq3WovFWQnOZnbay b3PStjWuWWxGoWVsdPz/RJu8JyIxG3Q= X-Received: by 2002:a05:6808:2027:b0:3a1:c233:5552 with SMTP id q39-20020a056808202700b003a1c2335552mr12592457oiw.34.1687867069854; Tue, 27 Jun 2023 04:57:49 -0700 (PDT) Received: from sol (194-223-178-180.tpgi.com.au. [194.223.178.180]) by smtp.gmail.com with ESMTPSA id y124-20020a636482000000b0053423447a12sm5734553pgb.73.2023.06.27.04.57.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Jun 2023 04:57:49 -0700 (PDT) Date: Tue, 27 Jun 2023 19:57:44 +0800 From: Kent Gibson To: Bartosz Golaszewski Cc: YE Chengfeng , "linus.walleij@linaro.org" , "andy@kernel.org" , "linux-gpio@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH] gpio: gpiolib-cdev: Fix potential &lr->wait.lock deadlock issue Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE 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 Tue, Jun 27, 2023 at 01:47:16PM +0200, Bartosz Golaszewski wrote: > On Tue, Jun 27, 2023 at 3:43 AM Kent Gibson wrote: > > > > On Mon, Jun 26, 2023 at 05:50:47PM +0200, Bartosz Golaszewski wrote: > > > On Mon, Jun 26, 2023 at 9:23 AM Kent Gibson wrote: > > > > > > > > > > > > While we are on the subject of spin_locks, why does > > gpio_desc_to_lineinfo() use spin_lock_irqsave()? > > I assume the _irq is necessary as the desc could be updated at interrupt > > level, but AFAICT gpio_desc_to_lineinfo() is only ever called from process > > context, so why not just spin_lock_irq()? > > > > Cheers, > > Kent. > > Didn't we use an atomic notifier before for some reason? Then it got > changed to blocking but the lock stayed like this? It does look like > spin_lock_irq() would be fine here. On the other hand - if something > isn't broken... :) > Yeah, it was atomic before blocking, but that doesn't explain the need for the save - interrupts are always enabled in that function. Not a big difference either way, and irqsave is always safe, so no problem with leaving it as is - I just thought it odd when I noticed it, while spin locks and context were front of mind. Cheers, Kent.