Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp15774970rwd; Mon, 26 Jun 2023 00:48:54 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6PbG7qoA7LS/0h2jK+kqZVc0QnV6IztIeAOO6tJuZUKVBS4Zh0TpPFzfLH+CxLJd0EMXQp X-Received: by 2002:a17:907:97c2:b0:988:8a02:457b with SMTP id js2-20020a17090797c200b009888a02457bmr20674275ejc.15.1687765734246; Mon, 26 Jun 2023 00:48:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687765734; cv=none; d=google.com; s=arc-20160816; b=bmipoWd+BjukLFWJqPTToMWJN3J+Bn8h+Ufqq9BWTXQuhwyaOxRhE8n7BsVIbe4RN8 CC8/TzvM/mjI7rbclL7CevecfDlXFU2OxYaq2di7C/4tXcjnYNzrRd6n5v/ttXv2GvfA fAhCMFWg2GHyVSB2zb/78bjJcmaTvXNQZDK534qiKafSVkD9FTp8ZHvvLrXxogEZqjKm K8omuJZcFQHS/LIFShQr2lTe1ts9s8sLj+h5PmvHAhC/dm77ymcciqd2OsGkZbaOxUJS 5OJ9EaWe83OYTqYxKOvHs6CJoAXSxLlNwqyhx9w1regrcrXxFY+SD7/juh3Lvv8TktRW kWqg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=JxJz1Dk5o1sPslwYPctCnp2x8NtNSKlIcL6JzU6aOJM=; fh=h3JsNsE6dQvsF7QHNW2xK42SoplruWJMQOC7mWXyoFM=; b=W06wUgdgz+3SDU3LJ7MLIoOn7fZsEALWWXFwEX0f5LJaQPldNgRB7o4EhqXEWsVY1w gd2Op4SRnKsCw4HvKio1OYJj9s6NmOW8gLzZqmcybAfk/76f5IeTlUr+rVJdA1wO1UiE FeZjYglt5Oz4p4xekcSP3plHxV7cWi1nYO3wfeHJl3xG3HotckXcN130Bdon8YvCjnxB 1d3X0cWY7V/jgCIuoBtyWKh1ARRz6r0xH1nDFwmle2VO8NBXYaqsPxmtp7Y6GDiVolZO CVZEwPIek+8kB2zrGnZ5cSLPQQCVVW+30ygp165IFrquah0advJiRiljnQmHAPUf8buX jboQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b="T9q/4Mwk"; 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 x22-20020a170906135600b009888665e53fsi2523748ejb.190.2023.06.26.00.48.29; Mon, 26 Jun 2023 00:48:54 -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="T9q/4Mwk"; 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 S229638AbjFZGya (ORCPT + 99 others); Mon, 26 Jun 2023 02:54:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50890 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229516AbjFZGy2 (ORCPT ); Mon, 26 Jun 2023 02:54:28 -0400 Received: from mail-ej1-x630.google.com (mail-ej1-x630.google.com [IPv6:2a00:1450:4864:20::630]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A2D74116; Sun, 25 Jun 2023 23:54:27 -0700 (PDT) Received: by mail-ej1-x630.google.com with SMTP id a640c23a62f3a-98e109525d6so268381266b.0; Sun, 25 Jun 2023 23:54:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687762466; x=1690354466; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=JxJz1Dk5o1sPslwYPctCnp2x8NtNSKlIcL6JzU6aOJM=; b=T9q/4MwkjAuBWPZSs5yMr7/a61IyeYxCPiYIAaEnmkuQ6G8jSZAi+QIowkM7/SDx0K Ch0ULgDFbwX6ARds/NeG1HBoQF7ZQgM2jIapXcEe9+f3HIhpCxJZ2guyr3IWR6ubW8mB LHo7zFYQyjObLHhxqHxC1mGu32MUsfmu7AHQLmFL4LKrdobeKkxqgmfX2uLUAWTATKwX 5JNCO/XqR4LjUvO2d/z/kf4DxQaYNKhir3HcNP3pX5Obimg+KtN1nJxkZWsyQ2BGkCLN sTm3aDacZZp0OHdTxFKC9np7UwCTClB6HOvMiBiyWXs4Z+ZAh/TcnKGdhWSa9ddbKlFV 5EAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687762466; x=1690354466; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=JxJz1Dk5o1sPslwYPctCnp2x8NtNSKlIcL6JzU6aOJM=; b=ML0Qaef7v0VM/d1qcj7NY010kQY3XM2Nwcx4TibjiONQwQLZvEVDJP6xylS5AGDOAZ hXzmMAWw3IBE6JfSen2tLceX1F13s+p8SUgUoi941RgP3geo9L8kDF7wyuLDxHMBrBfe JRbFIQ2p7h3DPFRRy6QNssfFb6ofuYwC6UZyDZ9lUQM/AsDIRetm13VlUX5oDq1GB3Vk UF++S61dRA/u5jZUS1V26Yt9GpGuNuRHwJpn5QPkfRePnwyGBcsBux0aWCcU2ssl5S8E pfQBWN7lmpWfrlbwhcARPY1Xm4gciFcpR3ts2skwxFCiacIekIJtt+HcRcXzVaohrtjS E9LQ== X-Gm-Message-State: AC+VfDy91QEblN3sgTsUPiiGmlyiTWBF4C0vE6eAqTg0dk8IsV+D+Xd6 bhuw5TpX0+qzuCIVetKK0iy6pEtX/CqYn1LkwDYxWhPN14cyMA== X-Received: by 2002:a17:906:ee8c:b0:988:8efc:54fa with SMTP id wt12-20020a170906ee8c00b009888efc54famr16225202ejb.37.1687762465837; Sun, 25 Jun 2023 23:54:25 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Andy Shevchenko Date: Mon, 26 Jun 2023 09:53:49 +0300 Message-ID: Subject: Re: [PATCH] gpio: gpiolib-cdev: Fix potential &lr->wait.lock deadlock issue To: YE Chengfeng Cc: "linus.walleij@linaro.org" , "brgl@bgdev.pl" , "andy@kernel.org" , "linux-gpio@vger.kernel.org" , "linux-kernel@vger.kernel.org" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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 Sun, Jun 25, 2023 at 5:45=E2=80=AFPM YE Chengfeng = wrote: > > linereq_put_event is called from both interrupt context (e.g., > edge_irq_thread) and process context (process_hw_ts_thread). > Therefore, interrupt should be disabled before acquiring lock > &lr->wait.lock inside linereq_put_event to avoid deadlock when > the lock is held in process context and edge_irq_thread comes. > > Similarly, linereq_read_unlocked running in process context > also acquies the same lock. It also need to disable interrupt acquires > otherwise deadlock could happen if the irq edge_irq_thread > comes to execution while the lock is held. > > Fix the two potential deadlock issues by spin_lock_irqsave. Sounds legit to me, but 1) do you have any warning/oops/etc to show the real case? 2) shouldn't we annotate with respective lockdep asserts this code? --=20 With Best Regards, Andy Shevchenko