Received: by 2002:a19:771d:0:0:0:0:0 with SMTP id s29csp1238270lfc; Wed, 1 Jun 2022 12:42:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz/wzHXGLhY5pRvJSX+v0ehyrC5wfJpMm7nMWobvC0Gu+Czsm+iAyaqVIZWLCNhCArEnYUS X-Received: by 2002:a17:902:d502:b0:161:8e01:b4f1 with SMTP id b2-20020a170902d50200b001618e01b4f1mr1015637plg.137.1654112554218; Wed, 01 Jun 2022 12:42:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654112554; cv=none; d=google.com; s=arc-20160816; b=b/oSA5cbXwL8BqxUdmY8kbS2dw5cfcYN9Q4YUNhWvMzFC+uu/bl/69cipUI0kJX9CY WliY1VH3bS/8HO94ac2jomkzVAUdTZI3lqb9TtfkIhFa9HD9YBcNdb9VUk5n4Lf0M+Ah b5XL57FsKqIMdEIcIBCbl0Eo7jrH0fKXr8TXaJEzftozqEyEMOLfKkaIotEHC86nV9PK VatTI9CYoxrFV0rGKIALP+h86ddFiA5L7Bl4hOQDH9WSavImYKVDU1voXw1l526sMIi7 4NRUX452NHGgBw3NGgwnO+iA7lVE9ROukgruk/4yhuUlZT+NpjyK9gP75g7ly5jBPH6F J5hA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=ZJ1Dv/ORClSlD+t4yWurULyU8Rzqx47jCXHy+bRYEDE=; b=x/xyC+LkP+XRPD7l3SdsSUrlls4Tncf3rSxMTG7pSd1FWEeaaYkVwTjDqUrZP9vBBG RbmYucyXYaLN5oRF/wwE2Dp2EYaIbL/YyIxuiSrGIiS85S0NdB6kKjZ2A9p6ioHCxWjb MPGkPrMCv9QujSDriOwECOWnzAVsjc6h0CzufPF7n/zgCQ8piC9Gu40sBAYygFbOjSXr Y6bHYfwL23E2yadmyZ8Ww1wr2eo+1NhVL3YA5oGsVpPnn2OGuZg+7aGuMWhytOPIdoTP M9k5dSY57qzzN2q5/CP9ubbOi2/uCywIxf1kEgu8Mh/QWM3MxyYEx5mJI/JL3HhF2zdJ dpMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20210112.gappssmtp.com header.s=20210112 header.b=s4SFXEhI; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id c14-20020a170903234e00b00163cb1c5462si3795490plh.99.2022.06.01.12.42.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Jun 2022 12:42:34 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@bgdev-pl.20210112.gappssmtp.com header.s=20210112 header.b=s4SFXEhI; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 7D68C1CC616; Wed, 1 Jun 2022 12:08:31 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346562AbiEaRaW (ORCPT + 99 others); Tue, 31 May 2022 13:30:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42570 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346060AbiEaRaU (ORCPT ); Tue, 31 May 2022 13:30:20 -0400 Received: from mail-ej1-x633.google.com (mail-ej1-x633.google.com [IPv6:2a00:1450:4864:20::633]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9602993471 for ; Tue, 31 May 2022 10:30:18 -0700 (PDT) Received: by mail-ej1-x633.google.com with SMTP id m20so27946713ejj.10 for ; Tue, 31 May 2022 10:30:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20210112.gappssmtp.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=ZJ1Dv/ORClSlD+t4yWurULyU8Rzqx47jCXHy+bRYEDE=; b=s4SFXEhIZO0VXaghT5MstJ3pOKhlcr6UMVHN6702O+K4zb4HghdAQ8ECXuhr5e3cwa 1tn6ZRRajJe94KKFptIBpCnK3mbwFFuLTEx/3W4v7zOn6xBBXd1Pmrdu1VoTmzqhztY2 NrHukB0XSDydD1LWnNSwgH9eSXZJO+j4JCGIgg1eV/E7+ciDUtFLDsmQ7hEDjxV3xpL3 dVg4f+mifOcN7CBo9rgfLB3IdEL8+gnUWSSrAWXeVAtRh5lq7S3aiEQtDBfAefsQ87iC 3AMxOmxb5BhxG08XHEmQnRxN0cXK1lq9cGTHNzRsl0sZwOagACD5DfxA4Cp1WGYxLP+1 oQ8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=ZJ1Dv/ORClSlD+t4yWurULyU8Rzqx47jCXHy+bRYEDE=; b=1veRCYJh7QsuyxURi31NA/zyaRBuVifG2+1vFI6eam1hXgfwU0TgC5QKXaDbxy++tS MSR7jy2sgGSahtMFpEXtGbCM+LcCIt1TddpQUKDRhiUrNYrxhpqd2Xmp7HoD8ZRk0aKq sQ6k4Jy3rCloJYZO5/FD7bm9u7OlpwvWGEvSGaCtZD2wPbDAa7q0OsAoZ3hj65NGTdPT UiGj59RyOjPkuIFVR3vMOH2pngRSKNdyk0K8y6ACBaMrgG3BMeiX6QdkfhH5lx8amD/F EXV4BULyrIRgSVKen8jp5h3mMRH+k0zgvZpvXo7AedGLMUMQPzJ/l1SBHp1t8MZK3W3+ f1/A== X-Gm-Message-State: AOAM530wW3Avp0p1ukoBlbgYE5unfeB0nGmh3R9baipC6qLAMm6AaxU4 +mQuqt9r/zbO4WhzEkoXcDl++Nw2FNVQw6r2yGalUFOPTMg= X-Received: by 2002:a17:907:6eab:b0:6fe:b5e2:7b0e with SMTP id sh43-20020a1709076eab00b006feb5e27b0emr48517985ejc.736.1654018217174; Tue, 31 May 2022 10:30:17 -0700 (PDT) MIME-Version: 1.0 References: <20220427144620.9105-1-pmalgujar@marvell.com> <20220427144620.9105-2-pmalgujar@marvell.com> <20220525131738.GA10532@Dell2s-9> In-Reply-To: <20220525131738.GA10532@Dell2s-9> From: Bartosz Golaszewski Date: Tue, 31 May 2022 19:30:06 +0200 Message-ID: Subject: Re: [PATCH 1/5] gpio: thunderx: avoid potential deadlock To: Piyush Malgujar Cc: "open list:GPIO SUBSYSTEM" , Linux Kernel Mailing List , devicetree , Linus Walleij , Rob Herring , Krzysztof Kozlowski , Robert Richter , cchavva@marvell.com, wsadowski@marvell.com Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 Wed, May 25, 2022 at 3:17 PM Piyush Malgujar wrote: > > On Mon, May 02, 2022 at 01:18:49PM +0200, Bartosz Golaszewski wrote: > > On Wed, Apr 27, 2022 at 4:46 PM Piyush Malgujar wrote: > > > > > > Using irqsave/irqrestore locking variants to avoid any deadlock. > > > > > > > I see you'll be resending this anyway so would you mind providing an > > example of a deadlock that is possible with no-irqsave variants? > > Thanks. > > > > Bart > > > Hi Bartosz, > > Thanks for the review. > > Please find below the issue scenario: > In the case when HARDIRQ-safe -> HARDIRQ-unsafe lock order is detected > and interrupt occurs, deadlock could occur. > > ======================================================== > WARNING: possible irq lock inversion dependency detected > 5.18.0-rc6 #4 Not tainted > -------------------------------------------------------- > swapper/3/0 just changed the state of lock: > ffff000110904cd8 (lock_class){-...}-{2:2}, at: handle_fasteoi_ack_irq+0x2c/0x1b0 > but this lock took another, HARDIRQ-unsafe lock in the past: > (&txgpio->lock){+.+.}-{2:2} > > > and interrupts could create inverse lock ordering between them. > > > other info that might help us debug this: > Possible interrupt unsafe locking scenario: > > CPU0 CPU1 > ---- ---- > lock(&txgpio->lock); > local_irq_disable(); > lock(lock_class); > lock(&txgpio->lock); > > lock(lock_class); > > *** DEADLOCK *** > > ========================================================== > > Thanks, > Piyush > > > Signed-off-by: Piyush Malgujar > > > --- Thanks. What I meant exactly was: resend it with that info in the commit message. Bart